code
stringlengths
38
801k
repo_path
stringlengths
6
263
/// The function fiat25519AddcarryxU26 is an addition with carry. /// Postconditions: /// out1 = (arg1 + arg2 + arg3) mod 2^26 /// out2 = ⌊(arg1 + arg2 + arg3) / 2^26⌋ /// /// Input Bounds: /// arg1: [0x0 ~> 0x1] /// arg2: [0x0 ~> 0x3ffffff] /// arg3: [0x0 ~> 0x3ffffff] /// Output Bounds: /// out1: [0x0 ~> 0x3ffffff] /// out2: [0x0 ~> 0x1] fn fiat25519AddcarryxU26(out1: *u32, out2: *u1, arg1: u1, arg2: u32, arg3: u32) callconv(.Inline) void { const x1: u32 = ((@intCast(u32, arg1) + arg2) + arg3); const x2: u32 = (x1 & 0x3ffffff); const x3: u1 = @intCast(u1, (x1 >> 26)); out1.* = x2; out2.* = x3; } /// The function fiat25519SubborrowxU26 is a subtraction with borrow. /// Postconditions: /// out1 = (-arg1 + arg2 + -arg3) mod 2^26 /// out2 = -⌊(-arg1 + arg2 + -arg3) / 2^26⌋ /// /// Input Bounds: /// arg1: [0x0 ~> 0x1] /// arg2: [0x0 ~> 0x3ffffff] /// arg3: [0x0 ~> 0x3ffffff] /// Output Bounds: /// out1: [0x0 ~> 0x3ffffff] /// out2: [0x0 ~> 0x1] fn fiat25519SubborrowxU26(out1: *u32, out2: *u1, arg1: u1, arg2: u32, arg3: u32) callconv(.Inline) void { const x1: i32 = @intCast(i32, (@intCast(i64, @intCast(i32, (@intCast(i64, arg2) - @intCast(i64, arg1)))) - @intCast(i64, arg3))); const x2: i1 = @intCast(i1, (x1 >> 26)); const x3: u32 = @intCast(u32, (@intCast(i64, x1) & @intCast(i64, 0x3ffffff))); out1.* = x3; out2.* = @intCast(u1, (@intCast(i2, 0x0) - @intCast(i2, x2))); } /// The function fiat25519AddcarryxU25 is an addition with carry. /// Postconditions: /// out1 = (arg1 + arg2 + arg3) mod 2^25 /// out2 = ⌊(arg1 + arg2 + arg3) / 2^25⌋ /// /// Input Bounds: /// arg1: [0x0 ~> 0x1] /// arg2: [0x0 ~> 0x1ffffff] /// arg3: [0x0 ~> 0x1ffffff] /// Output Bounds: /// out1: [0x0 ~> 0x1ffffff] /// out2: [0x0 ~> 0x1] fn fiat25519AddcarryxU25(out1: *u32, out2: *u1, arg1: u1, arg2: u32, arg3: u32) callconv(.Inline) void { const x1: u32 = ((@intCast(u32, arg1) + arg2) + arg3); const x2: u32 = (x1 & 0x1ffffff); const x3: u1 = @intCast(u1, (x1 >> 25)); out1.* = x2; out2.* = x3; } /// The function fiat25519SubborrowxU25 is a subtraction with borrow. /// Postconditions: /// out1 = (-arg1 + arg2 + -arg3) mod 2^25 /// out2 = -⌊(-arg1 + arg2 + -arg3) / 2^25⌋ /// /// Input Bounds: /// arg1: [0x0 ~> 0x1] /// arg2: [0x0 ~> 0x1ffffff] /// arg3: [0x0 ~> 0x1ffffff] /// Output Bounds: /// out1: [0x0 ~> 0x1ffffff] /// out2: [0x0 ~> 0x1] fn fiat25519SubborrowxU25(out1: *u32, out2: *u1, arg1: u1, arg2: u32, arg3: u32) callconv(.Inline) void { const x1: i32 = @intCast(i32, (@intCast(i64, @intCast(i32, (@intCast(i64, arg2) - @intCast(i64, arg1)))) - @intCast(i64, arg3))); const x2: i1 = @intCast(i1, (x1 >> 25)); const x3: u32 = @intCast(u32, (@intCast(i64, x1) & @intCast(i64, 0x1ffffff))); out1.* = x3; out2.* = @intCast(u1, (@intCast(i2, 0x0) - @intCast(i2, x2))); } /// The function fiat25519CmovznzU32 is a single-word conditional move. /// Postconditions: /// out1 = (if arg1 = 0 then arg2 else arg3) /// /// Input Bounds: /// arg1: [0x0 ~> 0x1] /// arg2: [0x0 ~> 0xffffffff] /// arg3: [0x0 ~> 0xffffffff] /// Output Bounds: /// out1: [0x0 ~> 0xffffffff] fn fiat25519CmovznzU32(out1: *u32, arg1: u1, arg2: u32, arg3: u32) callconv(.Inline) void { const x1: u1 = (~(~arg1)); const x2: u32 = @intCast(u32, (@intCast(i64, @intCast(i1, (@intCast(i2, 0x0) - @intCast(i2, x1)))) & @intCast(i64, 0xffffffff))); const x3: u32 = ((x2 & arg3) | ((~x2) & arg2)); out1.* = x3; } /// The function fiat25519CarryMul multiplies two field elements and reduces the result. /// Postconditions: /// eval out1 mod m = (eval arg1 * eval arg2) mod m /// /// Input Bounds: /// arg1: [[0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000]] /// arg2: [[0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000]] /// Output Bounds: /// out1: [[0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000]] pub fn fiat25519CarryMul(out1: *[10]u32, arg1: [10]u32, arg2: [10]u32) void { const x1: u64 = (@intCast(u64, (arg1[9])) * @intCast(u64, ((arg2[9]) * 0x26))); const x2: u64 = (@intCast(u64, (arg1[9])) * @intCast(u64, ((arg2[8]) * 0x13))); const x3: u64 = (@intCast(u64, (arg1[9])) * @intCast(u64, ((arg2[7]) * 0x26))); const x4: u64 = (@intCast(u64, (arg1[9])) * @intCast(u64, ((arg2[6]) * 0x13))); const x5: u64 = (@intCast(u64, (arg1[9])) * @intCast(u64, ((arg2[5]) * 0x26))); const x6: u64 = (@intCast(u64, (arg1[9])) * @intCast(u64, ((arg2[4]) * 0x13))); const x7: u64 = (@intCast(u64, (arg1[9])) * @intCast(u64, ((arg2[3]) * 0x26))); const x8: u64 = (@intCast(u64, (arg1[9])) * @intCast(u64, ((arg2[2]) * 0x13))); const x9: u64 = (@intCast(u64, (arg1[9])) * @intCast(u64, ((arg2[1]) * 0x26))); const x10: u64 = (@intCast(u64, (arg1[8])) * @intCast(u64, ((arg2[9]) * 0x13))); const x11: u64 = (@intCast(u64, (arg1[8])) * @intCast(u64, ((arg2[8]) * 0x13))); const x12: u64 = (@intCast(u64, (arg1[8])) * @intCast(u64, ((arg2[7]) * 0x13))); const x13: u64 = (@intCast(u64, (arg1[8])) * @intCast(u64, ((arg2[6]) * 0x13))); const x14: u64 = (@intCast(u64, (arg1[8])) * @intCast(u64, ((arg2[5]) * 0x13))); const x15: u64 = (@intCast(u64, (arg1[8])) * @intCast(u64, ((arg2[4]) * 0x13))); const x16: u64 = (@intCast(u64, (arg1[8])) * @intCast(u64, ((arg2[3]) * 0x13))); const x17: u64 = (@intCast(u64, (arg1[8])) * @intCast(u64, ((arg2[2]) * 0x13))); const x18: u64 = (@intCast(u64, (arg1[7])) * @intCast(u64, ((arg2[9]) * 0x26))); const x19: u64 = (@intCast(u64, (arg1[7])) * @intCast(u64, ((arg2[8]) * 0x13))); const x20: u64 = (@intCast(u64, (arg1[7])) * @intCast(u64, ((arg2[7]) * 0x26))); const x21: u64 = (@intCast(u64, (arg1[7])) * @intCast(u64, ((arg2[6]) * 0x13))); const x22: u64 = (@intCast(u64, (arg1[7])) * @intCast(u64, ((arg2[5]) * 0x26))); const x23: u64 = (@intCast(u64, (arg1[7])) * @intCast(u64, ((arg2[4]) * 0x13))); const x24: u64 = (@intCast(u64, (arg1[7])) * @intCast(u64, ((arg2[3]) * 0x26))); const x25: u64 = (@intCast(u64, (arg1[6])) * @intCast(u64, ((arg2[9]) * 0x13))); const x26: u64 = (@intCast(u64, (arg1[6])) * @intCast(u64, ((arg2[8]) * 0x13))); const x27: u64 = (@intCast(u64, (arg1[6])) * @intCast(u64, ((arg2[7]) * 0x13))); const x28: u64 = (@intCast(u64, (arg1[6])) * @intCast(u64, ((arg2[6]) * 0x13))); const x29: u64 = (@intCast(u64, (arg1[6])) * @intCast(u64, ((arg2[5]) * 0x13))); const x30: u64 = (@intCast(u64, (arg1[6])) * @intCast(u64, ((arg2[4]) * 0x13))); const x31: u64 = (@intCast(u64, (arg1[5])) * @intCast(u64, ((arg2[9]) * 0x26))); const x32: u64 = (@intCast(u64, (arg1[5])) * @intCast(u64, ((arg2[8]) * 0x13))); const x33: u64 = (@intCast(u64, (arg1[5])) * @intCast(u64, ((arg2[7]) * 0x26))); const x34: u64 = (@intCast(u64, (arg1[5])) * @intCast(u64, ((arg2[6]) * 0x13))); const x35: u64 = (@intCast(u64, (arg1[5])) * @intCast(u64, ((arg2[5]) * 0x26))); const x36: u64 = (@intCast(u64, (arg1[4])) * @intCast(u64, ((arg2[9]) * 0x13))); const x37: u64 = (@intCast(u64, (arg1[4])) * @intCast(u64, ((arg2[8]) * 0x13))); const x38: u64 = (@intCast(u64, (arg1[4])) * @intCast(u64, ((arg2[7]) * 0x13))); const x39: u64 = (@intCast(u64, (arg1[4])) * @intCast(u64, ((arg2[6]) * 0x13))); const x40: u64 = (@intCast(u64, (arg1[3])) * @intCast(u64, ((arg2[9]) * 0x26))); const x41: u64 = (@intCast(u64, (arg1[3])) * @intCast(u64, ((arg2[8]) * 0x13))); const x42: u64 = (@intCast(u64, (arg1[3])) * @intCast(u64, ((arg2[7]) * 0x26))); const x43: u64 = (@intCast(u64, (arg1[2])) * @intCast(u64, ((arg2[9]) * 0x13))); const x44: u64 = (@intCast(u64, (arg1[2])) * @intCast(u64, ((arg2[8]) * 0x13))); const x45: u64 = (@intCast(u64, (arg1[1])) * @intCast(u64, ((arg2[9]) * 0x26))); const x46: u64 = (@intCast(u64, (arg1[9])) * @intCast(u64, (arg2[0]))); const x47: u64 = (@intCast(u64, (arg1[8])) * @intCast(u64, (arg2[1]))); const x48: u64 = (@intCast(u64, (arg1[8])) * @intCast(u64, (arg2[0]))); const x49: u64 = (@intCast(u64, (arg1[7])) * @intCast(u64, (arg2[2]))); const x50: u64 = (@intCast(u64, (arg1[7])) * @intCast(u64, ((arg2[1]) * 0x2))); const x51: u64 = (@intCast(u64, (arg1[7])) * @intCast(u64, (arg2[0]))); const x52: u64 = (@intCast(u64, (arg1[6])) * @intCast(u64, (arg2[3]))); const x53: u64 = (@intCast(u64, (arg1[6])) * @intCast(u64, (arg2[2]))); const x54: u64 = (@intCast(u64, (arg1[6])) * @intCast(u64, (arg2[1]))); const x55: u64 = (@intCast(u64, (arg1[6])) * @intCast(u64, (arg2[0]))); const x56: u64 = (@intCast(u64, (arg1[5])) * @intCast(u64, (arg2[4]))); const x57: u64 = (@intCast(u64, (arg1[5])) * @intCast(u64, ((arg2[3]) * 0x2))); const x58: u64 = (@intCast(u64, (arg1[5])) * @intCast(u64, (arg2[2]))); const x59: u64 = (@intCast(u64, (arg1[5])) * @intCast(u64, ((arg2[1]) * 0x2))); const x60: u64 = (@intCast(u64, (arg1[5])) * @intCast(u64, (arg2[0]))); const x61: u64 = (@intCast(u64, (arg1[4])) * @intCast(u64, (arg2[5]))); const x62: u64 = (@intCast(u64, (arg1[4])) * @intCast(u64, (arg2[4]))); const x63: u64 = (@intCast(u64, (arg1[4])) * @intCast(u64, (arg2[3]))); const x64: u64 = (@intCast(u64, (arg1[4])) * @intCast(u64, (arg2[2]))); const x65: u64 = (@intCast(u64, (arg1[4])) * @intCast(u64, (arg2[1]))); const x66: u64 = (@intCast(u64, (arg1[4])) * @intCast(u64, (arg2[0]))); const x67: u64 = (@intCast(u64, (arg1[3])) * @intCast(u64, (arg2[6]))); const x68: u64 = (@intCast(u64, (arg1[3])) * @intCast(u64, ((arg2[5]) * 0x2))); const x69: u64 = (@intCast(u64, (arg1[3])) * @intCast(u64, (arg2[4]))); const x70: u64 = (@intCast(u64, (arg1[3])) * @intCast(u64, ((arg2[3]) * 0x2))); const x71: u64 = (@intCast(u64, (arg1[3])) * @intCast(u64, (arg2[2]))); const x72: u64 = (@intCast(u64, (arg1[3])) * @intCast(u64, ((arg2[1]) * 0x2))); const x73: u64 = (@intCast(u64, (arg1[3])) * @intCast(u64, (arg2[0]))); const x74: u64 = (@intCast(u64, (arg1[2])) * @intCast(u64, (arg2[7]))); const x75: u64 = (@intCast(u64, (arg1[2])) * @intCast(u64, (arg2[6]))); const x76: u64 = (@intCast(u64, (arg1[2])) * @intCast(u64, (arg2[5]))); const x77: u64 = (@intCast(u64, (arg1[2])) * @intCast(u64, (arg2[4]))); const x78: u64 = (@intCast(u64, (arg1[2])) * @intCast(u64, (arg2[3]))); const x79: u64 = (@intCast(u64, (arg1[2])) * @intCast(u64, (arg2[2]))); const x80: u64 = (@intCast(u64, (arg1[2])) * @intCast(u64, (arg2[1]))); const x81: u64 = (@intCast(u64, (arg1[2])) * @intCast(u64, (arg2[0]))); const x82: u64 = (@intCast(u64, (arg1[1])) * @intCast(u64, (arg2[8]))); const x83: u64 = (@intCast(u64, (arg1[1])) * @intCast(u64, ((arg2[7]) * 0x2))); const x84: u64 = (@intCast(u64, (arg1[1])) * @intCast(u64, (arg2[6]))); const x85: u64 = (@intCast(u64, (arg1[1])) * @intCast(u64, ((arg2[5]) * 0x2))); const x86: u64 = (@intCast(u64, (arg1[1])) * @intCast(u64, (arg2[4]))); const x87: u64 = (@intCast(u64, (arg1[1])) * @intCast(u64, ((arg2[3]) * 0x2))); const x88: u64 = (@intCast(u64, (arg1[1])) * @intCast(u64, (arg2[2]))); const x89: u64 = (@intCast(u64, (arg1[1])) * @intCast(u64, ((arg2[1]) * 0x2))); const x90: u64 = (@intCast(u64, (arg1[1])) * @intCast(u64, (arg2[0]))); const x91: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, (arg2[9]))); const x92: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, (arg2[8]))); const x93: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, (arg2[7]))); const x94: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, (arg2[6]))); const x95: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, (arg2[5]))); const x96: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, (arg2[4]))); const x97: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, (arg2[3]))); const x98: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, (arg2[2]))); const x99: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, (arg2[1]))); const x100: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, (arg2[0]))); const x101: u64 = (x100 + (x45 + (x44 + (x42 + (x39 + (x35 + (x30 + (x24 + (x17 + x9))))))))); const x102: u64 = (x101 >> 26); const x103: u32 = @intCast(u32, (x101 & @intCast(u64, 0x3ffffff))); const x104: u64 = (x91 + (x82 + (x74 + (x67 + (x61 + (x56 + (x52 + (x49 + (x47 + x46))))))))); const x105: u64 = (x92 + (x83 + (x75 + (x68 + (x62 + (x57 + (x53 + (x50 + (x48 + x1))))))))); const x106: u64 = (x93 + (x84 + (x76 + (x69 + (x63 + (x58 + (x54 + (x51 + (x10 + x2))))))))); const x107: u64 = (x94 + (x85 + (x77 + (x70 + (x64 + (x59 + (x55 + (x18 + (x11 + x3))))))))); const x108: u64 = (x95 + (x86 + (x78 + (x71 + (x65 + (x60 + (x25 + (x19 + (x12 + x4))))))))); const x109: u64 = (x96 + (x87 + (x79 + (x72 + (x66 + (x31 + (x26 + (x20 + (x13 + x5))))))))); const x110: u64 = (x97 + (x88 + (x80 + (x73 + (x36 + (x32 + (x27 + (x21 + (x14 + x6))))))))); const x111: u64 = (x98 + (x89 + (x81 + (x40 + (x37 + (x33 + (x28 + (x22 + (x15 + x7))))))))); const x112: u64 = (x99 + (x90 + (x43 + (x41 + (x38 + (x34 + (x29 + (x23 + (x16 + x8))))))))); const x113: u64 = (x102 + x112); const x114: u64 = (x113 >> 25); const x115: u32 = @intCast(u32, (x113 & @intCast(u64, 0x1ffffff))); const x116: u64 = (x114 + x111); const x117: u64 = (x116 >> 26); const x118: u32 = @intCast(u32, (x116 & @intCast(u64, 0x3ffffff))); const x119: u64 = (x117 + x110); const x120: u64 = (x119 >> 25); const x121: u32 = @intCast(u32, (x119 & @intCast(u64, 0x1ffffff))); const x122: u64 = (x120 + x109); const x123: u64 = (x122 >> 26); const x124: u32 = @intCast(u32, (x122 & @intCast(u64, 0x3ffffff))); const x125: u64 = (x123 + x108); const x126: u64 = (x125 >> 25); const x127: u32 = @intCast(u32, (x125 & @intCast(u64, 0x1ffffff))); const x128: u64 = (x126 + x107); const x129: u64 = (x128 >> 26); const x130: u32 = @intCast(u32, (x128 & @intCast(u64, 0x3ffffff))); const x131: u64 = (x129 + x106); const x132: u64 = (x131 >> 25); const x133: u32 = @intCast(u32, (x131 & @intCast(u64, 0x1ffffff))); const x134: u64 = (x132 + x105); const x135: u64 = (x134 >> 26); const x136: u32 = @intCast(u32, (x134 & @intCast(u64, 0x3ffffff))); const x137: u64 = (x135 + x104); const x138: u64 = (x137 >> 25); const x139: u32 = @intCast(u32, (x137 & @intCast(u64, 0x1ffffff))); const x140: u64 = (x138 * @intCast(u64, 0x13)); const x141: u64 = (@intCast(u64, x103) + x140); const x142: u32 = @intCast(u32, (x141 >> 26)); const x143: u32 = @intCast(u32, (x141 & @intCast(u64, 0x3ffffff))); const x144: u32 = (x142 + x115); const x145: u1 = @intCast(u1, (x144 >> 25)); const x146: u32 = (x144 & 0x1ffffff); const x147: u32 = (@intCast(u32, x145) + x118); out1[0] = x143; out1[1] = x146; out1[2] = x147; out1[3] = x121; out1[4] = x124; out1[5] = x127; out1[6] = x130; out1[7] = x133; out1[8] = x136; out1[9] = x139; } /// The function fiat25519CarrySquare squares a field element and reduces the result. /// Postconditions: /// eval out1 mod m = (eval arg1 * eval arg1) mod m /// /// Input Bounds: /// arg1: [[0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000]] /// Output Bounds: /// out1: [[0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000]] pub fn fiat25519CarrySquare(out1: *[10]u32, arg1: [10]u32) void { const x1: u32 = ((arg1[9]) * 0x13); const x2: u32 = (x1 * 0x2); const x3: u32 = ((arg1[9]) * 0x2); const x4: u32 = ((arg1[8]) * 0x13); const x5: u64 = (@intCast(u64, x4) * @intCast(u64, 0x2)); const x6: u32 = ((arg1[8]) * 0x2); const x7: u32 = ((arg1[7]) * 0x13); const x8: u32 = (x7 * 0x2); const x9: u32 = ((arg1[7]) * 0x2); const x10: u32 = ((arg1[6]) * 0x13); const x11: u64 = (@intCast(u64, x10) * @intCast(u64, 0x2)); const x12: u32 = ((arg1[6]) * 0x2); const x13: u32 = ((arg1[5]) * 0x13); const x14: u32 = ((arg1[5]) * 0x2); const x15: u32 = ((arg1[4]) * 0x2); const x16: u32 = ((arg1[3]) * 0x2); const x17: u32 = ((arg1[2]) * 0x2); const x18: u32 = ((arg1[1]) * 0x2); const x19: u64 = (@intCast(u64, (arg1[9])) * @intCast(u64, (x1 * 0x2))); const x20: u64 = (@intCast(u64, (arg1[8])) * @intCast(u64, x2)); const x21: u64 = (@intCast(u64, (arg1[8])) * @intCast(u64, x4)); const x22: u64 = (@intCast(u64, (arg1[7])) * (@intCast(u64, x2) * @intCast(u64, 0x2))); const x23: u64 = (@intCast(u64, (arg1[7])) * x5); const x24: u64 = (@intCast(u64, (arg1[7])) * @intCast(u64, (x7 * 0x2))); const x25: u64 = (@intCast(u64, (arg1[6])) * @intCast(u64, x2)); const x26: u64 = (@intCast(u64, (arg1[6])) * x5); const x27: u64 = (@intCast(u64, (arg1[6])) * @intCast(u64, x8)); const x28: u64 = (@intCast(u64, (arg1[6])) * @intCast(u64, x10)); const x29: u64 = (@intCast(u64, (arg1[5])) * (@intCast(u64, x2) * @intCast(u64, 0x2))); const x30: u64 = (@intCast(u64, (arg1[5])) * x5); const x31: u64 = (@intCast(u64, (arg1[5])) * (@intCast(u64, x8) * @intCast(u64, 0x2))); const x32: u64 = (@intCast(u64, (arg1[5])) * x11); const x33: u64 = (@intCast(u64, (arg1[5])) * @intCast(u64, (x13 * 0x2))); const x34: u64 = (@intCast(u64, (arg1[4])) * @intCast(u64, x2)); const x35: u64 = (@intCast(u64, (arg1[4])) * x5); const x36: u64 = (@intCast(u64, (arg1[4])) * @intCast(u64, x8)); const x37: u64 = (@intCast(u64, (arg1[4])) * x11); const x38: u64 = (@intCast(u64, (arg1[4])) * @intCast(u64, x14)); const x39: u64 = (@intCast(u64, (arg1[4])) * @intCast(u64, (arg1[4]))); const x40: u64 = (@intCast(u64, (arg1[3])) * (@intCast(u64, x2) * @intCast(u64, 0x2))); const x41: u64 = (@intCast(u64, (arg1[3])) * x5); const x42: u64 = (@intCast(u64, (arg1[3])) * (@intCast(u64, x8) * @intCast(u64, 0x2))); const x43: u64 = (@intCast(u64, (arg1[3])) * @intCast(u64, x12)); const x44: u64 = (@intCast(u64, (arg1[3])) * @intCast(u64, (x14 * 0x2))); const x45: u64 = (@intCast(u64, (arg1[3])) * @intCast(u64, x15)); const x46: u64 = (@intCast(u64, (arg1[3])) * @intCast(u64, ((arg1[3]) * 0x2))); const x47: u64 = (@intCast(u64, (arg1[2])) * @intCast(u64, x2)); const x48: u64 = (@intCast(u64, (arg1[2])) * x5); const x49: u64 = (@intCast(u64, (arg1[2])) * @intCast(u64, x9)); const x50: u64 = (@intCast(u64, (arg1[2])) * @intCast(u64, x12)); const x51: u64 = (@intCast(u64, (arg1[2])) * @intCast(u64, x14)); const x52: u64 = (@intCast(u64, (arg1[2])) * @intCast(u64, x15)); const x53: u64 = (@intCast(u64, (arg1[2])) * @intCast(u64, x16)); const x54: u64 = (@intCast(u64, (arg1[2])) * @intCast(u64, (arg1[2]))); const x55: u64 = (@intCast(u64, (arg1[1])) * (@intCast(u64, x2) * @intCast(u64, 0x2))); const x56: u64 = (@intCast(u64, (arg1[1])) * @intCast(u64, x6)); const x57: u64 = (@intCast(u64, (arg1[1])) * @intCast(u64, (x9 * 0x2))); const x58: u64 = (@intCast(u64, (arg1[1])) * @intCast(u64, x12)); const x59: u64 = (@intCast(u64, (arg1[1])) * @intCast(u64, (x14 * 0x2))); const x60: u64 = (@intCast(u64, (arg1[1])) * @intCast(u64, x15)); const x61: u64 = (@intCast(u64, (arg1[1])) * @intCast(u64, (x16 * 0x2))); const x62: u64 = (@intCast(u64, (arg1[1])) * @intCast(u64, x17)); const x63: u64 = (@intCast(u64, (arg1[1])) * @intCast(u64, ((arg1[1]) * 0x2))); const x64: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, x3)); const x65: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, x6)); const x66: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, x9)); const x67: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, x12)); const x68: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, x14)); const x69: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, x15)); const x70: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, x16)); const x71: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, x17)); const x72: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, x18)); const x73: u64 = (@intCast(u64, (arg1[0])) * @intCast(u64, (arg1[0]))); const x74: u64 = (x73 + (x55 + (x48 + (x42 + (x37 + x33))))); const x75: u64 = (x74 >> 26); const x76: u32 = @intCast(u32, (x74 & @intCast(u64, 0x3ffffff))); const x77: u64 = (x64 + (x56 + (x49 + (x43 + x38)))); const x78: u64 = (x65 + (x57 + (x50 + (x44 + (x39 + x19))))); const x79: u64 = (x66 + (x58 + (x51 + (x45 + x20)))); const x80: u64 = (x67 + (x59 + (x52 + (x46 + (x22 + x21))))); const x81: u64 = (x68 + (x60 + (x53 + (x25 + x23)))); const x82: u64 = (x69 + (x61 + (x54 + (x29 + (x26 + x24))))); const x83: u64 = (x70 + (x62 + (x34 + (x30 + x27)))); const x84: u64 = (x71 + (x63 + (x40 + (x35 + (x31 + x28))))); const x85: u64 = (x72 + (x47 + (x41 + (x36 + x32)))); const x86: u64 = (x75 + x85); const x87: u64 = (x86 >> 25); const x88: u32 = @intCast(u32, (x86 & @intCast(u64, 0x1ffffff))); const x89: u64 = (x87 + x84); const x90: u64 = (x89 >> 26); const x91: u32 = @intCast(u32, (x89 & @intCast(u64, 0x3ffffff))); const x92: u64 = (x90 + x83); const x93: u64 = (x92 >> 25); const x94: u32 = @intCast(u32, (x92 & @intCast(u64, 0x1ffffff))); const x95: u64 = (x93 + x82); const x96: u64 = (x95 >> 26); const x97: u32 = @intCast(u32, (x95 & @intCast(u64, 0x3ffffff))); const x98: u64 = (x96 + x81); const x99: u64 = (x98 >> 25); const x100: u32 = @intCast(u32, (x98 & @intCast(u64, 0x1ffffff))); const x101: u64 = (x99 + x80); const x102: u64 = (x101 >> 26); const x103: u32 = @intCast(u32, (x101 & @intCast(u64, 0x3ffffff))); const x104: u64 = (x102 + x79); const x105: u64 = (x104 >> 25); const x106: u32 = @intCast(u32, (x104 & @intCast(u64, 0x1ffffff))); const x107: u64 = (x105 + x78); const x108: u64 = (x107 >> 26); const x109: u32 = @intCast(u32, (x107 & @intCast(u64, 0x3ffffff))); const x110: u64 = (x108 + x77); const x111: u64 = (x110 >> 25); const x112: u32 = @intCast(u32, (x110 & @intCast(u64, 0x1ffffff))); const x113: u64 = (x111 * @intCast(u64, 0x13)); const x114: u64 = (@intCast(u64, x76) + x113); const x115: u32 = @intCast(u32, (x114 >> 26)); const x116: u32 = @intCast(u32, (x114 & @intCast(u64, 0x3ffffff))); const x117: u32 = (x115 + x88); const x118: u1 = @intCast(u1, (x117 >> 25)); const x119: u32 = (x117 & 0x1ffffff); const x120: u32 = (@intCast(u32, x118) + x91); out1[0] = x116; out1[1] = x119; out1[2] = x120; out1[3] = x94; out1[4] = x97; out1[5] = x100; out1[6] = x103; out1[7] = x106; out1[8] = x109; out1[9] = x112; } /// The function fiat25519Carry reduces a field element. /// Postconditions: /// eval out1 mod m = eval arg1 mod m /// /// Input Bounds: /// arg1: [[0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000]] /// Output Bounds: /// out1: [[0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000]] pub fn fiat25519Carry(out1: *[10]u32, arg1: [10]u32) void { const x1: u32 = (arg1[0]); const x2: u32 = ((x1 >> 26) + (arg1[1])); const x3: u32 = ((x2 >> 25) + (arg1[2])); const x4: u32 = ((x3 >> 26) + (arg1[3])); const x5: u32 = ((x4 >> 25) + (arg1[4])); const x6: u32 = ((x5 >> 26) + (arg1[5])); const x7: u32 = ((x6 >> 25) + (arg1[6])); const x8: u32 = ((x7 >> 26) + (arg1[7])); const x9: u32 = ((x8 >> 25) + (arg1[8])); const x10: u32 = ((x9 >> 26) + (arg1[9])); const x11: u32 = ((x1 & 0x3ffffff) + ((x10 >> 25) * 0x13)); const x12: u32 = (@intCast(u32, @intCast(u1, (x11 >> 26))) + (x2 & 0x1ffffff)); const x13: u32 = (x11 & 0x3ffffff); const x14: u32 = (x12 & 0x1ffffff); const x15: u32 = (@intCast(u32, @intCast(u1, (x12 >> 25))) + (x3 & 0x3ffffff)); const x16: u32 = (x4 & 0x1ffffff); const x17: u32 = (x5 & 0x3ffffff); const x18: u32 = (x6 & 0x1ffffff); const x19: u32 = (x7 & 0x3ffffff); const x20: u32 = (x8 & 0x1ffffff); const x21: u32 = (x9 & 0x3ffffff); const x22: u32 = (x10 & 0x1ffffff); out1[0] = x13; out1[1] = x14; out1[2] = x15; out1[3] = x16; out1[4] = x17; out1[5] = x18; out1[6] = x19; out1[7] = x20; out1[8] = x21; out1[9] = x22; } /// The function fiat25519Add adds two field elements. /// Postconditions: /// eval out1 mod m = (eval arg1 + eval arg2) mod m /// /// Input Bounds: /// arg1: [[0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000]] /// arg2: [[0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000]] /// Output Bounds: /// out1: [[0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000]] pub fn fiat25519Add(out1: *[10]u32, arg1: [10]u32, arg2: [10]u32) void { const x1: u32 = ((arg1[0]) + (arg2[0])); const x2: u32 = ((arg1[1]) + (arg2[1])); const x3: u32 = ((arg1[2]) + (arg2[2])); const x4: u32 = ((arg1[3]) + (arg2[3])); const x5: u32 = ((arg1[4]) + (arg2[4])); const x6: u32 = ((arg1[5]) + (arg2[5])); const x7: u32 = ((arg1[6]) + (arg2[6])); const x8: u32 = ((arg1[7]) + (arg2[7])); const x9: u32 = ((arg1[8]) + (arg2[8])); const x10: u32 = ((arg1[9]) + (arg2[9])); out1[0] = x1; out1[1] = x2; out1[2] = x3; out1[3] = x4; out1[4] = x5; out1[5] = x6; out1[6] = x7; out1[7] = x8; out1[8] = x9; out1[9] = x10; } /// The function fiat25519Sub subtracts two field elements. /// Postconditions: /// eval out1 mod m = (eval arg1 - eval arg2) mod m /// /// Input Bounds: /// arg1: [[0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000]] /// arg2: [[0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000]] /// Output Bounds: /// out1: [[0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000]] pub fn fiat25519Sub(out1: *[10]u32, arg1: [10]u32, arg2: [10]u32) void { const x1: u32 = ((0x7ffffda + (arg1[0])) - (arg2[0])); const x2: u32 = ((0x3fffffe + (arg1[1])) - (arg2[1])); const x3: u32 = ((0x7fffffe + (arg1[2])) - (arg2[2])); const x4: u32 = ((0x3fffffe + (arg1[3])) - (arg2[3])); const x5: u32 = ((0x7fffffe + (arg1[4])) - (arg2[4])); const x6: u32 = ((0x3fffffe + (arg1[5])) - (arg2[5])); const x7: u32 = ((0x7fffffe + (arg1[6])) - (arg2[6])); const x8: u32 = ((0x3fffffe + (arg1[7])) - (arg2[7])); const x9: u32 = ((0x7fffffe + (arg1[8])) - (arg2[8])); const x10: u32 = ((0x3fffffe + (arg1[9])) - (arg2[9])); out1[0] = x1; out1[1] = x2; out1[2] = x3; out1[3] = x4; out1[4] = x5; out1[5] = x6; out1[6] = x7; out1[7] = x8; out1[8] = x9; out1[9] = x10; } /// The function fiat25519Opp negates a field element. /// Postconditions: /// eval out1 mod m = -eval arg1 mod m /// /// Input Bounds: /// arg1: [[0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000]] /// Output Bounds: /// out1: [[0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000]] pub fn fiat25519Opp(out1: *[10]u32, arg1: [10]u32) void { const x1: u32 = (0x7ffffda - (arg1[0])); const x2: u32 = (0x3fffffe - (arg1[1])); const x3: u32 = (0x7fffffe - (arg1[2])); const x4: u32 = (0x3fffffe - (arg1[3])); const x5: u32 = (0x7fffffe - (arg1[4])); const x6: u32 = (0x3fffffe - (arg1[5])); const x7: u32 = (0x7fffffe - (arg1[6])); const x8: u32 = (0x3fffffe - (arg1[7])); const x9: u32 = (0x7fffffe - (arg1[8])); const x10: u32 = (0x3fffffe - (arg1[9])); out1[0] = x1; out1[1] = x2; out1[2] = x3; out1[3] = x4; out1[4] = x5; out1[5] = x6; out1[6] = x7; out1[7] = x8; out1[8] = x9; out1[9] = x10; } /// The function fiat25519Selectznz is a multi-limb conditional select. /// Postconditions: /// eval out1 = (if arg1 = 0 then eval arg2 else eval arg3) /// /// Input Bounds: /// arg1: [0x0 ~> 0x1] /// arg2: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] /// arg3: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] /// Output Bounds: /// out1: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] pub fn fiat25519Selectznz(out1: *[10]u32, arg1: u1, arg2: [10]u32, arg3: [10]u32) void { var x1: u32 = undefined; fiat25519CmovznzU32(&x1, arg1, (arg2[0]), (arg3[0])); var x2: u32 = undefined; fiat25519CmovznzU32(&x2, arg1, (arg2[1]), (arg3[1])); var x3: u32 = undefined; fiat25519CmovznzU32(&x3, arg1, (arg2[2]), (arg3[2])); var x4: u32 = undefined; fiat25519CmovznzU32(&x4, arg1, (arg2[3]), (arg3[3])); var x5: u32 = undefined; fiat25519CmovznzU32(&x5, arg1, (arg2[4]), (arg3[4])); var x6: u32 = undefined; fiat25519CmovznzU32(&x6, arg1, (arg2[5]), (arg3[5])); var x7: u32 = undefined; fiat25519CmovznzU32(&x7, arg1, (arg2[6]), (arg3[6])); var x8: u32 = undefined; fiat25519CmovznzU32(&x8, arg1, (arg2[7]), (arg3[7])); var x9: u32 = undefined; fiat25519CmovznzU32(&x9, arg1, (arg2[8]), (arg3[8])); var x10: u32 = undefined; fiat25519CmovznzU32(&x10, arg1, (arg2[9]), (arg3[9])); out1[0] = x1; out1[1] = x2; out1[2] = x3; out1[3] = x4; out1[4] = x5; out1[5] = x6; out1[6] = x7; out1[7] = x8; out1[8] = x9; out1[9] = x10; } /// The function fiat25519ToBytes serializes a field element to bytes in little-endian order. /// Postconditions: /// out1 = map (λ x, ⌊((eval arg1 mod m) mod 2^(8 * (x + 1))) / 2^(8 * x)⌋) [0..31] /// /// Input Bounds: /// arg1: [[0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000]] /// Output Bounds: /// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0x7f]] pub fn fiat25519ToBytes(out1: *[32]u8, arg1: [10]u32) void { var x1: u32 = undefined; var x2: u1 = undefined; fiat25519SubborrowxU26(&x1, &x2, 0x0, (arg1[0]), 0x3ffffed); var x3: u32 = undefined; var x4: u1 = undefined; fiat25519SubborrowxU25(&x3, &x4, x2, (arg1[1]), 0x1ffffff); var x5: u32 = undefined; var x6: u1 = undefined; fiat25519SubborrowxU26(&x5, &x6, x4, (arg1[2]), 0x3ffffff); var x7: u32 = undefined; var x8: u1 = undefined; fiat25519SubborrowxU25(&x7, &x8, x6, (arg1[3]), 0x1ffffff); var x9: u32 = undefined; var x10: u1 = undefined; fiat25519SubborrowxU26(&x9, &x10, x8, (arg1[4]), 0x3ffffff); var x11: u32 = undefined; var x12: u1 = undefined; fiat25519SubborrowxU25(&x11, &x12, x10, (arg1[5]), 0x1ffffff); var x13: u32 = undefined; var x14: u1 = undefined; fiat25519SubborrowxU26(&x13, &x14, x12, (arg1[6]), 0x3ffffff); var x15: u32 = undefined; var x16: u1 = undefined; fiat25519SubborrowxU25(&x15, &x16, x14, (arg1[7]), 0x1ffffff); var x17: u32 = undefined; var x18: u1 = undefined; fiat25519SubborrowxU26(&x17, &x18, x16, (arg1[8]), 0x3ffffff); var x19: u32 = undefined; var x20: u1 = undefined; fiat25519SubborrowxU25(&x19, &x20, x18, (arg1[9]), 0x1ffffff); var x21: u32 = undefined; fiat25519CmovznzU32(&x21, x20, @intCast(u32, 0x0), 0xffffffff); var x22: u32 = undefined; var x23: u1 = undefined; fiat25519AddcarryxU26(&x22, &x23, 0x0, x1, (x21 & 0x3ffffed)); var x24: u32 = undefined; var x25: u1 = undefined; fiat25519AddcarryxU25(&x24, &x25, x23, x3, (x21 & 0x1ffffff)); var x26: u32 = undefined; var x27: u1 = undefined; fiat25519AddcarryxU26(&x26, &x27, x25, x5, (x21 & 0x3ffffff)); var x28: u32 = undefined; var x29: u1 = undefined; fiat25519AddcarryxU25(&x28, &x29, x27, x7, (x21 & 0x1ffffff)); var x30: u32 = undefined; var x31: u1 = undefined; fiat25519AddcarryxU26(&x30, &x31, x29, x9, (x21 & 0x3ffffff)); var x32: u32 = undefined; var x33: u1 = undefined; fiat25519AddcarryxU25(&x32, &x33, x31, x11, (x21 & 0x1ffffff)); var x34: u32 = undefined; var x35: u1 = undefined; fiat25519AddcarryxU26(&x34, &x35, x33, x13, (x21 & 0x3ffffff)); var x36: u32 = undefined; var x37: u1 = undefined; fiat25519AddcarryxU25(&x36, &x37, x35, x15, (x21 & 0x1ffffff)); var x38: u32 = undefined; var x39: u1 = undefined; fiat25519AddcarryxU26(&x38, &x39, x37, x17, (x21 & 0x3ffffff)); var x40: u32 = undefined; var x41: u1 = undefined; fiat25519AddcarryxU25(&x40, &x41, x39, x19, (x21 & 0x1ffffff)); const x42: u32 = (x40 << 6); const x43: u32 = (x38 << 4); const x44: u32 = (x36 << 3); const x45: u32 = (x34 * @intCast(u32, 0x2)); const x46: u32 = (x30 << 6); const x47: u32 = (x28 << 5); const x48: u32 = (x26 << 3); const x49: u32 = (x24 << 2); const x50: u8 = @intCast(u8, (x22 & @intCast(u32, 0xff))); const x51: u32 = (x22 >> 8); const x52: u8 = @intCast(u8, (x51 & @intCast(u32, 0xff))); const x53: u32 = (x51 >> 8); const x54: u8 = @intCast(u8, (x53 & @intCast(u32, 0xff))); const x55: u8 = @intCast(u8, (x53 >> 8)); const x56: u32 = (x49 + @intCast(u32, x55)); const x57: u8 = @intCast(u8, (x56 & @intCast(u32, 0xff))); const x58: u32 = (x56 >> 8); const x59: u8 = @intCast(u8, (x58 & @intCast(u32, 0xff))); const x60: u32 = (x58 >> 8); const x61: u8 = @intCast(u8, (x60 & @intCast(u32, 0xff))); const x62: u8 = @intCast(u8, (x60 >> 8)); const x63: u32 = (x48 + @intCast(u32, x62)); const x64: u8 = @intCast(u8, (x63 & @intCast(u32, 0xff))); const x65: u32 = (x63 >> 8); const x66: u8 = @intCast(u8, (x65 & @intCast(u32, 0xff))); const x67: u32 = (x65 >> 8); const x68: u8 = @intCast(u8, (x67 & @intCast(u32, 0xff))); const x69: u8 = @intCast(u8, (x67 >> 8)); const x70: u32 = (x47 + @intCast(u32, x69)); const x71: u8 = @intCast(u8, (x70 & @intCast(u32, 0xff))); const x72: u32 = (x70 >> 8); const x73: u8 = @intCast(u8, (x72 & @intCast(u32, 0xff))); const x74: u32 = (x72 >> 8); const x75: u8 = @intCast(u8, (x74 & @intCast(u32, 0xff))); const x76: u8 = @intCast(u8, (x74 >> 8)); const x77: u32 = (x46 + @intCast(u32, x76)); const x78: u8 = @intCast(u8, (x77 & @intCast(u32, 0xff))); const x79: u32 = (x77 >> 8); const x80: u8 = @intCast(u8, (x79 & @intCast(u32, 0xff))); const x81: u32 = (x79 >> 8); const x82: u8 = @intCast(u8, (x81 & @intCast(u32, 0xff))); const x83: u8 = @intCast(u8, (x81 >> 8)); const x84: u8 = @intCast(u8, (x32 & @intCast(u32, 0xff))); const x85: u32 = (x32 >> 8); const x86: u8 = @intCast(u8, (x85 & @intCast(u32, 0xff))); const x87: u32 = (x85 >> 8); const x88: u8 = @intCast(u8, (x87 & @intCast(u32, 0xff))); const x89: u1 = @intCast(u1, (x87 >> 8)); const x90: u32 = (x45 + @intCast(u32, x89)); const x91: u8 = @intCast(u8, (x90 & @intCast(u32, 0xff))); const x92: u32 = (x90 >> 8); const x93: u8 = @intCast(u8, (x92 & @intCast(u32, 0xff))); const x94: u32 = (x92 >> 8); const x95: u8 = @intCast(u8, (x94 & @intCast(u32, 0xff))); const x96: u8 = @intCast(u8, (x94 >> 8)); const x97: u32 = (x44 + @intCast(u32, x96)); const x98: u8 = @intCast(u8, (x97 & @intCast(u32, 0xff))); const x99: u32 = (x97 >> 8); const x100: u8 = @intCast(u8, (x99 & @intCast(u32, 0xff))); const x101: u32 = (x99 >> 8); const x102: u8 = @intCast(u8, (x101 & @intCast(u32, 0xff))); const x103: u8 = @intCast(u8, (x101 >> 8)); const x104: u32 = (x43 + @intCast(u32, x103)); const x105: u8 = @intCast(u8, (x104 & @intCast(u32, 0xff))); const x106: u32 = (x104 >> 8); const x107: u8 = @intCast(u8, (x106 & @intCast(u32, 0xff))); const x108: u32 = (x106 >> 8); const x109: u8 = @intCast(u8, (x108 & @intCast(u32, 0xff))); const x110: u8 = @intCast(u8, (x108 >> 8)); const x111: u32 = (x42 + @intCast(u32, x110)); const x112: u8 = @intCast(u8, (x111 & @intCast(u32, 0xff))); const x113: u32 = (x111 >> 8); const x114: u8 = @intCast(u8, (x113 & @intCast(u32, 0xff))); const x115: u32 = (x113 >> 8); const x116: u8 = @intCast(u8, (x115 & @intCast(u32, 0xff))); const x117: u8 = @intCast(u8, (x115 >> 8)); out1[0] = x50; out1[1] = x52; out1[2] = x54; out1[3] = x57; out1[4] = x59; out1[5] = x61; out1[6] = x64; out1[7] = x66; out1[8] = x68; out1[9] = x71; out1[10] = x73; out1[11] = x75; out1[12] = x78; out1[13] = x80; out1[14] = x82; out1[15] = x83; out1[16] = x84; out1[17] = x86; out1[18] = x88; out1[19] = x91; out1[20] = x93; out1[21] = x95; out1[22] = x98; out1[23] = x100; out1[24] = x102; out1[25] = x105; out1[26] = x107; out1[27] = x109; out1[28] = x112; out1[29] = x114; out1[30] = x116; out1[31] = x117; } /// The function fiat25519FromBytes deserializes a field element from bytes in little-endian order. /// Postconditions: /// eval out1 mod m = bytes_eval arg1 mod m /// /// Input Bounds: /// arg1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0x7f]] /// Output Bounds: /// out1: [[0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000]] pub fn fiat25519FromBytes(out1: *[10]u32, arg1: [32]u8) void { const x1: u32 = (@intCast(u32, (arg1[31])) << 18); const x2: u32 = (@intCast(u32, (arg1[30])) << 10); const x3: u32 = (@intCast(u32, (arg1[29])) << 2); const x4: u32 = (@intCast(u32, (arg1[28])) << 20); const x5: u32 = (@intCast(u32, (arg1[27])) << 12); const x6: u32 = (@intCast(u32, (arg1[26])) << 4); const x7: u32 = (@intCast(u32, (arg1[25])) << 21); const x8: u32 = (@intCast(u32, (arg1[24])) << 13); const x9: u32 = (@intCast(u32, (arg1[23])) << 5); const x10: u32 = (@intCast(u32, (arg1[22])) << 23); const x11: u32 = (@intCast(u32, (arg1[21])) << 15); const x12: u32 = (@intCast(u32, (arg1[20])) << 7); const x13: u32 = (@intCast(u32, (arg1[19])) << 24); const x14: u32 = (@intCast(u32, (arg1[18])) << 16); const x15: u32 = (@intCast(u32, (arg1[17])) << 8); const x16: u8 = (arg1[16]); const x17: u32 = (@intCast(u32, (arg1[15])) << 18); const x18: u32 = (@intCast(u32, (arg1[14])) << 10); const x19: u32 = (@intCast(u32, (arg1[13])) << 2); const x20: u32 = (@intCast(u32, (arg1[12])) << 19); const x21: u32 = (@intCast(u32, (arg1[11])) << 11); const x22: u32 = (@intCast(u32, (arg1[10])) << 3); const x23: u32 = (@intCast(u32, (arg1[9])) << 21); const x24: u32 = (@intCast(u32, (arg1[8])) << 13); const x25: u32 = (@intCast(u32, (arg1[7])) << 5); const x26: u32 = (@intCast(u32, (arg1[6])) << 22); const x27: u32 = (@intCast(u32, (arg1[5])) << 14); const x28: u32 = (@intCast(u32, (arg1[4])) << 6); const x29: u32 = (@intCast(u32, (arg1[3])) << 24); const x30: u32 = (@intCast(u32, (arg1[2])) << 16); const x31: u32 = (@intCast(u32, (arg1[1])) << 8); const x32: u8 = (arg1[0]); const x33: u32 = (x31 + @intCast(u32, x32)); const x34: u32 = (x30 + x33); const x35: u32 = (x29 + x34); const x36: u32 = (x35 & 0x3ffffff); const x37: u8 = @intCast(u8, (x35 >> 26)); const x38: u32 = (x28 + @intCast(u32, x37)); const x39: u32 = (x27 + x38); const x40: u32 = (x26 + x39); const x41: u32 = (x40 & 0x1ffffff); const x42: u8 = @intCast(u8, (x40 >> 25)); const x43: u32 = (x25 + @intCast(u32, x42)); const x44: u32 = (x24 + x43); const x45: u32 = (x23 + x44); const x46: u32 = (x45 & 0x3ffffff); const x47: u8 = @intCast(u8, (x45 >> 26)); const x48: u32 = (x22 + @intCast(u32, x47)); const x49: u32 = (x21 + x48); const x50: u32 = (x20 + x49); const x51: u32 = (x50 & 0x1ffffff); const x52: u8 = @intCast(u8, (x50 >> 25)); const x53: u32 = (x19 + @intCast(u32, x52)); const x54: u32 = (x18 + x53); const x55: u32 = (x17 + x54); const x56: u32 = (x15 + @intCast(u32, x16)); const x57: u32 = (x14 + x56); const x58: u32 = (x13 + x57); const x59: u32 = (x58 & 0x1ffffff); const x60: u8 = @intCast(u8, (x58 >> 25)); const x61: u32 = (x12 + @intCast(u32, x60)); const x62: u32 = (x11 + x61); const x63: u32 = (x10 + x62); const x64: u32 = (x63 & 0x3ffffff); const x65: u8 = @intCast(u8, (x63 >> 26)); const x66: u32 = (x9 + @intCast(u32, x65)); const x67: u32 = (x8 + x66); const x68: u32 = (x7 + x67); const x69: u32 = (x68 & 0x1ffffff); const x70: u8 = @intCast(u8, (x68 >> 25)); const x71: u32 = (x6 + @intCast(u32, x70)); const x72: u32 = (x5 + x71); const x73: u32 = (x4 + x72); const x74: u32 = (x73 & 0x3ffffff); const x75: u8 = @intCast(u8, (x73 >> 26)); const x76: u32 = (x3 + @intCast(u32, x75)); const x77: u32 = (x2 + x76); const x78: u32 = (x1 + x77); out1[0] = x36; out1[1] = x41; out1[2] = x46; out1[3] = x51; out1[4] = x55; out1[5] = x59; out1[6] = x64; out1[7] = x69; out1[8] = x74; out1[9] = x78; } /// The function fiat25519CarryScmul121666 multiplies a field element by 121666 and reduces the result. /// Postconditions: /// eval out1 mod m = (121666 * eval arg1) mod m /// /// Input Bounds: /// arg1: [[0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000], [0x0 ~> 0xc000000], [0x0 ~> 0x6000000]] /// Output Bounds: /// out1: [[0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000], [0x0 ~> 0x4000000], [0x0 ~> 0x2000000]] pub fn fiat25519CarryScmul121666(out1: *[10]u32, arg1: [10]u32) void { const x1: u64 = (@intCast(u64, 0x1db42) * @intCast(u64, (arg1[9]))); const x2: u64 = (@intCast(u64, 0x1db42) * @intCast(u64, (arg1[8]))); const x3: u64 = (@intCast(u64, 0x1db42) * @intCast(u64, (arg1[7]))); const x4: u64 = (@intCast(u64, 0x1db42) * @intCast(u64, (arg1[6]))); const x5: u64 = (@intCast(u64, 0x1db42) * @intCast(u64, (arg1[5]))); const x6: u64 = (@intCast(u64, 0x1db42) * @intCast(u64, (arg1[4]))); const x7: u64 = (@intCast(u64, 0x1db42) * @intCast(u64, (arg1[3]))); const x8: u64 = (@intCast(u64, 0x1db42) * @intCast(u64, (arg1[2]))); const x9: u64 = (@intCast(u64, 0x1db42) * @intCast(u64, (arg1[1]))); const x10: u64 = (@intCast(u64, 0x1db42) * @intCast(u64, (arg1[0]))); const x11: u32 = @intCast(u32, (x10 >> 26)); const x12: u32 = @intCast(u32, (x10 & @intCast(u64, 0x3ffffff))); const x13: u64 = (@intCast(u64, x11) + x9); const x14: u32 = @intCast(u32, (x13 >> 25)); const x15: u32 = @intCast(u32, (x13 & @intCast(u64, 0x1ffffff))); const x16: u64 = (@intCast(u64, x14) + x8); const x17: u32 = @intCast(u32, (x16 >> 26)); const x18: u32 = @intCast(u32, (x16 & @intCast(u64, 0x3ffffff))); const x19: u64 = (@intCast(u64, x17) + x7); const x20: u32 = @intCast(u32, (x19 >> 25)); const x21: u32 = @intCast(u32, (x19 & @intCast(u64, 0x1ffffff))); const x22: u64 = (@intCast(u64, x20) + x6); const x23: u32 = @intCast(u32, (x22 >> 26)); const x24: u32 = @intCast(u32, (x22 & @intCast(u64, 0x3ffffff))); const x25: u64 = (@intCast(u64, x23) + x5); const x26: u32 = @intCast(u32, (x25 >> 25)); const x27: u32 = @intCast(u32, (x25 & @intCast(u64, 0x1ffffff))); const x28: u64 = (@intCast(u64, x26) + x4); const x29: u32 = @intCast(u32, (x28 >> 26)); const x30: u32 = @intCast(u32, (x28 & @intCast(u64, 0x3ffffff))); const x31: u64 = (@intCast(u64, x29) + x3); const x32: u32 = @intCast(u32, (x31 >> 25)); const x33: u32 = @intCast(u32, (x31 & @intCast(u64, 0x1ffffff))); const x34: u64 = (@intCast(u64, x32) + x2); const x35: u32 = @intCast(u32, (x34 >> 26)); const x36: u32 = @intCast(u32, (x34 & @intCast(u64, 0x3ffffff))); const x37: u64 = (@intCast(u64, x35) + x1); const x38: u32 = @intCast(u32, (x37 >> 25)); const x39: u32 = @intCast(u32, (x37 & @intCast(u64, 0x1ffffff))); const x40: u32 = (x38 * 0x13); const x41: u32 = (x12 + x40); const x42: u1 = @intCast(u1, (x41 >> 26)); const x43: u32 = (x41 & 0x3ffffff); const x44: u32 = (@intCast(u32, x42) + x15); const x45: u1 = @intCast(u1, (x44 >> 25)); const x46: u32 = (x44 & 0x1ffffff); const x47: u32 = (@intCast(u32, x45) + x18); out1[0] = x43; out1[1] = x46; out1[2] = x47; out1[3] = x21; out1[4] = x24; out1[5] = x27; out1[6] = x30; out1[7] = x33; out1[8] = x36; out1[9] = x39; }
fiat-zig/src/curve25519_32.zig
const std = @import("std"); const tools = @import("tools"); const with_trace = false; const with_dissassemble = false; const assert = std.debug.assert; fn trace(comptime fmt: []const u8, args: anytype) void { if (with_trace) std.debug.print(fmt, args); } const Computer = tools.IntCode_Computer; const Vec2 = tools.Vec2; const Map = tools.Map(u7, 100, 100, false); const MapTiles = struct { const unknown: Map.Tile = '?'; const empty: Map.Tile = '.'; const scafold: Map.Tile = '#'; const visited: Map.Tile = 'O'; }; fn longuest_seq(candidate: []const u8, string: []const u8) []const u8 { var l = candidate.len; var best_reduc: usize = 0; var best_l: usize = 0; while (l > 1) : (l -= 1) { if (candidate[l - 1] == ',') continue; var matches: u32 = 0; var pos: usize = 0; while (std.mem.indexOfPos(u8, string, pos, candidate[0..l])) |p| { matches += 1; pos = p + 1; } if (matches > 1) { trace("matched {} times {}\n", .{ matches, candidate[0..l] }); } if (matches * l > best_reduc) { best_reduc = matches * l; best_l = l; } } return candidate[0..best_l]; } fn reduce(string: []const u8, pattern: []const u8, replace: []const u8, storage: []u8) []const u8 { var cursor: usize = 0; var first = true; var it = std.mem.split(u8, string, pattern); while (it.next()) |str| { if (!first) { std.mem.copy(u8, storage[cursor .. cursor + replace.len], replace); cursor += replace.len; } std.mem.copy(u8, storage[cursor .. cursor + str.len], str); first = false; cursor += str.len; } return storage[0..cursor]; } pub fn run(input: []const u8, allocator: std.mem.Allocator) ![2][]const u8 { const int_count = blk: { var int_count: usize = 0; var it = std.mem.split(u8, input, ","); while (it.next()) |_| int_count += 1; break :blk int_count; }; const boot_image = try allocator.alloc(Computer.Data, int_count); defer allocator.free(boot_image); { var it = std.mem.split(u8, input, ","); var i: usize = 0; while (it.next()) |n_text| : (i += 1) { const trimmed = std.mem.trim(u8, n_text, " \n\r\t"); boot_image[i] = try std.fmt.parseInt(Computer.Data, trimmed, 10); } } if (with_dissassemble) Computer.disassemble(boot_image); var cpu = Computer{ .name = "Vacuum", .memory = try allocator.alloc(Computer.Data, 5000), }; defer allocator.free(cpu.memory); cpu.boot(boot_image); cpu.memory[0] = 2; trace("starting {}\n", .{cpu.name}); _ = async cpu.run(); var map = Map{ .default_tile = MapTiles.unknown }; var map_cursor = Vec2{ .x = 0, .y = 0 }; var robot_pos: ?Vec2 = null; var robot_dir: u2 = 0; const Dir = struct { const up: u2 = 0; const left: u2 = 1; const down: u2 = 2; const right: u2 = 3; }; const moves = [_]Vec2{ Vec2{ .x = 0, .y = -1 }, Vec2{ .x = -1, .y = 0 }, Vec2{ .x = 0, .y = 1 }, Vec2{ .x = 1, .y = 0 }, }; while (!cpu.is_halted()) { if (cpu.io_mode == .input) { break; //cpu.io_port = 0; //trace("wrting input to {} = {}\n", .{ cpu.name, cpu.io_port }); } if (cpu.io_mode == .output) { trace("{} outputs {}\n", .{ cpu.name, cpu.io_port }); //try stdout.print("{c}", .{@intCast(u8, cpu.io_port)}); var write: ?Map.Tile = null; switch (cpu.io_port) { 10 => map_cursor = Vec2{ .x = 0, .y = map_cursor.y + 1 }, '#' => write = MapTiles.scafold, '.' => write = MapTiles.empty, '^' => { write = MapTiles.scafold; robot_pos = map_cursor; robot_dir = Dir.up; }, 'v' => { write = MapTiles.scafold; robot_pos = map_cursor; robot_dir = Dir.down; }, '>' => { write = MapTiles.scafold; robot_pos = map_cursor; robot_dir = Dir.left; }, '<' => { write = MapTiles.scafold; robot_pos = map_cursor; robot_dir = Dir.right; }, else => { trace("{c}", .{@intCast(u8, cpu.io_port)}); // unreachable, }, } trace("{}:{}\n", .{ map_cursor, write }); if (write) |tile| { map.set(map_cursor, tile); map_cursor.x += 1; } } trace("resuming {}\n", .{cpu.name}); resume cpu.io_runframe; } var alignpar: i32 = 0; var nb_scafolds: u32 = 0; { assert(map.bbox.min.x == 0 and map.bbox.min.y == 0); var y: i32 = 1; while (y < map.bbox.max.y - 1) : (y += 1) { var x: i32 = 1; while (x < map.bbox.max.x - 1) : (x += 1) { const m = map.get(Vec2{ .x = x, .y = y }) orelse MapTiles.unknown; if (m != MapTiles.scafold) continue; const up = map.at(Vec2{ .x = x, .y = y - 1 }); const down = map.at(Vec2{ .x = x, .y = y + 1 }); const left = map.at(Vec2{ .x = x - 1, .y = y }); const right = map.at(Vec2{ .x = x + 1, .y = y }); if (up == MapTiles.scafold and down == MapTiles.scafold and left == MapTiles.scafold and right == MapTiles.scafold) { alignpar += (x * y); } } } for (map.map) |m| { if (m == MapTiles.scafold) nb_scafolds += 1; } var storage: [10000]u8 = undefined; trace("{}, align={}\n", .{ map.printToBuf(robot_pos.?, null, null, &storage), alignpar }); } // sequence de parcours: var commandstring_storage: [500]u8 = undefined; var commandstring: []u8 = undefined; { var seq: [500]struct { rot: i2, steps: u8, } = undefined; var pos = robot_pos.?; { map.set(pos, MapTiles.visited); nb_scafolds -= 1; } var iseq: usize = 0; while (nb_scafolds > 0) { // tout droit tant qu'on peut const d = moves[robot_dir]; const m = map.get(Vec2{ .x = pos.x + d.x, .y = pos.y + d.y }) orelse MapTiles.unknown; if (m == MapTiles.scafold or m == MapTiles.visited) { const s = &seq[iseq - 1]; s.steps += 1; pos = Vec2{ .x = pos.x + d.x, .y = pos.y + d.y }; if (m == MapTiles.scafold) { map.set(pos, MapTiles.visited); nb_scafolds -= 1; } continue; } // tourne sinon const dR = moves[robot_dir +% 1]; const dL = moves[robot_dir -% 1]; const mR = map.get(Vec2{ .x = pos.x + dR.x, .y = pos.y + dR.y }) orelse MapTiles.unknown; const mL = map.get(Vec2{ .x = pos.x + dL.x, .y = pos.y + dL.y }) orelse MapTiles.unknown; if (mR == MapTiles.scafold) { const s = &seq[iseq]; iseq += 1; s.rot = 1; s.steps = 0; robot_dir +%= 1; } else if (mL == MapTiles.scafold) { const s = &seq[iseq]; iseq += 1; s.rot = -1; s.steps = 0; robot_dir -%= 1; } else { unreachable; // TODO backtrack? } } var storage: [10000]u8 = undefined; trace("{}, steps={}\n", .{ map.printToBuf(pos, null, null, &storage), iseq }); { var l: usize = 0; for (seq[0..iseq]) |s| { if (s.rot == -1) { tools.fmt_bufAppend(&commandstring_storage, &l, ",R,{}", .{s.steps}); } else { tools.fmt_bufAppend(&commandstring_storage, &l, ",L,{}", .{s.steps}); } } commandstring = commandstring_storage[1..l]; trace("seq='{}' len={}\n", .{ commandstring, commandstring.len }); } } // version simple "on reduit par seq la plus longue en zero." marche pas // const seqA = longuest_seq(commandstring[0..(if (commandstring.len / 2 <= 20) commandstring.len / 2 else 20)], commandstring); var storage_1: [200]u8 = undefined; var storage_2: [200]u8 = undefined; var storage_3: [200]u8 = undefined; const inputs = blk: { var l1: usize = 1; while (l1 <= 20) : (l1 += 1) { const patternA = commandstring[0..l1]; if (patternA[0] == ',' or patternA[patternA.len - 1] == ',') continue; var reduceA = reduce(commandstring, patternA, "A", &storage_1); var l2: usize = 1; while (l2 <= 20) : (l2 += 1) { const patternB = std.mem.trim(u8, reduceA, ",ABC")[0..l2]; if (patternB[0] == ',' or patternB[patternB.len - 1] == ',') continue; var reduceB = reduce(reduceA, patternB, "B", &storage_2); var l3: usize = 1; while (l3 <= 20) : (l3 += 1) { const patternC = std.mem.trim(u8, reduceB, ",ABC")[0..l3]; if (patternC[0] == ',' or patternC[patternC.len - 1] == ',') continue; var reduceC = reduce(reduceB, patternC, "C", &storage_3); if (reduceC.len < 20) { break :blk .{ reduceC, patternA, patternB, patternC }; } } } } unreachable; }; trace("inputs: '{s}' with A='{s}' B='{s}' C='{s}'\n", inputs); var fullinputseq_buf: [100]u8 = undefined; const fullinputseq = std.fmt.bufPrint(&fullinputseq_buf, "{s}\n{s}\n{s}\n{s}\nn\n", inputs) catch unreachable; var i_input: usize = 0; var answer2: Computer.Data = undefined; // cpu.boot(boot_image); // cpu.memory[0] = 2; // trace("starting {}\n", .{cpu.name}); // _ = async cpu.run(); while (!cpu.is_halted()) { if (cpu.io_mode == .input) { cpu.io_port = fullinputseq[i_input]; i_input += 1; trace("wrting input to {s} = {}\n", .{ cpu.name, cpu.io_port }); } if (cpu.io_mode == .output) { trace("{s} outputs {}\n", .{ cpu.name, cpu.io_port }); if (cpu.io_port < 127) { trace("{c}", .{@intCast(u8, cpu.io_port)}); } else { trace("\nans = {}\n", .{cpu.io_port}); answer2 = cpu.io_port; } } trace("resuming {s}\n", .{cpu.name}); resume cpu.io_runframe; } return [_][]const u8{ try std.fmt.allocPrint(allocator, "{}", .{alignpar}), try std.fmt.allocPrint(allocator, "{}", .{answer2}), }; } pub const main = tools.defaultMain("2019/day17.txt", run);
2019/day17.zig
const std = @import("std"); const tools = @import("tools"); const with_trace = false; const with_dissassemble = false; const interractive = false; const assert = std.debug.assert; fn trace(comptime fmt: []const u8, args: anytype) void { if (with_trace) std.debug.print(fmt, args); } pub const main = tools.defaultMain("2019/day25.txt", run); const Computer = tools.IntCode_Computer; const Map = tools.Map(u8, 512, 512, true); const Vec2 = tools.Vec2; const State = struct { room_index: usize, inventory: u64, door: u2, next_pos: Vec2, }; const Trace = struct { // cpu: Computer, // memory: [1000]Computer.Data, len: usize, commands: [4096]u8, }; const BFS = tools.BestFirstSearch(State, Trace); const Room = struct { name: []const u8, desc: []const u8, items: [2]usize, items_count: usize, doors: [4]bool, pos: Vec2, }; pub fn run(input: []const u8, allocator: std.mem.Allocator) tools.RunError![2][]const u8 { const int_count = std.mem.count(u8, input, ",") + 1; const boot_image = try allocator.alloc(Computer.Data, int_count); defer allocator.free(boot_image); { var it = std.mem.split(u8, input, ","); var i: usize = 0; while (it.next()) |n_text| : (i += 1) { const trimmed = std.mem.trim(u8, n_text, " \n\r\t"); boot_image[i] = try std.fmt.parseInt(Computer.Data, trimmed, 10); } } if (with_dissassemble) Computer.disassemble(boot_image); var cpu = Computer{ .name = "droid", .memory = try allocator.alloc(Computer.Data, 8000), }; defer allocator.free(cpu.memory); var map = Map{ .default_tile = '#' }; map.set(Vec2{ .x = 0, .y = 0 }, ' '); var bfs = BFS.init(allocator); defer bfs.deinit(); try bfs.insert(BFS.Node{ .cost = 0, .rating = 0, .state = State{ .room_index = 0, .next_pos = Vec2{ .x = 0, .y = 0 }, .door = 0, .inventory = 0, //.cpu = cpu, //.memory = try std.mem.dupe(u8, cpu.memory), }, .trace = Trace{ .len = 0, .commands = undefined }, }); var rooms = std.ArrayList(Room).init(allocator); defer rooms.deinit(); { const room0 = try rooms.addOne(); room0.name = "the void"; } var items = std.ArrayList([]const u8).init(allocator); defer items.deinit(); try items.append("infinite loop"); try items.append("giant electromagnet"); try items.append("escape pod"); try items.append("molten lava"); try items.append("photons"); const items_firstvalid = items.items.len; const dirs = [_]Vec2{ .{ .x = 0, .y = -1 }, .{ .x = -1, .y = 0 }, .{ .x = 0, .y = 1 }, .{ .x = 1, .y = 0 } }; const cmds = [_][]const u8{ "north", "west", "south", "east" }; const ans1 = ans: { if (interractive) { const stdin = &std.io.getStdIn().reader(); const stdout = std.io.getStdOut().writer(); cpu.boot(boot_image); _ = async cpu.run(); while (true) { assert(!cpu.is_halted()); if (cpu.io_mode == .input) { cpu.io_port = stdin.readByte() catch return error.UnsupportedInput; //try stdout.print("{c}", .{@intCast(u8, cpu.io_port)}); //trace("wrting input to {s} = {}\n", .{ cpu.name, cpu.io_port }); } if (cpu.io_mode == .output) { //trace("{s} outputs {}\n", .{ cpu.name, cpu.io_port }); stdout.writeByte(@intCast(u8, cpu.io_port)) catch return error.UnsupportedInput; } //trace("resuming {s}\n", .{cpu.name}); resume cpu.io_runframe; } unreachable; } else { while (bfs.pop()) |node| { cpu.boot(boot_image); // trace("starting {s}\n", .{cpu.name}); _ = async cpu.run(); // replay commands // trace("applying commands: {}\n", .{node.trace.commands[0..node.trace.len]}); { const commands = node.trace.commands[0..node.trace.len]; for (commands) |command| { assert(!cpu.is_halted()); var deathtext: [1000]u8 = undefined; var deathtextlen: usize = 0; while (cpu.io_mode != .input) { deathtext[deathtextlen] = @intCast(u8, cpu.io_port); deathtextlen += 1; if (cpu.is_halted()) { trace("halted by {s}, after commands: {s}\n", .{ deathtext[0..deathtextlen], node.trace.commands[0..node.trace.len] }); unreachable; } // drop output resume cpu.io_runframe; } cpu.io_port = command; resume cpu.io_runframe; } } // parse desc var found_new_room = false; var room_index: ?usize = blk: { var room: Room = undefined; var desc: [1000]u8 = undefined; var out: usize = 0; while (true) { if (cpu.is_halted()) { trace("halted by {s}, after commands: {s}\n", .{ desc[0..out], node.trace.commands[0..node.trace.len] }); const sentence = "You should be able to get in by typing "; if (std.mem.indexOf(u8, &desc, sentence)) |index| { const str = desc[index + sentence.len ..]; const code = std.mem.tokenize(u8, str, " ").next().?; break :ans try std.fmt.parseInt(u64, code, 10); } unreachable; } if (cpu.io_mode == .input) { break; } if (cpu.io_mode == .output) { desc[out] = @intCast(u8, cpu.io_port); out += 1; } resume cpu.io_runframe; } // trace("parsing desc: {s}\n", .{desc[0..out]}); room.desc = ""; room.doors = [_]bool{ false, false, false, false }; room.items_count = 0; room.pos = node.state.next_pos; { var sec: enum { title, desc, doors, items, done, } = .title; var it = std.mem.tokenize(u8, desc[0..out], "\n"); while (it.next()) |line0| { const line = std.mem.trim(u8, line0, " \n\r\t"); if (line.len == 0) continue; switch (sec) { .title => { if (std.mem.eql(u8, line[0..3], "== ")) { room.name = line[3 .. line.len - 3]; //try allocator.dupe(u8, line[3 .. line.len - 3]); sec = .desc; } else { trace("Skipping: {s}\n", .{line}); trace("after commands: {s}\n", .{node.trace.commands[0..node.trace.len]}); unreachable; } }, .desc => { if (std.mem.eql(u8, line, "Doors here lead:")) { sec = .doors; } else { assert(room.desc.len == 0); room.desc = line; //try allocator.dupe(u8, line); } }, .doors => { if (std.mem.eql(u8, line, "A loud, robotic voice says \"Alert! Droids on this ship are heavier than the detected value!\" and you are ejected back to the checkpoint.")) { trace("rejected (too light) after: {s}\n", .{node.trace.commands[0..node.trace.len]}); sec = .done; break :blk null; } else if (std.mem.eql(u8, line, "A loud, robotic voice says \"Alert! Droids on this ship are lighter than the detected value!\" and you are ejected back to the checkpoint.")) { trace("rejected (too heavy) after: {s}\n", .{node.trace.commands[0..node.trace.len]}); sec = .done; break :blk null; } else if (std.mem.eql(u8, line, "Items here:")) { sec = .items; } else if (std.mem.eql(u8, line, "Command?")) { sec = .done; } else if (std.mem.eql(u8, line, "- north")) { room.doors[0] = true; } else if (std.mem.eql(u8, line, "- west")) { room.doors[1] = true; } else if (std.mem.eql(u8, line, "- south")) { room.doors[2] = true; } else if (std.mem.eql(u8, line, "- east")) { room.doors[3] = true; } else { trace("Skipping: {s}\n", .{line}); trace("after commands: {s}\n", .{node.trace.commands[0..node.trace.len]}); unreachable; } }, .items => { if (std.mem.eql(u8, line[0..2], "- ")) { const item = line[2..]; const item_num = itemblk: { for (items.items) |existing, i| { if (std.mem.eql(u8, item, existing)) break :itemblk i; } try items.append(try allocator.dupe(u8, item)); break :itemblk items.items.len - 1; }; room.items[room.items_count] = item_num; room.items_count += 1; } else if (std.mem.eql(u8, line, "Command?")) { sec = .done; } else { trace("Skipping: {s}\n", .{line}); trace("after commands: {s}\n", .{node.trace.commands[0..node.trace.len]}); unreachable; } }, .done => { trace("Skipping: {s}\n", .{line}); trace("after commands: {s}\n", .{node.trace.commands[0..node.trace.len]}); unreachable; }, } } } for (rooms.items) |r, i| { if (std.mem.eql(u8, room.name, r.name)) { assert(room.pos.x == r.pos.x and room.pos.y == r.pos.y); assert(std.mem.eql(bool, &room.doors, &r.doors)); assert(std.mem.eql(u8, room.desc, r.desc)); break :blk i; } } found_new_room = true; const newroom = try rooms.addOne(); newroom.* = room; newroom.name = try allocator.dupe(u8, room.name); newroom.desc = try allocator.dupe(u8, room.desc); break :blk rooms.items.len - 1; }; if (room_index == null) // action erronée continue; // update map { const room = rooms.items[room_index.?]; const p = room.pos; map.set(p, ' '); for (room.doors) |open, d| { const np = Vec2{ .x = p.x + dirs[d].x, .y = p.y + dirs[d].y }; var prev_val = map.get(np) orelse '#'; const new_val: u8 = if (open) '.' else '#'; if (prev_val == '#' or prev_val == new_val) { map.set(np, new_val); } else { map.set(np, '+'); } } //var buf: [1000]u8 = undefined; //trace("map=\n{}\n", .{map.printToBuf(p, null, null, &buf)}); } if (found_new_room) { const room = rooms.items[room_index.?]; const p = room.pos; trace("\n==========================\nfound a new room! commands:\n{s}desc:{s}\n", .{ node.trace.commands[0..node.trace.len], room }); var buf: [1000]u8 = undefined; trace("map=\n{s}\n", .{map.printToBuf(p, null, null, &buf)}); trace("so far, {} rooms and {} items\n", .{ rooms.items.len, items.items.len }); trace("so far, agenda: {}, visited: {}\n", .{ bfs.agenda.items.len, bfs.visited.count() }); } // insert new nodes: { const room = rooms.items[room_index.?]; const p = room.pos; for (room.doors) |open, d| { if (!open) continue; var new = BFS.Node{ .cost = node.cost + 1, .rating = node.rating + 1, .state = State{ .room_index = room_index.?, .door = @intCast(u2, d), .inventory = node.state.inventory, .next_pos = Vec2{ .x = p.x + dirs[d].x * 2, .y = p.y + dirs[d].y * 2 }, }, .trace = node.trace, }; tools.fmt_bufAppend(&new.trace.commands, &new.trace.len, "{s}\n", .{cmds[d]}); try bfs.insert(new); for (room.items[0..room.items_count]) |itemidx| { if (itemidx < items_firstvalid) continue; new.cost = node.cost + 1 + 1; new.rating = node.rating + 1 + 10; new.trace.len = node.trace.len; new.state.inventory |= (@as(u64, 1) << @intCast(u6, itemidx)); tools.fmt_bufAppend(&new.trace.commands, &new.trace.len, "take {s}\n", .{items.items[itemidx]}); tools.fmt_bufAppend(&new.trace.commands, &new.trace.len, "{s}\n", .{cmds[d]}); try bfs.insert(new); } } } } } unreachable; }; const ans2 = ans: { break :ans "gratis!"; }; return [_][]const u8{ try std.fmt.allocPrint(allocator, "{}", .{ans1}), try std.fmt.allocPrint(allocator, "{s}", .{ans2}), }; }
2019/day25.zig
pub const MICROSOFT_URL_EXPERIENCE_PROPERTY = "Microsoft TIP URL Experience"; pub const MICROSOFT_TIP_NO_INSERT_BUTTON_PROPERTY = "Microsoft TIP No Insert Option"; pub const MICROSOFT_TIP_COMBOBOXLIST_PROPERTY = "Microsoft TIP ComboBox List Window Identifier"; pub const MICROSOFT_TIP_OPENING_MSG = "TabletInputPanelOpening"; pub const SAFE_PARTIAL = @as(u32, 1); pub const BEST_COMPLETE = @as(u32, 2); pub const MAX_VENDORNAME = @as(u32, 32); pub const MAX_FRIENDLYNAME = @as(u32, 64); pub const MAX_LANGUAGES = @as(u32, 64); pub const CAC_FULL = @as(u32, 0); pub const CAC_PREFIX = @as(u32, 1); pub const CAC_RANDOM = @as(u32, 2); pub const ASYNC_RECO_INTERRUPTED = @as(u32, 1); pub const ASYNC_RECO_PROCESS_FAILED = @as(u32, 2); pub const ASYNC_RECO_ADDSTROKE_FAILED = @as(u32, 4); pub const ASYNC_RECO_SETCACMODE_FAILED = @as(u32, 8); pub const ASYNC_RECO_RESETCONTEXT_FAILED = @as(u32, 16); pub const ASYNC_RECO_SETGUIDE_FAILED = @as(u32, 32); pub const ASYNC_RECO_SETFLAGS_FAILED = @as(u32, 64); pub const ASYNC_RECO_SETFACTOID_FAILED = @as(u32, 128); pub const ASYNC_RECO_SETTEXTCONTEXT_FAILED = @as(u32, 256); pub const ASYNC_RECO_SETWORDLIST_FAILED = @as(u32, 512); pub const RF_DONTCARE = @as(i32, 1); pub const RF_OBJECT = @as(i32, 2); pub const RF_FREE_INPUT = @as(i32, 4); pub const RF_LINED_INPUT = @as(i32, 8); pub const RF_BOXED_INPUT = @as(i32, 16); pub const RF_CAC_INPUT = @as(i32, 32); pub const RF_RIGHT_AND_DOWN = @as(i32, 64); pub const RF_LEFT_AND_DOWN = @as(i32, 128); pub const RF_DOWN_AND_LEFT = @as(i32, 256); pub const RF_DOWN_AND_RIGHT = @as(i32, 512); pub const RF_ARBITRARY_ANGLE = @as(i32, 1024); pub const RF_LATTICE = @as(i32, 2048); pub const RF_ADVISEINKCHANGE = @as(i32, 4096); pub const RF_STROKEREORDER = @as(i32, 8192); pub const RF_PERSONALIZABLE = @as(i32, 16384); pub const RF_PERFORMSLINEBREAKING = @as(i32, 65536); pub const RF_REQUIRESSEGMENTATIONBREAKING = @as(i32, 131072); pub const FLICK_WM_HANDLED_MASK = @as(u32, 1); pub const NUM_FLICK_DIRECTIONS = @as(u32, 8); pub const WM_TABLET_DEFBASE = @as(u32, 704); pub const WM_TABLET_MAXOFFSET = @as(u32, 32); pub const WM_TABLET_ADDED = @as(u32, 712); pub const WM_TABLET_DELETED = @as(u32, 713); pub const WM_TABLET_FLICK = @as(u32, 715); pub const WM_TABLET_QUERYSYSTEMGESTURESTATUS = @as(u32, 716); pub const TABLET_DISABLE_PRESSANDHOLD = @as(u32, 1); pub const TABLET_DISABLE_PENTAPFEEDBACK = @as(u32, 8); pub const TABLET_DISABLE_PENBARRELFEEDBACK = @as(u32, 16); pub const TABLET_DISABLE_TOUCHUIFORCEON = @as(u32, 256); pub const TABLET_DISABLE_TOUCHUIFORCEOFF = @as(u32, 512); pub const TABLET_DISABLE_TOUCHSWITCH = @as(u32, 32768); pub const TABLET_DISABLE_FLICKS = @as(u32, 65536); pub const TABLET_ENABLE_FLICKSONCONTEXT = @as(u32, 131072); pub const TABLET_ENABLE_FLICKLEARNINGMODE = @as(u32, 262144); pub const TABLET_DISABLE_SMOOTHSCROLLING = @as(u32, 524288); pub const TABLET_DISABLE_FLICKFALLBACKKEYS = @as(u32, 1048576); pub const TABLET_ENABLE_MULTITOUCHDATA = @as(u32, 16777216); pub const MAX_PACKET_PROPERTY_COUNT = @as(u32, 32); pub const MAX_PACKET_BUTTON_COUNT = @as(u32, 32); pub const IP_CURSOR_DOWN = @as(u32, 1); pub const IP_INVERTED = @as(u32, 2); pub const IP_MARGIN = @as(u32, 4); pub const IEC__BASE = @as(u32, 1536); pub const EM_GETINKMODE = @as(u32, 1537); pub const EM_SETINKMODE = @as(u32, 1538); pub const EM_GETINKINSERTMODE = @as(u32, 1539); pub const EM_SETINKINSERTMODE = @as(u32, 1540); pub const EM_GETDRAWATTR = @as(u32, 1541); pub const EM_SETDRAWATTR = @as(u32, 1542); pub const EM_GETRECOTIMEOUT = @as(u32, 1543); pub const EM_SETRECOTIMEOUT = @as(u32, 1544); pub const EM_GETGESTURESTATUS = @as(u32, 1545); pub const EM_SETGESTURESTATUS = @as(u32, 1546); pub const EM_GETRECOGNIZER = @as(u32, 1547); pub const EM_SETRECOGNIZER = @as(u32, 1548); pub const EM_GETFACTOID = @as(u32, 1549); pub const EM_SETFACTOID = @as(u32, 1550); pub const EM_GETSELINK = @as(u32, 1551); pub const EM_SETSELINK = @as(u32, 1552); pub const EM_GETMOUSEICON = @as(u32, 1553); pub const EM_SETMOUSEICON = @as(u32, 1554); pub const EM_GETMOUSEPOINTER = @as(u32, 1555); pub const EM_SETMOUSEPOINTER = @as(u32, 1556); pub const EM_GETSTATUS = @as(u32, 1557); pub const EM_RECOGNIZE = @as(u32, 1558); pub const EM_GETUSEMOUSEFORINPUT = @as(u32, 1559); pub const EM_SETUSEMOUSEFORINPUT = @as(u32, 1560); pub const EM_SETSELINKDISPLAYMODE = @as(u32, 1561); pub const EM_GETSELINKDISPLAYMODE = @as(u32, 1562); pub const IECN__BASE = @as(u32, 2048); pub const IECN_STROKE = @as(u32, 2049); pub const IECN_GESTURE = @as(u32, 2050); pub const IECN_RECOGNITIONRESULT = @as(u32, 2051); pub const RECOFLAG_WORDMODE = @as(u32, 1); pub const RECOFLAG_COERCE = @as(u32, 2); pub const RECOFLAG_SINGLESEG = @as(u32, 4); pub const RECOFLAG_PREFIXOK = @as(u32, 8); pub const RECOFLAG_LINEMODE = @as(u32, 16); pub const RECOFLAG_DISABLEPERSONALIZATION = @as(u32, 32); pub const RECOFLAG_AUTOSPACE = @as(u32, 64); pub const RECOCONF_LOWCONFIDENCE = @as(i32, -1); pub const RECOCONF_MEDIUMCONFIDENCE = @as(u32, 0); pub const RECOCONF_HIGHCONFIDENCE = @as(u32, 1); pub const RECOCONF_NOTSET = @as(u32, 128); pub const GESTURE_NULL = @as(u32, 61440); pub const GESTURE_SCRATCHOUT = @as(u32, 61441); pub const GESTURE_TRIANGLE = @as(u32, 61442); pub const GESTURE_SQUARE = @as(u32, 61443); pub const GESTURE_STAR = @as(u32, 61444); pub const GESTURE_CHECK = @as(u32, 61445); pub const GESTURE_INFINITY = @as(u32, 61446); pub const GESTURE_CROSS = @as(u32, 61447); pub const GESTURE_PARAGRAPH = @as(u32, 61448); pub const GESTURE_SECTION = @as(u32, 61449); pub const GESTURE_BULLET = @as(u32, 61450); pub const GESTURE_BULLET_CROSS = @as(u32, 61451); pub const GESTURE_SQUIGGLE = @as(u32, 61452); pub const GESTURE_SWAP = @as(u32, 61453); pub const GESTURE_OPENUP = @as(u32, 61454); pub const GESTURE_CLOSEUP = @as(u32, 61455); pub const GESTURE_CURLICUE = @as(u32, 61456); pub const GESTURE_DOUBLE_CURLICUE = @as(u32, 61457); pub const GESTURE_RECTANGLE = @as(u32, 61458); pub const GESTURE_CIRCLE = @as(u32, 61472); pub const GESTURE_DOUBLE_CIRCLE = @as(u32, 61473); pub const GESTURE_CIRCLE_TAP = @as(u32, 61474); pub const GESTURE_CIRCLE_CIRCLE = @as(u32, 61475); pub const GESTURE_CIRCLE_CROSS = @as(u32, 61477); pub const GESTURE_CIRCLE_LINE_VERT = @as(u32, 61478); pub const GESTURE_CIRCLE_LINE_HORZ = @as(u32, 61479); pub const GESTURE_SEMICIRCLE_LEFT = @as(u32, 61480); pub const GESTURE_SEMICIRCLE_RIGHT = @as(u32, 61481); pub const GESTURE_CHEVRON_UP = @as(u32, 61488); pub const GESTURE_CHEVRON_DOWN = @as(u32, 61489); pub const GESTURE_CHEVRON_LEFT = @as(u32, 61490); pub const GESTURE_CHEVRON_RIGHT = @as(u32, 61491); pub const GESTURE_ARROW_UP = @as(u32, 61496); pub const GESTURE_ARROW_DOWN = @as(u32, 61497); pub const GESTURE_ARROW_LEFT = @as(u32, 61498); pub const GESTURE_ARROW_RIGHT = @as(u32, 61499); pub const GESTURE_DOUBLE_ARROW_UP = @as(u32, 61500); pub const GESTURE_DOUBLE_ARROW_DOWN = @as(u32, 61501); pub const GESTURE_DOUBLE_ARROW_LEFT = @as(u32, 61502); pub const GESTURE_DOUBLE_ARROW_RIGHT = @as(u32, 61503); pub const GESTURE_UP_ARROW_LEFT = @as(u32, 61504); pub const GESTURE_UP_ARROW_RIGHT = @as(u32, 61505); pub const GESTURE_DOWN_ARROW_LEFT = @as(u32, 61506); pub const GESTURE_DOWN_ARROW_RIGHT = @as(u32, 61507); pub const GESTURE_LEFT_ARROW_UP = @as(u32, 61508); pub const GESTURE_LEFT_ARROW_DOWN = @as(u32, 61509); pub const GESTURE_RIGHT_ARROW_UP = @as(u32, 61510); pub const GESTURE_RIGHT_ARROW_DOWN = @as(u32, 61511); pub const GESTURE_UP = @as(u32, 61528); pub const GESTURE_DOWN = @as(u32, 61529); pub const GESTURE_LEFT = @as(u32, 61530); pub const GESTURE_RIGHT = @as(u32, 61531); pub const GESTURE_DIAGONAL_LEFTUP = @as(u32, 61532); pub const GESTURE_DIAGONAL_RIGHTUP = @as(u32, 61533); pub const GESTURE_DIAGONAL_LEFTDOWN = @as(u32, 61534); pub const GESTURE_DIAGONAL_RIGHTDOWN = @as(u32, 61535); pub const GESTURE_UP_DOWN = @as(u32, 61536); pub const GESTURE_DOWN_UP = @as(u32, 61537); pub const GESTURE_LEFT_RIGHT = @as(u32, 61538); pub const GESTURE_RIGHT_LEFT = @as(u32, 61539); pub const GESTURE_UP_LEFT_LONG = @as(u32, 61540); pub const GESTURE_UP_RIGHT_LONG = @as(u32, 61541); pub const GESTURE_DOWN_LEFT_LONG = @as(u32, 61542); pub const GESTURE_DOWN_RIGHT_LONG = @as(u32, 61543); pub const GESTURE_UP_LEFT = @as(u32, 61544); pub const GESTURE_UP_RIGHT = @as(u32, 61545); pub const GESTURE_DOWN_LEFT = @as(u32, 61546); pub const GESTURE_DOWN_RIGHT = @as(u32, 61547); pub const GESTURE_LEFT_UP = @as(u32, 61548); pub const GESTURE_LEFT_DOWN = @as(u32, 61549); pub const GESTURE_RIGHT_UP = @as(u32, 61550); pub const GESTURE_RIGHT_DOWN = @as(u32, 61551); pub const GESTURE_LETTER_A = @as(u32, 61568); pub const GESTURE_LETTER_B = @as(u32, 61569); pub const GESTURE_LETTER_C = @as(u32, 61570); pub const GESTURE_LETTER_D = @as(u32, 61571); pub const GESTURE_LETTER_E = @as(u32, 61572); pub const GESTURE_LETTER_F = @as(u32, 61573); pub const GESTURE_LETTER_G = @as(u32, 61574); pub const GESTURE_LETTER_H = @as(u32, 61575); pub const GESTURE_LETTER_I = @as(u32, 61576); pub const GESTURE_LETTER_J = @as(u32, 61577); pub const GESTURE_LETTER_K = @as(u32, 61578); pub const GESTURE_LETTER_L = @as(u32, 61579); pub const GESTURE_LETTER_M = @as(u32, 61580); pub const GESTURE_LETTER_N = @as(u32, 61581); pub const GESTURE_LETTER_O = @as(u32, 61582); pub const GESTURE_LETTER_P = @as(u32, 61583); pub const GESTURE_LETTER_Q = @as(u32, 61584); pub const GESTURE_LETTER_R = @as(u32, 61585); pub const GESTURE_LETTER_S = @as(u32, 61586); pub const GESTURE_LETTER_T = @as(u32, 61587); pub const GESTURE_LETTER_U = @as(u32, 61588); pub const GESTURE_LETTER_V = @as(u32, 61589); pub const GESTURE_LETTER_W = @as(u32, 61590); pub const GESTURE_LETTER_X = @as(u32, 61591); pub const GESTURE_LETTER_Y = @as(u32, 61592); pub const GESTURE_LETTER_Z = @as(u32, 61593); pub const GESTURE_DIGIT_0 = @as(u32, 61594); pub const GESTURE_DIGIT_1 = @as(u32, 61595); pub const GESTURE_DIGIT_2 = @as(u32, 61596); pub const GESTURE_DIGIT_3 = @as(u32, 61597); pub const GESTURE_DIGIT_4 = @as(u32, 61598); pub const GESTURE_DIGIT_5 = @as(u32, 61599); pub const GESTURE_DIGIT_6 = @as(u32, 61600); pub const GESTURE_DIGIT_7 = @as(u32, 61601); pub const GESTURE_DIGIT_8 = @as(u32, 61602); pub const GESTURE_DIGIT_9 = @as(u32, 61603); pub const GESTURE_EXCLAMATION = @as(u32, 61604); pub const GESTURE_QUESTION = @as(u32, 61605); pub const GESTURE_SHARP = @as(u32, 61606); pub const GESTURE_DOLLAR = @as(u32, 61607); pub const GESTURE_ASTERISK = @as(u32, 61608); pub const GESTURE_PLUS = @as(u32, 61609); pub const GESTURE_DOUBLE_UP = @as(u32, 61624); pub const GESTURE_DOUBLE_DOWN = @as(u32, 61625); pub const GESTURE_DOUBLE_LEFT = @as(u32, 61626); pub const GESTURE_DOUBLE_RIGHT = @as(u32, 61627); pub const GESTURE_TRIPLE_UP = @as(u32, 61628); pub const GESTURE_TRIPLE_DOWN = @as(u32, 61629); pub const GESTURE_TRIPLE_LEFT = @as(u32, 61630); pub const GESTURE_TRIPLE_RIGHT = @as(u32, 61631); pub const GESTURE_BRACKET_OVER = @as(u32, 61668); pub const GESTURE_BRACKET_UNDER = @as(u32, 61669); pub const GESTURE_BRACKET_LEFT = @as(u32, 61670); pub const GESTURE_BRACKET_RIGHT = @as(u32, 61671); pub const GESTURE_BRACE_OVER = @as(u32, 61672); pub const GESTURE_BRACE_UNDER = @as(u32, 61673); pub const GESTURE_BRACE_LEFT = @as(u32, 61674); pub const GESTURE_BRACE_RIGHT = @as(u32, 61675); pub const GESTURE_TAP = @as(u32, 61680); pub const GESTURE_DOUBLE_TAP = @as(u32, 61681); pub const GESTURE_TRIPLE_TAP = @as(u32, 61682); pub const GESTURE_QUAD_TAP = @as(u32, 61683); pub const FACILITY_INK = @as(u32, 40); pub const GUID_PACKETPROPERTY_GUID_X = Guid.initString("598a6a8f-52c0-4ba0-93af-af357411a561"); pub const GUID_PACKETPROPERTY_GUID_Y = Guid.initString("b53f9f75-04e0-4498-a7ee-c30dbb5a9011"); pub const GUID_PACKETPROPERTY_GUID_Z = Guid.initString("735adb30-0ebb-4788-a0e4-0f316490055d"); pub const GUID_PACKETPROPERTY_GUID_PACKET_STATUS = Guid.initString("6e0e07bf-afe7-4cf7-87d1-af6446208418"); pub const GUID_PACKETPROPERTY_GUID_TIMER_TICK = Guid.initString("436510c5-fed3-45d1-8b76-71d3ea7a829d"); pub const GUID_PACKETPROPERTY_GUID_SERIAL_NUMBER = Guid.initString("78a81b56-0935-4493-baae-00541a8a16c4"); pub const GUID_PACKETPROPERTY_GUID_NORMAL_PRESSURE = Guid.initString("7307502d-f9f4-4e18-b3f2-2ce1b1a3610c"); pub const GUID_PACKETPROPERTY_GUID_TANGENT_PRESSURE = Guid.initString("6da4488b-5244-41ec-905b-32d89ab80809"); pub const GUID_PACKETPROPERTY_GUID_BUTTON_PRESSURE = Guid.initString("8b7fefc4-96aa-4bfe-ac26-8a5f0be07bf5"); pub const GUID_PACKETPROPERTY_GUID_X_TILT_ORIENTATION = Guid.initString("a8d07b3a-8bf0-40b0-95a9-b80a6bb787bf"); pub const GUID_PACKETPROPERTY_GUID_Y_TILT_ORIENTATION = Guid.initString("0e932389-1d77-43af-ac00-5b950d6d4b2d"); pub const GUID_PACKETPROPERTY_GUID_AZIMUTH_ORIENTATION = Guid.initString("029123b4-8828-410b-b250-a0536595e5dc"); pub const GUID_PACKETPROPERTY_GUID_ALTITUDE_ORIENTATION = Guid.initString("82dec5c7-f6ba-4906-894f-66d68dfc456c"); pub const GUID_PACKETPROPERTY_GUID_TWIST_ORIENTATION = Guid.initString("0d324960-13b2-41e4-ace6-7ae9d43d2d3b"); pub const GUID_PACKETPROPERTY_GUID_PITCH_ROTATION = Guid.initString("7f7e57b7-be37-4be1-a356-7a84160e1893"); pub const GUID_PACKETPROPERTY_GUID_ROLL_ROTATION = Guid.initString("5d5d5e56-6ba9-4c5b-9fb0-851c91714e56"); pub const GUID_PACKETPROPERTY_GUID_YAW_ROTATION = Guid.initString("6a849980-7c3a-45b7-aa82-90a262950e89"); pub const GUID_PACKETPROPERTY_GUID_WIDTH = Guid.initString("baabe94d-2712-48f5-be9d-8f8b5ea0711a"); pub const GUID_PACKETPROPERTY_GUID_HEIGHT = Guid.initString("e61858d2-e447-4218-9d3f-18865c203df4"); pub const GUID_PACKETPROPERTY_GUID_FINGERCONTACTCONFIDENCE = Guid.initString("e706c804-57f0-4f00-8a0c-853d57789be9"); pub const GUID_PACKETPROPERTY_GUID_DEVICE_CONTACT_ID = Guid.initString("02585b91-049b-4750-9615-df8948ab3c9c"); pub const InkMinTransparencyValue = @as(i32, 0); pub const InkMaxTransparencyValue = @as(i32, 255); pub const InkCollectorClipInkToMargin = @as(i32, 0); pub const InkCollectorDefaultMargin = @as(i32, -2147483648); pub const GUID_GESTURE_DATA = Guid.initString("41e4ec0f-26aa-455a-9aa5-2cd36cf63fb9"); pub const GUID_DYNAMIC_RENDERER_CACHED_DATA = Guid.initString("bf531b92-25bf-4a95-89ad-0e476b34b4f5"); //-------------------------------------------------------------------------------- // Section: Types (240) //-------------------------------------------------------------------------------- pub const PfnRecoCallback = fn( param0: u32, param1: ?*u8, param2: ?HRECOCONTEXT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const HRECOALT = *opaque{}; pub const HRECOCONTEXT = *opaque{}; pub const HRECOGNIZER = *opaque{}; pub const HRECOLATTICE = *opaque{}; pub const HRECOWORDLIST = *opaque{}; const CLSID_InkDisp_Value = @import("../zig.zig").Guid.initString("937c1a34-151d-4610-9ca6-a8cc9bdb5d83"); pub const CLSID_InkDisp = &CLSID_InkDisp_Value; const CLSID_InkOverlay_Value = @import("../zig.zig").Guid.initString("65d00646-cde3-4a88-9163-6769f0f1a97d"); pub const CLSID_InkOverlay = &CLSID_InkOverlay_Value; const CLSID_InkPicture_Value = @import("../zig.zig").Guid.initString("04a1e553-fe36-4fde-865e-344194e69424"); pub const CLSID_InkPicture = &CLSID_InkPicture_Value; const CLSID_InkCollector_Value = @import("../zig.zig").Guid.initString("43fb1553-ad74-4ee8-88e4-3e6daac915db"); pub const CLSID_InkCollector = &CLSID_InkCollector_Value; const CLSID_InkDrawingAttributes_Value = @import("../zig.zig").Guid.initString("d8bf32a2-05a5-44c3-b3aa-5e80ac7d2576"); pub const CLSID_InkDrawingAttributes = &CLSID_InkDrawingAttributes_Value; const CLSID_InkRectangle_Value = @import("../zig.zig").Guid.initString("43b07326-aae0-4b62-a83d-5fd768b7353c"); pub const CLSID_InkRectangle = &CLSID_InkRectangle_Value; const CLSID_InkRenderer_Value = @import("../zig.zig").Guid.initString("9c1cc6e4-d7eb-4eeb-9091-15a7c8791ed9"); pub const CLSID_InkRenderer = &CLSID_InkRenderer_Value; const CLSID_InkTransform_Value = @import("../zig.zig").Guid.initString("e3d5d93c-1663-4a78-a1a7-22375dfebaee"); pub const CLSID_InkTransform = &CLSID_InkTransform_Value; const CLSID_InkRecognizers_Value = @import("../zig.zig").Guid.initString("9fd4e808-f6e6-4e65-98d3-aa39054c1255"); pub const CLSID_InkRecognizers = &CLSID_InkRecognizers_Value; const CLSID_InkRecognizerContext_Value = @import("../zig.zig").Guid.initString("aac46a37-9229-4fc0-8cce-4497569bf4d1"); pub const CLSID_InkRecognizerContext = &CLSID_InkRecognizerContext_Value; const CLSID_InkRecognizerGuide_Value = @import("../zig.zig").Guid.initString("8770d941-a63a-4671-a375-2855a18eba73"); pub const CLSID_InkRecognizerGuide = &CLSID_InkRecognizerGuide_Value; const CLSID_InkTablets_Value = @import("../zig.zig").Guid.initString("6e4fcb12-510a-4d40-9304-1da10ae9147c"); pub const CLSID_InkTablets = &CLSID_InkTablets_Value; const CLSID_InkWordList_Value = @import("../zig.zig").Guid.initString("9de85094-f71f-44f1-8471-15a2fa76fcf3"); pub const CLSID_InkWordList = &CLSID_InkWordList_Value; const CLSID_InkStrokes_Value = @import("../zig.zig").Guid.initString("48f491bc-240e-4860-b079-a1e94d3d2c86"); pub const CLSID_InkStrokes = &CLSID_InkStrokes_Value; const CLSID_Ink_Value = @import("../zig.zig").Guid.initString("13de4a42-8d21-4c8e-bf9c-8f69cb068fca"); pub const CLSID_Ink = &CLSID_Ink_Value; const CLSID_SketchInk_Value = @import("../zig.zig").Guid.initString("f0291081-e87c-4e07-97da-a0a03761e586"); pub const CLSID_SketchInk = &CLSID_SketchInk_Value; pub const PROPERTY_UNITS = enum(i32) { DEFAULT = 0, INCHES = 1, CENTIMETERS = 2, DEGREES = 3, RADIANS = 4, SECONDS = 5, POUNDS = 6, GRAMS = 7, SILINEAR = 8, SIROTATION = 9, ENGLINEAR = 10, ENGROTATION = 11, SLUGS = 12, KELVIN = 13, FAHRENHEIT = 14, AMPERE = 15, CANDELA = 16, }; pub const PROPERTY_UNITS_DEFAULT = PROPERTY_UNITS.DEFAULT; pub const PROPERTY_UNITS_INCHES = PROPERTY_UNITS.INCHES; pub const PROPERTY_UNITS_CENTIMETERS = PROPERTY_UNITS.CENTIMETERS; pub const PROPERTY_UNITS_DEGREES = PROPERTY_UNITS.DEGREES; pub const PROPERTY_UNITS_RADIANS = PROPERTY_UNITS.RADIANS; pub const PROPERTY_UNITS_SECONDS = PROPERTY_UNITS.SECONDS; pub const PROPERTY_UNITS_POUNDS = PROPERTY_UNITS.POUNDS; pub const PROPERTY_UNITS_GRAMS = PROPERTY_UNITS.GRAMS; pub const PROPERTY_UNITS_SILINEAR = PROPERTY_UNITS.SILINEAR; pub const PROPERTY_UNITS_SIROTATION = PROPERTY_UNITS.SIROTATION; pub const PROPERTY_UNITS_ENGLINEAR = PROPERTY_UNITS.ENGLINEAR; pub const PROPERTY_UNITS_ENGROTATION = PROPERTY_UNITS.ENGROTATION; pub const PROPERTY_UNITS_SLUGS = PROPERTY_UNITS.SLUGS; pub const PROPERTY_UNITS_KELVIN = PROPERTY_UNITS.KELVIN; pub const PROPERTY_UNITS_FAHRENHEIT = PROPERTY_UNITS.FAHRENHEIT; pub const PROPERTY_UNITS_AMPERE = PROPERTY_UNITS.AMPERE; pub const PROPERTY_UNITS_CANDELA = PROPERTY_UNITS.CANDELA; pub const SYSTEM_EVENT_DATA = extern struct { bModifier: u8, wKey: u16, xPos: i32, yPos: i32, bCursorMode: u8, dwButtonState: u32, }; pub const STROKE_RANGE = extern struct { iStrokeBegin: u32, iStrokeEnd: u32, }; pub const PROPERTY_METRICS = extern struct { nLogicalMin: i32, nLogicalMax: i32, Units: PROPERTY_UNITS, fResolution: f32, }; pub const PACKET_PROPERTY = extern struct { guid: Guid, PropertyMetrics: PROPERTY_METRICS, }; pub const PACKET_DESCRIPTION = extern struct { cbPacketSize: u32, cPacketProperties: u32, pPacketProperties: ?*PACKET_PROPERTY, cButtons: u32, pguidButtons: ?*Guid, }; pub const enumINKMETRIC_FLAGS = enum(i32) { FONT_SELECTED_IN_HDC = 1, ITALIC = 2, BOLD = 4, }; pub const IMF_FONT_SELECTED_IN_HDC = enumINKMETRIC_FLAGS.FONT_SELECTED_IN_HDC; pub const IMF_ITALIC = enumINKMETRIC_FLAGS.ITALIC; pub const IMF_BOLD = enumINKMETRIC_FLAGS.BOLD; pub const enumGetCandidateFlags = enum(i32) { ALLOW_RECOGNITION = 1, FORCE_RECOGNITION = 2, }; pub const TCF_ALLOW_RECOGNITION = enumGetCandidateFlags.ALLOW_RECOGNITION; pub const TCF_FORCE_RECOGNITION = enumGetCandidateFlags.FORCE_RECOGNITION; pub const INKMETRIC = extern struct { iHeight: i32, iFontAscent: i32, iFontDescent: i32, dwFlags: u32, color: u32, }; pub const InkSelectionConstants = enum(i32) { FirstElement = 0, AllElements = -1, }; pub const ISC_FirstElement = InkSelectionConstants.FirstElement; pub const ISC_AllElements = InkSelectionConstants.AllElements; pub const InkBoundingBoxMode = enum(i32) { Default = 0, NoCurveFit = 1, CurveFit = 2, PointsOnly = 3, Union = 4, }; pub const IBBM_Default = InkBoundingBoxMode.Default; pub const IBBM_NoCurveFit = InkBoundingBoxMode.NoCurveFit; pub const IBBM_CurveFit = InkBoundingBoxMode.CurveFit; pub const IBBM_PointsOnly = InkBoundingBoxMode.PointsOnly; pub const IBBM_Union = InkBoundingBoxMode.Union; pub const InkExtractFlags = enum(i32) { CopyFromOriginal = 0, RemoveFromOriginal = 1, // Default = 1, this enum value conflicts with RemoveFromOriginal }; pub const IEF_CopyFromOriginal = InkExtractFlags.CopyFromOriginal; pub const IEF_RemoveFromOriginal = InkExtractFlags.RemoveFromOriginal; pub const IEF_Default = InkExtractFlags.RemoveFromOriginal; pub const InkPersistenceFormat = enum(i32) { InkSerializedFormat = 0, Base64InkSerializedFormat = 1, GIF = 2, Base64GIF = 3, }; pub const IPF_InkSerializedFormat = InkPersistenceFormat.InkSerializedFormat; pub const IPF_Base64InkSerializedFormat = InkPersistenceFormat.Base64InkSerializedFormat; pub const IPF_GIF = InkPersistenceFormat.GIF; pub const IPF_Base64GIF = InkPersistenceFormat.Base64GIF; pub const InkPersistenceCompressionMode = enum(i32) { Default = 0, MaximumCompression = 1, NoCompression = 2, }; pub const IPCM_Default = InkPersistenceCompressionMode.Default; pub const IPCM_MaximumCompression = InkPersistenceCompressionMode.MaximumCompression; pub const IPCM_NoCompression = InkPersistenceCompressionMode.NoCompression; pub const InkPenTip = enum(i32) { Ball = 0, Rectangle = 1, }; pub const IPT_Ball = InkPenTip.Ball; pub const IPT_Rectangle = InkPenTip.Rectangle; pub const InkRasterOperation = enum(i32) { Black = 1, NotMergePen = 2, MaskNotPen = 3, NotCopyPen = 4, MaskPenNot = 5, Not = 6, XOrPen = 7, NotMaskPen = 8, MaskPen = 9, NotXOrPen = 10, NoOperation = 11, MergeNotPen = 12, CopyPen = 13, MergePenNot = 14, MergePen = 15, White = 16, }; pub const IRO_Black = InkRasterOperation.Black; pub const IRO_NotMergePen = InkRasterOperation.NotMergePen; pub const IRO_MaskNotPen = InkRasterOperation.MaskNotPen; pub const IRO_NotCopyPen = InkRasterOperation.NotCopyPen; pub const IRO_MaskPenNot = InkRasterOperation.MaskPenNot; pub const IRO_Not = InkRasterOperation.Not; pub const IRO_XOrPen = InkRasterOperation.XOrPen; pub const IRO_NotMaskPen = InkRasterOperation.NotMaskPen; pub const IRO_MaskPen = InkRasterOperation.MaskPen; pub const IRO_NotXOrPen = InkRasterOperation.NotXOrPen; pub const IRO_NoOperation = InkRasterOperation.NoOperation; pub const IRO_MergeNotPen = InkRasterOperation.MergeNotPen; pub const IRO_CopyPen = InkRasterOperation.CopyPen; pub const IRO_MergePenNot = InkRasterOperation.MergePenNot; pub const IRO_MergePen = InkRasterOperation.MergePen; pub const IRO_White = InkRasterOperation.White; pub const InkMousePointer = enum(i32) { Default = 0, Arrow = 1, Crosshair = 2, Ibeam = 3, SizeNESW = 4, SizeNS = 5, SizeNWSE = 6, SizeWE = 7, UpArrow = 8, Hourglass = 9, NoDrop = 10, ArrowHourglass = 11, ArrowQuestion = 12, SizeAll = 13, Hand = 14, Custom = 99, }; pub const IMP_Default = InkMousePointer.Default; pub const IMP_Arrow = InkMousePointer.Arrow; pub const IMP_Crosshair = InkMousePointer.Crosshair; pub const IMP_Ibeam = InkMousePointer.Ibeam; pub const IMP_SizeNESW = InkMousePointer.SizeNESW; pub const IMP_SizeNS = InkMousePointer.SizeNS; pub const IMP_SizeNWSE = InkMousePointer.SizeNWSE; pub const IMP_SizeWE = InkMousePointer.SizeWE; pub const IMP_UpArrow = InkMousePointer.UpArrow; pub const IMP_Hourglass = InkMousePointer.Hourglass; pub const IMP_NoDrop = InkMousePointer.NoDrop; pub const IMP_ArrowHourglass = InkMousePointer.ArrowHourglass; pub const IMP_ArrowQuestion = InkMousePointer.ArrowQuestion; pub const IMP_SizeAll = InkMousePointer.SizeAll; pub const IMP_Hand = InkMousePointer.Hand; pub const IMP_Custom = InkMousePointer.Custom; pub const InkClipboardModes = enum(i32) { Copy = 0, Cut = 1, ExtractOnly = 48, DelayedCopy = 32, // Default = 0, this enum value conflicts with Copy }; pub const ICB_Copy = InkClipboardModes.Copy; pub const ICB_Cut = InkClipboardModes.Cut; pub const ICB_ExtractOnly = InkClipboardModes.ExtractOnly; pub const ICB_DelayedCopy = InkClipboardModes.DelayedCopy; pub const ICB_Default = InkClipboardModes.Copy; pub const InkClipboardFormats = enum(i32) { None = 0, InkSerializedFormat = 1, SketchInk = 2, TextInk = 6, EnhancedMetafile = 8, Metafile = 32, Bitmap = 64, PasteMask = 7, CopyMask = 127, // Default = 127, this enum value conflicts with CopyMask }; pub const ICF_None = InkClipboardFormats.None; pub const ICF_InkSerializedFormat = InkClipboardFormats.InkSerializedFormat; pub const ICF_SketchInk = InkClipboardFormats.SketchInk; pub const ICF_TextInk = InkClipboardFormats.TextInk; pub const ICF_EnhancedMetafile = InkClipboardFormats.EnhancedMetafile; pub const ICF_Metafile = InkClipboardFormats.Metafile; pub const ICF_Bitmap = InkClipboardFormats.Bitmap; pub const ICF_PasteMask = InkClipboardFormats.PasteMask; pub const ICF_CopyMask = InkClipboardFormats.CopyMask; pub const ICF_Default = InkClipboardFormats.CopyMask; pub const SelectionHitResult = enum(i32) { None = 0, NW = 1, SE = 2, NE = 3, SW = 4, E = 5, W = 6, N = 7, S = 8, Selection = 9, }; pub const SHR_None = SelectionHitResult.None; pub const SHR_NW = SelectionHitResult.NW; pub const SHR_SE = SelectionHitResult.SE; pub const SHR_NE = SelectionHitResult.NE; pub const SHR_SW = SelectionHitResult.SW; pub const SHR_E = SelectionHitResult.E; pub const SHR_W = SelectionHitResult.W; pub const SHR_N = SelectionHitResult.N; pub const SHR_S = SelectionHitResult.S; pub const SHR_Selection = SelectionHitResult.Selection; pub const InkRecognitionStatus = enum(i32) { NoError = 0, Interrupted = 1, ProcessFailed = 2, InkAddedFailed = 4, SetAutoCompletionModeFailed = 8, SetStrokesFailed = 16, SetGuideFailed = 32, SetFlagsFailed = 64, SetFactoidFailed = 128, SetPrefixSuffixFailed = 256, SetWordListFailed = 512, }; pub const IRS_NoError = InkRecognitionStatus.NoError; pub const IRS_Interrupted = InkRecognitionStatus.Interrupted; pub const IRS_ProcessFailed = InkRecognitionStatus.ProcessFailed; pub const IRS_InkAddedFailed = InkRecognitionStatus.InkAddedFailed; pub const IRS_SetAutoCompletionModeFailed = InkRecognitionStatus.SetAutoCompletionModeFailed; pub const IRS_SetStrokesFailed = InkRecognitionStatus.SetStrokesFailed; pub const IRS_SetGuideFailed = InkRecognitionStatus.SetGuideFailed; pub const IRS_SetFlagsFailed = InkRecognitionStatus.SetFlagsFailed; pub const IRS_SetFactoidFailed = InkRecognitionStatus.SetFactoidFailed; pub const IRS_SetPrefixSuffixFailed = InkRecognitionStatus.SetPrefixSuffixFailed; pub const IRS_SetWordListFailed = InkRecognitionStatus.SetWordListFailed; pub const DISPID_InkRectangle = enum(i32) { Top = 1, Left = 2, Bottom = 3, Right = 4, GetRectangle = 5, SetRectangle = 6, Data = 7, }; pub const DISPID_IRTop = DISPID_InkRectangle.Top; pub const DISPID_IRLeft = DISPID_InkRectangle.Left; pub const DISPID_IRBottom = DISPID_InkRectangle.Bottom; pub const DISPID_IRRight = DISPID_InkRectangle.Right; pub const DISPID_IRGetRectangle = DISPID_InkRectangle.GetRectangle; pub const DISPID_IRSetRectangle = DISPID_InkRectangle.SetRectangle; pub const DISPID_IRData = DISPID_InkRectangle.Data; pub const DISPID_InkExtendedProperty = enum(i32) { Guid = 1, Data = 2, }; pub const DISPID_IEPGuid = DISPID_InkExtendedProperty.Guid; pub const DISPID_IEPData = DISPID_InkExtendedProperty.Data; pub const DISPID_InkExtendedProperties = enum(i32) { _NewEnum = -4, Item = 0, Count = 1, Add = 2, Remove = 3, Clear = 4, DoesPropertyExist = 5, }; pub const DISPID_IEPs_NewEnum = DISPID_InkExtendedProperties._NewEnum; pub const DISPID_IEPsItem = DISPID_InkExtendedProperties.Item; pub const DISPID_IEPsCount = DISPID_InkExtendedProperties.Count; pub const DISPID_IEPsAdd = DISPID_InkExtendedProperties.Add; pub const DISPID_IEPsRemove = DISPID_InkExtendedProperties.Remove; pub const DISPID_IEPsClear = DISPID_InkExtendedProperties.Clear; pub const DISPID_IEPsDoesPropertyExist = DISPID_InkExtendedProperties.DoesPropertyExist; pub const DISPID_InkDrawingAttributes = enum(i32) { Height = 1, Color = 2, Width = 3, FitToCurve = 4, IgnorePressure = 5, AntiAliased = 6, Transparency = 7, RasterOperation = 8, PenTip = 9, Clone = 10, ExtendedProperties = 11, }; pub const DISPID_DAHeight = DISPID_InkDrawingAttributes.Height; pub const DISPID_DAColor = DISPID_InkDrawingAttributes.Color; pub const DISPID_DAWidth = DISPID_InkDrawingAttributes.Width; pub const DISPID_DAFitToCurve = DISPID_InkDrawingAttributes.FitToCurve; pub const DISPID_DAIgnorePressure = DISPID_InkDrawingAttributes.IgnorePressure; pub const DISPID_DAAntiAliased = DISPID_InkDrawingAttributes.AntiAliased; pub const DISPID_DATransparency = DISPID_InkDrawingAttributes.Transparency; pub const DISPID_DARasterOperation = DISPID_InkDrawingAttributes.RasterOperation; pub const DISPID_DAPenTip = DISPID_InkDrawingAttributes.PenTip; pub const DISPID_DAClone = DISPID_InkDrawingAttributes.Clone; pub const DISPID_DAExtendedProperties = DISPID_InkDrawingAttributes.ExtendedProperties; pub const DISPID_InkTransform = enum(i32) { Reset = 1, Translate = 2, Rotate = 3, Reflect = 4, Shear = 5, Scale = 6, eM11 = 7, eM12 = 8, eM21 = 9, eM22 = 10, eDx = 11, eDy = 12, GetTransform = 13, SetTransform = 14, Data = 15, }; pub const DISPID_ITReset = DISPID_InkTransform.Reset; pub const DISPID_ITTranslate = DISPID_InkTransform.Translate; pub const DISPID_ITRotate = DISPID_InkTransform.Rotate; pub const DISPID_ITReflect = DISPID_InkTransform.Reflect; pub const DISPID_ITShear = DISPID_InkTransform.Shear; pub const DISPID_ITScale = DISPID_InkTransform.Scale; pub const DISPID_ITeM11 = DISPID_InkTransform.eM11; pub const DISPID_ITeM12 = DISPID_InkTransform.eM12; pub const DISPID_ITeM21 = DISPID_InkTransform.eM21; pub const DISPID_ITeM22 = DISPID_InkTransform.eM22; pub const DISPID_ITeDx = DISPID_InkTransform.eDx; pub const DISPID_ITeDy = DISPID_InkTransform.eDy; pub const DISPID_ITGetTransform = DISPID_InkTransform.GetTransform; pub const DISPID_ITSetTransform = DISPID_InkTransform.SetTransform; pub const DISPID_ITData = DISPID_InkTransform.Data; pub const InkApplicationGesture = enum(i32) { AllGestures = 0, NoGesture = 61440, Scratchout = 61441, Triangle = 61442, Square = 61443, Star = 61444, Check = 61445, Curlicue = 61456, DoubleCurlicue = 61457, Circle = 61472, DoubleCircle = 61473, SemiCircleLeft = 61480, SemiCircleRight = 61481, ChevronUp = 61488, ChevronDown = 61489, ChevronLeft = 61490, ChevronRight = 61491, ArrowUp = 61496, ArrowDown = 61497, ArrowLeft = 61498, ArrowRight = 61499, Up = 61528, Down = 61529, Left = 61530, Right = 61531, UpDown = 61536, DownUp = 61537, LeftRight = 61538, RightLeft = 61539, UpLeftLong = 61540, UpRightLong = 61541, DownLeftLong = 61542, DownRightLong = 61543, UpLeft = 61544, UpRight = 61545, DownLeft = 61546, DownRight = 61547, LeftUp = 61548, LeftDown = 61549, RightUp = 61550, RightDown = 61551, Exclamation = 61604, Tap = 61680, DoubleTap = 61681, }; pub const IAG_AllGestures = InkApplicationGesture.AllGestures; pub const IAG_NoGesture = InkApplicationGesture.NoGesture; pub const IAG_Scratchout = InkApplicationGesture.Scratchout; pub const IAG_Triangle = InkApplicationGesture.Triangle; pub const IAG_Square = InkApplicationGesture.Square; pub const IAG_Star = InkApplicationGesture.Star; pub const IAG_Check = InkApplicationGesture.Check; pub const IAG_Curlicue = InkApplicationGesture.Curlicue; pub const IAG_DoubleCurlicue = InkApplicationGesture.DoubleCurlicue; pub const IAG_Circle = InkApplicationGesture.Circle; pub const IAG_DoubleCircle = InkApplicationGesture.DoubleCircle; pub const IAG_SemiCircleLeft = InkApplicationGesture.SemiCircleLeft; pub const IAG_SemiCircleRight = InkApplicationGesture.SemiCircleRight; pub const IAG_ChevronUp = InkApplicationGesture.ChevronUp; pub const IAG_ChevronDown = InkApplicationGesture.ChevronDown; pub const IAG_ChevronLeft = InkApplicationGesture.ChevronLeft; pub const IAG_ChevronRight = InkApplicationGesture.ChevronRight; pub const IAG_ArrowUp = InkApplicationGesture.ArrowUp; pub const IAG_ArrowDown = InkApplicationGesture.ArrowDown; pub const IAG_ArrowLeft = InkApplicationGesture.ArrowLeft; pub const IAG_ArrowRight = InkApplicationGesture.ArrowRight; pub const IAG_Up = InkApplicationGesture.Up; pub const IAG_Down = InkApplicationGesture.Down; pub const IAG_Left = InkApplicationGesture.Left; pub const IAG_Right = InkApplicationGesture.Right; pub const IAG_UpDown = InkApplicationGesture.UpDown; pub const IAG_DownUp = InkApplicationGesture.DownUp; pub const IAG_LeftRight = InkApplicationGesture.LeftRight; pub const IAG_RightLeft = InkApplicationGesture.RightLeft; pub const IAG_UpLeftLong = InkApplicationGesture.UpLeftLong; pub const IAG_UpRightLong = InkApplicationGesture.UpRightLong; pub const IAG_DownLeftLong = InkApplicationGesture.DownLeftLong; pub const IAG_DownRightLong = InkApplicationGesture.DownRightLong; pub const IAG_UpLeft = InkApplicationGesture.UpLeft; pub const IAG_UpRight = InkApplicationGesture.UpRight; pub const IAG_DownLeft = InkApplicationGesture.DownLeft; pub const IAG_DownRight = InkApplicationGesture.DownRight; pub const IAG_LeftUp = InkApplicationGesture.LeftUp; pub const IAG_LeftDown = InkApplicationGesture.LeftDown; pub const IAG_RightUp = InkApplicationGesture.RightUp; pub const IAG_RightDown = InkApplicationGesture.RightDown; pub const IAG_Exclamation = InkApplicationGesture.Exclamation; pub const IAG_Tap = InkApplicationGesture.Tap; pub const IAG_DoubleTap = InkApplicationGesture.DoubleTap; pub const InkSystemGesture = enum(i32) { Tap = 16, DoubleTap = 17, RightTap = 18, Drag = 19, RightDrag = 20, HoldEnter = 21, HoldLeave = 22, HoverEnter = 23, HoverLeave = 24, Flick = 31, }; pub const ISG_Tap = InkSystemGesture.Tap; pub const ISG_DoubleTap = InkSystemGesture.DoubleTap; pub const ISG_RightTap = InkSystemGesture.RightTap; pub const ISG_Drag = InkSystemGesture.Drag; pub const ISG_RightDrag = InkSystemGesture.RightDrag; pub const ISG_HoldEnter = InkSystemGesture.HoldEnter; pub const ISG_HoldLeave = InkSystemGesture.HoldLeave; pub const ISG_HoverEnter = InkSystemGesture.HoverEnter; pub const ISG_HoverLeave = InkSystemGesture.HoverLeave; pub const ISG_Flick = InkSystemGesture.Flick; pub const InkRecognitionConfidence = enum(i32) { Strong = 0, Intermediate = 1, Poor = 2, }; pub const IRC_Strong = InkRecognitionConfidence.Strong; pub const IRC_Intermediate = InkRecognitionConfidence.Intermediate; pub const IRC_Poor = InkRecognitionConfidence.Poor; pub const DISPID_InkGesture = enum(i32) { Id = 0, GetHotPoint = 1, Confidence = 2, }; pub const DISPID_IGId = DISPID_InkGesture.Id; pub const DISPID_IGGetHotPoint = DISPID_InkGesture.GetHotPoint; pub const DISPID_IGConfidence = DISPID_InkGesture.Confidence; pub const DISPID_InkCursor = enum(i32) { Name = 0, Id = 1, DrawingAttributes = 2, Buttons = 3, Inverted = 4, Tablet = 5, }; pub const DISPID_ICsrName = DISPID_InkCursor.Name; pub const DISPID_ICsrId = DISPID_InkCursor.Id; pub const DISPID_ICsrDrawingAttributes = DISPID_InkCursor.DrawingAttributes; pub const DISPID_ICsrButtons = DISPID_InkCursor.Buttons; pub const DISPID_ICsrInverted = DISPID_InkCursor.Inverted; pub const DISPID_ICsrTablet = DISPID_InkCursor.Tablet; pub const DISPID_InkCursors = enum(i32) { _NewEnum = -4, Item = 0, Count = 1, }; pub const DISPID_ICs_NewEnum = DISPID_InkCursors._NewEnum; pub const DISPID_ICsItem = DISPID_InkCursors.Item; pub const DISPID_ICsCount = DISPID_InkCursors.Count; pub const InkCursorButtonState = enum(i32) { Unavailable = 0, Up = 1, Down = 2, }; pub const ICBS_Unavailable = InkCursorButtonState.Unavailable; pub const ICBS_Up = InkCursorButtonState.Up; pub const ICBS_Down = InkCursorButtonState.Down; pub const DISPID_InkCursorButton = enum(i32) { Name = 0, Id = 1, State = 2, }; pub const DISPID_ICBName = DISPID_InkCursorButton.Name; pub const DISPID_ICBId = DISPID_InkCursorButton.Id; pub const DISPID_ICBState = DISPID_InkCursorButton.State; pub const DISPID_InkCursorButtons = enum(i32) { _NewEnum = -4, Item = 0, Count = 1, }; pub const DISPID_ICBs_NewEnum = DISPID_InkCursorButtons._NewEnum; pub const DISPID_ICBsItem = DISPID_InkCursorButtons.Item; pub const DISPID_ICBsCount = DISPID_InkCursorButtons.Count; pub const TabletHardwareCapabilities = enum(i32) { Integrated = 1, CursorMustTouch = 2, HardProximity = 4, CursorsHavePhysicalIds = 8, }; pub const THWC_Integrated = TabletHardwareCapabilities.Integrated; pub const THWC_CursorMustTouch = TabletHardwareCapabilities.CursorMustTouch; pub const THWC_HardProximity = TabletHardwareCapabilities.HardProximity; pub const THWC_CursorsHavePhysicalIds = TabletHardwareCapabilities.CursorsHavePhysicalIds; pub const TabletPropertyMetricUnit = enum(i32) { Default = 0, Inches = 1, Centimeters = 2, Degrees = 3, Radians = 4, Seconds = 5, Pounds = 6, Grams = 7, }; pub const TPMU_Default = TabletPropertyMetricUnit.Default; pub const TPMU_Inches = TabletPropertyMetricUnit.Inches; pub const TPMU_Centimeters = TabletPropertyMetricUnit.Centimeters; pub const TPMU_Degrees = TabletPropertyMetricUnit.Degrees; pub const TPMU_Radians = TabletPropertyMetricUnit.Radians; pub const TPMU_Seconds = TabletPropertyMetricUnit.Seconds; pub const TPMU_Pounds = TabletPropertyMetricUnit.Pounds; pub const TPMU_Grams = TabletPropertyMetricUnit.Grams; pub const DISPID_InkTablet = enum(i32) { Name = 0, PlugAndPlayId = 1, PropertyMetrics = 2, IsPacketPropertySupported = 3, MaximumInputRectangle = 4, HardwareCapabilities = 5, }; pub const DISPID_ITName = DISPID_InkTablet.Name; pub const DISPID_ITPlugAndPlayId = DISPID_InkTablet.PlugAndPlayId; pub const DISPID_ITPropertyMetrics = DISPID_InkTablet.PropertyMetrics; pub const DISPID_ITIsPacketPropertySupported = DISPID_InkTablet.IsPacketPropertySupported; pub const DISPID_ITMaximumInputRectangle = DISPID_InkTablet.MaximumInputRectangle; pub const DISPID_ITHardwareCapabilities = DISPID_InkTablet.HardwareCapabilities; pub const TabletDeviceKind = enum(i32) { Mouse = 0, Pen = 1, Touch = 2, }; pub const TDK_Mouse = TabletDeviceKind.Mouse; pub const TDK_Pen = TabletDeviceKind.Pen; pub const TDK_Touch = TabletDeviceKind.Touch; pub const DISPID_InkTablet2 = enum(i32) { d = 0, }; pub const DISPID_IT2DeviceKind = DISPID_InkTablet2.d; pub const DISPID_InkTablet3 = enum(i32) { IsMultiTouch = 0, MaximumCursors = 1, }; pub const DISPID_IT3IsMultiTouch = DISPID_InkTablet3.IsMultiTouch; pub const DISPID_IT3MaximumCursors = DISPID_InkTablet3.MaximumCursors; pub const DISPID_InkTablets = enum(i32) { _NewEnum = -4, Item = 0, DefaultTablet = 1, Count = 2, IsPacketPropertySupported = 3, }; pub const DISPID_ITs_NewEnum = DISPID_InkTablets._NewEnum; pub const DISPID_ITsItem = DISPID_InkTablets.Item; pub const DISPID_ITsDefaultTablet = DISPID_InkTablets.DefaultTablet; pub const DISPID_ITsCount = DISPID_InkTablets.Count; pub const DISPID_ITsIsPacketPropertySupported = DISPID_InkTablets.IsPacketPropertySupported; pub const DISPID_InkStrokeDisp = enum(i32) { InkIndex = 1, ID = 2, GetBoundingBox = 3, DrawingAttributes = 4, FindIntersections = 5, GetRectangleIntersections = 6, Clip = 7, HitTestCircle = 8, NearestPoint = 9, Split = 10, ExtendedProperties = 11, Ink = 12, BezierPoints = 13, PolylineCusps = 14, BezierCusps = 15, SelfIntersections = 16, PacketCount = 17, PacketSize = 18, PacketDescription = 19, Deleted = 20, GetPacketDescriptionPropertyMetrics = 21, GetPoints = 22, SetPoints = 23, GetPacketData = 24, GetPacketValuesByProperty = 25, SetPacketValuesByProperty = 26, GetFlattenedBezierPoints = 27, ScaleToRectangle = 28, Transform = 29, Move = 30, Rotate = 31, Shear = 32, Scale = 33, }; pub const DISPID_ISDInkIndex = DISPID_InkStrokeDisp.InkIndex; pub const DISPID_ISDID = DISPID_InkStrokeDisp.ID; pub const DISPID_ISDGetBoundingBox = DISPID_InkStrokeDisp.GetBoundingBox; pub const DISPID_ISDDrawingAttributes = DISPID_InkStrokeDisp.DrawingAttributes; pub const DISPID_ISDFindIntersections = DISPID_InkStrokeDisp.FindIntersections; pub const DISPID_ISDGetRectangleIntersections = DISPID_InkStrokeDisp.GetRectangleIntersections; pub const DISPID_ISDClip = DISPID_InkStrokeDisp.Clip; pub const DISPID_ISDHitTestCircle = DISPID_InkStrokeDisp.HitTestCircle; pub const DISPID_ISDNearestPoint = DISPID_InkStrokeDisp.NearestPoint; pub const DISPID_ISDSplit = DISPID_InkStrokeDisp.Split; pub const DISPID_ISDExtendedProperties = DISPID_InkStrokeDisp.ExtendedProperties; pub const DISPID_ISDInk = DISPID_InkStrokeDisp.Ink; pub const DISPID_ISDBezierPoints = DISPID_InkStrokeDisp.BezierPoints; pub const DISPID_ISDPolylineCusps = DISPID_InkStrokeDisp.PolylineCusps; pub const DISPID_ISDBezierCusps = DISPID_InkStrokeDisp.BezierCusps; pub const DISPID_ISDSelfIntersections = DISPID_InkStrokeDisp.SelfIntersections; pub const DISPID_ISDPacketCount = DISPID_InkStrokeDisp.PacketCount; pub const DISPID_ISDPacketSize = DISPID_InkStrokeDisp.PacketSize; pub const DISPID_ISDPacketDescription = DISPID_InkStrokeDisp.PacketDescription; pub const DISPID_ISDDeleted = DISPID_InkStrokeDisp.Deleted; pub const DISPID_ISDGetPacketDescriptionPropertyMetrics = DISPID_InkStrokeDisp.GetPacketDescriptionPropertyMetrics; pub const DISPID_ISDGetPoints = DISPID_InkStrokeDisp.GetPoints; pub const DISPID_ISDSetPoints = DISPID_InkStrokeDisp.SetPoints; pub const DISPID_ISDGetPacketData = DISPID_InkStrokeDisp.GetPacketData; pub const DISPID_ISDGetPacketValuesByProperty = DISPID_InkStrokeDisp.GetPacketValuesByProperty; pub const DISPID_ISDSetPacketValuesByProperty = DISPID_InkStrokeDisp.SetPacketValuesByProperty; pub const DISPID_ISDGetFlattenedBezierPoints = DISPID_InkStrokeDisp.GetFlattenedBezierPoints; pub const DISPID_ISDScaleToRectangle = DISPID_InkStrokeDisp.ScaleToRectangle; pub const DISPID_ISDTransform = DISPID_InkStrokeDisp.Transform; pub const DISPID_ISDMove = DISPID_InkStrokeDisp.Move; pub const DISPID_ISDRotate = DISPID_InkStrokeDisp.Rotate; pub const DISPID_ISDShear = DISPID_InkStrokeDisp.Shear; pub const DISPID_ISDScale = DISPID_InkStrokeDisp.Scale; pub const DISPID_InkStrokes = enum(i32) { _NewEnum = -4, Item = 0, Count = 1, Valid = 2, Ink = 3, Add = 4, AddStrokes = 5, Remove = 6, RemoveStrokes = 7, ToString = 8, ModifyDrawingAttributes = 9, GetBoundingBox = 10, ScaleToRectangle = 11, Transform = 12, Move = 13, Rotate = 14, Shear = 15, Scale = 16, Clip = 17, RecognitionResult = 18, RemoveRecognitionResult = 19, }; pub const DISPID_ISs_NewEnum = DISPID_InkStrokes._NewEnum; pub const DISPID_ISsItem = DISPID_InkStrokes.Item; pub const DISPID_ISsCount = DISPID_InkStrokes.Count; pub const DISPID_ISsValid = DISPID_InkStrokes.Valid; pub const DISPID_ISsInk = DISPID_InkStrokes.Ink; pub const DISPID_ISsAdd = DISPID_InkStrokes.Add; pub const DISPID_ISsAddStrokes = DISPID_InkStrokes.AddStrokes; pub const DISPID_ISsRemove = DISPID_InkStrokes.Remove; pub const DISPID_ISsRemoveStrokes = DISPID_InkStrokes.RemoveStrokes; pub const DISPID_ISsToString = DISPID_InkStrokes.ToString; pub const DISPID_ISsModifyDrawingAttributes = DISPID_InkStrokes.ModifyDrawingAttributes; pub const DISPID_ISsGetBoundingBox = DISPID_InkStrokes.GetBoundingBox; pub const DISPID_ISsScaleToRectangle = DISPID_InkStrokes.ScaleToRectangle; pub const DISPID_ISsTransform = DISPID_InkStrokes.Transform; pub const DISPID_ISsMove = DISPID_InkStrokes.Move; pub const DISPID_ISsRotate = DISPID_InkStrokes.Rotate; pub const DISPID_ISsShear = DISPID_InkStrokes.Shear; pub const DISPID_ISsScale = DISPID_InkStrokes.Scale; pub const DISPID_ISsClip = DISPID_InkStrokes.Clip; pub const DISPID_ISsRecognitionResult = DISPID_InkStrokes.RecognitionResult; pub const DISPID_ISsRemoveRecognitionResult = DISPID_InkStrokes.RemoveRecognitionResult; pub const DISPID_InkCustomStrokes = enum(i32) { _NewEnum = -4, Item = 0, Count = 1, Add = 2, Remove = 3, Clear = 4, }; pub const DISPID_ICSs_NewEnum = DISPID_InkCustomStrokes._NewEnum; pub const DISPID_ICSsItem = DISPID_InkCustomStrokes.Item; pub const DISPID_ICSsCount = DISPID_InkCustomStrokes.Count; pub const DISPID_ICSsAdd = DISPID_InkCustomStrokes.Add; pub const DISPID_ICSsRemove = DISPID_InkCustomStrokes.Remove; pub const DISPID_ICSsClear = DISPID_InkCustomStrokes.Clear; pub const DISPID_StrokeEvent = enum(i32) { Added = 1, Removed = 2, }; pub const DISPID_SEStrokesAdded = DISPID_StrokeEvent.Added; pub const DISPID_SEStrokesRemoved = DISPID_StrokeEvent.Removed; pub const DISPID_Ink = enum(i32) { Strokes = 1, ExtendedProperties = 2, GetBoundingBox = 3, DeleteStrokes = 4, DeleteStroke = 5, ExtractStrokes = 6, ExtractWithRectangle = 7, Dirty = 8, CustomStrokes = 9, Clone = 10, HitTestCircle = 11, HitTestWithRectangle = 12, HitTestWithLasso = 13, NearestPoint = 14, CreateStrokes = 15, CreateStroke = 16, AddStrokesAtRectangle = 17, Clip = 18, Save = 19, Load = 20, CreateStrokeFromPoints = 21, ClipboardCopyWithRectangle = 22, ClipboardCopy = 23, CanPaste = 24, ClipboardPaste = 25, }; pub const DISPID_IStrokes = DISPID_Ink.Strokes; pub const DISPID_IExtendedProperties = DISPID_Ink.ExtendedProperties; pub const DISPID_IGetBoundingBox = DISPID_Ink.GetBoundingBox; pub const DISPID_IDeleteStrokes = DISPID_Ink.DeleteStrokes; pub const DISPID_IDeleteStroke = DISPID_Ink.DeleteStroke; pub const DISPID_IExtractStrokes = DISPID_Ink.ExtractStrokes; pub const DISPID_IExtractWithRectangle = DISPID_Ink.ExtractWithRectangle; pub const DISPID_IDirty = DISPID_Ink.Dirty; pub const DISPID_ICustomStrokes = DISPID_Ink.CustomStrokes; pub const DISPID_IClone = DISPID_Ink.Clone; pub const DISPID_IHitTestCircle = DISPID_Ink.HitTestCircle; pub const DISPID_IHitTestWithRectangle = DISPID_Ink.HitTestWithRectangle; pub const DISPID_IHitTestWithLasso = DISPID_Ink.HitTestWithLasso; pub const DISPID_INearestPoint = DISPID_Ink.NearestPoint; pub const DISPID_ICreateStrokes = DISPID_Ink.CreateStrokes; pub const DISPID_ICreateStroke = DISPID_Ink.CreateStroke; pub const DISPID_IAddStrokesAtRectangle = DISPID_Ink.AddStrokesAtRectangle; pub const DISPID_IClip = DISPID_Ink.Clip; pub const DISPID_ISave = DISPID_Ink.Save; pub const DISPID_ILoad = DISPID_Ink.Load; pub const DISPID_ICreateStrokeFromPoints = DISPID_Ink.CreateStrokeFromPoints; pub const DISPID_IClipboardCopyWithRectangle = DISPID_Ink.ClipboardCopyWithRectangle; pub const DISPID_IClipboardCopy = DISPID_Ink.ClipboardCopy; pub const DISPID_ICanPaste = DISPID_Ink.CanPaste; pub const DISPID_IClipboardPaste = DISPID_Ink.ClipboardPaste; pub const DISPID_InkEvent = enum(i32) { Added = 1, Deleted = 2, }; pub const DISPID_IEInkAdded = DISPID_InkEvent.Added; pub const DISPID_IEInkDeleted = DISPID_InkEvent.Deleted; pub const DISPID_InkRenderer = enum(i32) { GetViewTransform = 1, SetViewTransform = 2, GetObjectTransform = 3, SetObjectTransform = 4, Draw = 5, DrawStroke = 6, PixelToInkSpace = 7, InkSpaceToPixel = 8, PixelToInkSpaceFromPoints = 9, InkSpaceToPixelFromPoints = 10, Measure = 11, MeasureStroke = 12, Move = 13, Rotate = 14, Scale = 15, }; pub const DISPID_IRGetViewTransform = DISPID_InkRenderer.GetViewTransform; pub const DISPID_IRSetViewTransform = DISPID_InkRenderer.SetViewTransform; pub const DISPID_IRGetObjectTransform = DISPID_InkRenderer.GetObjectTransform; pub const DISPID_IRSetObjectTransform = DISPID_InkRenderer.SetObjectTransform; pub const DISPID_IRDraw = DISPID_InkRenderer.Draw; pub const DISPID_IRDrawStroke = DISPID_InkRenderer.DrawStroke; pub const DISPID_IRPixelToInkSpace = DISPID_InkRenderer.PixelToInkSpace; pub const DISPID_IRInkSpaceToPixel = DISPID_InkRenderer.InkSpaceToPixel; pub const DISPID_IRPixelToInkSpaceFromPoints = DISPID_InkRenderer.PixelToInkSpaceFromPoints; pub const DISPID_IRInkSpaceToPixelFromPoints = DISPID_InkRenderer.InkSpaceToPixelFromPoints; pub const DISPID_IRMeasure = DISPID_InkRenderer.Measure; pub const DISPID_IRMeasureStroke = DISPID_InkRenderer.MeasureStroke; pub const DISPID_IRMove = DISPID_InkRenderer.Move; pub const DISPID_IRRotate = DISPID_InkRenderer.Rotate; pub const DISPID_IRScale = DISPID_InkRenderer.Scale; pub const InkCollectorEventInterest = enum(i32) { DefaultEvents = -1, CursorDown = 0, Stroke = 1, NewPackets = 2, NewInAirPackets = 3, CursorButtonDown = 4, CursorButtonUp = 5, CursorInRange = 6, CursorOutOfRange = 7, SystemGesture = 8, TabletAdded = 9, TabletRemoved = 10, MouseDown = 11, MouseMove = 12, MouseUp = 13, MouseWheel = 14, DblClick = 15, AllEvents = 16, }; pub const ICEI_DefaultEvents = InkCollectorEventInterest.DefaultEvents; pub const ICEI_CursorDown = InkCollectorEventInterest.CursorDown; pub const ICEI_Stroke = InkCollectorEventInterest.Stroke; pub const ICEI_NewPackets = InkCollectorEventInterest.NewPackets; pub const ICEI_NewInAirPackets = InkCollectorEventInterest.NewInAirPackets; pub const ICEI_CursorButtonDown = InkCollectorEventInterest.CursorButtonDown; pub const ICEI_CursorButtonUp = InkCollectorEventInterest.CursorButtonUp; pub const ICEI_CursorInRange = InkCollectorEventInterest.CursorInRange; pub const ICEI_CursorOutOfRange = InkCollectorEventInterest.CursorOutOfRange; pub const ICEI_SystemGesture = InkCollectorEventInterest.SystemGesture; pub const ICEI_TabletAdded = InkCollectorEventInterest.TabletAdded; pub const ICEI_TabletRemoved = InkCollectorEventInterest.TabletRemoved; pub const ICEI_MouseDown = InkCollectorEventInterest.MouseDown; pub const ICEI_MouseMove = InkCollectorEventInterest.MouseMove; pub const ICEI_MouseUp = InkCollectorEventInterest.MouseUp; pub const ICEI_MouseWheel = InkCollectorEventInterest.MouseWheel; pub const ICEI_DblClick = InkCollectorEventInterest.DblClick; pub const ICEI_AllEvents = InkCollectorEventInterest.AllEvents; pub const InkMouseButton = enum(i32) { Left = 1, Right = 2, Middle = 4, }; pub const IMF_Left = InkMouseButton.Left; pub const IMF_Right = InkMouseButton.Right; pub const IMF_Middle = InkMouseButton.Middle; pub const InkShiftKeyModifierFlags = enum(i32) { Shift = 1, Control = 2, Alt = 4, }; pub const IKM_Shift = InkShiftKeyModifierFlags.Shift; pub const IKM_Control = InkShiftKeyModifierFlags.Control; pub const IKM_Alt = InkShiftKeyModifierFlags.Alt; pub const DISPID_InkCollectorEvent = enum(i32) { CEStroke = 1, CECursorDown = 2, CENewPackets = 3, CENewInAirPackets = 4, CECursorButtonDown = 5, CECursorButtonUp = 6, CECursorInRange = 7, CECursorOutOfRange = 8, CESystemGesture = 9, CEGesture = 10, CETabletAdded = 11, CETabletRemoved = 12, OEPainting = 13, OEPainted = 14, OESelectionChanging = 15, OESelectionChanged = 16, OESelectionMoving = 17, OESelectionMoved = 18, OESelectionResizing = 19, OESelectionResized = 20, OEStrokesDeleting = 21, OEStrokesDeleted = 22, PEChangeUICues = 23, PEClick = 24, PEDblClick = 25, PEInvalidated = 26, PEMouseDown = 27, PEMouseEnter = 28, PEMouseHover = 29, PEMouseLeave = 30, PEMouseMove = 31, PEMouseUp = 32, PEMouseWheel = 33, PESizeModeChanged = 34, PEStyleChanged = 35, PESystemColorsChanged = 36, PEKeyDown = 37, PEKeyPress = 38, PEKeyUp = 39, PEResize = 40, PESizeChanged = 41, }; pub const DISPID_ICEStroke = DISPID_InkCollectorEvent.CEStroke; pub const DISPID_ICECursorDown = DISPID_InkCollectorEvent.CECursorDown; pub const DISPID_ICENewPackets = DISPID_InkCollectorEvent.CENewPackets; pub const DISPID_ICENewInAirPackets = DISPID_InkCollectorEvent.CENewInAirPackets; pub const DISPID_ICECursorButtonDown = DISPID_InkCollectorEvent.CECursorButtonDown; pub const DISPID_ICECursorButtonUp = DISPID_InkCollectorEvent.CECursorButtonUp; pub const DISPID_ICECursorInRange = DISPID_InkCollectorEvent.CECursorInRange; pub const DISPID_ICECursorOutOfRange = DISPID_InkCollectorEvent.CECursorOutOfRange; pub const DISPID_ICESystemGesture = DISPID_InkCollectorEvent.CESystemGesture; pub const DISPID_ICEGesture = DISPID_InkCollectorEvent.CEGesture; pub const DISPID_ICETabletAdded = DISPID_InkCollectorEvent.CETabletAdded; pub const DISPID_ICETabletRemoved = DISPID_InkCollectorEvent.CETabletRemoved; pub const DISPID_IOEPainting = DISPID_InkCollectorEvent.OEPainting; pub const DISPID_IOEPainted = DISPID_InkCollectorEvent.OEPainted; pub const DISPID_IOESelectionChanging = DISPID_InkCollectorEvent.OESelectionChanging; pub const DISPID_IOESelectionChanged = DISPID_InkCollectorEvent.OESelectionChanged; pub const DISPID_IOESelectionMoving = DISPID_InkCollectorEvent.OESelectionMoving; pub const DISPID_IOESelectionMoved = DISPID_InkCollectorEvent.OESelectionMoved; pub const DISPID_IOESelectionResizing = DISPID_InkCollectorEvent.OESelectionResizing; pub const DISPID_IOESelectionResized = DISPID_InkCollectorEvent.OESelectionResized; pub const DISPID_IOEStrokesDeleting = DISPID_InkCollectorEvent.OEStrokesDeleting; pub const DISPID_IOEStrokesDeleted = DISPID_InkCollectorEvent.OEStrokesDeleted; pub const DISPID_IPEChangeUICues = DISPID_InkCollectorEvent.PEChangeUICues; pub const DISPID_IPEClick = DISPID_InkCollectorEvent.PEClick; pub const DISPID_IPEDblClick = DISPID_InkCollectorEvent.PEDblClick; pub const DISPID_IPEInvalidated = DISPID_InkCollectorEvent.PEInvalidated; pub const DISPID_IPEMouseDown = DISPID_InkCollectorEvent.PEMouseDown; pub const DISPID_IPEMouseEnter = DISPID_InkCollectorEvent.PEMouseEnter; pub const DISPID_IPEMouseHover = DISPID_InkCollectorEvent.PEMouseHover; pub const DISPID_IPEMouseLeave = DISPID_InkCollectorEvent.PEMouseLeave; pub const DISPID_IPEMouseMove = DISPID_InkCollectorEvent.PEMouseMove; pub const DISPID_IPEMouseUp = DISPID_InkCollectorEvent.PEMouseUp; pub const DISPID_IPEMouseWheel = DISPID_InkCollectorEvent.PEMouseWheel; pub const DISPID_IPESizeModeChanged = DISPID_InkCollectorEvent.PESizeModeChanged; pub const DISPID_IPEStyleChanged = DISPID_InkCollectorEvent.PEStyleChanged; pub const DISPID_IPESystemColorsChanged = DISPID_InkCollectorEvent.PESystemColorsChanged; pub const DISPID_IPEKeyDown = DISPID_InkCollectorEvent.PEKeyDown; pub const DISPID_IPEKeyPress = DISPID_InkCollectorEvent.PEKeyPress; pub const DISPID_IPEKeyUp = DISPID_InkCollectorEvent.PEKeyUp; pub const DISPID_IPEResize = DISPID_InkCollectorEvent.PEResize; pub const DISPID_IPESizeChanged = DISPID_InkCollectorEvent.PESizeChanged; pub const InkOverlayEditingMode = enum(i32) { Ink = 0, Delete = 1, Select = 2, }; pub const IOEM_Ink = InkOverlayEditingMode.Ink; pub const IOEM_Delete = InkOverlayEditingMode.Delete; pub const IOEM_Select = InkOverlayEditingMode.Select; pub const InkOverlayAttachMode = enum(i32) { Behind = 0, InFront = 1, }; pub const IOAM_Behind = InkOverlayAttachMode.Behind; pub const IOAM_InFront = InkOverlayAttachMode.InFront; pub const InkPictureSizeMode = enum(i32) { AutoSize = 0, CenterImage = 1, Normal = 2, StretchImage = 3, }; pub const IPSM_AutoSize = InkPictureSizeMode.AutoSize; pub const IPSM_CenterImage = InkPictureSizeMode.CenterImage; pub const IPSM_Normal = InkPictureSizeMode.Normal; pub const IPSM_StretchImage = InkPictureSizeMode.StretchImage; pub const InkOverlayEraserMode = enum(i32) { StrokeErase = 0, PointErase = 1, }; pub const IOERM_StrokeErase = InkOverlayEraserMode.StrokeErase; pub const IOERM_PointErase = InkOverlayEraserMode.PointErase; pub const InkCollectionMode = enum(i32) { InkOnly = 0, GestureOnly = 1, InkAndGesture = 2, }; pub const ICM_InkOnly = InkCollectionMode.InkOnly; pub const ICM_GestureOnly = InkCollectionMode.GestureOnly; pub const ICM_InkAndGesture = InkCollectionMode.InkAndGesture; pub const DISPID_InkCollector = enum(i32) { CEnabled = 1, CHwnd = 2, CPaint = 3, CText = 4, CDefaultDrawingAttributes = 5, CRenderer = 6, CInk = 7, CAutoRedraw = 8, CCollectingInk = 9, CSetEventInterest = 10, CGetEventInterest = 11, OEditingMode = 12, OSelection = 13, OAttachMode = 14, OHitTestSelection = 15, ODraw = 16, PPicture = 17, PSizeMode = 18, PBackColor = 19, CCursors = 20, CMarginX = 21, CMarginY = 22, CSetWindowInputRectangle = 23, CGetWindowInputRectangle = 24, CTablet = 25, CSetAllTabletsMode = 26, CSetSingleTabletIntegratedMode = 27, CCollectionMode = 28, CSetGestureStatus = 29, CGetGestureStatus = 30, CDynamicRendering = 31, CDesiredPacketDescription = 32, OEraserMode = 33, OEraserWidth = 34, CMouseIcon = 35, CMousePointer = 36, PInkEnabled = 37, CSupportHighContrastInk = 38, OSupportHighContrastSelectionUI = 39, }; pub const DISPID_ICEnabled = DISPID_InkCollector.CEnabled; pub const DISPID_ICHwnd = DISPID_InkCollector.CHwnd; pub const DISPID_ICPaint = DISPID_InkCollector.CPaint; pub const DISPID_ICText = DISPID_InkCollector.CText; pub const DISPID_ICDefaultDrawingAttributes = DISPID_InkCollector.CDefaultDrawingAttributes; pub const DISPID_ICRenderer = DISPID_InkCollector.CRenderer; pub const DISPID_ICInk = DISPID_InkCollector.CInk; pub const DISPID_ICAutoRedraw = DISPID_InkCollector.CAutoRedraw; pub const DISPID_ICCollectingInk = DISPID_InkCollector.CCollectingInk; pub const DISPID_ICSetEventInterest = DISPID_InkCollector.CSetEventInterest; pub const DISPID_ICGetEventInterest = DISPID_InkCollector.CGetEventInterest; pub const DISPID_IOEditingMode = DISPID_InkCollector.OEditingMode; pub const DISPID_IOSelection = DISPID_InkCollector.OSelection; pub const DISPID_IOAttachMode = DISPID_InkCollector.OAttachMode; pub const DISPID_IOHitTestSelection = DISPID_InkCollector.OHitTestSelection; pub const DISPID_IODraw = DISPID_InkCollector.ODraw; pub const DISPID_IPPicture = DISPID_InkCollector.PPicture; pub const DISPID_IPSizeMode = DISPID_InkCollector.PSizeMode; pub const DISPID_IPBackColor = DISPID_InkCollector.PBackColor; pub const DISPID_ICCursors = DISPID_InkCollector.CCursors; pub const DISPID_ICMarginX = DISPID_InkCollector.CMarginX; pub const DISPID_ICMarginY = DISPID_InkCollector.CMarginY; pub const DISPID_ICSetWindowInputRectangle = DISPID_InkCollector.CSetWindowInputRectangle; pub const DISPID_ICGetWindowInputRectangle = DISPID_InkCollector.CGetWindowInputRectangle; pub const DISPID_ICTablet = DISPID_InkCollector.CTablet; pub const DISPID_ICSetAllTabletsMode = DISPID_InkCollector.CSetAllTabletsMode; pub const DISPID_ICSetSingleTabletIntegratedMode = DISPID_InkCollector.CSetSingleTabletIntegratedMode; pub const DISPID_ICCollectionMode = DISPID_InkCollector.CCollectionMode; pub const DISPID_ICSetGestureStatus = DISPID_InkCollector.CSetGestureStatus; pub const DISPID_ICGetGestureStatus = DISPID_InkCollector.CGetGestureStatus; pub const DISPID_ICDynamicRendering = DISPID_InkCollector.CDynamicRendering; pub const DISPID_ICDesiredPacketDescription = DISPID_InkCollector.CDesiredPacketDescription; pub const DISPID_IOEraserMode = DISPID_InkCollector.OEraserMode; pub const DISPID_IOEraserWidth = DISPID_InkCollector.OEraserWidth; pub const DISPID_ICMouseIcon = DISPID_InkCollector.CMouseIcon; pub const DISPID_ICMousePointer = DISPID_InkCollector.CMousePointer; pub const DISPID_IPInkEnabled = DISPID_InkCollector.PInkEnabled; pub const DISPID_ICSupportHighContrastInk = DISPID_InkCollector.CSupportHighContrastInk; pub const DISPID_IOSupportHighContrastSelectionUI = DISPID_InkCollector.OSupportHighContrastSelectionUI; pub const DISPID_InkRecognizer = enum(i32) { Clsid = 1, Name = 2, Vendor = 3, Capabilities = 4, LanguageID = 5, PreferredPacketDescription = 6, CreateRecognizerContext = 7, SupportedProperties = 8, }; pub const DISPID_RecoClsid = DISPID_InkRecognizer.Clsid; pub const DISPID_RecoName = DISPID_InkRecognizer.Name; pub const DISPID_RecoVendor = DISPID_InkRecognizer.Vendor; pub const DISPID_RecoCapabilities = DISPID_InkRecognizer.Capabilities; pub const DISPID_RecoLanguageID = DISPID_InkRecognizer.LanguageID; pub const DISPID_RecoPreferredPacketDescription = DISPID_InkRecognizer.PreferredPacketDescription; pub const DISPID_RecoCreateRecognizerContext = DISPID_InkRecognizer.CreateRecognizerContext; pub const DISPID_RecoSupportedProperties = DISPID_InkRecognizer.SupportedProperties; pub const InkRecognizerCapabilities = enum(i32) { DontCare = 1, Object = 2, FreeInput = 4, LinedInput = 8, BoxedInput = 16, CharacterAutoCompletionInput = 32, RightAndDown = 64, LeftAndDown = 128, DownAndLeft = 256, DownAndRight = 512, ArbitraryAngle = 1024, Lattice = 2048, AdviseInkChange = 4096, StrokeReorder = 8192, Personalizable = 16384, PrefersArbitraryAngle = 32768, PrefersParagraphBreaking = 65536, PrefersSegmentation = 131072, Cursive = 262144, TextPrediction = 524288, Alpha = 1048576, Beta = 2097152, }; pub const IRC_DontCare = InkRecognizerCapabilities.DontCare; pub const IRC_Object = InkRecognizerCapabilities.Object; pub const IRC_FreeInput = InkRecognizerCapabilities.FreeInput; pub const IRC_LinedInput = InkRecognizerCapabilities.LinedInput; pub const IRC_BoxedInput = InkRecognizerCapabilities.BoxedInput; pub const IRC_CharacterAutoCompletionInput = InkRecognizerCapabilities.CharacterAutoCompletionInput; pub const IRC_RightAndDown = InkRecognizerCapabilities.RightAndDown; pub const IRC_LeftAndDown = InkRecognizerCapabilities.LeftAndDown; pub const IRC_DownAndLeft = InkRecognizerCapabilities.DownAndLeft; pub const IRC_DownAndRight = InkRecognizerCapabilities.DownAndRight; pub const IRC_ArbitraryAngle = InkRecognizerCapabilities.ArbitraryAngle; pub const IRC_Lattice = InkRecognizerCapabilities.Lattice; pub const IRC_AdviseInkChange = InkRecognizerCapabilities.AdviseInkChange; pub const IRC_StrokeReorder = InkRecognizerCapabilities.StrokeReorder; pub const IRC_Personalizable = InkRecognizerCapabilities.Personalizable; pub const IRC_PrefersArbitraryAngle = InkRecognizerCapabilities.PrefersArbitraryAngle; pub const IRC_PrefersParagraphBreaking = InkRecognizerCapabilities.PrefersParagraphBreaking; pub const IRC_PrefersSegmentation = InkRecognizerCapabilities.PrefersSegmentation; pub const IRC_Cursive = InkRecognizerCapabilities.Cursive; pub const IRC_TextPrediction = InkRecognizerCapabilities.TextPrediction; pub const IRC_Alpha = InkRecognizerCapabilities.Alpha; pub const IRC_Beta = InkRecognizerCapabilities.Beta; pub const DISPID_InkRecognizer2 = enum(i32) { Id = 0, UnicodeRanges = 1, }; pub const DISPID_RecoId = DISPID_InkRecognizer2.Id; pub const DISPID_RecoUnicodeRanges = DISPID_InkRecognizer2.UnicodeRanges; pub const DISPID_InkRecognizers = enum(i32) { _NewEnum = -4, Item = 0, Count = 1, GetDefaultRecognizer = 2, }; pub const DISPID_IRecos_NewEnum = DISPID_InkRecognizers._NewEnum; pub const DISPID_IRecosItem = DISPID_InkRecognizers.Item; pub const DISPID_IRecosCount = DISPID_InkRecognizers.Count; pub const DISPID_IRecosGetDefaultRecognizer = DISPID_InkRecognizers.GetDefaultRecognizer; pub const InkRecognizerCharacterAutoCompletionMode = enum(i32) { Full = 0, Prefix = 1, Random = 2, }; pub const IRCACM_Full = InkRecognizerCharacterAutoCompletionMode.Full; pub const IRCACM_Prefix = InkRecognizerCharacterAutoCompletionMode.Prefix; pub const IRCACM_Random = InkRecognizerCharacterAutoCompletionMode.Random; pub const InkRecognitionModes = enum(i32) { None = 0, WordModeOnly = 1, Coerce = 2, TopInkBreaksOnly = 4, PrefixOk = 8, LineMode = 16, DisablePersonalization = 32, AutoSpace = 64, Max = 128, }; pub const IRM_None = InkRecognitionModes.None; pub const IRM_WordModeOnly = InkRecognitionModes.WordModeOnly; pub const IRM_Coerce = InkRecognitionModes.Coerce; pub const IRM_TopInkBreaksOnly = InkRecognitionModes.TopInkBreaksOnly; pub const IRM_PrefixOk = InkRecognitionModes.PrefixOk; pub const IRM_LineMode = InkRecognitionModes.LineMode; pub const IRM_DisablePersonalization = InkRecognitionModes.DisablePersonalization; pub const IRM_AutoSpace = InkRecognitionModes.AutoSpace; pub const IRM_Max = InkRecognitionModes.Max; pub const DISPID_InkRecognitionEvent = enum(i32) { WithAlternates = 1, n = 2, }; pub const DISPID_IRERecognitionWithAlternates = DISPID_InkRecognitionEvent.WithAlternates; pub const DISPID_IRERecognition = DISPID_InkRecognitionEvent.n; pub const DISPID_InkRecoContext = enum(i32) { Strokes = 1, CharacterAutoCompletionMode = 2, Factoid = 3, WordList = 4, Recognizer = 5, Guide = 6, Flags = 7, PrefixText = 8, SuffixText = 9, StopRecognition = 10, Clone = 11, Recognize = 12, StopBackgroundRecognition = 13, EndInkInput = 14, BackgroundRecognize = 15, BackgroundRecognizeWithAlternates = 16, IsStringSupported = 17, }; pub const DISPID_IRecoCtx_Strokes = DISPID_InkRecoContext.Strokes; pub const DISPID_IRecoCtx_CharacterAutoCompletionMode = DISPID_InkRecoContext.CharacterAutoCompletionMode; pub const DISPID_IRecoCtx_Factoid = DISPID_InkRecoContext.Factoid; pub const DISPID_IRecoCtx_WordList = DISPID_InkRecoContext.WordList; pub const DISPID_IRecoCtx_Recognizer = DISPID_InkRecoContext.Recognizer; pub const DISPID_IRecoCtx_Guide = DISPID_InkRecoContext.Guide; pub const DISPID_IRecoCtx_Flags = DISPID_InkRecoContext.Flags; pub const DISPID_IRecoCtx_PrefixText = DISPID_InkRecoContext.PrefixText; pub const DISPID_IRecoCtx_SuffixText = DISPID_InkRecoContext.SuffixText; pub const DISPID_IRecoCtx_StopRecognition = DISPID_InkRecoContext.StopRecognition; pub const DISPID_IRecoCtx_Clone = DISPID_InkRecoContext.Clone; pub const DISPID_IRecoCtx_Recognize = DISPID_InkRecoContext.Recognize; pub const DISPID_IRecoCtx_StopBackgroundRecognition = DISPID_InkRecoContext.StopBackgroundRecognition; pub const DISPID_IRecoCtx_EndInkInput = DISPID_InkRecoContext.EndInkInput; pub const DISPID_IRecoCtx_BackgroundRecognize = DISPID_InkRecoContext.BackgroundRecognize; pub const DISPID_IRecoCtx_BackgroundRecognizeWithAlternates = DISPID_InkRecoContext.BackgroundRecognizeWithAlternates; pub const DISPID_IRecoCtx_IsStringSupported = DISPID_InkRecoContext.IsStringSupported; pub const DISPID_InkRecoContext2 = enum(i32) { s = 0, }; pub const DISPID_IRecoCtx2_EnabledUnicodeRanges = DISPID_InkRecoContext2.s; pub const InkRecognitionAlternatesSelection = enum(i32) { Start = 0, DefaultCount = 10, All = -1, }; pub const IRAS_Start = InkRecognitionAlternatesSelection.Start; pub const IRAS_DefaultCount = InkRecognitionAlternatesSelection.DefaultCount; pub const IRAS_All = InkRecognitionAlternatesSelection.All; pub const DISPID_InkRecognitionResult = enum(i32) { TopString = 1, TopAlternate = 2, Strokes = 3, TopConfidence = 4, AlternatesFromSelection = 5, ModifyTopAlternate = 6, SetResultOnStrokes = 7, }; pub const DISPID_InkRecognitionResult_TopString = DISPID_InkRecognitionResult.TopString; pub const DISPID_InkRecognitionResult_TopAlternate = DISPID_InkRecognitionResult.TopAlternate; pub const DISPID_InkRecognitionResult_Strokes = DISPID_InkRecognitionResult.Strokes; pub const DISPID_InkRecognitionResult_TopConfidence = DISPID_InkRecognitionResult.TopConfidence; pub const DISPID_InkRecognitionResult_AlternatesFromSelection = DISPID_InkRecognitionResult.AlternatesFromSelection; pub const DISPID_InkRecognitionResult_ModifyTopAlternate = DISPID_InkRecognitionResult.ModifyTopAlternate; pub const DISPID_InkRecognitionResult_SetResultOnStrokes = DISPID_InkRecognitionResult.SetResultOnStrokes; pub const DISPID_InkRecoAlternate = enum(i32) { String = 1, LineNumber = 2, Baseline = 3, Midline = 4, Ascender = 5, Descender = 6, Confidence = 7, Strokes = 8, GetStrokesFromStrokeRanges = 9, GetStrokesFromTextRange = 10, GetTextRangeFromStrokes = 11, GetPropertyValue = 12, LineAlternates = 13, ConfidenceAlternates = 14, AlternatesWithConstantPropertyValues = 15, }; pub const DISPID_InkRecoAlternate_String = DISPID_InkRecoAlternate.String; pub const DISPID_InkRecoAlternate_LineNumber = DISPID_InkRecoAlternate.LineNumber; pub const DISPID_InkRecoAlternate_Baseline = DISPID_InkRecoAlternate.Baseline; pub const DISPID_InkRecoAlternate_Midline = DISPID_InkRecoAlternate.Midline; pub const DISPID_InkRecoAlternate_Ascender = DISPID_InkRecoAlternate.Ascender; pub const DISPID_InkRecoAlternate_Descender = DISPID_InkRecoAlternate.Descender; pub const DISPID_InkRecoAlternate_Confidence = DISPID_InkRecoAlternate.Confidence; pub const DISPID_InkRecoAlternate_Strokes = DISPID_InkRecoAlternate.Strokes; pub const DISPID_InkRecoAlternate_GetStrokesFromStrokeRanges = DISPID_InkRecoAlternate.GetStrokesFromStrokeRanges; pub const DISPID_InkRecoAlternate_GetStrokesFromTextRange = DISPID_InkRecoAlternate.GetStrokesFromTextRange; pub const DISPID_InkRecoAlternate_GetTextRangeFromStrokes = DISPID_InkRecoAlternate.GetTextRangeFromStrokes; pub const DISPID_InkRecoAlternate_GetPropertyValue = DISPID_InkRecoAlternate.GetPropertyValue; pub const DISPID_InkRecoAlternate_LineAlternates = DISPID_InkRecoAlternate.LineAlternates; pub const DISPID_InkRecoAlternate_ConfidenceAlternates = DISPID_InkRecoAlternate.ConfidenceAlternates; pub const DISPID_InkRecoAlternate_AlternatesWithConstantPropertyValues = DISPID_InkRecoAlternate.AlternatesWithConstantPropertyValues; pub const DISPID_InkRecognitionAlternates = enum(i32) { NewEnum = -4, Item = 0, Count = 1, Strokes = 2, }; pub const DISPID_InkRecognitionAlternates_NewEnum = DISPID_InkRecognitionAlternates.NewEnum; pub const DISPID_InkRecognitionAlternates_Item = DISPID_InkRecognitionAlternates.Item; pub const DISPID_InkRecognitionAlternates_Count = DISPID_InkRecognitionAlternates.Count; pub const DISPID_InkRecognitionAlternates_Strokes = DISPID_InkRecognitionAlternates.Strokes; pub const InkRecoGuide = extern struct { rectWritingBox: RECT, rectDrawnBox: RECT, cRows: i32, cColumns: i32, midline: i32, }; pub const DISPID_InkRecognizerGuide = enum(i32) { WritingBox = 1, DrawnBox = 2, Rows = 3, Columns = 4, Midline = 5, GuideData = 6, }; pub const DISPID_IRGWritingBox = DISPID_InkRecognizerGuide.WritingBox; pub const DISPID_IRGDrawnBox = DISPID_InkRecognizerGuide.DrawnBox; pub const DISPID_IRGRows = DISPID_InkRecognizerGuide.Rows; pub const DISPID_IRGColumns = DISPID_InkRecognizerGuide.Columns; pub const DISPID_IRGMidline = DISPID_InkRecognizerGuide.Midline; pub const DISPID_IRGGuideData = DISPID_InkRecognizerGuide.GuideData; pub const DISPID_InkWordList = enum(i32) { AddWord = 0, RemoveWord = 1, Merge = 2, }; pub const DISPID_InkWordList_AddWord = DISPID_InkWordList.AddWord; pub const DISPID_InkWordList_RemoveWord = DISPID_InkWordList.RemoveWord; pub const DISPID_InkWordList_Merge = DISPID_InkWordList.Merge; pub const DISPID_InkWordList2 = enum(i32) { s = 3, }; pub const DISPID_InkWordList2_AddWords = DISPID_InkWordList2.s; const IID_IInkRectangle_Value = @import("../zig.zig").Guid.initString("9794ff82-6071-4717-8a8b-6ac7c64a686e"); pub const IID_IInkRectangle = &IID_IInkRectangle_Value; pub const IInkRectangle = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Top: fn( self: *const IInkRectangle, Units: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Top: fn( self: *const IInkRectangle, Units: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Left: fn( self: *const IInkRectangle, Units: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Left: fn( self: *const IInkRectangle, Units: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Bottom: fn( self: *const IInkRectangle, Units: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Bottom: fn( self: *const IInkRectangle, Units: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Right: fn( self: *const IInkRectangle, Units: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Right: fn( self: *const IInkRectangle, Units: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Data: fn( self: *const IInkRectangle, Rect: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Data: fn( self: *const IInkRectangle, Rect: RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRectangle: fn( self: *const IInkRectangle, Top: ?*i32, Left: ?*i32, Bottom: ?*i32, Right: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetRectangle: fn( self: *const IInkRectangle, Top: i32, Left: i32, Bottom: i32, Right: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRectangle_get_Top(self: *const T, Units: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRectangle.VTable, self.vtable).get_Top(@ptrCast(*const IInkRectangle, self), Units); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRectangle_put_Top(self: *const T, Units: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRectangle.VTable, self.vtable).put_Top(@ptrCast(*const IInkRectangle, self), Units); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRectangle_get_Left(self: *const T, Units: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRectangle.VTable, self.vtable).get_Left(@ptrCast(*const IInkRectangle, self), Units); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRectangle_put_Left(self: *const T, Units: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRectangle.VTable, self.vtable).put_Left(@ptrCast(*const IInkRectangle, self), Units); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRectangle_get_Bottom(self: *const T, Units: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRectangle.VTable, self.vtable).get_Bottom(@ptrCast(*const IInkRectangle, self), Units); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRectangle_put_Bottom(self: *const T, Units: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRectangle.VTable, self.vtable).put_Bottom(@ptrCast(*const IInkRectangle, self), Units); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRectangle_get_Right(self: *const T, Units: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRectangle.VTable, self.vtable).get_Right(@ptrCast(*const IInkRectangle, self), Units); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRectangle_put_Right(self: *const T, Units: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRectangle.VTable, self.vtable).put_Right(@ptrCast(*const IInkRectangle, self), Units); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRectangle_get_Data(self: *const T, Rect: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRectangle.VTable, self.vtable).get_Data(@ptrCast(*const IInkRectangle, self), Rect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRectangle_put_Data(self: *const T, Rect: RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRectangle.VTable, self.vtable).put_Data(@ptrCast(*const IInkRectangle, self), Rect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRectangle_GetRectangle(self: *const T, Top: ?*i32, Left: ?*i32, Bottom: ?*i32, Right: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRectangle.VTable, self.vtable).GetRectangle(@ptrCast(*const IInkRectangle, self), Top, Left, Bottom, Right); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRectangle_SetRectangle(self: *const T, Top: i32, Left: i32, Bottom: i32, Right: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRectangle.VTable, self.vtable).SetRectangle(@ptrCast(*const IInkRectangle, self), Top, Left, Bottom, Right); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkExtendedProperty_Value = @import("../zig.zig").Guid.initString("db489209-b7c3-411d-90f6-1548cfff271e"); pub const IID_IInkExtendedProperty = &IID_IInkExtendedProperty_Value; pub const IInkExtendedProperty = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Guid: fn( self: *const IInkExtendedProperty, Guid: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Data: fn( self: *const IInkExtendedProperty, Data: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Data: fn( self: *const IInkExtendedProperty, Data: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkExtendedProperty_get_Guid(self: *const T, _param_Guid: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkExtendedProperty.VTable, self.vtable).get_Guid(@ptrCast(*const IInkExtendedProperty, self), _param_Guid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkExtendedProperty_get_Data(self: *const T, Data: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkExtendedProperty.VTable, self.vtable).get_Data(@ptrCast(*const IInkExtendedProperty, self), Data); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkExtendedProperty_put_Data(self: *const T, Data: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkExtendedProperty.VTable, self.vtable).put_Data(@ptrCast(*const IInkExtendedProperty, self), Data); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkExtendedProperties_Value = @import("../zig.zig").Guid.initString("89f2a8be-95a9-4530-8b8f-88e971e3e25f"); pub const IID_IInkExtendedProperties = &IID_IInkExtendedProperties_Value; pub const IInkExtendedProperties = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const IInkExtendedProperties, Count: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IInkExtendedProperties, _NewEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Item: fn( self: *const IInkExtendedProperties, Identifier: VARIANT, Item: ?*?*IInkExtendedProperty, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Add: fn( self: *const IInkExtendedProperties, Guid: ?BSTR, Data: VARIANT, InkExtendedProperty: ?*?*IInkExtendedProperty, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Remove: fn( self: *const IInkExtendedProperties, Identifier: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clear: fn( self: *const IInkExtendedProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DoesPropertyExist: fn( self: *const IInkExtendedProperties, Guid: ?BSTR, DoesPropertyExist: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkExtendedProperties_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkExtendedProperties.VTable, self.vtable).get_Count(@ptrCast(*const IInkExtendedProperties, self), Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkExtendedProperties_get__NewEnum(self: *const T, _NewEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IInkExtendedProperties.VTable, self.vtable).get__NewEnum(@ptrCast(*const IInkExtendedProperties, self), _NewEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkExtendedProperties_Item(self: *const T, Identifier: VARIANT, Item: ?*?*IInkExtendedProperty) callconv(.Inline) HRESULT { return @ptrCast(*const IInkExtendedProperties.VTable, self.vtable).Item(@ptrCast(*const IInkExtendedProperties, self), Identifier, Item); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkExtendedProperties_Add(self: *const T, _param_Guid: ?BSTR, Data: VARIANT, InkExtendedProperty: ?*?*IInkExtendedProperty) callconv(.Inline) HRESULT { return @ptrCast(*const IInkExtendedProperties.VTable, self.vtable).Add(@ptrCast(*const IInkExtendedProperties, self), _param_Guid, Data, InkExtendedProperty); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkExtendedProperties_Remove(self: *const T, Identifier: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkExtendedProperties.VTable, self.vtable).Remove(@ptrCast(*const IInkExtendedProperties, self), Identifier); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkExtendedProperties_Clear(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IInkExtendedProperties.VTable, self.vtable).Clear(@ptrCast(*const IInkExtendedProperties, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkExtendedProperties_DoesPropertyExist(self: *const T, _param_Guid: ?BSTR, DoesPropertyExist: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkExtendedProperties.VTable, self.vtable).DoesPropertyExist(@ptrCast(*const IInkExtendedProperties, self), _param_Guid, DoesPropertyExist); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInkDrawingAttributes_Value = @import("../zig.zig").Guid.initString("bf519b75-0a15-4623-adc9-c00d436a8092"); pub const IID_IInkDrawingAttributes = &IID_IInkDrawingAttributes_Value; pub const IInkDrawingAttributes = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Color: fn( self: *const IInkDrawingAttributes, CurrentColor: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Color: fn( self: *const IInkDrawingAttributes, NewColor: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Width: fn( self: *const IInkDrawingAttributes, CurrentWidth: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Width: fn( self: *const IInkDrawingAttributes, NewWidth: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Height: fn( self: *const IInkDrawingAttributes, CurrentHeight: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Height: fn( self: *const IInkDrawingAttributes, NewHeight: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_FitToCurve: fn( self: *const IInkDrawingAttributes, Flag: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_FitToCurve: fn( self: *const IInkDrawingAttributes, Flag: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_IgnorePressure: fn( self: *const IInkDrawingAttributes, Flag: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_IgnorePressure: fn( self: *const IInkDrawingAttributes, Flag: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AntiAliased: fn( self: *const IInkDrawingAttributes, Flag: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AntiAliased: fn( self: *const IInkDrawingAttributes, Flag: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Transparency: fn( self: *const IInkDrawingAttributes, CurrentTransparency: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Transparency: fn( self: *const IInkDrawingAttributes, NewTransparency: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RasterOperation: fn( self: *const IInkDrawingAttributes, CurrentRasterOperation: ?*InkRasterOperation, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RasterOperation: fn( self: *const IInkDrawingAttributes, NewRasterOperation: InkRasterOperation, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PenTip: fn( self: *const IInkDrawingAttributes, CurrentPenTip: ?*InkPenTip, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_PenTip: fn( self: *const IInkDrawingAttributes, NewPenTip: InkPenTip, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ExtendedProperties: fn( self: *const IInkDrawingAttributes, Properties: ?*?*IInkExtendedProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IInkDrawingAttributes, DrawingAttributes: ?*?*IInkDrawingAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_get_Color(self: *const T, CurrentColor: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).get_Color(@ptrCast(*const IInkDrawingAttributes, self), CurrentColor); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_put_Color(self: *const T, NewColor: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).put_Color(@ptrCast(*const IInkDrawingAttributes, self), NewColor); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_get_Width(self: *const T, CurrentWidth: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).get_Width(@ptrCast(*const IInkDrawingAttributes, self), CurrentWidth); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_put_Width(self: *const T, NewWidth: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).put_Width(@ptrCast(*const IInkDrawingAttributes, self), NewWidth); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_get_Height(self: *const T, CurrentHeight: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).get_Height(@ptrCast(*const IInkDrawingAttributes, self), CurrentHeight); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_put_Height(self: *const T, NewHeight: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).put_Height(@ptrCast(*const IInkDrawingAttributes, self), NewHeight); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_get_FitToCurve(self: *const T, Flag: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).get_FitToCurve(@ptrCast(*const IInkDrawingAttributes, self), Flag); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_put_FitToCurve(self: *const T, Flag: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).put_FitToCurve(@ptrCast(*const IInkDrawingAttributes, self), Flag); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_get_IgnorePressure(self: *const T, Flag: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).get_IgnorePressure(@ptrCast(*const IInkDrawingAttributes, self), Flag); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_put_IgnorePressure(self: *const T, Flag: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).put_IgnorePressure(@ptrCast(*const IInkDrawingAttributes, self), Flag); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_get_AntiAliased(self: *const T, Flag: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).get_AntiAliased(@ptrCast(*const IInkDrawingAttributes, self), Flag); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_put_AntiAliased(self: *const T, Flag: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).put_AntiAliased(@ptrCast(*const IInkDrawingAttributes, self), Flag); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_get_Transparency(self: *const T, CurrentTransparency: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).get_Transparency(@ptrCast(*const IInkDrawingAttributes, self), CurrentTransparency); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_put_Transparency(self: *const T, NewTransparency: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).put_Transparency(@ptrCast(*const IInkDrawingAttributes, self), NewTransparency); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_get_RasterOperation(self: *const T, CurrentRasterOperation: ?*InkRasterOperation) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).get_RasterOperation(@ptrCast(*const IInkDrawingAttributes, self), CurrentRasterOperation); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_put_RasterOperation(self: *const T, NewRasterOperation: InkRasterOperation) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).put_RasterOperation(@ptrCast(*const IInkDrawingAttributes, self), NewRasterOperation); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_get_PenTip(self: *const T, CurrentPenTip: ?*InkPenTip) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).get_PenTip(@ptrCast(*const IInkDrawingAttributes, self), CurrentPenTip); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_put_PenTip(self: *const T, NewPenTip: InkPenTip) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).put_PenTip(@ptrCast(*const IInkDrawingAttributes, self), NewPenTip); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_get_ExtendedProperties(self: *const T, Properties: ?*?*IInkExtendedProperties) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).get_ExtendedProperties(@ptrCast(*const IInkDrawingAttributes, self), Properties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDrawingAttributes_Clone(self: *const T, DrawingAttributes: ?*?*IInkDrawingAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDrawingAttributes.VTable, self.vtable).Clone(@ptrCast(*const IInkDrawingAttributes, self), DrawingAttributes); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInkTransform_Value = @import("../zig.zig").Guid.initString("615f1d43-8703-4565-88e2-8201d2ecd7b7"); pub const IID_IInkTransform = &IID_IInkTransform_Value; pub const IInkTransform = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, Reset: fn( self: *const IInkTransform, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Translate: fn( self: *const IInkTransform, HorizontalComponent: f32, VerticalComponent: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Rotate: fn( self: *const IInkTransform, Degrees: f32, x: f32, y: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reflect: fn( self: *const IInkTransform, Horizontally: i16, Vertically: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Shear: fn( self: *const IInkTransform, HorizontalComponent: f32, VerticalComponent: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ScaleTransform: fn( self: *const IInkTransform, HorizontalMultiplier: f32, VerticalMultiplier: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTransform: fn( self: *const IInkTransform, eM11: ?*f32, eM12: ?*f32, eM21: ?*f32, eM22: ?*f32, eDx: ?*f32, eDy: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetTransform: fn( self: *const IInkTransform, eM11: f32, eM12: f32, eM21: f32, eM22: f32, eDx: f32, eDy: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_eM11: fn( self: *const IInkTransform, Value: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_eM11: fn( self: *const IInkTransform, Value: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_eM12: fn( self: *const IInkTransform, Value: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_eM12: fn( self: *const IInkTransform, Value: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_eM21: fn( self: *const IInkTransform, Value: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_eM21: fn( self: *const IInkTransform, Value: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_eM22: fn( self: *const IInkTransform, Value: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_eM22: fn( self: *const IInkTransform, Value: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_eDx: fn( self: *const IInkTransform, Value: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_eDx: fn( self: *const IInkTransform, Value: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_eDy: fn( self: *const IInkTransform, Value: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_eDy: fn( self: *const IInkTransform, Value: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Data: fn( self: *const IInkTransform, XForm: ?*XFORM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Data: fn( self: *const IInkTransform, XForm: XFORM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).Reset(@ptrCast(*const IInkTransform, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_Translate(self: *const T, HorizontalComponent: f32, VerticalComponent: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).Translate(@ptrCast(*const IInkTransform, self), HorizontalComponent, VerticalComponent); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_Rotate(self: *const T, Degrees: f32, x: f32, y: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).Rotate(@ptrCast(*const IInkTransform, self), Degrees, x, y); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_Reflect(self: *const T, Horizontally: i16, Vertically: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).Reflect(@ptrCast(*const IInkTransform, self), Horizontally, Vertically); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_Shear(self: *const T, HorizontalComponent: f32, VerticalComponent: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).Shear(@ptrCast(*const IInkTransform, self), HorizontalComponent, VerticalComponent); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_ScaleTransform(self: *const T, HorizontalMultiplier: f32, VerticalMultiplier: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).ScaleTransform(@ptrCast(*const IInkTransform, self), HorizontalMultiplier, VerticalMultiplier); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_GetTransform(self: *const T, eM11: ?*f32, eM12: ?*f32, eM21: ?*f32, eM22: ?*f32, eDx: ?*f32, eDy: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).GetTransform(@ptrCast(*const IInkTransform, self), eM11, eM12, eM21, eM22, eDx, eDy); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_SetTransform(self: *const T, eM11: f32, eM12: f32, eM21: f32, eM22: f32, eDx: f32, eDy: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).SetTransform(@ptrCast(*const IInkTransform, self), eM11, eM12, eM21, eM22, eDx, eDy); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_get_eM11(self: *const T, Value: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).get_eM11(@ptrCast(*const IInkTransform, self), Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_put_eM11(self: *const T, Value: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).put_eM11(@ptrCast(*const IInkTransform, self), Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_get_eM12(self: *const T, Value: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).get_eM12(@ptrCast(*const IInkTransform, self), Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_put_eM12(self: *const T, Value: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).put_eM12(@ptrCast(*const IInkTransform, self), Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_get_eM21(self: *const T, Value: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).get_eM21(@ptrCast(*const IInkTransform, self), Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_put_eM21(self: *const T, Value: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).put_eM21(@ptrCast(*const IInkTransform, self), Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_get_eM22(self: *const T, Value: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).get_eM22(@ptrCast(*const IInkTransform, self), Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_put_eM22(self: *const T, Value: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).put_eM22(@ptrCast(*const IInkTransform, self), Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_get_eDx(self: *const T, Value: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).get_eDx(@ptrCast(*const IInkTransform, self), Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_put_eDx(self: *const T, Value: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).put_eDx(@ptrCast(*const IInkTransform, self), Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_get_eDy(self: *const T, Value: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).get_eDy(@ptrCast(*const IInkTransform, self), Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_put_eDy(self: *const T, Value: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).put_eDy(@ptrCast(*const IInkTransform, self), Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_get_Data(self: *const T, XForm: ?*XFORM) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).get_Data(@ptrCast(*const IInkTransform, self), XForm); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTransform_put_Data(self: *const T, XForm: XFORM) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTransform.VTable, self.vtable).put_Data(@ptrCast(*const IInkTransform, self), XForm); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkGesture_Value = @import("../zig.zig").Guid.initString("3bdc0a97-04e5-4e26-b813-18f052d41def"); pub const IID_IInkGesture = &IID_IInkGesture_Value; pub const IInkGesture = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Confidence: fn( self: *const IInkGesture, Confidence: ?*InkRecognitionConfidence, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Id: fn( self: *const IInkGesture, Id: ?*InkApplicationGesture, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetHotPoint: fn( self: *const IInkGesture, X: ?*i32, Y: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkGesture_get_Confidence(self: *const T, Confidence: ?*InkRecognitionConfidence) callconv(.Inline) HRESULT { return @ptrCast(*const IInkGesture.VTable, self.vtable).get_Confidence(@ptrCast(*const IInkGesture, self), Confidence); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkGesture_get_Id(self: *const T, Id: ?*InkApplicationGesture) callconv(.Inline) HRESULT { return @ptrCast(*const IInkGesture.VTable, self.vtable).get_Id(@ptrCast(*const IInkGesture, self), Id); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkGesture_GetHotPoint(self: *const T, X: ?*i32, Y: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkGesture.VTable, self.vtable).GetHotPoint(@ptrCast(*const IInkGesture, self), X, Y); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkCursor_Value = @import("../zig.zig").Guid.initString("ad30c630-40c5-4350-8405-9c71012fc558"); pub const IID_IInkCursor = &IID_IInkCursor_Value; pub const IInkCursor = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const IInkCursor, Name: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Id: fn( self: *const IInkCursor, Id: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Inverted: fn( self: *const IInkCursor, Status: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DrawingAttributes: fn( self: *const IInkCursor, Attributes: ?*?*IInkDrawingAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_DrawingAttributes: fn( self: *const IInkCursor, Attributes: ?*IInkDrawingAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Tablet: fn( self: *const IInkCursor, Tablet: ?*?*IInkTablet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Buttons: fn( self: *const IInkCursor, Buttons: ?*?*IInkCursorButtons, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCursor_get_Name(self: *const T, Name: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCursor.VTable, self.vtable).get_Name(@ptrCast(*const IInkCursor, self), Name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCursor_get_Id(self: *const T, Id: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCursor.VTable, self.vtable).get_Id(@ptrCast(*const IInkCursor, self), Id); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCursor_get_Inverted(self: *const T, Status: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCursor.VTable, self.vtable).get_Inverted(@ptrCast(*const IInkCursor, self), Status); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCursor_get_DrawingAttributes(self: *const T, Attributes: ?*?*IInkDrawingAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCursor.VTable, self.vtable).get_DrawingAttributes(@ptrCast(*const IInkCursor, self), Attributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCursor_putref_DrawingAttributes(self: *const T, Attributes: ?*IInkDrawingAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCursor.VTable, self.vtable).putref_DrawingAttributes(@ptrCast(*const IInkCursor, self), Attributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCursor_get_Tablet(self: *const T, Tablet: ?*?*IInkTablet) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCursor.VTable, self.vtable).get_Tablet(@ptrCast(*const IInkCursor, self), Tablet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCursor_get_Buttons(self: *const T, Buttons: ?*?*IInkCursorButtons) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCursor.VTable, self.vtable).get_Buttons(@ptrCast(*const IInkCursor, self), Buttons); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkCursors_Value = @import("../zig.zig").Guid.initString("a248c1ac-c698-4e06-9e5c-d57f77c7e647"); pub const IID_IInkCursors = &IID_IInkCursors_Value; pub const IInkCursors = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const IInkCursors, Count: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IInkCursors, _NewEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Item: fn( self: *const IInkCursors, Index: i32, Cursor: ?*?*IInkCursor, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCursors_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCursors.VTable, self.vtable).get_Count(@ptrCast(*const IInkCursors, self), Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCursors_get__NewEnum(self: *const T, _NewEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCursors.VTable, self.vtable).get__NewEnum(@ptrCast(*const IInkCursors, self), _NewEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCursors_Item(self: *const T, Index: i32, Cursor: ?*?*IInkCursor) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCursors.VTable, self.vtable).Item(@ptrCast(*const IInkCursors, self), Index, Cursor); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkCursorButton_Value = @import("../zig.zig").Guid.initString("85ef9417-1d59-49b2-a13c-702c85430894"); pub const IID_IInkCursorButton = &IID_IInkCursorButton_Value; pub const IInkCursorButton = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const IInkCursorButton, Name: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Id: fn( self: *const IInkCursorButton, Id: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_State: fn( self: *const IInkCursorButton, CurrentState: ?*InkCursorButtonState, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCursorButton_get_Name(self: *const T, Name: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCursorButton.VTable, self.vtable).get_Name(@ptrCast(*const IInkCursorButton, self), Name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCursorButton_get_Id(self: *const T, Id: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCursorButton.VTable, self.vtable).get_Id(@ptrCast(*const IInkCursorButton, self), Id); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCursorButton_get_State(self: *const T, CurrentState: ?*InkCursorButtonState) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCursorButton.VTable, self.vtable).get_State(@ptrCast(*const IInkCursorButton, self), CurrentState); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkCursorButtons_Value = @import("../zig.zig").Guid.initString("3671cc40-b624-4671-9fa0-db119d952d54"); pub const IID_IInkCursorButtons = &IID_IInkCursorButtons_Value; pub const IInkCursorButtons = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const IInkCursorButtons, Count: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IInkCursorButtons, _NewEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Item: fn( self: *const IInkCursorButtons, Identifier: VARIANT, Button: ?*?*IInkCursorButton, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCursorButtons_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCursorButtons.VTable, self.vtable).get_Count(@ptrCast(*const IInkCursorButtons, self), Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCursorButtons_get__NewEnum(self: *const T, _NewEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCursorButtons.VTable, self.vtable).get__NewEnum(@ptrCast(*const IInkCursorButtons, self), _NewEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCursorButtons_Item(self: *const T, Identifier: VARIANT, Button: ?*?*IInkCursorButton) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCursorButtons.VTable, self.vtable).Item(@ptrCast(*const IInkCursorButtons, self), Identifier, Button); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkTablet_Value = @import("../zig.zig").Guid.initString("2de25eaa-6ef8-42d5-aee9-185bc81b912d"); pub const IID_IInkTablet = &IID_IInkTablet_Value; pub const IInkTablet = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const IInkTablet, Name: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PlugAndPlayId: fn( self: *const IInkTablet, Id: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MaximumInputRectangle: fn( self: *const IInkTablet, Rectangle: ?*?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_HardwareCapabilities: fn( self: *const IInkTablet, Capabilities: ?*TabletHardwareCapabilities, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsPacketPropertySupported: fn( self: *const IInkTablet, packetPropertyName: ?BSTR, Supported: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPropertyMetrics: fn( self: *const IInkTablet, propertyName: ?BSTR, Minimum: ?*i32, Maximum: ?*i32, Units: ?*TabletPropertyMetricUnit, Resolution: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTablet_get_Name(self: *const T, Name: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTablet.VTable, self.vtable).get_Name(@ptrCast(*const IInkTablet, self), Name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTablet_get_PlugAndPlayId(self: *const T, Id: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTablet.VTable, self.vtable).get_PlugAndPlayId(@ptrCast(*const IInkTablet, self), Id); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTablet_get_MaximumInputRectangle(self: *const T, Rectangle: ?*?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTablet.VTable, self.vtable).get_MaximumInputRectangle(@ptrCast(*const IInkTablet, self), Rectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTablet_get_HardwareCapabilities(self: *const T, Capabilities: ?*TabletHardwareCapabilities) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTablet.VTable, self.vtable).get_HardwareCapabilities(@ptrCast(*const IInkTablet, self), Capabilities); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTablet_IsPacketPropertySupported(self: *const T, packetPropertyName: ?BSTR, Supported: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTablet.VTable, self.vtable).IsPacketPropertySupported(@ptrCast(*const IInkTablet, self), packetPropertyName, Supported); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTablet_GetPropertyMetrics(self: *const T, propertyName: ?BSTR, Minimum: ?*i32, Maximum: ?*i32, Units: ?*TabletPropertyMetricUnit, Resolution: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTablet.VTable, self.vtable).GetPropertyMetrics(@ptrCast(*const IInkTablet, self), propertyName, Minimum, Maximum, Units, Resolution); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkTablet2_Value = @import("../zig.zig").Guid.initString("90c91ad2-fa36-49d6-9516-ce8d570f6f85"); pub const IID_IInkTablet2 = &IID_IInkTablet2_Value; pub const IInkTablet2 = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DeviceKind: fn( self: *const IInkTablet2, Kind: ?*TabletDeviceKind, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTablet2_get_DeviceKind(self: *const T, Kind: ?*TabletDeviceKind) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTablet2.VTable, self.vtable).get_DeviceKind(@ptrCast(*const IInkTablet2, self), Kind); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IInkTablet3_Value = @import("../zig.zig").Guid.initString("7e313997-1327-41dd-8ca9-79f24be17250"); pub const IID_IInkTablet3 = &IID_IInkTablet3_Value; pub const IInkTablet3 = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_IsMultiTouch: fn( self: *const IInkTablet3, pIsMultiTouch: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MaximumCursors: fn( self: *const IInkTablet3, pMaximumCursors: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTablet3_get_IsMultiTouch(self: *const T, pIsMultiTouch: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTablet3.VTable, self.vtable).get_IsMultiTouch(@ptrCast(*const IInkTablet3, self), pIsMultiTouch); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTablet3_get_MaximumCursors(self: *const T, pMaximumCursors: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTablet3.VTable, self.vtable).get_MaximumCursors(@ptrCast(*const IInkTablet3, self), pMaximumCursors); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInkTablets_Value = @import("../zig.zig").Guid.initString("112086d9-7779-4535-a699-862b43ac1863"); pub const IID_IInkTablets = &IID_IInkTablets_Value; pub const IInkTablets = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const IInkTablets, Count: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IInkTablets, _NewEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DefaultTablet: fn( self: *const IInkTablets, DefaultTablet: ?*?*IInkTablet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Item: fn( self: *const IInkTablets, Index: i32, Tablet: ?*?*IInkTablet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsPacketPropertySupported: fn( self: *const IInkTablets, packetPropertyName: ?BSTR, Supported: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTablets_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTablets.VTable, self.vtable).get_Count(@ptrCast(*const IInkTablets, self), Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTablets_get__NewEnum(self: *const T, _NewEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTablets.VTable, self.vtable).get__NewEnum(@ptrCast(*const IInkTablets, self), _NewEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTablets_get_DefaultTablet(self: *const T, DefaultTablet: ?*?*IInkTablet) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTablets.VTable, self.vtable).get_DefaultTablet(@ptrCast(*const IInkTablets, self), DefaultTablet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTablets_Item(self: *const T, Index: i32, Tablet: ?*?*IInkTablet) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTablets.VTable, self.vtable).Item(@ptrCast(*const IInkTablets, self), Index, Tablet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkTablets_IsPacketPropertySupported(self: *const T, packetPropertyName: ?BSTR, Supported: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkTablets.VTable, self.vtable).IsPacketPropertySupported(@ptrCast(*const IInkTablets, self), packetPropertyName, Supported); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkStrokeDisp_Value = @import("../zig.zig").Guid.initString("43242fea-91d1-4a72-963e-fbb91829cfa2"); pub const IID_IInkStrokeDisp = &IID_IInkStrokeDisp_Value; pub const IInkStrokeDisp = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ID: fn( self: *const IInkStrokeDisp, ID: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_BezierPoints: fn( self: *const IInkStrokeDisp, Points: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DrawingAttributes: fn( self: *const IInkStrokeDisp, DrawAttrs: ?*?*IInkDrawingAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_DrawingAttributes: fn( self: *const IInkStrokeDisp, DrawAttrs: ?*IInkDrawingAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Ink: fn( self: *const IInkStrokeDisp, Ink: ?*?*IInkDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ExtendedProperties: fn( self: *const IInkStrokeDisp, Properties: ?*?*IInkExtendedProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PolylineCusps: fn( self: *const IInkStrokeDisp, Cusps: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_BezierCusps: fn( self: *const IInkStrokeDisp, Cusps: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SelfIntersections: fn( self: *const IInkStrokeDisp, Intersections: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PacketCount: fn( self: *const IInkStrokeDisp, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PacketSize: fn( self: *const IInkStrokeDisp, plSize: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PacketDescription: fn( self: *const IInkStrokeDisp, PacketDescription: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Deleted: fn( self: *const IInkStrokeDisp, Deleted: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBoundingBox: fn( self: *const IInkStrokeDisp, BoundingBoxMode: InkBoundingBoxMode, Rectangle: ?*?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FindIntersections: fn( self: *const IInkStrokeDisp, Strokes: ?*IInkStrokes, Intersections: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRectangleIntersections: fn( self: *const IInkStrokeDisp, Rectangle: ?*IInkRectangle, Intersections: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clip: fn( self: *const IInkStrokeDisp, Rectangle: ?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, HitTestCircle: fn( self: *const IInkStrokeDisp, X: i32, Y: i32, Radius: f32, Intersects: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, NearestPoint: fn( self: *const IInkStrokeDisp, X: i32, Y: i32, Distance: ?*f32, Point: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Split: fn( self: *const IInkStrokeDisp, SplitAt: f32, NewStroke: ?*?*IInkStrokeDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPacketDescriptionPropertyMetrics: fn( self: *const IInkStrokeDisp, PropertyName: ?BSTR, Minimum: ?*i32, Maximum: ?*i32, Units: ?*TabletPropertyMetricUnit, Resolution: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPoints: fn( self: *const IInkStrokeDisp, Index: i32, Count: i32, Points: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetPoints: fn( self: *const IInkStrokeDisp, Points: VARIANT, Index: i32, Count: i32, NumberOfPointsSet: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPacketData: fn( self: *const IInkStrokeDisp, Index: i32, Count: i32, PacketData: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPacketValuesByProperty: fn( self: *const IInkStrokeDisp, PropertyName: ?BSTR, Index: i32, Count: i32, PacketValues: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetPacketValuesByProperty: fn( self: *const IInkStrokeDisp, bstrPropertyName: ?BSTR, PacketValues: VARIANT, Index: i32, Count: i32, NumberOfPacketsSet: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFlattenedBezierPoints: fn( self: *const IInkStrokeDisp, FittingError: i32, FlattenedBezierPoints: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Transform: fn( self: *const IInkStrokeDisp, Transform: ?*IInkTransform, ApplyOnPenWidth: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ScaleToRectangle: fn( self: *const IInkStrokeDisp, Rectangle: ?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Move: fn( self: *const IInkStrokeDisp, HorizontalComponent: f32, VerticalComponent: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Rotate: fn( self: *const IInkStrokeDisp, Degrees: f32, x: f32, y: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Shear: fn( self: *const IInkStrokeDisp, HorizontalMultiplier: f32, VerticalMultiplier: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ScaleTransform: fn( self: *const IInkStrokeDisp, HorizontalMultiplier: f32, VerticalMultiplier: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_get_ID(self: *const T, ID: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).get_ID(@ptrCast(*const IInkStrokeDisp, self), ID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_get_BezierPoints(self: *const T, Points: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).get_BezierPoints(@ptrCast(*const IInkStrokeDisp, self), Points); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_get_DrawingAttributes(self: *const T, DrawAttrs: ?*?*IInkDrawingAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).get_DrawingAttributes(@ptrCast(*const IInkStrokeDisp, self), DrawAttrs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_putref_DrawingAttributes(self: *const T, DrawAttrs: ?*IInkDrawingAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).putref_DrawingAttributes(@ptrCast(*const IInkStrokeDisp, self), DrawAttrs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_get_Ink(self: *const T, Ink: ?*?*IInkDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).get_Ink(@ptrCast(*const IInkStrokeDisp, self), Ink); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_get_ExtendedProperties(self: *const T, Properties: ?*?*IInkExtendedProperties) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).get_ExtendedProperties(@ptrCast(*const IInkStrokeDisp, self), Properties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_get_PolylineCusps(self: *const T, Cusps: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).get_PolylineCusps(@ptrCast(*const IInkStrokeDisp, self), Cusps); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_get_BezierCusps(self: *const T, Cusps: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).get_BezierCusps(@ptrCast(*const IInkStrokeDisp, self), Cusps); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_get_SelfIntersections(self: *const T, Intersections: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).get_SelfIntersections(@ptrCast(*const IInkStrokeDisp, self), Intersections); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_get_PacketCount(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).get_PacketCount(@ptrCast(*const IInkStrokeDisp, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_get_PacketSize(self: *const T, plSize: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).get_PacketSize(@ptrCast(*const IInkStrokeDisp, self), plSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_get_PacketDescription(self: *const T, PacketDescription: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).get_PacketDescription(@ptrCast(*const IInkStrokeDisp, self), PacketDescription); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_get_Deleted(self: *const T, Deleted: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).get_Deleted(@ptrCast(*const IInkStrokeDisp, self), Deleted); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_GetBoundingBox(self: *const T, BoundingBoxMode: InkBoundingBoxMode, Rectangle: ?*?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).GetBoundingBox(@ptrCast(*const IInkStrokeDisp, self), BoundingBoxMode, Rectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_FindIntersections(self: *const T, Strokes: ?*IInkStrokes, Intersections: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).FindIntersections(@ptrCast(*const IInkStrokeDisp, self), Strokes, Intersections); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_GetRectangleIntersections(self: *const T, Rectangle: ?*IInkRectangle, Intersections: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).GetRectangleIntersections(@ptrCast(*const IInkStrokeDisp, self), Rectangle, Intersections); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_Clip(self: *const T, Rectangle: ?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).Clip(@ptrCast(*const IInkStrokeDisp, self), Rectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_HitTestCircle(self: *const T, X: i32, Y: i32, Radius: f32, Intersects: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).HitTestCircle(@ptrCast(*const IInkStrokeDisp, self), X, Y, Radius, Intersects); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_NearestPoint(self: *const T, X: i32, Y: i32, Distance: ?*f32, Point: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).NearestPoint(@ptrCast(*const IInkStrokeDisp, self), X, Y, Distance, Point); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_Split(self: *const T, SplitAt: f32, NewStroke: ?*?*IInkStrokeDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).Split(@ptrCast(*const IInkStrokeDisp, self), SplitAt, NewStroke); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_GetPacketDescriptionPropertyMetrics(self: *const T, PropertyName: ?BSTR, Minimum: ?*i32, Maximum: ?*i32, Units: ?*TabletPropertyMetricUnit, Resolution: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).GetPacketDescriptionPropertyMetrics(@ptrCast(*const IInkStrokeDisp, self), PropertyName, Minimum, Maximum, Units, Resolution); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_GetPoints(self: *const T, Index: i32, Count: i32, Points: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).GetPoints(@ptrCast(*const IInkStrokeDisp, self), Index, Count, Points); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_SetPoints(self: *const T, Points: VARIANT, Index: i32, Count: i32, NumberOfPointsSet: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).SetPoints(@ptrCast(*const IInkStrokeDisp, self), Points, Index, Count, NumberOfPointsSet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_GetPacketData(self: *const T, Index: i32, Count: i32, PacketData: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).GetPacketData(@ptrCast(*const IInkStrokeDisp, self), Index, Count, PacketData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_GetPacketValuesByProperty(self: *const T, PropertyName: ?BSTR, Index: i32, Count: i32, PacketValues: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).GetPacketValuesByProperty(@ptrCast(*const IInkStrokeDisp, self), PropertyName, Index, Count, PacketValues); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_SetPacketValuesByProperty(self: *const T, bstrPropertyName: ?BSTR, PacketValues: VARIANT, Index: i32, Count: i32, NumberOfPacketsSet: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).SetPacketValuesByProperty(@ptrCast(*const IInkStrokeDisp, self), bstrPropertyName, PacketValues, Index, Count, NumberOfPacketsSet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_GetFlattenedBezierPoints(self: *const T, FittingError: i32, FlattenedBezierPoints: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).GetFlattenedBezierPoints(@ptrCast(*const IInkStrokeDisp, self), FittingError, FlattenedBezierPoints); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_Transform(self: *const T, Transform: ?*IInkTransform, ApplyOnPenWidth: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).Transform(@ptrCast(*const IInkStrokeDisp, self), Transform, ApplyOnPenWidth); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_ScaleToRectangle(self: *const T, Rectangle: ?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).ScaleToRectangle(@ptrCast(*const IInkStrokeDisp, self), Rectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_Move(self: *const T, HorizontalComponent: f32, VerticalComponent: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).Move(@ptrCast(*const IInkStrokeDisp, self), HorizontalComponent, VerticalComponent); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_Rotate(self: *const T, Degrees: f32, x: f32, y: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).Rotate(@ptrCast(*const IInkStrokeDisp, self), Degrees, x, y); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_Shear(self: *const T, HorizontalMultiplier: f32, VerticalMultiplier: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).Shear(@ptrCast(*const IInkStrokeDisp, self), HorizontalMultiplier, VerticalMultiplier); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokeDisp_ScaleTransform(self: *const T, HorizontalMultiplier: f32, VerticalMultiplier: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokeDisp.VTable, self.vtable).ScaleTransform(@ptrCast(*const IInkStrokeDisp, self), HorizontalMultiplier, VerticalMultiplier); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInkStrokes_Value = @import("../zig.zig").Guid.initString("f1f4c9d8-590a-4963-b3ae-1935671bb6f3"); pub const IID_IInkStrokes = &IID_IInkStrokes_Value; pub const IInkStrokes = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const IInkStrokes, Count: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IInkStrokes, _NewEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Ink: fn( self: *const IInkStrokes, Ink: ?*?*IInkDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RecognitionResult: fn( self: *const IInkStrokes, RecognitionResult: ?*?*IInkRecognitionResult, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ToString: fn( self: *const IInkStrokes, ToString: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Item: fn( self: *const IInkStrokes, Index: i32, Stroke: ?*?*IInkStrokeDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Add: fn( self: *const IInkStrokes, InkStroke: ?*IInkStrokeDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddStrokes: fn( self: *const IInkStrokes, InkStrokes: ?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Remove: fn( self: *const IInkStrokes, InkStroke: ?*IInkStrokeDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveStrokes: fn( self: *const IInkStrokes, InkStrokes: ?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ModifyDrawingAttributes: fn( self: *const IInkStrokes, DrawAttrs: ?*IInkDrawingAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBoundingBox: fn( self: *const IInkStrokes, BoundingBoxMode: InkBoundingBoxMode, BoundingBox: ?*?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Transform: fn( self: *const IInkStrokes, Transform: ?*IInkTransform, ApplyOnPenWidth: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ScaleToRectangle: fn( self: *const IInkStrokes, Rectangle: ?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Move: fn( self: *const IInkStrokes, HorizontalComponent: f32, VerticalComponent: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Rotate: fn( self: *const IInkStrokes, Degrees: f32, x: f32, y: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Shear: fn( self: *const IInkStrokes, HorizontalMultiplier: f32, VerticalMultiplier: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ScaleTransform: fn( self: *const IInkStrokes, HorizontalMultiplier: f32, VerticalMultiplier: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clip: fn( self: *const IInkStrokes, Rectangle: ?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveRecognitionResult: fn( self: *const IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).get_Count(@ptrCast(*const IInkStrokes, self), Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_get__NewEnum(self: *const T, _NewEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).get__NewEnum(@ptrCast(*const IInkStrokes, self), _NewEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_get_Ink(self: *const T, Ink: ?*?*IInkDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).get_Ink(@ptrCast(*const IInkStrokes, self), Ink); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_get_RecognitionResult(self: *const T, RecognitionResult: ?*?*IInkRecognitionResult) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).get_RecognitionResult(@ptrCast(*const IInkStrokes, self), RecognitionResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_ToString(self: *const T, ToString: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).ToString(@ptrCast(*const IInkStrokes, self), ToString); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_Item(self: *const T, Index: i32, Stroke: ?*?*IInkStrokeDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).Item(@ptrCast(*const IInkStrokes, self), Index, Stroke); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_Add(self: *const T, InkStroke: ?*IInkStrokeDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).Add(@ptrCast(*const IInkStrokes, self), InkStroke); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_AddStrokes(self: *const T, InkStrokes: ?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).AddStrokes(@ptrCast(*const IInkStrokes, self), InkStrokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_Remove(self: *const T, InkStroke: ?*IInkStrokeDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).Remove(@ptrCast(*const IInkStrokes, self), InkStroke); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_RemoveStrokes(self: *const T, InkStrokes: ?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).RemoveStrokes(@ptrCast(*const IInkStrokes, self), InkStrokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_ModifyDrawingAttributes(self: *const T, DrawAttrs: ?*IInkDrawingAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).ModifyDrawingAttributes(@ptrCast(*const IInkStrokes, self), DrawAttrs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_GetBoundingBox(self: *const T, BoundingBoxMode: InkBoundingBoxMode, BoundingBox: ?*?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).GetBoundingBox(@ptrCast(*const IInkStrokes, self), BoundingBoxMode, BoundingBox); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_Transform(self: *const T, Transform: ?*IInkTransform, ApplyOnPenWidth: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).Transform(@ptrCast(*const IInkStrokes, self), Transform, ApplyOnPenWidth); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_ScaleToRectangle(self: *const T, Rectangle: ?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).ScaleToRectangle(@ptrCast(*const IInkStrokes, self), Rectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_Move(self: *const T, HorizontalComponent: f32, VerticalComponent: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).Move(@ptrCast(*const IInkStrokes, self), HorizontalComponent, VerticalComponent); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_Rotate(self: *const T, Degrees: f32, x: f32, y: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).Rotate(@ptrCast(*const IInkStrokes, self), Degrees, x, y); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_Shear(self: *const T, HorizontalMultiplier: f32, VerticalMultiplier: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).Shear(@ptrCast(*const IInkStrokes, self), HorizontalMultiplier, VerticalMultiplier); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_ScaleTransform(self: *const T, HorizontalMultiplier: f32, VerticalMultiplier: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).ScaleTransform(@ptrCast(*const IInkStrokes, self), HorizontalMultiplier, VerticalMultiplier); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_Clip(self: *const T, Rectangle: ?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).Clip(@ptrCast(*const IInkStrokes, self), Rectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkStrokes_RemoveRecognitionResult(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IInkStrokes.VTable, self.vtable).RemoveRecognitionResult(@ptrCast(*const IInkStrokes, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkCustomStrokes_Value = @import("../zig.zig").Guid.initString("7e23a88f-c30e-420f-9bdb-28902543f0c1"); pub const IID_IInkCustomStrokes = &IID_IInkCustomStrokes_Value; pub const IInkCustomStrokes = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const IInkCustomStrokes, Count: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IInkCustomStrokes, _NewEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Item: fn( self: *const IInkCustomStrokes, Identifier: VARIANT, Strokes: ?*?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Add: fn( self: *const IInkCustomStrokes, Name: ?BSTR, Strokes: ?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Remove: fn( self: *const IInkCustomStrokes, Identifier: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clear: fn( self: *const IInkCustomStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCustomStrokes_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCustomStrokes.VTable, self.vtable).get_Count(@ptrCast(*const IInkCustomStrokes, self), Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCustomStrokes_get__NewEnum(self: *const T, _NewEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCustomStrokes.VTable, self.vtable).get__NewEnum(@ptrCast(*const IInkCustomStrokes, self), _NewEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCustomStrokes_Item(self: *const T, Identifier: VARIANT, Strokes: ?*?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCustomStrokes.VTable, self.vtable).Item(@ptrCast(*const IInkCustomStrokes, self), Identifier, Strokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCustomStrokes_Add(self: *const T, Name: ?BSTR, Strokes: ?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCustomStrokes.VTable, self.vtable).Add(@ptrCast(*const IInkCustomStrokes, self), Name, Strokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCustomStrokes_Remove(self: *const T, Identifier: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCustomStrokes.VTable, self.vtable).Remove(@ptrCast(*const IInkCustomStrokes, self), Identifier); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCustomStrokes_Clear(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCustomStrokes.VTable, self.vtable).Clear(@ptrCast(*const IInkCustomStrokes, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID__IInkStrokesEvents_Value = @import("../zig.zig").Guid.initString("f33053ec-5d25-430a-928f-76a6491dde15"); pub const IID__IInkStrokesEvents = &IID__IInkStrokesEvents_Value; pub const _IInkStrokesEvents = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; const IID_IInkDisp_Value = @import("../zig.zig").Guid.initString("9d398fa0-c4e2-4fcd-9973-975caaf47ea6"); pub const IID_IInkDisp = &IID_IInkDisp_Value; pub const IInkDisp = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Strokes: fn( self: *const IInkDisp, Strokes: ?*?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ExtendedProperties: fn( self: *const IInkDisp, Properties: ?*?*IInkExtendedProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Dirty: fn( self: *const IInkDisp, Dirty: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Dirty: fn( self: *const IInkDisp, Dirty: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CustomStrokes: fn( self: *const IInkDisp, ppunkInkCustomStrokes: ?*?*IInkCustomStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBoundingBox: fn( self: *const IInkDisp, BoundingBoxMode: InkBoundingBoxMode, Rectangle: ?*?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteStrokes: fn( self: *const IInkDisp, Strokes: ?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteStroke: fn( self: *const IInkDisp, Stroke: ?*IInkStrokeDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ExtractStrokes: fn( self: *const IInkDisp, Strokes: ?*IInkStrokes, ExtractFlags: InkExtractFlags, ExtractedInk: ?*?*IInkDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ExtractWithRectangle: fn( self: *const IInkDisp, Rectangle: ?*IInkRectangle, extractFlags: InkExtractFlags, ExtractedInk: ?*?*IInkDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clip: fn( self: *const IInkDisp, Rectangle: ?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IInkDisp, NewInk: ?*?*IInkDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, HitTestCircle: fn( self: *const IInkDisp, X: i32, Y: i32, radius: f32, Strokes: ?*?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, HitTestWithRectangle: fn( self: *const IInkDisp, SelectionRectangle: ?*IInkRectangle, IntersectPercent: f32, Strokes: ?*?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, HitTestWithLasso: fn( self: *const IInkDisp, Points: VARIANT, IntersectPercent: f32, LassoPoints: ?*VARIANT, Strokes: ?*?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, NearestPoint: fn( self: *const IInkDisp, X: i32, Y: i32, PointOnStroke: ?*f32, DistanceFromPacket: ?*f32, Stroke: ?*?*IInkStrokeDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateStrokes: fn( self: *const IInkDisp, StrokeIds: VARIANT, Strokes: ?*?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddStrokesAtRectangle: fn( self: *const IInkDisp, SourceStrokes: ?*IInkStrokes, TargetRectangle: ?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Save: fn( self: *const IInkDisp, PersistenceFormat: InkPersistenceFormat, CompressionMode: InkPersistenceCompressionMode, Data: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Load: fn( self: *const IInkDisp, Data: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateStroke: fn( self: *const IInkDisp, PacketData: VARIANT, PacketDescription: VARIANT, Stroke: ?*?*IInkStrokeDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ClipboardCopyWithRectangle: fn( self: *const IInkDisp, Rectangle: ?*IInkRectangle, ClipboardFormats: InkClipboardFormats, ClipboardModes: InkClipboardModes, DataObject: ?*?*IDataObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ClipboardCopy: fn( self: *const IInkDisp, strokes: ?*IInkStrokes, ClipboardFormats: InkClipboardFormats, ClipboardModes: InkClipboardModes, DataObject: ?*?*IDataObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CanPaste: fn( self: *const IInkDisp, DataObject: ?*IDataObject, CanPaste: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ClipboardPaste: fn( self: *const IInkDisp, x: i32, y: i32, DataObject: ?*IDataObject, Strokes: ?*?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_get_Strokes(self: *const T, Strokes: ?*?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).get_Strokes(@ptrCast(*const IInkDisp, self), Strokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_get_ExtendedProperties(self: *const T, Properties: ?*?*IInkExtendedProperties) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).get_ExtendedProperties(@ptrCast(*const IInkDisp, self), Properties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_get_Dirty(self: *const T, Dirty: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).get_Dirty(@ptrCast(*const IInkDisp, self), Dirty); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_put_Dirty(self: *const T, Dirty: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).put_Dirty(@ptrCast(*const IInkDisp, self), Dirty); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_get_CustomStrokes(self: *const T, ppunkInkCustomStrokes: ?*?*IInkCustomStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).get_CustomStrokes(@ptrCast(*const IInkDisp, self), ppunkInkCustomStrokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_GetBoundingBox(self: *const T, BoundingBoxMode: InkBoundingBoxMode, Rectangle: ?*?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).GetBoundingBox(@ptrCast(*const IInkDisp, self), BoundingBoxMode, Rectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_DeleteStrokes(self: *const T, Strokes: ?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).DeleteStrokes(@ptrCast(*const IInkDisp, self), Strokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_DeleteStroke(self: *const T, Stroke: ?*IInkStrokeDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).DeleteStroke(@ptrCast(*const IInkDisp, self), Stroke); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_ExtractStrokes(self: *const T, Strokes: ?*IInkStrokes, ExtractFlags: InkExtractFlags, ExtractedInk: ?*?*IInkDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).ExtractStrokes(@ptrCast(*const IInkDisp, self), Strokes, ExtractFlags, ExtractedInk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_ExtractWithRectangle(self: *const T, Rectangle: ?*IInkRectangle, extractFlags: InkExtractFlags, ExtractedInk: ?*?*IInkDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).ExtractWithRectangle(@ptrCast(*const IInkDisp, self), Rectangle, extractFlags, ExtractedInk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_Clip(self: *const T, Rectangle: ?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).Clip(@ptrCast(*const IInkDisp, self), Rectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_Clone(self: *const T, NewInk: ?*?*IInkDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).Clone(@ptrCast(*const IInkDisp, self), NewInk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_HitTestCircle(self: *const T, X: i32, Y: i32, radius: f32, Strokes: ?*?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).HitTestCircle(@ptrCast(*const IInkDisp, self), X, Y, radius, Strokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_HitTestWithRectangle(self: *const T, SelectionRectangle: ?*IInkRectangle, IntersectPercent: f32, Strokes: ?*?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).HitTestWithRectangle(@ptrCast(*const IInkDisp, self), SelectionRectangle, IntersectPercent, Strokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_HitTestWithLasso(self: *const T, Points: VARIANT, IntersectPercent: f32, LassoPoints: ?*VARIANT, Strokes: ?*?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).HitTestWithLasso(@ptrCast(*const IInkDisp, self), Points, IntersectPercent, LassoPoints, Strokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_NearestPoint(self: *const T, X: i32, Y: i32, PointOnStroke: ?*f32, DistanceFromPacket: ?*f32, Stroke: ?*?*IInkStrokeDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).NearestPoint(@ptrCast(*const IInkDisp, self), X, Y, PointOnStroke, DistanceFromPacket, Stroke); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_CreateStrokes(self: *const T, StrokeIds: VARIANT, Strokes: ?*?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).CreateStrokes(@ptrCast(*const IInkDisp, self), StrokeIds, Strokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_AddStrokesAtRectangle(self: *const T, SourceStrokes: ?*IInkStrokes, TargetRectangle: ?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).AddStrokesAtRectangle(@ptrCast(*const IInkDisp, self), SourceStrokes, TargetRectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_Save(self: *const T, PersistenceFormat: InkPersistenceFormat, CompressionMode: InkPersistenceCompressionMode, Data: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).Save(@ptrCast(*const IInkDisp, self), PersistenceFormat, CompressionMode, Data); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_Load(self: *const T, Data: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).Load(@ptrCast(*const IInkDisp, self), Data); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_CreateStroke(self: *const T, PacketData: VARIANT, PacketDescription: VARIANT, Stroke: ?*?*IInkStrokeDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).CreateStroke(@ptrCast(*const IInkDisp, self), PacketData, PacketDescription, Stroke); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_ClipboardCopyWithRectangle(self: *const T, Rectangle: ?*IInkRectangle, ClipboardFormats: InkClipboardFormats, ClipboardModes: InkClipboardModes, DataObject: ?*?*IDataObject) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).ClipboardCopyWithRectangle(@ptrCast(*const IInkDisp, self), Rectangle, ClipboardFormats, ClipboardModes, DataObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_ClipboardCopy(self: *const T, strokes: ?*IInkStrokes, ClipboardFormats: InkClipboardFormats, ClipboardModes: InkClipboardModes, DataObject: ?*?*IDataObject) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).ClipboardCopy(@ptrCast(*const IInkDisp, self), strokes, ClipboardFormats, ClipboardModes, DataObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_CanPaste(self: *const T, DataObject: ?*IDataObject, CanPaste: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).CanPaste(@ptrCast(*const IInkDisp, self), DataObject, CanPaste); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDisp_ClipboardPaste(self: *const T, x: i32, y: i32, DataObject: ?*IDataObject, Strokes: ?*?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDisp.VTable, self.vtable).ClipboardPaste(@ptrCast(*const IInkDisp, self), x, y, DataObject, Strokes); } };} pub usingnamespace MethodMixin(@This()); }; const IID__IInkEvents_Value = @import("../zig.zig").Guid.initString("427b1865-ca3f-479a-83a9-0f420f2a0073"); pub const IID__IInkEvents = &IID__IInkEvents_Value; pub const _IInkEvents = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; const IID_IInkRenderer_Value = @import("../zig.zig").Guid.initString("e6257a9c-b511-4f4c-a8b0-a7dbc9506b83"); pub const IID_IInkRenderer = &IID_IInkRenderer_Value; pub const IInkRenderer = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, GetViewTransform: fn( self: *const IInkRenderer, ViewTransform: ?*IInkTransform, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetViewTransform: fn( self: *const IInkRenderer, ViewTransform: ?*IInkTransform, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetObjectTransform: fn( self: *const IInkRenderer, ObjectTransform: ?*IInkTransform, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetObjectTransform: fn( self: *const IInkRenderer, ObjectTransform: ?*IInkTransform, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Draw: fn( self: *const IInkRenderer, hDC: isize, Strokes: ?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DrawStroke: fn( self: *const IInkRenderer, hDC: isize, Stroke: ?*IInkStrokeDisp, DrawingAttributes: ?*IInkDrawingAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PixelToInkSpace: fn( self: *const IInkRenderer, hDC: isize, x: ?*i32, y: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InkSpaceToPixel: fn( self: *const IInkRenderer, hdcDisplay: isize, x: ?*i32, y: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PixelToInkSpaceFromPoints: fn( self: *const IInkRenderer, hDC: isize, Points: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InkSpaceToPixelFromPoints: fn( self: *const IInkRenderer, hDC: isize, Points: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Measure: fn( self: *const IInkRenderer, Strokes: ?*IInkStrokes, Rectangle: ?*?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MeasureStroke: fn( self: *const IInkRenderer, Stroke: ?*IInkStrokeDisp, DrawingAttributes: ?*IInkDrawingAttributes, Rectangle: ?*?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Move: fn( self: *const IInkRenderer, HorizontalComponent: f32, VerticalComponent: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Rotate: fn( self: *const IInkRenderer, Degrees: f32, x: f32, y: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ScaleTransform: fn( self: *const IInkRenderer, HorizontalMultiplier: f32, VerticalMultiplier: f32, ApplyOnPenWidth: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRenderer_GetViewTransform(self: *const T, ViewTransform: ?*IInkTransform) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRenderer.VTable, self.vtable).GetViewTransform(@ptrCast(*const IInkRenderer, self), ViewTransform); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRenderer_SetViewTransform(self: *const T, ViewTransform: ?*IInkTransform) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRenderer.VTable, self.vtable).SetViewTransform(@ptrCast(*const IInkRenderer, self), ViewTransform); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRenderer_GetObjectTransform(self: *const T, ObjectTransform: ?*IInkTransform) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRenderer.VTable, self.vtable).GetObjectTransform(@ptrCast(*const IInkRenderer, self), ObjectTransform); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRenderer_SetObjectTransform(self: *const T, ObjectTransform: ?*IInkTransform) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRenderer.VTable, self.vtable).SetObjectTransform(@ptrCast(*const IInkRenderer, self), ObjectTransform); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRenderer_Draw(self: *const T, hDC: isize, Strokes: ?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRenderer.VTable, self.vtable).Draw(@ptrCast(*const IInkRenderer, self), hDC, Strokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRenderer_DrawStroke(self: *const T, hDC: isize, Stroke: ?*IInkStrokeDisp, DrawingAttributes: ?*IInkDrawingAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRenderer.VTable, self.vtable).DrawStroke(@ptrCast(*const IInkRenderer, self), hDC, Stroke, DrawingAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRenderer_PixelToInkSpace(self: *const T, hDC: isize, x: ?*i32, y: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRenderer.VTable, self.vtable).PixelToInkSpace(@ptrCast(*const IInkRenderer, self), hDC, x, y); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRenderer_InkSpaceToPixel(self: *const T, hdcDisplay: isize, x: ?*i32, y: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRenderer.VTable, self.vtable).InkSpaceToPixel(@ptrCast(*const IInkRenderer, self), hdcDisplay, x, y); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRenderer_PixelToInkSpaceFromPoints(self: *const T, hDC: isize, Points: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRenderer.VTable, self.vtable).PixelToInkSpaceFromPoints(@ptrCast(*const IInkRenderer, self), hDC, Points); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRenderer_InkSpaceToPixelFromPoints(self: *const T, hDC: isize, Points: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRenderer.VTable, self.vtable).InkSpaceToPixelFromPoints(@ptrCast(*const IInkRenderer, self), hDC, Points); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRenderer_Measure(self: *const T, Strokes: ?*IInkStrokes, Rectangle: ?*?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRenderer.VTable, self.vtable).Measure(@ptrCast(*const IInkRenderer, self), Strokes, Rectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRenderer_MeasureStroke(self: *const T, Stroke: ?*IInkStrokeDisp, DrawingAttributes: ?*IInkDrawingAttributes, Rectangle: ?*?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRenderer.VTable, self.vtable).MeasureStroke(@ptrCast(*const IInkRenderer, self), Stroke, DrawingAttributes, Rectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRenderer_Move(self: *const T, HorizontalComponent: f32, VerticalComponent: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRenderer.VTable, self.vtable).Move(@ptrCast(*const IInkRenderer, self), HorizontalComponent, VerticalComponent); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRenderer_Rotate(self: *const T, Degrees: f32, x: f32, y: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRenderer.VTable, self.vtable).Rotate(@ptrCast(*const IInkRenderer, self), Degrees, x, y); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRenderer_ScaleTransform(self: *const T, HorizontalMultiplier: f32, VerticalMultiplier: f32, ApplyOnPenWidth: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRenderer.VTable, self.vtable).ScaleTransform(@ptrCast(*const IInkRenderer, self), HorizontalMultiplier, VerticalMultiplier, ApplyOnPenWidth); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInkCollector_Value = @import("../zig.zig").Guid.initString("f0f060b5-8b1f-4a7c-89ec-880692588a4f"); pub const IID_IInkCollector = &IID_IInkCollector_Value; pub const IInkCollector = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_hWnd: fn( self: *const IInkCollector, CurrentWindow: ?*isize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_hWnd: fn( self: *const IInkCollector, NewWindow: isize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Enabled: fn( self: *const IInkCollector, Collecting: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Enabled: fn( self: *const IInkCollector, Collecting: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DefaultDrawingAttributes: fn( self: *const IInkCollector, CurrentAttributes: ?*?*IInkDrawingAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_DefaultDrawingAttributes: fn( self: *const IInkCollector, NewAttributes: ?*IInkDrawingAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Renderer: fn( self: *const IInkCollector, CurrentInkRenderer: ?*?*IInkRenderer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_Renderer: fn( self: *const IInkCollector, NewInkRenderer: ?*IInkRenderer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Ink: fn( self: *const IInkCollector, Ink: ?*?*IInkDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_Ink: fn( self: *const IInkCollector, NewInk: ?*IInkDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AutoRedraw: fn( self: *const IInkCollector, AutoRedraw: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AutoRedraw: fn( self: *const IInkCollector, AutoRedraw: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CollectingInk: fn( self: *const IInkCollector, Collecting: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CollectionMode: fn( self: *const IInkCollector, Mode: ?*InkCollectionMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_CollectionMode: fn( self: *const IInkCollector, Mode: InkCollectionMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DynamicRendering: fn( self: *const IInkCollector, Enabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DynamicRendering: fn( self: *const IInkCollector, Enabled: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DesiredPacketDescription: fn( self: *const IInkCollector, PacketGuids: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DesiredPacketDescription: fn( self: *const IInkCollector, PacketGuids: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MouseIcon: fn( self: *const IInkCollector, MouseIcon: ?*?*IPictureDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MouseIcon: fn( self: *const IInkCollector, MouseIcon: ?*IPictureDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_MouseIcon: fn( self: *const IInkCollector, MouseIcon: ?*IPictureDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MousePointer: fn( self: *const IInkCollector, MousePointer: ?*InkMousePointer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MousePointer: fn( self: *const IInkCollector, MousePointer: InkMousePointer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Cursors: fn( self: *const IInkCollector, Cursors: ?*?*IInkCursors, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MarginX: fn( self: *const IInkCollector, MarginX: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MarginX: fn( self: *const IInkCollector, MarginX: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MarginY: fn( self: *const IInkCollector, MarginY: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MarginY: fn( self: *const IInkCollector, MarginY: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Tablet: fn( self: *const IInkCollector, SingleTablet: ?*?*IInkTablet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SupportHighContrastInk: fn( self: *const IInkCollector, Support: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SupportHighContrastInk: fn( self: *const IInkCollector, Support: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetGestureStatus: fn( self: *const IInkCollector, Gesture: InkApplicationGesture, Listen: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetGestureStatus: fn( self: *const IInkCollector, Gesture: InkApplicationGesture, Listening: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetWindowInputRectangle: fn( self: *const IInkCollector, WindowInputRectangle: ?*?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetWindowInputRectangle: fn( self: *const IInkCollector, WindowInputRectangle: ?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetAllTabletsMode: fn( self: *const IInkCollector, UseMouseForInput: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSingleTabletIntegratedMode: fn( self: *const IInkCollector, Tablet: ?*IInkTablet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEventInterest: fn( self: *const IInkCollector, EventId: InkCollectorEventInterest, Listen: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetEventInterest: fn( self: *const IInkCollector, EventId: InkCollectorEventInterest, Listen: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_get_hWnd(self: *const T, CurrentWindow: ?*isize) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).get_hWnd(@ptrCast(*const IInkCollector, self), CurrentWindow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_put_hWnd(self: *const T, NewWindow: isize) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).put_hWnd(@ptrCast(*const IInkCollector, self), NewWindow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_get_Enabled(self: *const T, Collecting: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).get_Enabled(@ptrCast(*const IInkCollector, self), Collecting); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_put_Enabled(self: *const T, Collecting: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).put_Enabled(@ptrCast(*const IInkCollector, self), Collecting); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_get_DefaultDrawingAttributes(self: *const T, CurrentAttributes: ?*?*IInkDrawingAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).get_DefaultDrawingAttributes(@ptrCast(*const IInkCollector, self), CurrentAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_putref_DefaultDrawingAttributes(self: *const T, NewAttributes: ?*IInkDrawingAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).putref_DefaultDrawingAttributes(@ptrCast(*const IInkCollector, self), NewAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_get_Renderer(self: *const T, CurrentInkRenderer: ?*?*IInkRenderer) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).get_Renderer(@ptrCast(*const IInkCollector, self), CurrentInkRenderer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_putref_Renderer(self: *const T, NewInkRenderer: ?*IInkRenderer) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).putref_Renderer(@ptrCast(*const IInkCollector, self), NewInkRenderer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_get_Ink(self: *const T, Ink: ?*?*IInkDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).get_Ink(@ptrCast(*const IInkCollector, self), Ink); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_putref_Ink(self: *const T, NewInk: ?*IInkDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).putref_Ink(@ptrCast(*const IInkCollector, self), NewInk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_get_AutoRedraw(self: *const T, AutoRedraw: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).get_AutoRedraw(@ptrCast(*const IInkCollector, self), AutoRedraw); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_put_AutoRedraw(self: *const T, AutoRedraw: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).put_AutoRedraw(@ptrCast(*const IInkCollector, self), AutoRedraw); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_get_CollectingInk(self: *const T, Collecting: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).get_CollectingInk(@ptrCast(*const IInkCollector, self), Collecting); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_get_CollectionMode(self: *const T, Mode: ?*InkCollectionMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).get_CollectionMode(@ptrCast(*const IInkCollector, self), Mode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_put_CollectionMode(self: *const T, Mode: InkCollectionMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).put_CollectionMode(@ptrCast(*const IInkCollector, self), Mode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_get_DynamicRendering(self: *const T, Enabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).get_DynamicRendering(@ptrCast(*const IInkCollector, self), Enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_put_DynamicRendering(self: *const T, Enabled: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).put_DynamicRendering(@ptrCast(*const IInkCollector, self), Enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_get_DesiredPacketDescription(self: *const T, PacketGuids: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).get_DesiredPacketDescription(@ptrCast(*const IInkCollector, self), PacketGuids); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_put_DesiredPacketDescription(self: *const T, PacketGuids: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).put_DesiredPacketDescription(@ptrCast(*const IInkCollector, self), PacketGuids); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_get_MouseIcon(self: *const T, MouseIcon: ?*?*IPictureDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).get_MouseIcon(@ptrCast(*const IInkCollector, self), MouseIcon); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_put_MouseIcon(self: *const T, MouseIcon: ?*IPictureDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).put_MouseIcon(@ptrCast(*const IInkCollector, self), MouseIcon); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_putref_MouseIcon(self: *const T, MouseIcon: ?*IPictureDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).putref_MouseIcon(@ptrCast(*const IInkCollector, self), MouseIcon); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_get_MousePointer(self: *const T, MousePointer: ?*InkMousePointer) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).get_MousePointer(@ptrCast(*const IInkCollector, self), MousePointer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_put_MousePointer(self: *const T, MousePointer: InkMousePointer) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).put_MousePointer(@ptrCast(*const IInkCollector, self), MousePointer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_get_Cursors(self: *const T, Cursors: ?*?*IInkCursors) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).get_Cursors(@ptrCast(*const IInkCollector, self), Cursors); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_get_MarginX(self: *const T, MarginX: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).get_MarginX(@ptrCast(*const IInkCollector, self), MarginX); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_put_MarginX(self: *const T, MarginX: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).put_MarginX(@ptrCast(*const IInkCollector, self), MarginX); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_get_MarginY(self: *const T, MarginY: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).get_MarginY(@ptrCast(*const IInkCollector, self), MarginY); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_put_MarginY(self: *const T, MarginY: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).put_MarginY(@ptrCast(*const IInkCollector, self), MarginY); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_get_Tablet(self: *const T, SingleTablet: ?*?*IInkTablet) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).get_Tablet(@ptrCast(*const IInkCollector, self), SingleTablet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_get_SupportHighContrastInk(self: *const T, Support: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).get_SupportHighContrastInk(@ptrCast(*const IInkCollector, self), Support); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_put_SupportHighContrastInk(self: *const T, Support: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).put_SupportHighContrastInk(@ptrCast(*const IInkCollector, self), Support); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_SetGestureStatus(self: *const T, Gesture: InkApplicationGesture, Listen: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).SetGestureStatus(@ptrCast(*const IInkCollector, self), Gesture, Listen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_GetGestureStatus(self: *const T, Gesture: InkApplicationGesture, Listening: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).GetGestureStatus(@ptrCast(*const IInkCollector, self), Gesture, Listening); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_GetWindowInputRectangle(self: *const T, WindowInputRectangle: ?*?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).GetWindowInputRectangle(@ptrCast(*const IInkCollector, self), WindowInputRectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_SetWindowInputRectangle(self: *const T, WindowInputRectangle: ?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).SetWindowInputRectangle(@ptrCast(*const IInkCollector, self), WindowInputRectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_SetAllTabletsMode(self: *const T, UseMouseForInput: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).SetAllTabletsMode(@ptrCast(*const IInkCollector, self), UseMouseForInput); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_SetSingleTabletIntegratedMode(self: *const T, Tablet: ?*IInkTablet) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).SetSingleTabletIntegratedMode(@ptrCast(*const IInkCollector, self), Tablet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_GetEventInterest(self: *const T, EventId: InkCollectorEventInterest, Listen: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).GetEventInterest(@ptrCast(*const IInkCollector, self), EventId, Listen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkCollector_SetEventInterest(self: *const T, EventId: InkCollectorEventInterest, Listen: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkCollector.VTable, self.vtable).SetEventInterest(@ptrCast(*const IInkCollector, self), EventId, Listen); } };} pub usingnamespace MethodMixin(@This()); }; const IID__IInkCollectorEvents_Value = @import("../zig.zig").Guid.initString("11a583f2-712d-4fea-abcf-ab4af38ea06b"); pub const IID__IInkCollectorEvents = &IID__IInkCollectorEvents_Value; pub const _IInkCollectorEvents = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; const IID_IInkOverlay_Value = @import("../zig.zig").Guid.initString("b82a463b-c1c5-45a3-997c-deab5651b67a"); pub const IID_IInkOverlay = &IID_IInkOverlay_Value; pub const IInkOverlay = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_hWnd: fn( self: *const IInkOverlay, CurrentWindow: ?*isize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_hWnd: fn( self: *const IInkOverlay, NewWindow: isize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Enabled: fn( self: *const IInkOverlay, Collecting: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Enabled: fn( self: *const IInkOverlay, Collecting: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DefaultDrawingAttributes: fn( self: *const IInkOverlay, CurrentAttributes: ?*?*IInkDrawingAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_DefaultDrawingAttributes: fn( self: *const IInkOverlay, NewAttributes: ?*IInkDrawingAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Renderer: fn( self: *const IInkOverlay, CurrentInkRenderer: ?*?*IInkRenderer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_Renderer: fn( self: *const IInkOverlay, NewInkRenderer: ?*IInkRenderer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Ink: fn( self: *const IInkOverlay, Ink: ?*?*IInkDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_Ink: fn( self: *const IInkOverlay, NewInk: ?*IInkDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AutoRedraw: fn( self: *const IInkOverlay, AutoRedraw: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AutoRedraw: fn( self: *const IInkOverlay, AutoRedraw: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CollectingInk: fn( self: *const IInkOverlay, Collecting: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CollectionMode: fn( self: *const IInkOverlay, Mode: ?*InkCollectionMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_CollectionMode: fn( self: *const IInkOverlay, Mode: InkCollectionMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DynamicRendering: fn( self: *const IInkOverlay, Enabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DynamicRendering: fn( self: *const IInkOverlay, Enabled: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DesiredPacketDescription: fn( self: *const IInkOverlay, PacketGuids: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DesiredPacketDescription: fn( self: *const IInkOverlay, PacketGuids: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MouseIcon: fn( self: *const IInkOverlay, MouseIcon: ?*?*IPictureDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MouseIcon: fn( self: *const IInkOverlay, MouseIcon: ?*IPictureDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_MouseIcon: fn( self: *const IInkOverlay, MouseIcon: ?*IPictureDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MousePointer: fn( self: *const IInkOverlay, MousePointer: ?*InkMousePointer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MousePointer: fn( self: *const IInkOverlay, MousePointer: InkMousePointer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_EditingMode: fn( self: *const IInkOverlay, EditingMode: ?*InkOverlayEditingMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_EditingMode: fn( self: *const IInkOverlay, EditingMode: InkOverlayEditingMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Selection: fn( self: *const IInkOverlay, Selection: ?*?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Selection: fn( self: *const IInkOverlay, Selection: ?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_EraserMode: fn( self: *const IInkOverlay, EraserMode: ?*InkOverlayEraserMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_EraserMode: fn( self: *const IInkOverlay, EraserMode: InkOverlayEraserMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_EraserWidth: fn( self: *const IInkOverlay, EraserWidth: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_EraserWidth: fn( self: *const IInkOverlay, newEraserWidth: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AttachMode: fn( self: *const IInkOverlay, AttachMode: ?*InkOverlayAttachMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AttachMode: fn( self: *const IInkOverlay, AttachMode: InkOverlayAttachMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Cursors: fn( self: *const IInkOverlay, Cursors: ?*?*IInkCursors, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MarginX: fn( self: *const IInkOverlay, MarginX: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MarginX: fn( self: *const IInkOverlay, MarginX: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MarginY: fn( self: *const IInkOverlay, MarginY: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MarginY: fn( self: *const IInkOverlay, MarginY: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Tablet: fn( self: *const IInkOverlay, SingleTablet: ?*?*IInkTablet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SupportHighContrastInk: fn( self: *const IInkOverlay, Support: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SupportHighContrastInk: fn( self: *const IInkOverlay, Support: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SupportHighContrastSelectionUI: fn( self: *const IInkOverlay, Support: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SupportHighContrastSelectionUI: fn( self: *const IInkOverlay, Support: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, HitTestSelection: fn( self: *const IInkOverlay, x: i32, y: i32, SelArea: ?*SelectionHitResult, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Draw: fn( self: *const IInkOverlay, Rect: ?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetGestureStatus: fn( self: *const IInkOverlay, Gesture: InkApplicationGesture, Listen: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetGestureStatus: fn( self: *const IInkOverlay, Gesture: InkApplicationGesture, Listening: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetWindowInputRectangle: fn( self: *const IInkOverlay, WindowInputRectangle: ?*?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetWindowInputRectangle: fn( self: *const IInkOverlay, WindowInputRectangle: ?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetAllTabletsMode: fn( self: *const IInkOverlay, UseMouseForInput: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSingleTabletIntegratedMode: fn( self: *const IInkOverlay, Tablet: ?*IInkTablet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEventInterest: fn( self: *const IInkOverlay, EventId: InkCollectorEventInterest, Listen: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetEventInterest: fn( self: *const IInkOverlay, EventId: InkCollectorEventInterest, Listen: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_hWnd(self: *const T, CurrentWindow: ?*isize) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_hWnd(@ptrCast(*const IInkOverlay, self), CurrentWindow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_put_hWnd(self: *const T, NewWindow: isize) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).put_hWnd(@ptrCast(*const IInkOverlay, self), NewWindow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_Enabled(self: *const T, Collecting: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_Enabled(@ptrCast(*const IInkOverlay, self), Collecting); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_put_Enabled(self: *const T, Collecting: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).put_Enabled(@ptrCast(*const IInkOverlay, self), Collecting); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_DefaultDrawingAttributes(self: *const T, CurrentAttributes: ?*?*IInkDrawingAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_DefaultDrawingAttributes(@ptrCast(*const IInkOverlay, self), CurrentAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_putref_DefaultDrawingAttributes(self: *const T, NewAttributes: ?*IInkDrawingAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).putref_DefaultDrawingAttributes(@ptrCast(*const IInkOverlay, self), NewAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_Renderer(self: *const T, CurrentInkRenderer: ?*?*IInkRenderer) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_Renderer(@ptrCast(*const IInkOverlay, self), CurrentInkRenderer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_putref_Renderer(self: *const T, NewInkRenderer: ?*IInkRenderer) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).putref_Renderer(@ptrCast(*const IInkOverlay, self), NewInkRenderer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_Ink(self: *const T, Ink: ?*?*IInkDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_Ink(@ptrCast(*const IInkOverlay, self), Ink); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_putref_Ink(self: *const T, NewInk: ?*IInkDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).putref_Ink(@ptrCast(*const IInkOverlay, self), NewInk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_AutoRedraw(self: *const T, AutoRedraw: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_AutoRedraw(@ptrCast(*const IInkOverlay, self), AutoRedraw); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_put_AutoRedraw(self: *const T, AutoRedraw: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).put_AutoRedraw(@ptrCast(*const IInkOverlay, self), AutoRedraw); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_CollectingInk(self: *const T, Collecting: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_CollectingInk(@ptrCast(*const IInkOverlay, self), Collecting); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_CollectionMode(self: *const T, Mode: ?*InkCollectionMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_CollectionMode(@ptrCast(*const IInkOverlay, self), Mode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_put_CollectionMode(self: *const T, Mode: InkCollectionMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).put_CollectionMode(@ptrCast(*const IInkOverlay, self), Mode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_DynamicRendering(self: *const T, Enabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_DynamicRendering(@ptrCast(*const IInkOverlay, self), Enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_put_DynamicRendering(self: *const T, Enabled: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).put_DynamicRendering(@ptrCast(*const IInkOverlay, self), Enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_DesiredPacketDescription(self: *const T, PacketGuids: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_DesiredPacketDescription(@ptrCast(*const IInkOverlay, self), PacketGuids); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_put_DesiredPacketDescription(self: *const T, PacketGuids: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).put_DesiredPacketDescription(@ptrCast(*const IInkOverlay, self), PacketGuids); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_MouseIcon(self: *const T, MouseIcon: ?*?*IPictureDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_MouseIcon(@ptrCast(*const IInkOverlay, self), MouseIcon); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_put_MouseIcon(self: *const T, MouseIcon: ?*IPictureDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).put_MouseIcon(@ptrCast(*const IInkOverlay, self), MouseIcon); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_putref_MouseIcon(self: *const T, MouseIcon: ?*IPictureDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).putref_MouseIcon(@ptrCast(*const IInkOverlay, self), MouseIcon); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_MousePointer(self: *const T, MousePointer: ?*InkMousePointer) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_MousePointer(@ptrCast(*const IInkOverlay, self), MousePointer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_put_MousePointer(self: *const T, MousePointer: InkMousePointer) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).put_MousePointer(@ptrCast(*const IInkOverlay, self), MousePointer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_EditingMode(self: *const T, EditingMode: ?*InkOverlayEditingMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_EditingMode(@ptrCast(*const IInkOverlay, self), EditingMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_put_EditingMode(self: *const T, EditingMode: InkOverlayEditingMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).put_EditingMode(@ptrCast(*const IInkOverlay, self), EditingMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_Selection(self: *const T, Selection: ?*?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_Selection(@ptrCast(*const IInkOverlay, self), Selection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_put_Selection(self: *const T, Selection: ?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).put_Selection(@ptrCast(*const IInkOverlay, self), Selection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_EraserMode(self: *const T, EraserMode: ?*InkOverlayEraserMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_EraserMode(@ptrCast(*const IInkOverlay, self), EraserMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_put_EraserMode(self: *const T, EraserMode: InkOverlayEraserMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).put_EraserMode(@ptrCast(*const IInkOverlay, self), EraserMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_EraserWidth(self: *const T, EraserWidth: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_EraserWidth(@ptrCast(*const IInkOverlay, self), EraserWidth); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_put_EraserWidth(self: *const T, newEraserWidth: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).put_EraserWidth(@ptrCast(*const IInkOverlay, self), newEraserWidth); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_AttachMode(self: *const T, AttachMode: ?*InkOverlayAttachMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_AttachMode(@ptrCast(*const IInkOverlay, self), AttachMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_put_AttachMode(self: *const T, AttachMode: InkOverlayAttachMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).put_AttachMode(@ptrCast(*const IInkOverlay, self), AttachMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_Cursors(self: *const T, Cursors: ?*?*IInkCursors) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_Cursors(@ptrCast(*const IInkOverlay, self), Cursors); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_MarginX(self: *const T, MarginX: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_MarginX(@ptrCast(*const IInkOverlay, self), MarginX); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_put_MarginX(self: *const T, MarginX: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).put_MarginX(@ptrCast(*const IInkOverlay, self), MarginX); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_MarginY(self: *const T, MarginY: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_MarginY(@ptrCast(*const IInkOverlay, self), MarginY); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_put_MarginY(self: *const T, MarginY: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).put_MarginY(@ptrCast(*const IInkOverlay, self), MarginY); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_Tablet(self: *const T, SingleTablet: ?*?*IInkTablet) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_Tablet(@ptrCast(*const IInkOverlay, self), SingleTablet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_SupportHighContrastInk(self: *const T, Support: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_SupportHighContrastInk(@ptrCast(*const IInkOverlay, self), Support); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_put_SupportHighContrastInk(self: *const T, Support: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).put_SupportHighContrastInk(@ptrCast(*const IInkOverlay, self), Support); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_get_SupportHighContrastSelectionUI(self: *const T, Support: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).get_SupportHighContrastSelectionUI(@ptrCast(*const IInkOverlay, self), Support); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_put_SupportHighContrastSelectionUI(self: *const T, Support: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).put_SupportHighContrastSelectionUI(@ptrCast(*const IInkOverlay, self), Support); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_HitTestSelection(self: *const T, x: i32, y: i32, SelArea: ?*SelectionHitResult) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).HitTestSelection(@ptrCast(*const IInkOverlay, self), x, y, SelArea); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_Draw(self: *const T, Rect: ?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).Draw(@ptrCast(*const IInkOverlay, self), Rect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_SetGestureStatus(self: *const T, Gesture: InkApplicationGesture, Listen: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).SetGestureStatus(@ptrCast(*const IInkOverlay, self), Gesture, Listen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_GetGestureStatus(self: *const T, Gesture: InkApplicationGesture, Listening: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).GetGestureStatus(@ptrCast(*const IInkOverlay, self), Gesture, Listening); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_GetWindowInputRectangle(self: *const T, WindowInputRectangle: ?*?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).GetWindowInputRectangle(@ptrCast(*const IInkOverlay, self), WindowInputRectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_SetWindowInputRectangle(self: *const T, WindowInputRectangle: ?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).SetWindowInputRectangle(@ptrCast(*const IInkOverlay, self), WindowInputRectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_SetAllTabletsMode(self: *const T, UseMouseForInput: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).SetAllTabletsMode(@ptrCast(*const IInkOverlay, self), UseMouseForInput); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_SetSingleTabletIntegratedMode(self: *const T, Tablet: ?*IInkTablet) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).SetSingleTabletIntegratedMode(@ptrCast(*const IInkOverlay, self), Tablet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_GetEventInterest(self: *const T, EventId: InkCollectorEventInterest, Listen: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).GetEventInterest(@ptrCast(*const IInkOverlay, self), EventId, Listen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkOverlay_SetEventInterest(self: *const T, EventId: InkCollectorEventInterest, Listen: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkOverlay.VTable, self.vtable).SetEventInterest(@ptrCast(*const IInkOverlay, self), EventId, Listen); } };} pub usingnamespace MethodMixin(@This()); }; const IID__IInkOverlayEvents_Value = @import("../zig.zig").Guid.initString("31179b69-e563-489e-b16f-712f1e8a0651"); pub const IID__IInkOverlayEvents = &IID__IInkOverlayEvents_Value; pub const _IInkOverlayEvents = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; const IID_IInkPicture_Value = @import("../zig.zig").Guid.initString("e85662e0-379a-40d7-9b5c-757d233f9923"); pub const IID_IInkPicture = &IID_IInkPicture_Value; pub const IInkPicture = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_hWnd: fn( self: *const IInkPicture, CurrentWindow: ?*isize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DefaultDrawingAttributes: fn( self: *const IInkPicture, CurrentAttributes: ?*?*IInkDrawingAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_DefaultDrawingAttributes: fn( self: *const IInkPicture, NewAttributes: ?*IInkDrawingAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Renderer: fn( self: *const IInkPicture, CurrentInkRenderer: ?*?*IInkRenderer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_Renderer: fn( self: *const IInkPicture, NewInkRenderer: ?*IInkRenderer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Ink: fn( self: *const IInkPicture, Ink: ?*?*IInkDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_Ink: fn( self: *const IInkPicture, NewInk: ?*IInkDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AutoRedraw: fn( self: *const IInkPicture, AutoRedraw: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AutoRedraw: fn( self: *const IInkPicture, AutoRedraw: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CollectingInk: fn( self: *const IInkPicture, Collecting: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CollectionMode: fn( self: *const IInkPicture, Mode: ?*InkCollectionMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_CollectionMode: fn( self: *const IInkPicture, Mode: InkCollectionMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DynamicRendering: fn( self: *const IInkPicture, Enabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DynamicRendering: fn( self: *const IInkPicture, Enabled: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DesiredPacketDescription: fn( self: *const IInkPicture, PacketGuids: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DesiredPacketDescription: fn( self: *const IInkPicture, PacketGuids: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MouseIcon: fn( self: *const IInkPicture, MouseIcon: ?*?*IPictureDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MouseIcon: fn( self: *const IInkPicture, MouseIcon: ?*IPictureDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_MouseIcon: fn( self: *const IInkPicture, MouseIcon: ?*IPictureDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MousePointer: fn( self: *const IInkPicture, MousePointer: ?*InkMousePointer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MousePointer: fn( self: *const IInkPicture, MousePointer: InkMousePointer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_EditingMode: fn( self: *const IInkPicture, EditingMode: ?*InkOverlayEditingMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_EditingMode: fn( self: *const IInkPicture, EditingMode: InkOverlayEditingMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Selection: fn( self: *const IInkPicture, Selection: ?*?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Selection: fn( self: *const IInkPicture, Selection: ?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_EraserMode: fn( self: *const IInkPicture, EraserMode: ?*InkOverlayEraserMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_EraserMode: fn( self: *const IInkPicture, EraserMode: InkOverlayEraserMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_EraserWidth: fn( self: *const IInkPicture, EraserWidth: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_EraserWidth: fn( self: *const IInkPicture, newEraserWidth: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_Picture: fn( self: *const IInkPicture, pPicture: ?*IPictureDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Picture: fn( self: *const IInkPicture, pPicture: ?*IPictureDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Picture: fn( self: *const IInkPicture, ppPicture: ?*?*IPictureDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SizeMode: fn( self: *const IInkPicture, smNewSizeMode: InkPictureSizeMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SizeMode: fn( self: *const IInkPicture, smSizeMode: ?*InkPictureSizeMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_BackColor: fn( self: *const IInkPicture, newColor: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_BackColor: fn( self: *const IInkPicture, pColor: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Cursors: fn( self: *const IInkPicture, Cursors: ?*?*IInkCursors, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MarginX: fn( self: *const IInkPicture, MarginX: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MarginX: fn( self: *const IInkPicture, MarginX: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MarginY: fn( self: *const IInkPicture, MarginY: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MarginY: fn( self: *const IInkPicture, MarginY: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Tablet: fn( self: *const IInkPicture, SingleTablet: ?*?*IInkTablet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SupportHighContrastInk: fn( self: *const IInkPicture, Support: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SupportHighContrastInk: fn( self: *const IInkPicture, Support: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SupportHighContrastSelectionUI: fn( self: *const IInkPicture, Support: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SupportHighContrastSelectionUI: fn( self: *const IInkPicture, Support: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, HitTestSelection: fn( self: *const IInkPicture, x: i32, y: i32, SelArea: ?*SelectionHitResult, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetGestureStatus: fn( self: *const IInkPicture, Gesture: InkApplicationGesture, Listen: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetGestureStatus: fn( self: *const IInkPicture, Gesture: InkApplicationGesture, Listening: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetWindowInputRectangle: fn( self: *const IInkPicture, WindowInputRectangle: ?*?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetWindowInputRectangle: fn( self: *const IInkPicture, WindowInputRectangle: ?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetAllTabletsMode: fn( self: *const IInkPicture, UseMouseForInput: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSingleTabletIntegratedMode: fn( self: *const IInkPicture, Tablet: ?*IInkTablet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEventInterest: fn( self: *const IInkPicture, EventId: InkCollectorEventInterest, Listen: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetEventInterest: fn( self: *const IInkPicture, EventId: InkCollectorEventInterest, Listen: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_InkEnabled: fn( self: *const IInkPicture, Collecting: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_InkEnabled: fn( self: *const IInkPicture, Collecting: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Enabled: fn( self: *const IInkPicture, pbool: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Enabled: fn( self: *const IInkPicture, vbool: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_hWnd(self: *const T, CurrentWindow: ?*isize) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_hWnd(@ptrCast(*const IInkPicture, self), CurrentWindow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_DefaultDrawingAttributes(self: *const T, CurrentAttributes: ?*?*IInkDrawingAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_DefaultDrawingAttributes(@ptrCast(*const IInkPicture, self), CurrentAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_putref_DefaultDrawingAttributes(self: *const T, NewAttributes: ?*IInkDrawingAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).putref_DefaultDrawingAttributes(@ptrCast(*const IInkPicture, self), NewAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_Renderer(self: *const T, CurrentInkRenderer: ?*?*IInkRenderer) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_Renderer(@ptrCast(*const IInkPicture, self), CurrentInkRenderer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_putref_Renderer(self: *const T, NewInkRenderer: ?*IInkRenderer) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).putref_Renderer(@ptrCast(*const IInkPicture, self), NewInkRenderer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_Ink(self: *const T, Ink: ?*?*IInkDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_Ink(@ptrCast(*const IInkPicture, self), Ink); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_putref_Ink(self: *const T, NewInk: ?*IInkDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).putref_Ink(@ptrCast(*const IInkPicture, self), NewInk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_AutoRedraw(self: *const T, AutoRedraw: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_AutoRedraw(@ptrCast(*const IInkPicture, self), AutoRedraw); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_put_AutoRedraw(self: *const T, AutoRedraw: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).put_AutoRedraw(@ptrCast(*const IInkPicture, self), AutoRedraw); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_CollectingInk(self: *const T, Collecting: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_CollectingInk(@ptrCast(*const IInkPicture, self), Collecting); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_CollectionMode(self: *const T, Mode: ?*InkCollectionMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_CollectionMode(@ptrCast(*const IInkPicture, self), Mode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_put_CollectionMode(self: *const T, Mode: InkCollectionMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).put_CollectionMode(@ptrCast(*const IInkPicture, self), Mode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_DynamicRendering(self: *const T, Enabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_DynamicRendering(@ptrCast(*const IInkPicture, self), Enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_put_DynamicRendering(self: *const T, Enabled: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).put_DynamicRendering(@ptrCast(*const IInkPicture, self), Enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_DesiredPacketDescription(self: *const T, PacketGuids: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_DesiredPacketDescription(@ptrCast(*const IInkPicture, self), PacketGuids); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_put_DesiredPacketDescription(self: *const T, PacketGuids: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).put_DesiredPacketDescription(@ptrCast(*const IInkPicture, self), PacketGuids); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_MouseIcon(self: *const T, MouseIcon: ?*?*IPictureDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_MouseIcon(@ptrCast(*const IInkPicture, self), MouseIcon); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_put_MouseIcon(self: *const T, MouseIcon: ?*IPictureDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).put_MouseIcon(@ptrCast(*const IInkPicture, self), MouseIcon); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_putref_MouseIcon(self: *const T, MouseIcon: ?*IPictureDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).putref_MouseIcon(@ptrCast(*const IInkPicture, self), MouseIcon); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_MousePointer(self: *const T, MousePointer: ?*InkMousePointer) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_MousePointer(@ptrCast(*const IInkPicture, self), MousePointer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_put_MousePointer(self: *const T, MousePointer: InkMousePointer) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).put_MousePointer(@ptrCast(*const IInkPicture, self), MousePointer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_EditingMode(self: *const T, EditingMode: ?*InkOverlayEditingMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_EditingMode(@ptrCast(*const IInkPicture, self), EditingMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_put_EditingMode(self: *const T, EditingMode: InkOverlayEditingMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).put_EditingMode(@ptrCast(*const IInkPicture, self), EditingMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_Selection(self: *const T, Selection: ?*?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_Selection(@ptrCast(*const IInkPicture, self), Selection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_put_Selection(self: *const T, Selection: ?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).put_Selection(@ptrCast(*const IInkPicture, self), Selection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_EraserMode(self: *const T, EraserMode: ?*InkOverlayEraserMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_EraserMode(@ptrCast(*const IInkPicture, self), EraserMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_put_EraserMode(self: *const T, EraserMode: InkOverlayEraserMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).put_EraserMode(@ptrCast(*const IInkPicture, self), EraserMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_EraserWidth(self: *const T, EraserWidth: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_EraserWidth(@ptrCast(*const IInkPicture, self), EraserWidth); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_put_EraserWidth(self: *const T, newEraserWidth: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).put_EraserWidth(@ptrCast(*const IInkPicture, self), newEraserWidth); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_putref_Picture(self: *const T, pPicture: ?*IPictureDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).putref_Picture(@ptrCast(*const IInkPicture, self), pPicture); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_put_Picture(self: *const T, pPicture: ?*IPictureDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).put_Picture(@ptrCast(*const IInkPicture, self), pPicture); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_Picture(self: *const T, ppPicture: ?*?*IPictureDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_Picture(@ptrCast(*const IInkPicture, self), ppPicture); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_put_SizeMode(self: *const T, smNewSizeMode: InkPictureSizeMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).put_SizeMode(@ptrCast(*const IInkPicture, self), smNewSizeMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_SizeMode(self: *const T, smSizeMode: ?*InkPictureSizeMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_SizeMode(@ptrCast(*const IInkPicture, self), smSizeMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_put_BackColor(self: *const T, newColor: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).put_BackColor(@ptrCast(*const IInkPicture, self), newColor); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_BackColor(self: *const T, pColor: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_BackColor(@ptrCast(*const IInkPicture, self), pColor); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_Cursors(self: *const T, Cursors: ?*?*IInkCursors) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_Cursors(@ptrCast(*const IInkPicture, self), Cursors); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_MarginX(self: *const T, MarginX: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_MarginX(@ptrCast(*const IInkPicture, self), MarginX); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_put_MarginX(self: *const T, MarginX: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).put_MarginX(@ptrCast(*const IInkPicture, self), MarginX); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_MarginY(self: *const T, MarginY: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_MarginY(@ptrCast(*const IInkPicture, self), MarginY); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_put_MarginY(self: *const T, MarginY: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).put_MarginY(@ptrCast(*const IInkPicture, self), MarginY); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_Tablet(self: *const T, SingleTablet: ?*?*IInkTablet) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_Tablet(@ptrCast(*const IInkPicture, self), SingleTablet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_SupportHighContrastInk(self: *const T, Support: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_SupportHighContrastInk(@ptrCast(*const IInkPicture, self), Support); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_put_SupportHighContrastInk(self: *const T, Support: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).put_SupportHighContrastInk(@ptrCast(*const IInkPicture, self), Support); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_SupportHighContrastSelectionUI(self: *const T, Support: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_SupportHighContrastSelectionUI(@ptrCast(*const IInkPicture, self), Support); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_put_SupportHighContrastSelectionUI(self: *const T, Support: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).put_SupportHighContrastSelectionUI(@ptrCast(*const IInkPicture, self), Support); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_HitTestSelection(self: *const T, x: i32, y: i32, SelArea: ?*SelectionHitResult) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).HitTestSelection(@ptrCast(*const IInkPicture, self), x, y, SelArea); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_SetGestureStatus(self: *const T, Gesture: InkApplicationGesture, Listen: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).SetGestureStatus(@ptrCast(*const IInkPicture, self), Gesture, Listen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_GetGestureStatus(self: *const T, Gesture: InkApplicationGesture, Listening: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).GetGestureStatus(@ptrCast(*const IInkPicture, self), Gesture, Listening); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_GetWindowInputRectangle(self: *const T, WindowInputRectangle: ?*?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).GetWindowInputRectangle(@ptrCast(*const IInkPicture, self), WindowInputRectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_SetWindowInputRectangle(self: *const T, WindowInputRectangle: ?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).SetWindowInputRectangle(@ptrCast(*const IInkPicture, self), WindowInputRectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_SetAllTabletsMode(self: *const T, UseMouseForInput: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).SetAllTabletsMode(@ptrCast(*const IInkPicture, self), UseMouseForInput); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_SetSingleTabletIntegratedMode(self: *const T, Tablet: ?*IInkTablet) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).SetSingleTabletIntegratedMode(@ptrCast(*const IInkPicture, self), Tablet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_GetEventInterest(self: *const T, EventId: InkCollectorEventInterest, Listen: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).GetEventInterest(@ptrCast(*const IInkPicture, self), EventId, Listen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_SetEventInterest(self: *const T, EventId: InkCollectorEventInterest, Listen: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).SetEventInterest(@ptrCast(*const IInkPicture, self), EventId, Listen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_InkEnabled(self: *const T, Collecting: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_InkEnabled(@ptrCast(*const IInkPicture, self), Collecting); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_put_InkEnabled(self: *const T, Collecting: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).put_InkEnabled(@ptrCast(*const IInkPicture, self), Collecting); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_get_Enabled(self: *const T, pbool: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).get_Enabled(@ptrCast(*const IInkPicture, self), pbool); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkPicture_put_Enabled(self: *const T, vbool: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkPicture.VTable, self.vtable).put_Enabled(@ptrCast(*const IInkPicture, self), vbool); } };} pub usingnamespace MethodMixin(@This()); }; const IID__IInkPictureEvents_Value = @import("../zig.zig").Guid.initString("60ff4fee-22ff-4484-acc1-d308d9cd7ea3"); pub const IID__IInkPictureEvents = &IID__IInkPictureEvents_Value; pub const _IInkPictureEvents = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkRecognizer_Value = @import("../zig.zig").Guid.initString("782bf7cf-034b-4396-8a32-3a1833cf6b56"); pub const IID_IInkRecognizer = &IID_IInkRecognizer_Value; pub const IInkRecognizer = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const IInkRecognizer, Name: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Vendor: fn( self: *const IInkRecognizer, Vendor: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Capabilities: fn( self: *const IInkRecognizer, CapabilitiesFlags: ?*InkRecognizerCapabilities, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Languages: fn( self: *const IInkRecognizer, Languages: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SupportedProperties: fn( self: *const IInkRecognizer, SupportedProperties: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PreferredPacketDescription: fn( self: *const IInkRecognizer, PreferredPacketDescription: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateRecognizerContext: fn( self: *const IInkRecognizer, Context: ?*?*IInkRecognizerContext, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizer_get_Name(self: *const T, Name: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizer.VTable, self.vtable).get_Name(@ptrCast(*const IInkRecognizer, self), Name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizer_get_Vendor(self: *const T, Vendor: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizer.VTable, self.vtable).get_Vendor(@ptrCast(*const IInkRecognizer, self), Vendor); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizer_get_Capabilities(self: *const T, CapabilitiesFlags: ?*InkRecognizerCapabilities) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizer.VTable, self.vtable).get_Capabilities(@ptrCast(*const IInkRecognizer, self), CapabilitiesFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizer_get_Languages(self: *const T, Languages: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizer.VTable, self.vtable).get_Languages(@ptrCast(*const IInkRecognizer, self), Languages); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizer_get_SupportedProperties(self: *const T, SupportedProperties: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizer.VTable, self.vtable).get_SupportedProperties(@ptrCast(*const IInkRecognizer, self), SupportedProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizer_get_PreferredPacketDescription(self: *const T, PreferredPacketDescription: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizer.VTable, self.vtable).get_PreferredPacketDescription(@ptrCast(*const IInkRecognizer, self), PreferredPacketDescription); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizer_CreateRecognizerContext(self: *const T, Context: ?*?*IInkRecognizerContext) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizer.VTable, self.vtable).CreateRecognizerContext(@ptrCast(*const IInkRecognizer, self), Context); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkRecognizer2_Value = @import("../zig.zig").Guid.initString("6110118a-3a75-4ad6-b2aa-04b2b72bbe65"); pub const IID_IInkRecognizer2 = &IID_IInkRecognizer2_Value; pub const IInkRecognizer2 = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Id: fn( self: *const IInkRecognizer2, pbstrId: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_UnicodeRanges: fn( self: *const IInkRecognizer2, UnicodeRanges: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizer2_get_Id(self: *const T, pbstrId: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizer2.VTable, self.vtable).get_Id(@ptrCast(*const IInkRecognizer2, self), pbstrId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizer2_get_UnicodeRanges(self: *const T, UnicodeRanges: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizer2.VTable, self.vtable).get_UnicodeRanges(@ptrCast(*const IInkRecognizer2, self), UnicodeRanges); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInkRecognizers_Value = @import("../zig.zig").Guid.initString("9ccc4f12-b0b7-4a8b-bf58-4aeca4e8cefd"); pub const IID_IInkRecognizers = &IID_IInkRecognizers_Value; pub const IInkRecognizers = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const IInkRecognizers, Count: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IInkRecognizers, _NewEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDefaultRecognizer: fn( self: *const IInkRecognizers, lcid: i32, DefaultRecognizer: ?*?*IInkRecognizer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Item: fn( self: *const IInkRecognizers, Index: i32, InkRecognizer: ?*?*IInkRecognizer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizers_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizers.VTable, self.vtable).get_Count(@ptrCast(*const IInkRecognizers, self), Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizers_get__NewEnum(self: *const T, _NewEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizers.VTable, self.vtable).get__NewEnum(@ptrCast(*const IInkRecognizers, self), _NewEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizers_GetDefaultRecognizer(self: *const T, lcid: i32, DefaultRecognizer: ?*?*IInkRecognizer) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizers.VTable, self.vtable).GetDefaultRecognizer(@ptrCast(*const IInkRecognizers, self), lcid, DefaultRecognizer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizers_Item(self: *const T, Index: i32, InkRecognizer: ?*?*IInkRecognizer) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizers.VTable, self.vtable).Item(@ptrCast(*const IInkRecognizers, self), Index, InkRecognizer); } };} pub usingnamespace MethodMixin(@This()); }; const IID__IInkRecognitionEvents_Value = @import("../zig.zig").Guid.initString("17bce92f-2e21-47fd-9d33-3c6afbfd8c59"); pub const IID__IInkRecognitionEvents = &IID__IInkRecognitionEvents_Value; pub const _IInkRecognitionEvents = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; const IID_IInkRecognizerContext_Value = @import("../zig.zig").Guid.initString("c68f52f9-32a3-4625-906c-44fc23b40958"); pub const IID_IInkRecognizerContext = &IID_IInkRecognizerContext_Value; pub const IInkRecognizerContext = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Strokes: fn( self: *const IInkRecognizerContext, Strokes: ?*?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_Strokes: fn( self: *const IInkRecognizerContext, Strokes: ?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CharacterAutoCompletionMode: fn( self: *const IInkRecognizerContext, Mode: ?*InkRecognizerCharacterAutoCompletionMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_CharacterAutoCompletionMode: fn( self: *const IInkRecognizerContext, Mode: InkRecognizerCharacterAutoCompletionMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Factoid: fn( self: *const IInkRecognizerContext, Factoid: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Factoid: fn( self: *const IInkRecognizerContext, factoid: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Guide: fn( self: *const IInkRecognizerContext, RecognizerGuide: ?*?*IInkRecognizerGuide, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_Guide: fn( self: *const IInkRecognizerContext, RecognizerGuide: ?*IInkRecognizerGuide, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PrefixText: fn( self: *const IInkRecognizerContext, Prefix: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_PrefixText: fn( self: *const IInkRecognizerContext, Prefix: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SuffixText: fn( self: *const IInkRecognizerContext, Suffix: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SuffixText: fn( self: *const IInkRecognizerContext, Suffix: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RecognitionFlags: fn( self: *const IInkRecognizerContext, Modes: ?*InkRecognitionModes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RecognitionFlags: fn( self: *const IInkRecognizerContext, Modes: InkRecognitionModes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_WordList: fn( self: *const IInkRecognizerContext, WordList: ?*?*IInkWordList, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_WordList: fn( self: *const IInkRecognizerContext, WordList: ?*IInkWordList, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Recognizer: fn( self: *const IInkRecognizerContext, Recognizer: ?*?*IInkRecognizer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Recognize: fn( self: *const IInkRecognizerContext, RecognitionStatus: ?*InkRecognitionStatus, RecognitionResult: ?*?*IInkRecognitionResult, ) callconv(@import("std").os.windows.WINAPI) HRESULT, StopBackgroundRecognition: fn( self: *const IInkRecognizerContext, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EndInkInput: fn( self: *const IInkRecognizerContext, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BackgroundRecognize: fn( self: *const IInkRecognizerContext, CustomData: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BackgroundRecognizeWithAlternates: fn( self: *const IInkRecognizerContext, CustomData: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IInkRecognizerContext, RecoContext: ?*?*IInkRecognizerContext, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsStringSupported: fn( self: *const IInkRecognizerContext, String: ?BSTR, Supported: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_get_Strokes(self: *const T, Strokes: ?*?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).get_Strokes(@ptrCast(*const IInkRecognizerContext, self), Strokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_putref_Strokes(self: *const T, Strokes: ?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).putref_Strokes(@ptrCast(*const IInkRecognizerContext, self), Strokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_get_CharacterAutoCompletionMode(self: *const T, Mode: ?*InkRecognizerCharacterAutoCompletionMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).get_CharacterAutoCompletionMode(@ptrCast(*const IInkRecognizerContext, self), Mode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_put_CharacterAutoCompletionMode(self: *const T, Mode: InkRecognizerCharacterAutoCompletionMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).put_CharacterAutoCompletionMode(@ptrCast(*const IInkRecognizerContext, self), Mode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_get_Factoid(self: *const T, Factoid: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).get_Factoid(@ptrCast(*const IInkRecognizerContext, self), Factoid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_put_Factoid(self: *const T, factoid: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).put_Factoid(@ptrCast(*const IInkRecognizerContext, self), factoid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_get_Guide(self: *const T, RecognizerGuide: ?*?*IInkRecognizerGuide) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).get_Guide(@ptrCast(*const IInkRecognizerContext, self), RecognizerGuide); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_putref_Guide(self: *const T, RecognizerGuide: ?*IInkRecognizerGuide) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).putref_Guide(@ptrCast(*const IInkRecognizerContext, self), RecognizerGuide); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_get_PrefixText(self: *const T, Prefix: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).get_PrefixText(@ptrCast(*const IInkRecognizerContext, self), Prefix); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_put_PrefixText(self: *const T, Prefix: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).put_PrefixText(@ptrCast(*const IInkRecognizerContext, self), Prefix); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_get_SuffixText(self: *const T, Suffix: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).get_SuffixText(@ptrCast(*const IInkRecognizerContext, self), Suffix); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_put_SuffixText(self: *const T, Suffix: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).put_SuffixText(@ptrCast(*const IInkRecognizerContext, self), Suffix); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_get_RecognitionFlags(self: *const T, Modes: ?*InkRecognitionModes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).get_RecognitionFlags(@ptrCast(*const IInkRecognizerContext, self), Modes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_put_RecognitionFlags(self: *const T, Modes: InkRecognitionModes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).put_RecognitionFlags(@ptrCast(*const IInkRecognizerContext, self), Modes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_get_WordList(self: *const T, WordList: ?*?*IInkWordList) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).get_WordList(@ptrCast(*const IInkRecognizerContext, self), WordList); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_putref_WordList(self: *const T, WordList: ?*IInkWordList) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).putref_WordList(@ptrCast(*const IInkRecognizerContext, self), WordList); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_get_Recognizer(self: *const T, Recognizer: ?*?*IInkRecognizer) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).get_Recognizer(@ptrCast(*const IInkRecognizerContext, self), Recognizer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_Recognize(self: *const T, RecognitionStatus: ?*InkRecognitionStatus, RecognitionResult: ?*?*IInkRecognitionResult) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).Recognize(@ptrCast(*const IInkRecognizerContext, self), RecognitionStatus, RecognitionResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_StopBackgroundRecognition(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).StopBackgroundRecognition(@ptrCast(*const IInkRecognizerContext, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_EndInkInput(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).EndInkInput(@ptrCast(*const IInkRecognizerContext, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_BackgroundRecognize(self: *const T, CustomData: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).BackgroundRecognize(@ptrCast(*const IInkRecognizerContext, self), CustomData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_BackgroundRecognizeWithAlternates(self: *const T, CustomData: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).BackgroundRecognizeWithAlternates(@ptrCast(*const IInkRecognizerContext, self), CustomData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_Clone(self: *const T, RecoContext: ?*?*IInkRecognizerContext) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).Clone(@ptrCast(*const IInkRecognizerContext, self), RecoContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext_IsStringSupported(self: *const T, String: ?BSTR, Supported: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext.VTable, self.vtable).IsStringSupported(@ptrCast(*const IInkRecognizerContext, self), String, Supported); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkRecognizerContext2_Value = @import("../zig.zig").Guid.initString("d6f0e32f-73d8-408e-8e9f-5fea592c363f"); pub const IID_IInkRecognizerContext2 = &IID_IInkRecognizerContext2_Value; pub const IInkRecognizerContext2 = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_EnabledUnicodeRanges: fn( self: *const IInkRecognizerContext2, UnicodeRanges: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_EnabledUnicodeRanges: fn( self: *const IInkRecognizerContext2, UnicodeRanges: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext2_get_EnabledUnicodeRanges(self: *const T, UnicodeRanges: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext2.VTable, self.vtable).get_EnabledUnicodeRanges(@ptrCast(*const IInkRecognizerContext2, self), UnicodeRanges); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerContext2_put_EnabledUnicodeRanges(self: *const T, UnicodeRanges: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerContext2.VTable, self.vtable).put_EnabledUnicodeRanges(@ptrCast(*const IInkRecognizerContext2, self), UnicodeRanges); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkRecognitionResult_Value = @import("../zig.zig").Guid.initString("3bc129a8-86cd-45ad-bde8-e0d32d61c16d"); pub const IID_IInkRecognitionResult = &IID_IInkRecognitionResult_Value; pub const IInkRecognitionResult = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_TopString: fn( self: *const IInkRecognitionResult, TopString: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_TopAlternate: fn( self: *const IInkRecognitionResult, TopAlternate: ?*?*IInkRecognitionAlternate, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_TopConfidence: fn( self: *const IInkRecognitionResult, TopConfidence: ?*InkRecognitionConfidence, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Strokes: fn( self: *const IInkRecognitionResult, Strokes: ?*?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AlternatesFromSelection: fn( self: *const IInkRecognitionResult, selectionStart: i32, selectionLength: i32, maximumAlternates: i32, AlternatesFromSelection: ?*?*IInkRecognitionAlternates, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ModifyTopAlternate: fn( self: *const IInkRecognitionResult, Alternate: ?*IInkRecognitionAlternate, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetResultOnStrokes: fn( self: *const IInkRecognitionResult, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionResult_get_TopString(self: *const T, TopString: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionResult.VTable, self.vtable).get_TopString(@ptrCast(*const IInkRecognitionResult, self), TopString); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionResult_get_TopAlternate(self: *const T, TopAlternate: ?*?*IInkRecognitionAlternate) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionResult.VTable, self.vtable).get_TopAlternate(@ptrCast(*const IInkRecognitionResult, self), TopAlternate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionResult_get_TopConfidence(self: *const T, TopConfidence: ?*InkRecognitionConfidence) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionResult.VTable, self.vtable).get_TopConfidence(@ptrCast(*const IInkRecognitionResult, self), TopConfidence); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionResult_get_Strokes(self: *const T, Strokes: ?*?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionResult.VTable, self.vtable).get_Strokes(@ptrCast(*const IInkRecognitionResult, self), Strokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionResult_AlternatesFromSelection(self: *const T, selectionStart: i32, selectionLength: i32, maximumAlternates: i32, AlternatesFromSelection: ?*?*IInkRecognitionAlternates) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionResult.VTable, self.vtable).AlternatesFromSelection(@ptrCast(*const IInkRecognitionResult, self), selectionStart, selectionLength, maximumAlternates, AlternatesFromSelection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionResult_ModifyTopAlternate(self: *const T, Alternate: ?*IInkRecognitionAlternate) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionResult.VTable, self.vtable).ModifyTopAlternate(@ptrCast(*const IInkRecognitionResult, self), Alternate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionResult_SetResultOnStrokes(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionResult.VTable, self.vtable).SetResultOnStrokes(@ptrCast(*const IInkRecognitionResult, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkRecognitionAlternate_Value = @import("../zig.zig").Guid.initString("b7e660ad-77e4-429b-adda-873780d1fc4a"); pub const IID_IInkRecognitionAlternate = &IID_IInkRecognitionAlternate_Value; pub const IInkRecognitionAlternate = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_String: fn( self: *const IInkRecognitionAlternate, RecoString: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Confidence: fn( self: *const IInkRecognitionAlternate, Confidence: ?*InkRecognitionConfidence, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Baseline: fn( self: *const IInkRecognitionAlternate, Baseline: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Midline: fn( self: *const IInkRecognitionAlternate, Midline: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Ascender: fn( self: *const IInkRecognitionAlternate, Ascender: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Descender: fn( self: *const IInkRecognitionAlternate, Descender: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LineNumber: fn( self: *const IInkRecognitionAlternate, LineNumber: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Strokes: fn( self: *const IInkRecognitionAlternate, Strokes: ?*?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LineAlternates: fn( self: *const IInkRecognitionAlternate, LineAlternates: ?*?*IInkRecognitionAlternates, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ConfidenceAlternates: fn( self: *const IInkRecognitionAlternate, ConfidenceAlternates: ?*?*IInkRecognitionAlternates, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStrokesFromStrokeRanges: fn( self: *const IInkRecognitionAlternate, Strokes: ?*IInkStrokes, GetStrokesFromStrokeRanges: ?*?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStrokesFromTextRange: fn( self: *const IInkRecognitionAlternate, selectionStart: ?*i32, selectionLength: ?*i32, GetStrokesFromTextRange: ?*?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTextRangeFromStrokes: fn( self: *const IInkRecognitionAlternate, Strokes: ?*IInkStrokes, selectionStart: ?*i32, selectionLength: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AlternatesWithConstantPropertyValues: fn( self: *const IInkRecognitionAlternate, PropertyType: ?BSTR, AlternatesWithConstantPropertyValues: ?*?*IInkRecognitionAlternates, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPropertyValue: fn( self: *const IInkRecognitionAlternate, PropertyType: ?BSTR, PropertyValue: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionAlternate_get_String(self: *const T, RecoString: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionAlternate.VTable, self.vtable).get_String(@ptrCast(*const IInkRecognitionAlternate, self), RecoString); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionAlternate_get_Confidence(self: *const T, Confidence: ?*InkRecognitionConfidence) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionAlternate.VTable, self.vtable).get_Confidence(@ptrCast(*const IInkRecognitionAlternate, self), Confidence); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionAlternate_get_Baseline(self: *const T, Baseline: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionAlternate.VTable, self.vtable).get_Baseline(@ptrCast(*const IInkRecognitionAlternate, self), Baseline); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionAlternate_get_Midline(self: *const T, Midline: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionAlternate.VTable, self.vtable).get_Midline(@ptrCast(*const IInkRecognitionAlternate, self), Midline); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionAlternate_get_Ascender(self: *const T, Ascender: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionAlternate.VTable, self.vtable).get_Ascender(@ptrCast(*const IInkRecognitionAlternate, self), Ascender); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionAlternate_get_Descender(self: *const T, Descender: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionAlternate.VTable, self.vtable).get_Descender(@ptrCast(*const IInkRecognitionAlternate, self), Descender); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionAlternate_get_LineNumber(self: *const T, LineNumber: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionAlternate.VTable, self.vtable).get_LineNumber(@ptrCast(*const IInkRecognitionAlternate, self), LineNumber); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionAlternate_get_Strokes(self: *const T, Strokes: ?*?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionAlternate.VTable, self.vtable).get_Strokes(@ptrCast(*const IInkRecognitionAlternate, self), Strokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionAlternate_get_LineAlternates(self: *const T, LineAlternates: ?*?*IInkRecognitionAlternates) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionAlternate.VTable, self.vtable).get_LineAlternates(@ptrCast(*const IInkRecognitionAlternate, self), LineAlternates); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionAlternate_get_ConfidenceAlternates(self: *const T, ConfidenceAlternates: ?*?*IInkRecognitionAlternates) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionAlternate.VTable, self.vtable).get_ConfidenceAlternates(@ptrCast(*const IInkRecognitionAlternate, self), ConfidenceAlternates); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionAlternate_GetStrokesFromStrokeRanges(self: *const T, Strokes: ?*IInkStrokes, GetStrokesFromStrokeRanges: ?*?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionAlternate.VTable, self.vtable).GetStrokesFromStrokeRanges(@ptrCast(*const IInkRecognitionAlternate, self), Strokes, GetStrokesFromStrokeRanges); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionAlternate_GetStrokesFromTextRange(self: *const T, selectionStart: ?*i32, selectionLength: ?*i32, GetStrokesFromTextRange: ?*?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionAlternate.VTable, self.vtable).GetStrokesFromTextRange(@ptrCast(*const IInkRecognitionAlternate, self), selectionStart, selectionLength, GetStrokesFromTextRange); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionAlternate_GetTextRangeFromStrokes(self: *const T, Strokes: ?*IInkStrokes, selectionStart: ?*i32, selectionLength: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionAlternate.VTable, self.vtable).GetTextRangeFromStrokes(@ptrCast(*const IInkRecognitionAlternate, self), Strokes, selectionStart, selectionLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionAlternate_AlternatesWithConstantPropertyValues(self: *const T, PropertyType: ?BSTR, AlternatesWithConstantPropertyValues: ?*?*IInkRecognitionAlternates) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionAlternate.VTable, self.vtable).AlternatesWithConstantPropertyValues(@ptrCast(*const IInkRecognitionAlternate, self), PropertyType, AlternatesWithConstantPropertyValues); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionAlternate_GetPropertyValue(self: *const T, PropertyType: ?BSTR, PropertyValue: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionAlternate.VTable, self.vtable).GetPropertyValue(@ptrCast(*const IInkRecognitionAlternate, self), PropertyType, PropertyValue); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkRecognitionAlternates_Value = @import("../zig.zig").Guid.initString("286a167f-9f19-4c61-9d53-4f07be622b84"); pub const IID_IInkRecognitionAlternates = &IID_IInkRecognitionAlternates_Value; pub const IInkRecognitionAlternates = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const IInkRecognitionAlternates, Count: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IInkRecognitionAlternates, _NewEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Strokes: fn( self: *const IInkRecognitionAlternates, Strokes: ?*?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Item: fn( self: *const IInkRecognitionAlternates, Index: i32, InkRecoAlternate: ?*?*IInkRecognitionAlternate, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionAlternates_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionAlternates.VTable, self.vtable).get_Count(@ptrCast(*const IInkRecognitionAlternates, self), Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionAlternates_get__NewEnum(self: *const T, _NewEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionAlternates.VTable, self.vtable).get__NewEnum(@ptrCast(*const IInkRecognitionAlternates, self), _NewEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionAlternates_get_Strokes(self: *const T, Strokes: ?*?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionAlternates.VTable, self.vtable).get_Strokes(@ptrCast(*const IInkRecognitionAlternates, self), Strokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognitionAlternates_Item(self: *const T, Index: i32, InkRecoAlternate: ?*?*IInkRecognitionAlternate) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognitionAlternates.VTable, self.vtable).Item(@ptrCast(*const IInkRecognitionAlternates, self), Index, InkRecoAlternate); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInkRecognizerGuide_Value = @import("../zig.zig").Guid.initString("d934be07-7b84-4208-9136-83c20994e905"); pub const IID_IInkRecognizerGuide = &IID_IInkRecognizerGuide_Value; pub const IInkRecognizerGuide = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_WritingBox: fn( self: *const IInkRecognizerGuide, Rectangle: ?*?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_WritingBox: fn( self: *const IInkRecognizerGuide, Rectangle: ?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DrawnBox: fn( self: *const IInkRecognizerGuide, Rectangle: ?*?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DrawnBox: fn( self: *const IInkRecognizerGuide, Rectangle: ?*IInkRectangle, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Rows: fn( self: *const IInkRecognizerGuide, Units: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Rows: fn( self: *const IInkRecognizerGuide, Units: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Columns: fn( self: *const IInkRecognizerGuide, Units: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Columns: fn( self: *const IInkRecognizerGuide, Units: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Midline: fn( self: *const IInkRecognizerGuide, Units: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Midline: fn( self: *const IInkRecognizerGuide, Units: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_GuideData: fn( self: *const IInkRecognizerGuide, pRecoGuide: ?*InkRecoGuide, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_GuideData: fn( self: *const IInkRecognizerGuide, recoGuide: InkRecoGuide, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerGuide_get_WritingBox(self: *const T, Rectangle: ?*?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerGuide.VTable, self.vtable).get_WritingBox(@ptrCast(*const IInkRecognizerGuide, self), Rectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerGuide_put_WritingBox(self: *const T, Rectangle: ?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerGuide.VTable, self.vtable).put_WritingBox(@ptrCast(*const IInkRecognizerGuide, self), Rectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerGuide_get_DrawnBox(self: *const T, Rectangle: ?*?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerGuide.VTable, self.vtable).get_DrawnBox(@ptrCast(*const IInkRecognizerGuide, self), Rectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerGuide_put_DrawnBox(self: *const T, Rectangle: ?*IInkRectangle) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerGuide.VTable, self.vtable).put_DrawnBox(@ptrCast(*const IInkRecognizerGuide, self), Rectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerGuide_get_Rows(self: *const T, Units: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerGuide.VTable, self.vtable).get_Rows(@ptrCast(*const IInkRecognizerGuide, self), Units); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerGuide_put_Rows(self: *const T, Units: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerGuide.VTable, self.vtable).put_Rows(@ptrCast(*const IInkRecognizerGuide, self), Units); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerGuide_get_Columns(self: *const T, Units: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerGuide.VTable, self.vtable).get_Columns(@ptrCast(*const IInkRecognizerGuide, self), Units); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerGuide_put_Columns(self: *const T, Units: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerGuide.VTable, self.vtable).put_Columns(@ptrCast(*const IInkRecognizerGuide, self), Units); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerGuide_get_Midline(self: *const T, Units: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerGuide.VTable, self.vtable).get_Midline(@ptrCast(*const IInkRecognizerGuide, self), Units); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerGuide_put_Midline(self: *const T, Units: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerGuide.VTable, self.vtable).put_Midline(@ptrCast(*const IInkRecognizerGuide, self), Units); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerGuide_get_GuideData(self: *const T, pRecoGuide: ?*InkRecoGuide) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerGuide.VTable, self.vtable).get_GuideData(@ptrCast(*const IInkRecognizerGuide, self), pRecoGuide); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkRecognizerGuide_put_GuideData(self: *const T, recoGuide: InkRecoGuide) callconv(.Inline) HRESULT { return @ptrCast(*const IInkRecognizerGuide.VTable, self.vtable).put_GuideData(@ptrCast(*const IInkRecognizerGuide, self), recoGuide); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInkWordList_Value = @import("../zig.zig").Guid.initString("76ba3491-cb2f-406b-9961-0e0c4cdaaef2"); pub const IID_IInkWordList = &IID_IInkWordList_Value; pub const IInkWordList = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, AddWord: fn( self: *const IInkWordList, NewWord: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveWord: fn( self: *const IInkWordList, RemoveWord: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Merge: fn( self: *const IInkWordList, MergeWordList: ?*IInkWordList, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkWordList_AddWord(self: *const T, NewWord: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkWordList.VTable, self.vtable).AddWord(@ptrCast(*const IInkWordList, self), NewWord); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkWordList_RemoveWord(self: *const T, RemoveWord: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkWordList.VTable, self.vtable).RemoveWord(@ptrCast(*const IInkWordList, self), RemoveWord); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkWordList_Merge(self: *const T, MergeWordList: ?*IInkWordList) callconv(.Inline) HRESULT { return @ptrCast(*const IInkWordList.VTable, self.vtable).Merge(@ptrCast(*const IInkWordList, self), MergeWordList); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkWordList2_Value = @import("../zig.zig").Guid.initString("14542586-11bf-4f5f-b6e7-49d0744aab6e"); pub const IID_IInkWordList2 = &IID_IInkWordList2_Value; pub const IInkWordList2 = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, AddWords: fn( self: *const IInkWordList2, NewWords: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkWordList2_AddWords(self: *const T, NewWords: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkWordList2.VTable, self.vtable).AddWords(@ptrCast(*const IInkWordList2, self), NewWords); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInk_Value = @import("../zig.zig").Guid.initString("03f8e511-43a1-11d3-8bb6-0080c7d6bad5"); pub const IID_IInk = &IID_IInk_Value; pub const IInk = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkLineInfo_Value = @import("../zig.zig").Guid.initString("9c1c5ad6-f22f-4de4-b453-a2cc482e7c33"); pub const IID_IInkLineInfo = &IID_IInkLineInfo_Value; pub const IInkLineInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetFormat: fn( self: *const IInkLineInfo, pim: ?*INKMETRIC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFormat: fn( self: *const IInkLineInfo, pim: ?*INKMETRIC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInkExtent: fn( self: *const IInkLineInfo, pim: ?*INKMETRIC, pnWidth: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCandidate: fn( self: *const IInkLineInfo, nCandidateNum: u32, pwcRecogWord: ?PWSTR, pcwcRecogWord: ?*u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCandidate: fn( self: *const IInkLineInfo, nCandidateNum: u32, strRecogWord: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Recognize: fn( self: *const IInkLineInfo, ) 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 IInkLineInfo_SetFormat(self: *const T, pim: ?*INKMETRIC) callconv(.Inline) HRESULT { return @ptrCast(*const IInkLineInfo.VTable, self.vtable).SetFormat(@ptrCast(*const IInkLineInfo, self), pim); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkLineInfo_GetFormat(self: *const T, pim: ?*INKMETRIC) callconv(.Inline) HRESULT { return @ptrCast(*const IInkLineInfo.VTable, self.vtable).GetFormat(@ptrCast(*const IInkLineInfo, self), pim); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkLineInfo_GetInkExtent(self: *const T, pim: ?*INKMETRIC, pnWidth: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkLineInfo.VTable, self.vtable).GetInkExtent(@ptrCast(*const IInkLineInfo, self), pim, pnWidth); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkLineInfo_GetCandidate(self: *const T, nCandidateNum: u32, pwcRecogWord: ?PWSTR, pcwcRecogWord: ?*u32, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkLineInfo.VTable, self.vtable).GetCandidate(@ptrCast(*const IInkLineInfo, self), nCandidateNum, pwcRecogWord, pcwcRecogWord, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkLineInfo_SetCandidate(self: *const T, nCandidateNum: u32, strRecogWord: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkLineInfo.VTable, self.vtable).SetCandidate(@ptrCast(*const IInkLineInfo, self), nCandidateNum, strRecogWord); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkLineInfo_Recognize(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IInkLineInfo.VTable, self.vtable).Recognize(@ptrCast(*const IInkLineInfo, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISketchInk_Value = @import("../zig.zig").Guid.initString("b4563688-98eb-4646-b279-44da14d45748"); pub const IID_ISketchInk = &IID_ISketchInk_Value; pub const ISketchInk = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; const CLSID_InkDivider_Value = @import("../zig.zig").Guid.initString("8854f6a0-4683-4ae7-9191-752fe64612c3"); pub const CLSID_InkDivider = &CLSID_InkDivider_Value; pub const InkDivisionType = enum(i32) { Segment = 0, Line = 1, Paragraph = 2, Drawing = 3, }; pub const IDT_Segment = InkDivisionType.Segment; pub const IDT_Line = InkDivisionType.Line; pub const IDT_Paragraph = InkDivisionType.Paragraph; pub const IDT_Drawing = InkDivisionType.Drawing; pub const DISPID_InkDivider = enum(i32) { Strokes = 1, RecognizerContext = 2, LineHeight = 3, Divide = 4, }; pub const DISPID_IInkDivider_Strokes = DISPID_InkDivider.Strokes; pub const DISPID_IInkDivider_RecognizerContext = DISPID_InkDivider.RecognizerContext; pub const DISPID_IInkDivider_LineHeight = DISPID_InkDivider.LineHeight; pub const DISPID_IInkDivider_Divide = DISPID_InkDivider.Divide; pub const DISPID_InkDivisionResult = enum(i32) { Strokes = 1, ResultByType = 2, }; pub const DISPID_IInkDivisionResult_Strokes = DISPID_InkDivisionResult.Strokes; pub const DISPID_IInkDivisionResult_ResultByType = DISPID_InkDivisionResult.ResultByType; pub const DISPID_InkDivisionUnit = enum(i32) { Strokes = 1, DivisionType = 2, RecognizedString = 3, RotationTransform = 4, }; pub const DISPID_IInkDivisionUnit_Strokes = DISPID_InkDivisionUnit.Strokes; pub const DISPID_IInkDivisionUnit_DivisionType = DISPID_InkDivisionUnit.DivisionType; pub const DISPID_IInkDivisionUnit_RecognizedString = DISPID_InkDivisionUnit.RecognizedString; pub const DISPID_IInkDivisionUnit_RotationTransform = DISPID_InkDivisionUnit.RotationTransform; pub const DISPID_InkDivisionUnits = enum(i32) { NewEnum = -4, Item = 0, Count = 1, }; pub const DISPID_IInkDivisionUnits_NewEnum = DISPID_InkDivisionUnits.NewEnum; pub const DISPID_IInkDivisionUnits_Item = DISPID_InkDivisionUnits.Item; pub const DISPID_IInkDivisionUnits_Count = DISPID_InkDivisionUnits.Count; const IID_IInkDivider_Value = @import("../zig.zig").Guid.initString("5de00405-f9a4-4651-b0c5-c317defd58b9"); pub const IID_IInkDivider = &IID_IInkDivider_Value; pub const IInkDivider = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Strokes: fn( self: *const IInkDivider, Strokes: ?*?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_Strokes: fn( self: *const IInkDivider, Strokes: ?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RecognizerContext: fn( self: *const IInkDivider, RecognizerContext: ?*?*IInkRecognizerContext, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_RecognizerContext: fn( self: *const IInkDivider, RecognizerContext: ?*IInkRecognizerContext, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LineHeight: fn( self: *const IInkDivider, LineHeight: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_LineHeight: fn( self: *const IInkDivider, LineHeight: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Divide: fn( self: *const IInkDivider, InkDivisionResult: ?*?*IInkDivisionResult, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDivider_get_Strokes(self: *const T, Strokes: ?*?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDivider.VTable, self.vtable).get_Strokes(@ptrCast(*const IInkDivider, self), Strokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDivider_putref_Strokes(self: *const T, Strokes: ?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDivider.VTable, self.vtable).putref_Strokes(@ptrCast(*const IInkDivider, self), Strokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDivider_get_RecognizerContext(self: *const T, RecognizerContext: ?*?*IInkRecognizerContext) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDivider.VTable, self.vtable).get_RecognizerContext(@ptrCast(*const IInkDivider, self), RecognizerContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDivider_putref_RecognizerContext(self: *const T, RecognizerContext: ?*IInkRecognizerContext) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDivider.VTable, self.vtable).putref_RecognizerContext(@ptrCast(*const IInkDivider, self), RecognizerContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDivider_get_LineHeight(self: *const T, LineHeight: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDivider.VTable, self.vtable).get_LineHeight(@ptrCast(*const IInkDivider, self), LineHeight); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDivider_put_LineHeight(self: *const T, LineHeight: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDivider.VTable, self.vtable).put_LineHeight(@ptrCast(*const IInkDivider, self), LineHeight); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDivider_Divide(self: *const T, InkDivisionResult: ?*?*IInkDivisionResult) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDivider.VTable, self.vtable).Divide(@ptrCast(*const IInkDivider, self), InkDivisionResult); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkDivisionResult_Value = @import("../zig.zig").Guid.initString("2dbec0a7-74c7-4b38-81eb-aa8ef0c24900"); pub const IID_IInkDivisionResult = &IID_IInkDivisionResult_Value; pub const IInkDivisionResult = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Strokes: fn( self: *const IInkDivisionResult, Strokes: ?*?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ResultByType: fn( self: *const IInkDivisionResult, divisionType: InkDivisionType, InkDivisionUnits: ?*?*IInkDivisionUnits, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDivisionResult_get_Strokes(self: *const T, Strokes: ?*?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDivisionResult.VTable, self.vtable).get_Strokes(@ptrCast(*const IInkDivisionResult, self), Strokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDivisionResult_ResultByType(self: *const T, divisionType: InkDivisionType, InkDivisionUnits: ?*?*IInkDivisionUnits) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDivisionResult.VTable, self.vtable).ResultByType(@ptrCast(*const IInkDivisionResult, self), divisionType, InkDivisionUnits); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkDivisionUnit_Value = @import("../zig.zig").Guid.initString("85aee342-48b0-4244-9dd5-1ed435410fab"); pub const IID_IInkDivisionUnit = &IID_IInkDivisionUnit_Value; pub const IInkDivisionUnit = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Strokes: fn( self: *const IInkDivisionUnit, Strokes: ?*?*IInkStrokes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DivisionType: fn( self: *const IInkDivisionUnit, divisionType: ?*InkDivisionType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RecognizedString: fn( self: *const IInkDivisionUnit, RecoString: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RotationTransform: fn( self: *const IInkDivisionUnit, RotationTransform: ?*?*IInkTransform, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDivisionUnit_get_Strokes(self: *const T, Strokes: ?*?*IInkStrokes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDivisionUnit.VTable, self.vtable).get_Strokes(@ptrCast(*const IInkDivisionUnit, self), Strokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDivisionUnit_get_DivisionType(self: *const T, divisionType: ?*InkDivisionType) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDivisionUnit.VTable, self.vtable).get_DivisionType(@ptrCast(*const IInkDivisionUnit, self), divisionType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDivisionUnit_get_RecognizedString(self: *const T, RecoString: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDivisionUnit.VTable, self.vtable).get_RecognizedString(@ptrCast(*const IInkDivisionUnit, self), RecoString); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDivisionUnit_get_RotationTransform(self: *const T, RotationTransform: ?*?*IInkTransform) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDivisionUnit.VTable, self.vtable).get_RotationTransform(@ptrCast(*const IInkDivisionUnit, self), RotationTransform); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInkDivisionUnits_Value = @import("../zig.zig").Guid.initString("1bb5ddc2-31cc-4135-ab82-2c66c9f00c41"); pub const IID_IInkDivisionUnits = &IID_IInkDivisionUnits_Value; pub const IInkDivisionUnits = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const IInkDivisionUnits, Count: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IInkDivisionUnits, _NewEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Item: fn( self: *const IInkDivisionUnits, Index: i32, InkDivisionUnit: ?*?*IInkDivisionUnit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDivisionUnits_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDivisionUnits.VTable, self.vtable).get_Count(@ptrCast(*const IInkDivisionUnits, self), Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDivisionUnits_get__NewEnum(self: *const T, _NewEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDivisionUnits.VTable, self.vtable).get__NewEnum(@ptrCast(*const IInkDivisionUnits, self), _NewEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkDivisionUnits_Item(self: *const T, Index: i32, InkDivisionUnit: ?*?*IInkDivisionUnit) callconv(.Inline) HRESULT { return @ptrCast(*const IInkDivisionUnits.VTable, self.vtable).Item(@ptrCast(*const IInkDivisionUnits, self), Index, InkDivisionUnit); } };} pub usingnamespace MethodMixin(@This()); }; const CLSID_HandwrittenTextInsertion_Value = @import("../zig.zig").Guid.initString("9f074ee2-e6e9-4d8a-a047-eb5b5c3c55da"); pub const CLSID_HandwrittenTextInsertion = &CLSID_HandwrittenTextInsertion_Value; const CLSID_PenInputPanel_Value = @import("../zig.zig").Guid.initString("f744e496-1b5a-489e-81dc-fbd7ac6298a8"); pub const CLSID_PenInputPanel = &CLSID_PenInputPanel_Value; const CLSID_TextInputPanel_Value = @import("../zig.zig").Guid.initString("f9b189d7-228b-4f2b-8650-b97f59e02c8c"); pub const CLSID_TextInputPanel = &CLSID_TextInputPanel_Value; const CLSID_PenInputPanel_Internal_Value = @import("../zig.zig").Guid.initString("802b1fb9-056b-4720-b0cc-80d23b71171e"); pub const CLSID_PenInputPanel_Internal = &CLSID_PenInputPanel_Internal_Value; pub const DISPID_PenInputPanel = enum(i32) { AttachedEditWindow = 0, Factoid = 1, CurrentPanel = 2, DefaultPanel = 3, Visible = 4, Top = 5, Left = 6, Width = 7, Height = 8, MoveTo = 9, CommitPendingInput = 10, Refresh = 11, Busy = 12, VerticalOffset = 13, HorizontalOffset = 14, EnableTsf = 15, AutoShow = 16, }; pub const DISPID_PIPAttachedEditWindow = DISPID_PenInputPanel.AttachedEditWindow; pub const DISPID_PIPFactoid = DISPID_PenInputPanel.Factoid; pub const DISPID_PIPCurrentPanel = DISPID_PenInputPanel.CurrentPanel; pub const DISPID_PIPDefaultPanel = DISPID_PenInputPanel.DefaultPanel; pub const DISPID_PIPVisible = DISPID_PenInputPanel.Visible; pub const DISPID_PIPTop = DISPID_PenInputPanel.Top; pub const DISPID_PIPLeft = DISPID_PenInputPanel.Left; pub const DISPID_PIPWidth = DISPID_PenInputPanel.Width; pub const DISPID_PIPHeight = DISPID_PenInputPanel.Height; pub const DISPID_PIPMoveTo = DISPID_PenInputPanel.MoveTo; pub const DISPID_PIPCommitPendingInput = DISPID_PenInputPanel.CommitPendingInput; pub const DISPID_PIPRefresh = DISPID_PenInputPanel.Refresh; pub const DISPID_PIPBusy = DISPID_PenInputPanel.Busy; pub const DISPID_PIPVerticalOffset = DISPID_PenInputPanel.VerticalOffset; pub const DISPID_PIPHorizontalOffset = DISPID_PenInputPanel.HorizontalOffset; pub const DISPID_PIPEnableTsf = DISPID_PenInputPanel.EnableTsf; pub const DISPID_PIPAutoShow = DISPID_PenInputPanel.AutoShow; pub const DISPID_PenInputPanelEvents = enum(i32) { VisibleChanged = 0, PanelChanged = 1, InputFailed = 2, PanelMoving = 3, }; pub const DISPID_PIPEVisibleChanged = DISPID_PenInputPanelEvents.VisibleChanged; pub const DISPID_PIPEPanelChanged = DISPID_PenInputPanelEvents.PanelChanged; pub const DISPID_PIPEInputFailed = DISPID_PenInputPanelEvents.InputFailed; pub const DISPID_PIPEPanelMoving = DISPID_PenInputPanelEvents.PanelMoving; pub const VisualState = enum(i32) { InPlace = 0, Floating = 1, DockedTop = 2, DockedBottom = 3, Closed = 4, }; pub const InPlace = VisualState.InPlace; pub const Floating = VisualState.Floating; pub const DockedTop = VisualState.DockedTop; pub const DockedBottom = VisualState.DockedBottom; pub const Closed = VisualState.Closed; pub const InteractionMode = enum(i32) { InPlace = 0, Floating = 1, DockedTop = 2, DockedBottom = 3, }; pub const InteractionMode_InPlace = InteractionMode.InPlace; pub const InteractionMode_Floating = InteractionMode.Floating; pub const InteractionMode_DockedTop = InteractionMode.DockedTop; pub const InteractionMode_DockedBottom = InteractionMode.DockedBottom; pub const InPlaceState = enum(i32) { Auto = 0, HoverTarget = 1, Expanded = 2, }; pub const InPlaceState_Auto = InPlaceState.Auto; pub const InPlaceState_HoverTarget = InPlaceState.HoverTarget; pub const InPlaceState_Expanded = InPlaceState.Expanded; pub const PanelInputArea = enum(i32) { Auto = 0, Keyboard = 1, WritingPad = 2, CharacterPad = 3, }; pub const PanelInputArea_Auto = PanelInputArea.Auto; pub const PanelInputArea_Keyboard = PanelInputArea.Keyboard; pub const PanelInputArea_WritingPad = PanelInputArea.WritingPad; pub const PanelInputArea_CharacterPad = PanelInputArea.CharacterPad; pub const CorrectionMode = enum(i32) { NotVisible = 0, PreInsertion = 1, PostInsertionCollapsed = 2, PostInsertionExpanded = 3, }; pub const CorrectionMode_NotVisible = CorrectionMode.NotVisible; pub const CorrectionMode_PreInsertion = CorrectionMode.PreInsertion; pub const CorrectionMode_PostInsertionCollapsed = CorrectionMode.PostInsertionCollapsed; pub const CorrectionMode_PostInsertionExpanded = CorrectionMode.PostInsertionExpanded; pub const CorrectionPosition = enum(i32) { Auto = 0, Bottom = 1, Top = 2, }; pub const CorrectionPosition_Auto = CorrectionPosition.Auto; pub const CorrectionPosition_Bottom = CorrectionPosition.Bottom; pub const CorrectionPosition_Top = CorrectionPosition.Top; pub const InPlaceDirection = enum(i32) { Auto = 0, Bottom = 1, Top = 2, }; pub const InPlaceDirection_Auto = InPlaceDirection.Auto; pub const InPlaceDirection_Bottom = InPlaceDirection.Bottom; pub const InPlaceDirection_Top = InPlaceDirection.Top; pub const EventMask = enum(i32) { InPlaceStateChanging = 1, InPlaceStateChanged = 2, InPlaceSizeChanging = 4, InPlaceSizeChanged = 8, InputAreaChanging = 16, InputAreaChanged = 32, CorrectionModeChanging = 64, CorrectionModeChanged = 128, InPlaceVisibilityChanging = 256, InPlaceVisibilityChanged = 512, TextInserting = 1024, TextInserted = 2048, All = 4095, }; pub const EventMask_InPlaceStateChanging = EventMask.InPlaceStateChanging; pub const EventMask_InPlaceStateChanged = EventMask.InPlaceStateChanged; pub const EventMask_InPlaceSizeChanging = EventMask.InPlaceSizeChanging; pub const EventMask_InPlaceSizeChanged = EventMask.InPlaceSizeChanged; pub const EventMask_InputAreaChanging = EventMask.InputAreaChanging; pub const EventMask_InputAreaChanged = EventMask.InputAreaChanged; pub const EventMask_CorrectionModeChanging = EventMask.CorrectionModeChanging; pub const EventMask_CorrectionModeChanged = EventMask.CorrectionModeChanged; pub const EventMask_InPlaceVisibilityChanging = EventMask.InPlaceVisibilityChanging; pub const EventMask_InPlaceVisibilityChanged = EventMask.InPlaceVisibilityChanged; pub const EventMask_TextInserting = EventMask.TextInserting; pub const EventMask_TextInserted = EventMask.TextInserted; pub const EventMask_All = EventMask.All; pub const PanelType = enum(i32) { Default = 0, Inactive = 1, Handwriting = 2, Keyboard = 3, }; pub const PT_Default = PanelType.Default; pub const PT_Inactive = PanelType.Inactive; pub const PT_Handwriting = PanelType.Handwriting; pub const PT_Keyboard = PanelType.Keyboard; const IID_IPenInputPanel_Value = @import("../zig.zig").Guid.initString("fa7a4083-5747-4040-a182-0b0e9fd4fac7"); pub const IID_IPenInputPanel = &IID_IPenInputPanel_Value; pub const IPenInputPanel = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Busy: fn( self: *const IPenInputPanel, Busy: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Factoid: fn( self: *const IPenInputPanel, Factoid: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Factoid: fn( self: *const IPenInputPanel, Factoid: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AttachedEditWindow: fn( self: *const IPenInputPanel, AttachedEditWindow: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AttachedEditWindow: fn( self: *const IPenInputPanel, AttachedEditWindow: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CurrentPanel: fn( self: *const IPenInputPanel, CurrentPanel: ?*PanelType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_CurrentPanel: fn( self: *const IPenInputPanel, CurrentPanel: PanelType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DefaultPanel: fn( self: *const IPenInputPanel, pDefaultPanel: ?*PanelType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DefaultPanel: fn( self: *const IPenInputPanel, DefaultPanel: PanelType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Visible: fn( self: *const IPenInputPanel, Visible: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Visible: fn( self: *const IPenInputPanel, Visible: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Top: fn( self: *const IPenInputPanel, Top: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Left: fn( self: *const IPenInputPanel, Left: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Width: fn( self: *const IPenInputPanel, Width: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Height: fn( self: *const IPenInputPanel, Height: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_VerticalOffset: fn( self: *const IPenInputPanel, VerticalOffset: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_VerticalOffset: fn( self: *const IPenInputPanel, VerticalOffset: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_HorizontalOffset: fn( self: *const IPenInputPanel, HorizontalOffset: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_HorizontalOffset: fn( self: *const IPenInputPanel, HorizontalOffset: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AutoShow: fn( self: *const IPenInputPanel, pAutoShow: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AutoShow: fn( self: *const IPenInputPanel, AutoShow: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MoveTo: fn( self: *const IPenInputPanel, Left: i32, Top: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CommitPendingInput: fn( self: *const IPenInputPanel, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const IPenInputPanel, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnableTsf: fn( self: *const IPenInputPanel, Enable: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_get_Busy(self: *const T, Busy: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).get_Busy(@ptrCast(*const IPenInputPanel, self), Busy); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_get_Factoid(self: *const T, Factoid: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).get_Factoid(@ptrCast(*const IPenInputPanel, self), Factoid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_put_Factoid(self: *const T, Factoid: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).put_Factoid(@ptrCast(*const IPenInputPanel, self), Factoid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_get_AttachedEditWindow(self: *const T, AttachedEditWindow: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).get_AttachedEditWindow(@ptrCast(*const IPenInputPanel, self), AttachedEditWindow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_put_AttachedEditWindow(self: *const T, AttachedEditWindow: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).put_AttachedEditWindow(@ptrCast(*const IPenInputPanel, self), AttachedEditWindow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_get_CurrentPanel(self: *const T, CurrentPanel: ?*PanelType) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).get_CurrentPanel(@ptrCast(*const IPenInputPanel, self), CurrentPanel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_put_CurrentPanel(self: *const T, CurrentPanel: PanelType) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).put_CurrentPanel(@ptrCast(*const IPenInputPanel, self), CurrentPanel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_get_DefaultPanel(self: *const T, pDefaultPanel: ?*PanelType) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).get_DefaultPanel(@ptrCast(*const IPenInputPanel, self), pDefaultPanel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_put_DefaultPanel(self: *const T, DefaultPanel: PanelType) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).put_DefaultPanel(@ptrCast(*const IPenInputPanel, self), DefaultPanel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_get_Visible(self: *const T, Visible: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).get_Visible(@ptrCast(*const IPenInputPanel, self), Visible); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_put_Visible(self: *const T, Visible: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).put_Visible(@ptrCast(*const IPenInputPanel, self), Visible); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_get_Top(self: *const T, Top: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).get_Top(@ptrCast(*const IPenInputPanel, self), Top); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_get_Left(self: *const T, Left: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).get_Left(@ptrCast(*const IPenInputPanel, self), Left); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_get_Width(self: *const T, Width: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).get_Width(@ptrCast(*const IPenInputPanel, self), Width); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_get_Height(self: *const T, Height: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).get_Height(@ptrCast(*const IPenInputPanel, self), Height); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_get_VerticalOffset(self: *const T, VerticalOffset: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).get_VerticalOffset(@ptrCast(*const IPenInputPanel, self), VerticalOffset); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_put_VerticalOffset(self: *const T, VerticalOffset: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).put_VerticalOffset(@ptrCast(*const IPenInputPanel, self), VerticalOffset); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_get_HorizontalOffset(self: *const T, HorizontalOffset: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).get_HorizontalOffset(@ptrCast(*const IPenInputPanel, self), HorizontalOffset); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_put_HorizontalOffset(self: *const T, HorizontalOffset: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).put_HorizontalOffset(@ptrCast(*const IPenInputPanel, self), HorizontalOffset); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_get_AutoShow(self: *const T, pAutoShow: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).get_AutoShow(@ptrCast(*const IPenInputPanel, self), pAutoShow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_put_AutoShow(self: *const T, AutoShow: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).put_AutoShow(@ptrCast(*const IPenInputPanel, self), AutoShow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_MoveTo(self: *const T, Left: i32, Top: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).MoveTo(@ptrCast(*const IPenInputPanel, self), Left, Top); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_CommitPendingInput(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).CommitPendingInput(@ptrCast(*const IPenInputPanel, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).Refresh(@ptrCast(*const IPenInputPanel, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPenInputPanel_EnableTsf(self: *const T, Enable: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IPenInputPanel.VTable, self.vtable).EnableTsf(@ptrCast(*const IPenInputPanel, self), Enable); } };} pub usingnamespace MethodMixin(@This()); }; const IID__IPenInputPanelEvents_Value = @import("../zig.zig").Guid.initString("b7e489da-3719-439f-848f-e7acbd820f17"); pub const IID__IPenInputPanelEvents = &IID__IPenInputPanelEvents_Value; pub const _IPenInputPanelEvents = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IHandwrittenTextInsertion_Value = @import("../zig.zig").Guid.initString("56fdea97-ecd6-43e7-aa3a-816be7785860"); pub const IID_IHandwrittenTextInsertion = &IID_IHandwrittenTextInsertion_Value; pub const IHandwrittenTextInsertion = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, InsertRecognitionResultsArray: fn( self: *const IHandwrittenTextInsertion, psaAlternates: ?*SAFEARRAY, locale: u32, fAlternateContainsAutoSpacingInformation: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InsertInkRecognitionResult: fn( self: *const IHandwrittenTextInsertion, pIInkRecoResult: ?*IInkRecognitionResult, locale: u32, fAlternateContainsAutoSpacingInformation: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IHandwrittenTextInsertion_InsertRecognitionResultsArray(self: *const T, psaAlternates: ?*SAFEARRAY, locale: u32, fAlternateContainsAutoSpacingInformation: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IHandwrittenTextInsertion.VTable, self.vtable).InsertRecognitionResultsArray(@ptrCast(*const IHandwrittenTextInsertion, self), psaAlternates, locale, fAlternateContainsAutoSpacingInformation); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IHandwrittenTextInsertion_InsertInkRecognitionResult(self: *const T, pIInkRecoResult: ?*IInkRecognitionResult, locale: u32, fAlternateContainsAutoSpacingInformation: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IHandwrittenTextInsertion.VTable, self.vtable).InsertInkRecognitionResult(@ptrCast(*const IHandwrittenTextInsertion, self), pIInkRecoResult, locale, fAlternateContainsAutoSpacingInformation); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_ITextInputPanelEventSink_Value = @import("../zig.zig").Guid.initString("27560408-8e64-4fe1-804e-421201584b31"); pub const IID_ITextInputPanelEventSink = &IID_ITextInputPanelEventSink_Value; pub const ITextInputPanelEventSink = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, InPlaceStateChanging: fn( self: *const ITextInputPanelEventSink, oldInPlaceState: InPlaceState, newInPlaceState: InPlaceState, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InPlaceStateChanged: fn( self: *const ITextInputPanelEventSink, oldInPlaceState: InPlaceState, newInPlaceState: InPlaceState, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InPlaceSizeChanging: fn( self: *const ITextInputPanelEventSink, oldBoundingRectangle: RECT, newBoundingRectangle: RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InPlaceSizeChanged: fn( self: *const ITextInputPanelEventSink, oldBoundingRectangle: RECT, newBoundingRectangle: RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InputAreaChanging: fn( self: *const ITextInputPanelEventSink, oldInputArea: PanelInputArea, newInputArea: PanelInputArea, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InputAreaChanged: fn( self: *const ITextInputPanelEventSink, oldInputArea: PanelInputArea, newInputArea: PanelInputArea, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CorrectionModeChanging: fn( self: *const ITextInputPanelEventSink, oldCorrectionMode: CorrectionMode, newCorrectionMode: CorrectionMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CorrectionModeChanged: fn( self: *const ITextInputPanelEventSink, oldCorrectionMode: CorrectionMode, newCorrectionMode: CorrectionMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InPlaceVisibilityChanging: fn( self: *const ITextInputPanelEventSink, oldVisible: BOOL, newVisible: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InPlaceVisibilityChanged: fn( self: *const ITextInputPanelEventSink, oldVisible: BOOL, newVisible: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TextInserting: fn( self: *const ITextInputPanelEventSink, Ink: ?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TextInserted: fn( self: *const ITextInputPanelEventSink, Ink: ?*SAFEARRAY, ) 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 ITextInputPanelEventSink_InPlaceStateChanging(self: *const T, oldInPlaceState: InPlaceState, newInPlaceState: InPlaceState) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanelEventSink.VTable, self.vtable).InPlaceStateChanging(@ptrCast(*const ITextInputPanelEventSink, self), oldInPlaceState, newInPlaceState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanelEventSink_InPlaceStateChanged(self: *const T, oldInPlaceState: InPlaceState, newInPlaceState: InPlaceState) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanelEventSink.VTable, self.vtable).InPlaceStateChanged(@ptrCast(*const ITextInputPanelEventSink, self), oldInPlaceState, newInPlaceState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanelEventSink_InPlaceSizeChanging(self: *const T, oldBoundingRectangle: RECT, newBoundingRectangle: RECT) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanelEventSink.VTable, self.vtable).InPlaceSizeChanging(@ptrCast(*const ITextInputPanelEventSink, self), oldBoundingRectangle, newBoundingRectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanelEventSink_InPlaceSizeChanged(self: *const T, oldBoundingRectangle: RECT, newBoundingRectangle: RECT) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanelEventSink.VTable, self.vtable).InPlaceSizeChanged(@ptrCast(*const ITextInputPanelEventSink, self), oldBoundingRectangle, newBoundingRectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanelEventSink_InputAreaChanging(self: *const T, oldInputArea: PanelInputArea, newInputArea: PanelInputArea) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanelEventSink.VTable, self.vtable).InputAreaChanging(@ptrCast(*const ITextInputPanelEventSink, self), oldInputArea, newInputArea); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanelEventSink_InputAreaChanged(self: *const T, oldInputArea: PanelInputArea, newInputArea: PanelInputArea) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanelEventSink.VTable, self.vtable).InputAreaChanged(@ptrCast(*const ITextInputPanelEventSink, self), oldInputArea, newInputArea); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanelEventSink_CorrectionModeChanging(self: *const T, oldCorrectionMode: CorrectionMode, newCorrectionMode: CorrectionMode) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanelEventSink.VTable, self.vtable).CorrectionModeChanging(@ptrCast(*const ITextInputPanelEventSink, self), oldCorrectionMode, newCorrectionMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanelEventSink_CorrectionModeChanged(self: *const T, oldCorrectionMode: CorrectionMode, newCorrectionMode: CorrectionMode) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanelEventSink.VTable, self.vtable).CorrectionModeChanged(@ptrCast(*const ITextInputPanelEventSink, self), oldCorrectionMode, newCorrectionMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanelEventSink_InPlaceVisibilityChanging(self: *const T, oldVisible: BOOL, newVisible: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanelEventSink.VTable, self.vtable).InPlaceVisibilityChanging(@ptrCast(*const ITextInputPanelEventSink, self), oldVisible, newVisible); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanelEventSink_InPlaceVisibilityChanged(self: *const T, oldVisible: BOOL, newVisible: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanelEventSink.VTable, self.vtable).InPlaceVisibilityChanged(@ptrCast(*const ITextInputPanelEventSink, self), oldVisible, newVisible); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanelEventSink_TextInserting(self: *const T, Ink: ?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanelEventSink.VTable, self.vtable).TextInserting(@ptrCast(*const ITextInputPanelEventSink, self), Ink); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanelEventSink_TextInserted(self: *const T, Ink: ?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanelEventSink.VTable, self.vtable).TextInserted(@ptrCast(*const ITextInputPanelEventSink, self), Ink); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_ITextInputPanel_Value = @import("../zig.zig").Guid.initString("6b6a65a5-6af3-46c2-b6ea-56cd1f80df71"); pub const IID_ITextInputPanel = &IID_ITextInputPanel_Value; pub const ITextInputPanel = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AttachedEditWindow: fn( self: *const ITextInputPanel, AttachedEditWindow: ?*?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AttachedEditWindow: fn( self: *const ITextInputPanel, AttachedEditWindow: ?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CurrentInteractionMode: fn( self: *const ITextInputPanel, CurrentInteractionMode: ?*InteractionMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DefaultInPlaceState: fn( self: *const ITextInputPanel, State: ?*InPlaceState, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DefaultInPlaceState: fn( self: *const ITextInputPanel, State: InPlaceState, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CurrentInPlaceState: fn( self: *const ITextInputPanel, State: ?*InPlaceState, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DefaultInputArea: fn( self: *const ITextInputPanel, Area: ?*PanelInputArea, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DefaultInputArea: fn( self: *const ITextInputPanel, Area: PanelInputArea, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CurrentInputArea: fn( self: *const ITextInputPanel, Area: ?*PanelInputArea, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CurrentCorrectionMode: fn( self: *const ITextInputPanel, Mode: ?*CorrectionMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PreferredInPlaceDirection: fn( self: *const ITextInputPanel, Direction: ?*InPlaceDirection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_PreferredInPlaceDirection: fn( self: *const ITextInputPanel, Direction: InPlaceDirection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ExpandPostInsertionCorrection: fn( self: *const ITextInputPanel, Expand: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_ExpandPostInsertionCorrection: fn( self: *const ITextInputPanel, Expand: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_InPlaceVisibleOnFocus: fn( self: *const ITextInputPanel, Visible: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_InPlaceVisibleOnFocus: fn( self: *const ITextInputPanel, Visible: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_InPlaceBoundingRectangle: fn( self: *const ITextInputPanel, BoundingRectangle: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PopUpCorrectionHeight: fn( self: *const ITextInputPanel, Height: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PopDownCorrectionHeight: fn( self: *const ITextInputPanel, Height: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CommitPendingInput: fn( self: *const ITextInputPanel, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetInPlaceVisibility: fn( self: *const ITextInputPanel, Visible: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetInPlacePosition: fn( self: *const ITextInputPanel, xPosition: i32, yPosition: i32, position: CorrectionPosition, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetInPlaceHoverTargetPosition: fn( self: *const ITextInputPanel, xPosition: i32, yPosition: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Advise: fn( self: *const ITextInputPanel, EventSink: ?*ITextInputPanelEventSink, EventMask: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unadvise: fn( self: *const ITextInputPanel, EventSink: ?*ITextInputPanelEventSink, ) 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 ITextInputPanel_get_AttachedEditWindow(self: *const T, AttachedEditWindow: ?*?HWND) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).get_AttachedEditWindow(@ptrCast(*const ITextInputPanel, self), AttachedEditWindow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_put_AttachedEditWindow(self: *const T, AttachedEditWindow: ?HWND) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).put_AttachedEditWindow(@ptrCast(*const ITextInputPanel, self), AttachedEditWindow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_get_CurrentInteractionMode(self: *const T, CurrentInteractionMode: ?*InteractionMode) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).get_CurrentInteractionMode(@ptrCast(*const ITextInputPanel, self), CurrentInteractionMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_get_DefaultInPlaceState(self: *const T, State: ?*InPlaceState) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).get_DefaultInPlaceState(@ptrCast(*const ITextInputPanel, self), State); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_put_DefaultInPlaceState(self: *const T, State: InPlaceState) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).put_DefaultInPlaceState(@ptrCast(*const ITextInputPanel, self), State); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_get_CurrentInPlaceState(self: *const T, State: ?*InPlaceState) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).get_CurrentInPlaceState(@ptrCast(*const ITextInputPanel, self), State); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_get_DefaultInputArea(self: *const T, Area: ?*PanelInputArea) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).get_DefaultInputArea(@ptrCast(*const ITextInputPanel, self), Area); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_put_DefaultInputArea(self: *const T, Area: PanelInputArea) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).put_DefaultInputArea(@ptrCast(*const ITextInputPanel, self), Area); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_get_CurrentInputArea(self: *const T, Area: ?*PanelInputArea) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).get_CurrentInputArea(@ptrCast(*const ITextInputPanel, self), Area); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_get_CurrentCorrectionMode(self: *const T, Mode: ?*CorrectionMode) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).get_CurrentCorrectionMode(@ptrCast(*const ITextInputPanel, self), Mode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_get_PreferredInPlaceDirection(self: *const T, Direction: ?*InPlaceDirection) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).get_PreferredInPlaceDirection(@ptrCast(*const ITextInputPanel, self), Direction); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_put_PreferredInPlaceDirection(self: *const T, Direction: InPlaceDirection) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).put_PreferredInPlaceDirection(@ptrCast(*const ITextInputPanel, self), Direction); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_get_ExpandPostInsertionCorrection(self: *const T, Expand: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).get_ExpandPostInsertionCorrection(@ptrCast(*const ITextInputPanel, self), Expand); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_put_ExpandPostInsertionCorrection(self: *const T, Expand: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).put_ExpandPostInsertionCorrection(@ptrCast(*const ITextInputPanel, self), Expand); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_get_InPlaceVisibleOnFocus(self: *const T, Visible: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).get_InPlaceVisibleOnFocus(@ptrCast(*const ITextInputPanel, self), Visible); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_put_InPlaceVisibleOnFocus(self: *const T, Visible: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).put_InPlaceVisibleOnFocus(@ptrCast(*const ITextInputPanel, self), Visible); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_get_InPlaceBoundingRectangle(self: *const T, BoundingRectangle: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).get_InPlaceBoundingRectangle(@ptrCast(*const ITextInputPanel, self), BoundingRectangle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_get_PopUpCorrectionHeight(self: *const T, Height: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).get_PopUpCorrectionHeight(@ptrCast(*const ITextInputPanel, self), Height); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_get_PopDownCorrectionHeight(self: *const T, Height: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).get_PopDownCorrectionHeight(@ptrCast(*const ITextInputPanel, self), Height); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_CommitPendingInput(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).CommitPendingInput(@ptrCast(*const ITextInputPanel, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_SetInPlaceVisibility(self: *const T, Visible: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).SetInPlaceVisibility(@ptrCast(*const ITextInputPanel, self), Visible); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_SetInPlacePosition(self: *const T, xPosition: i32, yPosition: i32, position: CorrectionPosition) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).SetInPlacePosition(@ptrCast(*const ITextInputPanel, self), xPosition, yPosition, position); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_SetInPlaceHoverTargetPosition(self: *const T, xPosition: i32, yPosition: i32) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).SetInPlaceHoverTargetPosition(@ptrCast(*const ITextInputPanel, self), xPosition, yPosition); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_Advise(self: *const T, EventSink: ?*ITextInputPanelEventSink, _param_EventMask: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).Advise(@ptrCast(*const ITextInputPanel, self), EventSink, _param_EventMask); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanel_Unadvise(self: *const T, EventSink: ?*ITextInputPanelEventSink) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanel.VTable, self.vtable).Unadvise(@ptrCast(*const ITextInputPanel, self), EventSink); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInputPanelWindowHandle_Value = @import("../zig.zig").Guid.initString("4af81847-fdc4-4fc3-ad0b-422479c1b935"); pub const IID_IInputPanelWindowHandle = &IID_IInputPanelWindowHandle_Value; pub const IInputPanelWindowHandle = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AttachedEditWindow32: fn( self: *const IInputPanelWindowHandle, AttachedEditWindow: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AttachedEditWindow32: fn( self: *const IInputPanelWindowHandle, AttachedEditWindow: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AttachedEditWindow64: fn( self: *const IInputPanelWindowHandle, AttachedEditWindow: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AttachedEditWindow64: fn( self: *const IInputPanelWindowHandle, AttachedEditWindow: i64, ) 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 IInputPanelWindowHandle_get_AttachedEditWindow32(self: *const T, AttachedEditWindow: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInputPanelWindowHandle.VTable, self.vtable).get_AttachedEditWindow32(@ptrCast(*const IInputPanelWindowHandle, self), AttachedEditWindow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInputPanelWindowHandle_put_AttachedEditWindow32(self: *const T, AttachedEditWindow: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInputPanelWindowHandle.VTable, self.vtable).put_AttachedEditWindow32(@ptrCast(*const IInputPanelWindowHandle, self), AttachedEditWindow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInputPanelWindowHandle_get_AttachedEditWindow64(self: *const T, AttachedEditWindow: ?*i64) callconv(.Inline) HRESULT { return @ptrCast(*const IInputPanelWindowHandle.VTable, self.vtable).get_AttachedEditWindow64(@ptrCast(*const IInputPanelWindowHandle, self), AttachedEditWindow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInputPanelWindowHandle_put_AttachedEditWindow64(self: *const T, AttachedEditWindow: i64) callconv(.Inline) HRESULT { return @ptrCast(*const IInputPanelWindowHandle.VTable, self.vtable).put_AttachedEditWindow64(@ptrCast(*const IInputPanelWindowHandle, self), AttachedEditWindow); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_ITextInputPanelRunInfo_Value = @import("../zig.zig").Guid.initString("9f424568-1920-48cc-9811-a993cbf5adba"); pub const IID_ITextInputPanelRunInfo = &IID_ITextInputPanelRunInfo_Value; pub const ITextInputPanelRunInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, IsTipRunning: fn( self: *const ITextInputPanelRunInfo, pfRunning: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITextInputPanelRunInfo_IsTipRunning(self: *const T, pfRunning: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ITextInputPanelRunInfo.VTable, self.vtable).IsTipRunning(@ptrCast(*const ITextInputPanelRunInfo, self), pfRunning); } };} pub usingnamespace MethodMixin(@This()); }; pub const FLICKDIRECTION = enum(i32) { MIN = 0, // RIGHT = 0, this enum value conflicts with MIN UPRIGHT = 1, UP = 2, UPLEFT = 3, LEFT = 4, DOWNLEFT = 5, DOWN = 6, DOWNRIGHT = 7, INVALID = 8, }; pub const FLICKDIRECTION_MIN = FLICKDIRECTION.MIN; pub const FLICKDIRECTION_RIGHT = FLICKDIRECTION.MIN; pub const FLICKDIRECTION_UPRIGHT = FLICKDIRECTION.UPRIGHT; pub const FLICKDIRECTION_UP = FLICKDIRECTION.UP; pub const FLICKDIRECTION_UPLEFT = FLICKDIRECTION.UPLEFT; pub const FLICKDIRECTION_LEFT = FLICKDIRECTION.LEFT; pub const FLICKDIRECTION_DOWNLEFT = FLICKDIRECTION.DOWNLEFT; pub const FLICKDIRECTION_DOWN = FLICKDIRECTION.DOWN; pub const FLICKDIRECTION_DOWNRIGHT = FLICKDIRECTION.DOWNRIGHT; pub const FLICKDIRECTION_INVALID = FLICKDIRECTION.INVALID; pub const FLICKMODE = enum(i32) { MIN = 0, // OFF = 0, this enum value conflicts with MIN ON = 1, LEARNING = 2, // MAX = 2, this enum value conflicts with LEARNING // DEFAULT = 1, this enum value conflicts with ON }; pub const FLICKMODE_MIN = FLICKMODE.MIN; pub const FLICKMODE_OFF = FLICKMODE.MIN; pub const FLICKMODE_ON = FLICKMODE.ON; pub const FLICKMODE_LEARNING = FLICKMODE.LEARNING; pub const FLICKMODE_MAX = FLICKMODE.LEARNING; pub const FLICKMODE_DEFAULT = FLICKMODE.ON; pub const FLICKACTION_COMMANDCODE = enum(i32) { NULL = 0, SCROLL = 1, APPCOMMAND = 2, CUSTOMKEY = 3, KEYMODIFIER = 4, }; pub const FLICKACTION_COMMANDCODE_NULL = FLICKACTION_COMMANDCODE.NULL; pub const FLICKACTION_COMMANDCODE_SCROLL = FLICKACTION_COMMANDCODE.SCROLL; pub const FLICKACTION_COMMANDCODE_APPCOMMAND = FLICKACTION_COMMANDCODE.APPCOMMAND; pub const FLICKACTION_COMMANDCODE_CUSTOMKEY = FLICKACTION_COMMANDCODE.CUSTOMKEY; pub const FLICKACTION_COMMANDCODE_KEYMODIFIER = FLICKACTION_COMMANDCODE.KEYMODIFIER; pub const FLICK_POINT = extern struct { _bitfield: i32, }; pub const FLICK_DATA = extern struct { _bitfield: i32, }; pub const SCROLLDIRECTION = enum(i32) { UP = 0, DOWN = 1, }; pub const SCROLLDIRECTION_UP = SCROLLDIRECTION.UP; pub const SCROLLDIRECTION_DOWN = SCROLLDIRECTION.DOWN; pub const KEYMODIFIER = enum(i32) { CONTROL = 1, MENU = 2, SHIFT = 4, WIN = 8, ALTGR = 16, EXT = 32, }; pub const KEYMODIFIER_CONTROL = KEYMODIFIER.CONTROL; pub const KEYMODIFIER_MENU = KEYMODIFIER.MENU; pub const KEYMODIFIER_SHIFT = KEYMODIFIER.SHIFT; pub const KEYMODIFIER_WIN = KEYMODIFIER.WIN; pub const KEYMODIFIER_ALTGR = KEYMODIFIER.ALTGR; pub const KEYMODIFIER_EXT = KEYMODIFIER.EXT; const CLSID_InkEdit_Value = @import("../zig.zig").Guid.initString("e5ca59f5-57c4-4dd8-9bd6-1deeedd27af4"); pub const CLSID_InkEdit = &CLSID_InkEdit_Value; pub const IEC_STROKEINFO = extern struct { nmhdr: NMHDR, Cursor: ?*IInkCursor, Stroke: ?*IInkStrokeDisp, }; pub const IEC_GESTUREINFO = extern struct { nmhdr: NMHDR, Cursor: ?*IInkCursor, Strokes: ?*IInkStrokes, Gestures: VARIANT, }; pub const IEC_RECOGNITIONRESULTINFO = extern struct { nmhdr: NMHDR, RecognitionResult: ?*IInkRecognitionResult, }; pub const MouseButton = enum(i32) { NO_BUTTON = 0, LEFT_BUTTON = 1, RIGHT_BUTTON = 2, MIDDLE_BUTTON = 4, }; pub const NO_BUTTON = MouseButton.NO_BUTTON; pub const LEFT_BUTTON = MouseButton.LEFT_BUTTON; pub const RIGHT_BUTTON = MouseButton.RIGHT_BUTTON; pub const MIDDLE_BUTTON = MouseButton.MIDDLE_BUTTON; pub const SelAlignmentConstants = enum(i32) { Left = 0, Right = 1, Center = 2, }; pub const rtfLeft = SelAlignmentConstants.Left; pub const rtfRight = SelAlignmentConstants.Right; pub const rtfCenter = SelAlignmentConstants.Center; pub const DISPID_InkEdit = enum(i32) { Text = 0, TextRTF = 1, Hwnd = 2, DisableNoScroll = 3, Locked = 4, Enabled = 5, MaxLength = 6, MultiLine = 7, ScrollBars = 8, RTSelStart = 9, RTSelLength = 10, RTSelText = 11, SelAlignment = 12, SelBold = 13, SelCharOffset = 14, SelColor = 15, SelFontName = 16, SelFontSize = 17, SelItalic = 18, SelRTF = 19, SelUnderline = 20, DragIcon = 21, Status = 22, UseMouseForInput = 23, InkMode = 24, InkInsertMode = 25, RecoTimeout = 26, DrawAttr = 27, Recognizer = 28, Factoid = 29, SelInk = 30, SelInksDisplayMode = 31, Recognize = 32, GetGestStatus = 33, SetGestStatus = 34, Refresh = 35, }; pub const DISPID_Text = DISPID_InkEdit.Text; pub const DISPID_TextRTF = DISPID_InkEdit.TextRTF; pub const DISPID_Hwnd = DISPID_InkEdit.Hwnd; pub const DISPID_DisableNoScroll = DISPID_InkEdit.DisableNoScroll; pub const DISPID_Locked = DISPID_InkEdit.Locked; pub const DISPID_Enabled = DISPID_InkEdit.Enabled; pub const DISPID_MaxLength = DISPID_InkEdit.MaxLength; pub const DISPID_MultiLine = DISPID_InkEdit.MultiLine; pub const DISPID_ScrollBars = DISPID_InkEdit.ScrollBars; pub const DISPID_RTSelStart = DISPID_InkEdit.RTSelStart; pub const DISPID_RTSelLength = DISPID_InkEdit.RTSelLength; pub const DISPID_RTSelText = DISPID_InkEdit.RTSelText; pub const DISPID_SelAlignment = DISPID_InkEdit.SelAlignment; pub const DISPID_SelBold = DISPID_InkEdit.SelBold; pub const DISPID_SelCharOffset = DISPID_InkEdit.SelCharOffset; pub const DISPID_SelColor = DISPID_InkEdit.SelColor; pub const DISPID_SelFontName = DISPID_InkEdit.SelFontName; pub const DISPID_SelFontSize = DISPID_InkEdit.SelFontSize; pub const DISPID_SelItalic = DISPID_InkEdit.SelItalic; pub const DISPID_SelRTF = DISPID_InkEdit.SelRTF; pub const DISPID_SelUnderline = DISPID_InkEdit.SelUnderline; pub const DISPID_DragIcon = DISPID_InkEdit.DragIcon; pub const DISPID_Status = DISPID_InkEdit.Status; pub const DISPID_UseMouseForInput = DISPID_InkEdit.UseMouseForInput; pub const DISPID_InkMode = DISPID_InkEdit.InkMode; pub const DISPID_InkInsertMode = DISPID_InkEdit.InkInsertMode; pub const DISPID_RecoTimeout = DISPID_InkEdit.RecoTimeout; pub const DISPID_DrawAttr = DISPID_InkEdit.DrawAttr; pub const DISPID_Recognizer = DISPID_InkEdit.Recognizer; pub const DISPID_Factoid = DISPID_InkEdit.Factoid; pub const DISPID_SelInk = DISPID_InkEdit.SelInk; pub const DISPID_SelInksDisplayMode = DISPID_InkEdit.SelInksDisplayMode; pub const DISPID_Recognize = DISPID_InkEdit.Recognize; pub const DISPID_GetGestStatus = DISPID_InkEdit.GetGestStatus; pub const DISPID_SetGestStatus = DISPID_InkEdit.SetGestStatus; pub const DISPID_Refresh = DISPID_InkEdit.Refresh; pub const DISPID_InkEditEvents = enum(i32) { Change = 1, SelChange = 2, KeyDown = 3, KeyUp = 4, MouseUp = 5, MouseDown = 6, KeyPress = 7, DblClick = 8, Click = 9, MouseMove = 10, CursorDown = 21, Stroke = 22, Gesture = 23, RecognitionResult = 24, }; pub const DISPID_IeeChange = DISPID_InkEditEvents.Change; pub const DISPID_IeeSelChange = DISPID_InkEditEvents.SelChange; pub const DISPID_IeeKeyDown = DISPID_InkEditEvents.KeyDown; pub const DISPID_IeeKeyUp = DISPID_InkEditEvents.KeyUp; pub const DISPID_IeeMouseUp = DISPID_InkEditEvents.MouseUp; pub const DISPID_IeeMouseDown = DISPID_InkEditEvents.MouseDown; pub const DISPID_IeeKeyPress = DISPID_InkEditEvents.KeyPress; pub const DISPID_IeeDblClick = DISPID_InkEditEvents.DblClick; pub const DISPID_IeeClick = DISPID_InkEditEvents.Click; pub const DISPID_IeeMouseMove = DISPID_InkEditEvents.MouseMove; pub const DISPID_IeeCursorDown = DISPID_InkEditEvents.CursorDown; pub const DISPID_IeeStroke = DISPID_InkEditEvents.Stroke; pub const DISPID_IeeGesture = DISPID_InkEditEvents.Gesture; pub const DISPID_IeeRecognitionResult = DISPID_InkEditEvents.RecognitionResult; pub const InkMode = enum(i32) { Disabled = 0, Ink = 1, InkAndGesture = 2, }; pub const IEM_Disabled = InkMode.Disabled; pub const IEM_Ink = InkMode.Ink; pub const IEM_InkAndGesture = InkMode.InkAndGesture; pub const InkInsertMode = enum(i32) { Text = 0, Ink = 1, }; pub const IEM_InsertText = InkInsertMode.Text; pub const IEM_InsertInk = InkInsertMode.Ink; pub const InkEditStatus = enum(i32) { Idle = 0, Collecting = 1, Recognizing = 2, }; pub const IES_Idle = InkEditStatus.Idle; pub const IES_Collecting = InkEditStatus.Collecting; pub const IES_Recognizing = InkEditStatus.Recognizing; pub const InkDisplayMode = enum(i32) { Ink = 0, Text = 1, }; pub const IDM_Ink = InkDisplayMode.Ink; pub const IDM_Text = InkDisplayMode.Text; pub const AppearanceConstants = enum(i32) { Flat = 0, ThreeD = 1, }; pub const rtfFlat = AppearanceConstants.Flat; pub const rtfThreeD = AppearanceConstants.ThreeD; pub const BorderStyleConstants = enum(i32) { NoBorder = 0, FixedSingle = 1, }; pub const rtfNoBorder = BorderStyleConstants.NoBorder; pub const rtfFixedSingle = BorderStyleConstants.FixedSingle; pub const ScrollBarsConstants = enum(i32) { None = 0, Horizontal = 1, Vertical = 2, Both = 3, }; pub const rtfNone = ScrollBarsConstants.None; pub const rtfHorizontal = ScrollBarsConstants.Horizontal; pub const rtfVertical = ScrollBarsConstants.Vertical; pub const rtfBoth = ScrollBarsConstants.Both; const IID_IInkEdit_Value = @import("../zig.zig").Guid.initString("f2127a19-fbfb-4aed-8464-3f36d78cfefb"); pub const IID_IInkEdit = &IID_IInkEdit_Value; pub const IInkEdit = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Status: fn( self: *const IInkEdit, pStatus: ?*InkEditStatus, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_UseMouseForInput: fn( self: *const IInkEdit, pVal: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_UseMouseForInput: fn( self: *const IInkEdit, newVal: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_InkMode: fn( self: *const IInkEdit, pVal: ?*InkMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_InkMode: fn( self: *const IInkEdit, newVal: InkMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_InkInsertMode: fn( self: *const IInkEdit, pVal: ?*InkInsertMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_InkInsertMode: fn( self: *const IInkEdit, newVal: InkInsertMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DrawingAttributes: fn( self: *const IInkEdit, pVal: ?*?*IInkDrawingAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_DrawingAttributes: fn( self: *const IInkEdit, newVal: ?*IInkDrawingAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RecognitionTimeout: fn( self: *const IInkEdit, pVal: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RecognitionTimeout: fn( self: *const IInkEdit, newVal: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Recognizer: fn( self: *const IInkEdit, pVal: ?*?*IInkRecognizer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_Recognizer: fn( self: *const IInkEdit, newVal: ?*IInkRecognizer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Factoid: fn( self: *const IInkEdit, pVal: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Factoid: fn( self: *const IInkEdit, newVal: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SelInks: fn( self: *const IInkEdit, pSelInk: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SelInks: fn( self: *const IInkEdit, SelInk: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SelInksDisplayMode: fn( self: *const IInkEdit, pInkDisplayMode: ?*InkDisplayMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SelInksDisplayMode: fn( self: *const IInkEdit, InkDisplayMode: InkDisplayMode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Recognize: fn( self: *const IInkEdit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetGestureStatus: fn( self: *const IInkEdit, Gesture: InkApplicationGesture, pListen: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetGestureStatus: fn( self: *const IInkEdit, Gesture: InkApplicationGesture, Listen: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_BackColor: fn( self: *const IInkEdit, clr: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_BackColor: fn( self: *const IInkEdit, pclr: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Appearance: fn( self: *const IInkEdit, pAppearance: ?*AppearanceConstants, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Appearance: fn( self: *const IInkEdit, pAppearance: AppearanceConstants, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_BorderStyle: fn( self: *const IInkEdit, pBorderStyle: ?*BorderStyleConstants, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_BorderStyle: fn( self: *const IInkEdit, pBorderStyle: BorderStyleConstants, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Hwnd: fn( self: *const IInkEdit, pohHwnd: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Font: fn( self: *const IInkEdit, ppFont: ?*?*IFontDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_Font: fn( self: *const IInkEdit, ppFont: ?*IFontDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Text: fn( self: *const IInkEdit, pbstrText: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Text: fn( self: *const IInkEdit, pbstrText: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MouseIcon: fn( self: *const IInkEdit, MouseIcon: ?*?*IPictureDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MouseIcon: fn( self: *const IInkEdit, MouseIcon: ?*IPictureDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_MouseIcon: fn( self: *const IInkEdit, MouseIcon: ?*IPictureDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MousePointer: fn( self: *const IInkEdit, MousePointer: ?*InkMousePointer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MousePointer: fn( self: *const IInkEdit, MousePointer: InkMousePointer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Locked: fn( self: *const IInkEdit, pVal: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Locked: fn( self: *const IInkEdit, newVal: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Enabled: fn( self: *const IInkEdit, pVal: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Enabled: fn( self: *const IInkEdit, newVal: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MaxLength: fn( self: *const IInkEdit, plMaxLength: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MaxLength: fn( self: *const IInkEdit, lMaxLength: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MultiLine: fn( self: *const IInkEdit, pVal: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MultiLine: fn( self: *const IInkEdit, newVal: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ScrollBars: fn( self: *const IInkEdit, pVal: ?*ScrollBarsConstants, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_ScrollBars: fn( self: *const IInkEdit, newVal: ScrollBarsConstants, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DisableNoScroll: fn( self: *const IInkEdit, pVal: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DisableNoScroll: fn( self: *const IInkEdit, newVal: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SelAlignment: fn( self: *const IInkEdit, pvarSelAlignment: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SelAlignment: fn( self: *const IInkEdit, pvarSelAlignment: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SelBold: fn( self: *const IInkEdit, pvarSelBold: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SelBold: fn( self: *const IInkEdit, pvarSelBold: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SelItalic: fn( self: *const IInkEdit, pvarSelItalic: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SelItalic: fn( self: *const IInkEdit, pvarSelItalic: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SelUnderline: fn( self: *const IInkEdit, pvarSelUnderline: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SelUnderline: fn( self: *const IInkEdit, pvarSelUnderline: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SelColor: fn( self: *const IInkEdit, pvarSelColor: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SelColor: fn( self: *const IInkEdit, pvarSelColor: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SelFontName: fn( self: *const IInkEdit, pvarSelFontName: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SelFontName: fn( self: *const IInkEdit, pvarSelFontName: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SelFontSize: fn( self: *const IInkEdit, pvarSelFontSize: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SelFontSize: fn( self: *const IInkEdit, pvarSelFontSize: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SelCharOffset: fn( self: *const IInkEdit, pvarSelCharOffset: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SelCharOffset: fn( self: *const IInkEdit, pvarSelCharOffset: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_TextRTF: fn( self: *const IInkEdit, pbstrTextRTF: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_TextRTF: fn( self: *const IInkEdit, pbstrTextRTF: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SelStart: fn( self: *const IInkEdit, plSelStart: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SelStart: fn( self: *const IInkEdit, plSelStart: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SelLength: fn( self: *const IInkEdit, plSelLength: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SelLength: fn( self: *const IInkEdit, plSelLength: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SelText: fn( self: *const IInkEdit, pbstrSelText: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SelText: fn( self: *const IInkEdit, pbstrSelText: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SelRTF: fn( self: *const IInkEdit, pbstrSelRTF: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SelRTF: fn( self: *const IInkEdit, pbstrSelRTF: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const IInkEdit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_Status(self: *const T, pStatus: ?*InkEditStatus) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_Status(@ptrCast(*const IInkEdit, self), pStatus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_UseMouseForInput(self: *const T, pVal: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_UseMouseForInput(@ptrCast(*const IInkEdit, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_UseMouseForInput(self: *const T, newVal: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_UseMouseForInput(@ptrCast(*const IInkEdit, self), newVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_InkMode(self: *const T, pVal: ?*InkMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_InkMode(@ptrCast(*const IInkEdit, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_InkMode(self: *const T, newVal: InkMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_InkMode(@ptrCast(*const IInkEdit, self), newVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_InkInsertMode(self: *const T, pVal: ?*InkInsertMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_InkInsertMode(@ptrCast(*const IInkEdit, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_InkInsertMode(self: *const T, newVal: InkInsertMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_InkInsertMode(@ptrCast(*const IInkEdit, self), newVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_DrawingAttributes(self: *const T, pVal: ?*?*IInkDrawingAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_DrawingAttributes(@ptrCast(*const IInkEdit, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_putref_DrawingAttributes(self: *const T, newVal: ?*IInkDrawingAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).putref_DrawingAttributes(@ptrCast(*const IInkEdit, self), newVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_RecognitionTimeout(self: *const T, pVal: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_RecognitionTimeout(@ptrCast(*const IInkEdit, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_RecognitionTimeout(self: *const T, newVal: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_RecognitionTimeout(@ptrCast(*const IInkEdit, self), newVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_Recognizer(self: *const T, pVal: ?*?*IInkRecognizer) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_Recognizer(@ptrCast(*const IInkEdit, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_putref_Recognizer(self: *const T, newVal: ?*IInkRecognizer) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).putref_Recognizer(@ptrCast(*const IInkEdit, self), newVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_Factoid(self: *const T, pVal: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_Factoid(@ptrCast(*const IInkEdit, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_Factoid(self: *const T, newVal: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_Factoid(@ptrCast(*const IInkEdit, self), newVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_SelInks(self: *const T, pSelInk: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_SelInks(@ptrCast(*const IInkEdit, self), pSelInk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_SelInks(self: *const T, SelInk: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_SelInks(@ptrCast(*const IInkEdit, self), SelInk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_SelInksDisplayMode(self: *const T, pInkDisplayMode: ?*InkDisplayMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_SelInksDisplayMode(@ptrCast(*const IInkEdit, self), pInkDisplayMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_SelInksDisplayMode(self: *const T, _param_InkDisplayMode: InkDisplayMode) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_SelInksDisplayMode(@ptrCast(*const IInkEdit, self), _param_InkDisplayMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_Recognize(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).Recognize(@ptrCast(*const IInkEdit, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_GetGestureStatus(self: *const T, Gesture: InkApplicationGesture, pListen: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).GetGestureStatus(@ptrCast(*const IInkEdit, self), Gesture, pListen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_SetGestureStatus(self: *const T, Gesture: InkApplicationGesture, Listen: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).SetGestureStatus(@ptrCast(*const IInkEdit, self), Gesture, Listen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_BackColor(self: *const T, clr: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_BackColor(@ptrCast(*const IInkEdit, self), clr); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_BackColor(self: *const T, pclr: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_BackColor(@ptrCast(*const IInkEdit, self), pclr); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_Appearance(self: *const T, pAppearance: ?*AppearanceConstants) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_Appearance(@ptrCast(*const IInkEdit, self), pAppearance); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_Appearance(self: *const T, pAppearance: AppearanceConstants) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_Appearance(@ptrCast(*const IInkEdit, self), pAppearance); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_BorderStyle(self: *const T, pBorderStyle: ?*BorderStyleConstants) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_BorderStyle(@ptrCast(*const IInkEdit, self), pBorderStyle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_BorderStyle(self: *const T, pBorderStyle: BorderStyleConstants) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_BorderStyle(@ptrCast(*const IInkEdit, self), pBorderStyle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_Hwnd(self: *const T, pohHwnd: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_Hwnd(@ptrCast(*const IInkEdit, self), pohHwnd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_Font(self: *const T, ppFont: ?*?*IFontDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_Font(@ptrCast(*const IInkEdit, self), ppFont); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_putref_Font(self: *const T, ppFont: ?*IFontDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).putref_Font(@ptrCast(*const IInkEdit, self), ppFont); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_Text(self: *const T, pbstrText: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_Text(@ptrCast(*const IInkEdit, self), pbstrText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_Text(self: *const T, pbstrText: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_Text(@ptrCast(*const IInkEdit, self), pbstrText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_MouseIcon(self: *const T, MouseIcon: ?*?*IPictureDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_MouseIcon(@ptrCast(*const IInkEdit, self), MouseIcon); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_MouseIcon(self: *const T, MouseIcon: ?*IPictureDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_MouseIcon(@ptrCast(*const IInkEdit, self), MouseIcon); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_putref_MouseIcon(self: *const T, MouseIcon: ?*IPictureDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).putref_MouseIcon(@ptrCast(*const IInkEdit, self), MouseIcon); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_MousePointer(self: *const T, MousePointer: ?*InkMousePointer) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_MousePointer(@ptrCast(*const IInkEdit, self), MousePointer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_MousePointer(self: *const T, MousePointer: InkMousePointer) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_MousePointer(@ptrCast(*const IInkEdit, self), MousePointer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_Locked(self: *const T, pVal: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_Locked(@ptrCast(*const IInkEdit, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_Locked(self: *const T, newVal: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_Locked(@ptrCast(*const IInkEdit, self), newVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_Enabled(self: *const T, pVal: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_Enabled(@ptrCast(*const IInkEdit, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_Enabled(self: *const T, newVal: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_Enabled(@ptrCast(*const IInkEdit, self), newVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_MaxLength(self: *const T, plMaxLength: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_MaxLength(@ptrCast(*const IInkEdit, self), plMaxLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_MaxLength(self: *const T, lMaxLength: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_MaxLength(@ptrCast(*const IInkEdit, self), lMaxLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_MultiLine(self: *const T, pVal: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_MultiLine(@ptrCast(*const IInkEdit, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_MultiLine(self: *const T, newVal: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_MultiLine(@ptrCast(*const IInkEdit, self), newVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_ScrollBars(self: *const T, pVal: ?*ScrollBarsConstants) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_ScrollBars(@ptrCast(*const IInkEdit, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_ScrollBars(self: *const T, newVal: ScrollBarsConstants) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_ScrollBars(@ptrCast(*const IInkEdit, self), newVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_DisableNoScroll(self: *const T, pVal: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_DisableNoScroll(@ptrCast(*const IInkEdit, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_DisableNoScroll(self: *const T, newVal: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_DisableNoScroll(@ptrCast(*const IInkEdit, self), newVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_SelAlignment(self: *const T, pvarSelAlignment: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_SelAlignment(@ptrCast(*const IInkEdit, self), pvarSelAlignment); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_SelAlignment(self: *const T, pvarSelAlignment: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_SelAlignment(@ptrCast(*const IInkEdit, self), pvarSelAlignment); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_SelBold(self: *const T, pvarSelBold: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_SelBold(@ptrCast(*const IInkEdit, self), pvarSelBold); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_SelBold(self: *const T, pvarSelBold: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_SelBold(@ptrCast(*const IInkEdit, self), pvarSelBold); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_SelItalic(self: *const T, pvarSelItalic: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_SelItalic(@ptrCast(*const IInkEdit, self), pvarSelItalic); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_SelItalic(self: *const T, pvarSelItalic: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_SelItalic(@ptrCast(*const IInkEdit, self), pvarSelItalic); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_SelUnderline(self: *const T, pvarSelUnderline: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_SelUnderline(@ptrCast(*const IInkEdit, self), pvarSelUnderline); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_SelUnderline(self: *const T, pvarSelUnderline: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_SelUnderline(@ptrCast(*const IInkEdit, self), pvarSelUnderline); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_SelColor(self: *const T, pvarSelColor: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_SelColor(@ptrCast(*const IInkEdit, self), pvarSelColor); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_SelColor(self: *const T, pvarSelColor: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_SelColor(@ptrCast(*const IInkEdit, self), pvarSelColor); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_SelFontName(self: *const T, pvarSelFontName: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_SelFontName(@ptrCast(*const IInkEdit, self), pvarSelFontName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_SelFontName(self: *const T, pvarSelFontName: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_SelFontName(@ptrCast(*const IInkEdit, self), pvarSelFontName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_SelFontSize(self: *const T, pvarSelFontSize: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_SelFontSize(@ptrCast(*const IInkEdit, self), pvarSelFontSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_SelFontSize(self: *const T, pvarSelFontSize: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_SelFontSize(@ptrCast(*const IInkEdit, self), pvarSelFontSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_SelCharOffset(self: *const T, pvarSelCharOffset: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_SelCharOffset(@ptrCast(*const IInkEdit, self), pvarSelCharOffset); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_SelCharOffset(self: *const T, pvarSelCharOffset: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_SelCharOffset(@ptrCast(*const IInkEdit, self), pvarSelCharOffset); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_TextRTF(self: *const T, pbstrTextRTF: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_TextRTF(@ptrCast(*const IInkEdit, self), pbstrTextRTF); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_TextRTF(self: *const T, pbstrTextRTF: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_TextRTF(@ptrCast(*const IInkEdit, self), pbstrTextRTF); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_SelStart(self: *const T, plSelStart: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_SelStart(@ptrCast(*const IInkEdit, self), plSelStart); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_SelStart(self: *const T, plSelStart: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_SelStart(@ptrCast(*const IInkEdit, self), plSelStart); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_SelLength(self: *const T, plSelLength: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_SelLength(@ptrCast(*const IInkEdit, self), plSelLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_SelLength(self: *const T, plSelLength: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_SelLength(@ptrCast(*const IInkEdit, self), plSelLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_SelText(self: *const T, pbstrSelText: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_SelText(@ptrCast(*const IInkEdit, self), pbstrSelText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_SelText(self: *const T, pbstrSelText: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_SelText(@ptrCast(*const IInkEdit, self), pbstrSelText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_get_SelRTF(self: *const T, pbstrSelRTF: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).get_SelRTF(@ptrCast(*const IInkEdit, self), pbstrSelRTF); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_put_SelRTF(self: *const T, pbstrSelRTF: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).put_SelRTF(@ptrCast(*const IInkEdit, self), pbstrSelRTF); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInkEdit_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IInkEdit.VTable, self.vtable).Refresh(@ptrCast(*const IInkEdit, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID__IInkEditEvents_Value = @import("../zig.zig").Guid.initString("e3b0b797-a72e-46db-a0d7-6c9eba8e9bbc"); pub const IID__IInkEditEvents = &IID__IInkEditEvents_Value; pub const _IInkEditEvents = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; const CLSID_MathInputControl_Value = @import("../zig.zig").Guid.initString("c561816c-14d8-4090-830c-98d994b21c7b"); pub const CLSID_MathInputControl = &CLSID_MathInputControl_Value; pub const MICUIELEMENT = enum(i32) { BUTTON_WRITE = 1, BUTTON_ERASE = 2, BUTTON_CORRECT = 4, BUTTON_CLEAR = 8, BUTTON_UNDO = 16, BUTTON_REDO = 32, BUTTON_INSERT = 64, BUTTON_CANCEL = 128, INKPANEL_BACKGROUND = 256, RESULTPANEL_BACKGROUND = 512, }; pub const MICUIELEMENT_BUTTON_WRITE = MICUIELEMENT.BUTTON_WRITE; pub const MICUIELEMENT_BUTTON_ERASE = MICUIELEMENT.BUTTON_ERASE; pub const MICUIELEMENT_BUTTON_CORRECT = MICUIELEMENT.BUTTON_CORRECT; pub const MICUIELEMENT_BUTTON_CLEAR = MICUIELEMENT.BUTTON_CLEAR; pub const MICUIELEMENT_BUTTON_UNDO = MICUIELEMENT.BUTTON_UNDO; pub const MICUIELEMENT_BUTTON_REDO = MICUIELEMENT.BUTTON_REDO; pub const MICUIELEMENT_BUTTON_INSERT = MICUIELEMENT.BUTTON_INSERT; pub const MICUIELEMENT_BUTTON_CANCEL = MICUIELEMENT.BUTTON_CANCEL; pub const MICUIELEMENT_INKPANEL_BACKGROUND = MICUIELEMENT.INKPANEL_BACKGROUND; pub const MICUIELEMENT_RESULTPANEL_BACKGROUND = MICUIELEMENT.RESULTPANEL_BACKGROUND; pub const MICUIELEMENTSTATE = enum(i32) { NORMAL = 1, HOT = 2, PRESSED = 3, DISABLED = 4, }; pub const MICUIELEMENTSTATE_NORMAL = MICUIELEMENTSTATE.NORMAL; pub const MICUIELEMENTSTATE_HOT = MICUIELEMENTSTATE.HOT; pub const MICUIELEMENTSTATE_PRESSED = MICUIELEMENTSTATE.PRESSED; pub const MICUIELEMENTSTATE_DISABLED = MICUIELEMENTSTATE.DISABLED; pub const DISPID_MathInputControlEvents = enum(i32) { Insert = 0, Close = 1, Paint = 2, Clear = 3, }; pub const DISPID_MICInsert = DISPID_MathInputControlEvents.Insert; pub const DISPID_MICClose = DISPID_MathInputControlEvents.Close; pub const DISPID_MICPaint = DISPID_MathInputControlEvents.Paint; pub const DISPID_MICClear = DISPID_MathInputControlEvents.Clear; const IID_IMathInputControl_Value = @import("../zig.zig").Guid.initString("eba615aa-fac6-4738-ba5f-ff09e9fe473e"); pub const IID_IMathInputControl = &IID_IMathInputControl_Value; pub const IMathInputControl = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, Show: fn( self: *const IMathInputControl, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Hide: fn( self: *const IMathInputControl, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsVisible: fn( self: *const IMathInputControl, pvbShown: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPosition: fn( self: *const IMathInputControl, Left: ?*i32, Top: ?*i32, Right: ?*i32, Bottom: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetPosition: fn( self: *const IMathInputControl, Left: i32, Top: i32, Right: i32, Bottom: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clear: fn( self: *const IMathInputControl, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCustomPaint: fn( self: *const IMathInputControl, Element: i32, Paint: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCaptionText: fn( self: *const IMathInputControl, CaptionText: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, LoadInk: fn( self: *const IMathInputControl, Ink: ?*IInkDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetOwnerWindow: fn( self: *const IMathInputControl, OwnerWindow: isize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnableExtendedButtons: fn( self: *const IMathInputControl, Extended: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPreviewHeight: fn( self: *const IMathInputControl, Height: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetPreviewHeight: fn( self: *const IMathInputControl, Height: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnableAutoGrow: fn( self: *const IMathInputControl, AutoGrow: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddFunctionName: fn( self: *const IMathInputControl, FunctionName: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveFunctionName: fn( self: *const IMathInputControl, FunctionName: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetHoverIcon: fn( self: *const IMathInputControl, HoverImage: ?*?*IPictureDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMathInputControl_Show(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IMathInputControl.VTable, self.vtable).Show(@ptrCast(*const IMathInputControl, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMathInputControl_Hide(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IMathInputControl.VTable, self.vtable).Hide(@ptrCast(*const IMathInputControl, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMathInputControl_IsVisible(self: *const T, pvbShown: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMathInputControl.VTable, self.vtable).IsVisible(@ptrCast(*const IMathInputControl, self), pvbShown); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMathInputControl_GetPosition(self: *const T, Left: ?*i32, Top: ?*i32, Right: ?*i32, Bottom: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IMathInputControl.VTable, self.vtable).GetPosition(@ptrCast(*const IMathInputControl, self), Left, Top, Right, Bottom); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMathInputControl_SetPosition(self: *const T, Left: i32, Top: i32, Right: i32, Bottom: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IMathInputControl.VTable, self.vtable).SetPosition(@ptrCast(*const IMathInputControl, self), Left, Top, Right, Bottom); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMathInputControl_Clear(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IMathInputControl.VTable, self.vtable).Clear(@ptrCast(*const IMathInputControl, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMathInputControl_SetCustomPaint(self: *const T, Element: i32, Paint: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMathInputControl.VTable, self.vtable).SetCustomPaint(@ptrCast(*const IMathInputControl, self), Element, Paint); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMathInputControl_SetCaptionText(self: *const T, CaptionText: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMathInputControl.VTable, self.vtable).SetCaptionText(@ptrCast(*const IMathInputControl, self), CaptionText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMathInputControl_LoadInk(self: *const T, Ink: ?*IInkDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IMathInputControl.VTable, self.vtable).LoadInk(@ptrCast(*const IMathInputControl, self), Ink); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMathInputControl_SetOwnerWindow(self: *const T, OwnerWindow: isize) callconv(.Inline) HRESULT { return @ptrCast(*const IMathInputControl.VTable, self.vtable).SetOwnerWindow(@ptrCast(*const IMathInputControl, self), OwnerWindow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMathInputControl_EnableExtendedButtons(self: *const T, Extended: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMathInputControl.VTable, self.vtable).EnableExtendedButtons(@ptrCast(*const IMathInputControl, self), Extended); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMathInputControl_GetPreviewHeight(self: *const T, Height: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IMathInputControl.VTable, self.vtable).GetPreviewHeight(@ptrCast(*const IMathInputControl, self), Height); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMathInputControl_SetPreviewHeight(self: *const T, Height: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IMathInputControl.VTable, self.vtable).SetPreviewHeight(@ptrCast(*const IMathInputControl, self), Height); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMathInputControl_EnableAutoGrow(self: *const T, AutoGrow: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMathInputControl.VTable, self.vtable).EnableAutoGrow(@ptrCast(*const IMathInputControl, self), AutoGrow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMathInputControl_AddFunctionName(self: *const T, FunctionName: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMathInputControl.VTable, self.vtable).AddFunctionName(@ptrCast(*const IMathInputControl, self), FunctionName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMathInputControl_RemoveFunctionName(self: *const T, FunctionName: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMathInputControl.VTable, self.vtable).RemoveFunctionName(@ptrCast(*const IMathInputControl, self), FunctionName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMathInputControl_GetHoverIcon(self: *const T, HoverImage: ?*?*IPictureDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IMathInputControl.VTable, self.vtable).GetHoverIcon(@ptrCast(*const IMathInputControl, self), HoverImage); } };} pub usingnamespace MethodMixin(@This()); }; const IID__IMathInputControlEvents_Value = @import("../zig.zig").Guid.initString("683336b5-a47d-4358-96f9-875a472ae70a"); pub const IID__IMathInputControlEvents = &IID__IMathInputControlEvents_Value; pub const _IMathInputControlEvents = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; const CLSID_RealTimeStylus_Value = @import("../zig.zig").Guid.initString("e26b366d-f998-43ce-836f-cb6d904432b0"); pub const CLSID_RealTimeStylus = &CLSID_RealTimeStylus_Value; const CLSID_DynamicRenderer_Value = @import("../zig.zig").Guid.initString("ecd32aea-746f-4dcb-bf68-082757faff18"); pub const CLSID_DynamicRenderer = &CLSID_DynamicRenderer_Value; const CLSID_GestureRecognizer_Value = @import("../zig.zig").Guid.initString("ea30c654-c62c-441f-ac00-95f9a196782c"); pub const CLSID_GestureRecognizer = &CLSID_GestureRecognizer_Value; const CLSID_StrokeBuilder_Value = @import("../zig.zig").Guid.initString("e810cee7-6e51-4cb0-aa3a-0b985b70daf7"); pub const CLSID_StrokeBuilder = &CLSID_StrokeBuilder_Value; pub const RealTimeStylusDataInterest = enum(i32) { AllData = -1, None = 0, Error = 1, RealTimeStylusEnabled = 2, RealTimeStylusDisabled = 4, StylusNew = 8, StylusInRange = 16, InAirPackets = 32, StylusOutOfRange = 64, StylusDown = 128, Packets = 256, StylusUp = 512, StylusButtonUp = 1024, StylusButtonDown = 2048, SystemEvents = 4096, TabletAdded = 8192, TabletRemoved = 16384, CustomStylusDataAdded = 32768, UpdateMapping = 65536, DefaultEvents = 37766, }; pub const RTSDI_AllData = RealTimeStylusDataInterest.AllData; pub const RTSDI_None = RealTimeStylusDataInterest.None; pub const RTSDI_Error = RealTimeStylusDataInterest.Error; pub const RTSDI_RealTimeStylusEnabled = RealTimeStylusDataInterest.RealTimeStylusEnabled; pub const RTSDI_RealTimeStylusDisabled = RealTimeStylusDataInterest.RealTimeStylusDisabled; pub const RTSDI_StylusNew = RealTimeStylusDataInterest.StylusNew; pub const RTSDI_StylusInRange = RealTimeStylusDataInterest.StylusInRange; pub const RTSDI_InAirPackets = RealTimeStylusDataInterest.InAirPackets; pub const RTSDI_StylusOutOfRange = RealTimeStylusDataInterest.StylusOutOfRange; pub const RTSDI_StylusDown = RealTimeStylusDataInterest.StylusDown; pub const RTSDI_Packets = RealTimeStylusDataInterest.Packets; pub const RTSDI_StylusUp = RealTimeStylusDataInterest.StylusUp; pub const RTSDI_StylusButtonUp = RealTimeStylusDataInterest.StylusButtonUp; pub const RTSDI_StylusButtonDown = RealTimeStylusDataInterest.StylusButtonDown; pub const RTSDI_SystemEvents = RealTimeStylusDataInterest.SystemEvents; pub const RTSDI_TabletAdded = RealTimeStylusDataInterest.TabletAdded; pub const RTSDI_TabletRemoved = RealTimeStylusDataInterest.TabletRemoved; pub const RTSDI_CustomStylusDataAdded = RealTimeStylusDataInterest.CustomStylusDataAdded; pub const RTSDI_UpdateMapping = RealTimeStylusDataInterest.UpdateMapping; pub const RTSDI_DefaultEvents = RealTimeStylusDataInterest.DefaultEvents; pub const StylusInfo = extern struct { tcid: u32, cid: u32, bIsInvertedCursor: BOOL, }; pub const StylusQueue = enum(i32) { SyncStylusQueue = 1, AsyncStylusQueueImmediate = 2, AsyncStylusQueue = 3, }; pub const SyncStylusQueue = StylusQueue.SyncStylusQueue; pub const AsyncStylusQueueImmediate = StylusQueue.AsyncStylusQueueImmediate; pub const AsyncStylusQueue = StylusQueue.AsyncStylusQueue; pub const RealTimeStylusLockType = enum(i32) { ObjLock = 1, SyncEventLock = 2, AsyncEventLock = 4, ExcludeCallback = 8, SyncObjLock = 11, AsyncObjLock = 13, }; pub const RTSLT_ObjLock = RealTimeStylusLockType.ObjLock; pub const RTSLT_SyncEventLock = RealTimeStylusLockType.SyncEventLock; pub const RTSLT_AsyncEventLock = RealTimeStylusLockType.AsyncEventLock; pub const RTSLT_ExcludeCallback = RealTimeStylusLockType.ExcludeCallback; pub const RTSLT_SyncObjLock = RealTimeStylusLockType.SyncObjLock; pub const RTSLT_AsyncObjLock = RealTimeStylusLockType.AsyncObjLock; pub const GESTURE_DATA = extern struct { gestureId: i32, recoConfidence: i32, strokeCount: i32, }; pub const DYNAMIC_RENDERER_CACHED_DATA = extern struct { strokeId: i32, dynamicRenderer: ?*IDynamicRenderer, }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IRealTimeStylus_Value = @import("../zig.zig").Guid.initString("a8bb5d22-3144-4a7b-93cd-f34a16be513a"); pub const IID_IRealTimeStylus = &IID_IRealTimeStylus_Value; pub const IRealTimeStylus = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Enabled: fn( self: *const IRealTimeStylus, pfEnable: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Enabled: fn( self: *const IRealTimeStylus, fEnable: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_HWND: fn( self: *const IRealTimeStylus, phwnd: ?*HANDLE_PTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_HWND: fn( self: *const IRealTimeStylus, hwnd: HANDLE_PTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_WindowInputRectangle: fn( self: *const IRealTimeStylus, prcWndInputRect: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_WindowInputRectangle: fn( self: *const IRealTimeStylus, prcWndInputRect: ?*const RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddStylusSyncPlugin: fn( self: *const IRealTimeStylus, iIndex: u32, piPlugin: ?*IStylusSyncPlugin, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveStylusSyncPlugin: fn( self: *const IRealTimeStylus, iIndex: u32, ppiPlugin: ?*?*IStylusSyncPlugin, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveAllStylusSyncPlugins: fn( self: *const IRealTimeStylus, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStylusSyncPlugin: fn( self: *const IRealTimeStylus, iIndex: u32, ppiPlugin: ?*?*IStylusSyncPlugin, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStylusSyncPluginCount: fn( self: *const IRealTimeStylus, pcPlugins: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddStylusAsyncPlugin: fn( self: *const IRealTimeStylus, iIndex: u32, piPlugin: ?*IStylusAsyncPlugin, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveStylusAsyncPlugin: fn( self: *const IRealTimeStylus, iIndex: u32, ppiPlugin: ?*?*IStylusAsyncPlugin, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveAllStylusAsyncPlugins: fn( self: *const IRealTimeStylus, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStylusAsyncPlugin: fn( self: *const IRealTimeStylus, iIndex: u32, ppiPlugin: ?*?*IStylusAsyncPlugin, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStylusAsyncPluginCount: fn( self: *const IRealTimeStylus, pcPlugins: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ChildRealTimeStylusPlugin: fn( self: *const IRealTimeStylus, ppiRTS: ?*?*IRealTimeStylus, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_ChildRealTimeStylusPlugin: fn( self: *const IRealTimeStylus, piRTS: ?*IRealTimeStylus, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddCustomStylusDataToQueue: fn( self: *const IRealTimeStylus, sq: StylusQueue, pGuidId: ?*const Guid, cbData: u32, pbData: ?[*:0]u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ClearStylusQueues: fn( self: *const IRealTimeStylus, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetAllTabletsMode: fn( self: *const IRealTimeStylus, fUseMouseForInput: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSingleTabletMode: fn( self: *const IRealTimeStylus, piTablet: ?*IInkTablet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTablet: fn( self: *const IRealTimeStylus, ppiSingleTablet: ?*?*IInkTablet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTabletContextIdFromTablet: fn( self: *const IRealTimeStylus, piTablet: ?*IInkTablet, ptcid: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTabletFromTabletContextId: fn( self: *const IRealTimeStylus, tcid: u32, ppiTablet: ?*?*IInkTablet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAllTabletContextIds: fn( self: *const IRealTimeStylus, pcTcidCount: ?*u32, ppTcids: ?[*]?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStyluses: fn( self: *const IRealTimeStylus, ppiInkCursors: ?*?*IInkCursors, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStylusForId: fn( self: *const IRealTimeStylus, sid: u32, ppiInkCursor: ?*?*IInkCursor, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetDesiredPacketDescription: fn( self: *const IRealTimeStylus, cProperties: u32, pPropertyGuids: [*]const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDesiredPacketDescription: fn( self: *const IRealTimeStylus, pcProperties: ?*u32, ppPropertyGuids: ?[*]?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPacketDescriptionData: fn( self: *const IRealTimeStylus, tcid: u32, pfInkToDeviceScaleX: ?*f32, pfInkToDeviceScaleY: ?*f32, pcPacketProperties: ?*u32, ppPacketProperties: ?[*]?*PACKET_PROPERTY, ) 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 IRealTimeStylus_get_Enabled(self: *const T, pfEnable: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).get_Enabled(@ptrCast(*const IRealTimeStylus, self), pfEnable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_put_Enabled(self: *const T, fEnable: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).put_Enabled(@ptrCast(*const IRealTimeStylus, self), fEnable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_get_HWND(self: *const T, phwnd: ?*HANDLE_PTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).get_HWND(@ptrCast(*const IRealTimeStylus, self), phwnd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_put_HWND(self: *const T, hwnd: HANDLE_PTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).put_HWND(@ptrCast(*const IRealTimeStylus, self), hwnd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_get_WindowInputRectangle(self: *const T, prcWndInputRect: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).get_WindowInputRectangle(@ptrCast(*const IRealTimeStylus, self), prcWndInputRect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_put_WindowInputRectangle(self: *const T, prcWndInputRect: ?*const RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).put_WindowInputRectangle(@ptrCast(*const IRealTimeStylus, self), prcWndInputRect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_AddStylusSyncPlugin(self: *const T, iIndex: u32, piPlugin: ?*IStylusSyncPlugin) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).AddStylusSyncPlugin(@ptrCast(*const IRealTimeStylus, self), iIndex, piPlugin); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_RemoveStylusSyncPlugin(self: *const T, iIndex: u32, ppiPlugin: ?*?*IStylusSyncPlugin) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).RemoveStylusSyncPlugin(@ptrCast(*const IRealTimeStylus, self), iIndex, ppiPlugin); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_RemoveAllStylusSyncPlugins(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).RemoveAllStylusSyncPlugins(@ptrCast(*const IRealTimeStylus, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_GetStylusSyncPlugin(self: *const T, iIndex: u32, ppiPlugin: ?*?*IStylusSyncPlugin) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).GetStylusSyncPlugin(@ptrCast(*const IRealTimeStylus, self), iIndex, ppiPlugin); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_GetStylusSyncPluginCount(self: *const T, pcPlugins: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).GetStylusSyncPluginCount(@ptrCast(*const IRealTimeStylus, self), pcPlugins); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_AddStylusAsyncPlugin(self: *const T, iIndex: u32, piPlugin: ?*IStylusAsyncPlugin) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).AddStylusAsyncPlugin(@ptrCast(*const IRealTimeStylus, self), iIndex, piPlugin); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_RemoveStylusAsyncPlugin(self: *const T, iIndex: u32, ppiPlugin: ?*?*IStylusAsyncPlugin) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).RemoveStylusAsyncPlugin(@ptrCast(*const IRealTimeStylus, self), iIndex, ppiPlugin); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_RemoveAllStylusAsyncPlugins(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).RemoveAllStylusAsyncPlugins(@ptrCast(*const IRealTimeStylus, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_GetStylusAsyncPlugin(self: *const T, iIndex: u32, ppiPlugin: ?*?*IStylusAsyncPlugin) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).GetStylusAsyncPlugin(@ptrCast(*const IRealTimeStylus, self), iIndex, ppiPlugin); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_GetStylusAsyncPluginCount(self: *const T, pcPlugins: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).GetStylusAsyncPluginCount(@ptrCast(*const IRealTimeStylus, self), pcPlugins); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_get_ChildRealTimeStylusPlugin(self: *const T, ppiRTS: ?*?*IRealTimeStylus) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).get_ChildRealTimeStylusPlugin(@ptrCast(*const IRealTimeStylus, self), ppiRTS); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_putref_ChildRealTimeStylusPlugin(self: *const T, piRTS: ?*IRealTimeStylus) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).putref_ChildRealTimeStylusPlugin(@ptrCast(*const IRealTimeStylus, self), piRTS); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_AddCustomStylusDataToQueue(self: *const T, sq: StylusQueue, pGuidId: ?*const Guid, cbData: u32, pbData: ?[*:0]u8) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).AddCustomStylusDataToQueue(@ptrCast(*const IRealTimeStylus, self), sq, pGuidId, cbData, pbData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_ClearStylusQueues(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).ClearStylusQueues(@ptrCast(*const IRealTimeStylus, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_SetAllTabletsMode(self: *const T, fUseMouseForInput: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).SetAllTabletsMode(@ptrCast(*const IRealTimeStylus, self), fUseMouseForInput); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_SetSingleTabletMode(self: *const T, piTablet: ?*IInkTablet) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).SetSingleTabletMode(@ptrCast(*const IRealTimeStylus, self), piTablet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_GetTablet(self: *const T, ppiSingleTablet: ?*?*IInkTablet) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).GetTablet(@ptrCast(*const IRealTimeStylus, self), ppiSingleTablet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_GetTabletContextIdFromTablet(self: *const T, piTablet: ?*IInkTablet, ptcid: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).GetTabletContextIdFromTablet(@ptrCast(*const IRealTimeStylus, self), piTablet, ptcid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_GetTabletFromTabletContextId(self: *const T, tcid: u32, ppiTablet: ?*?*IInkTablet) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).GetTabletFromTabletContextId(@ptrCast(*const IRealTimeStylus, self), tcid, ppiTablet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_GetAllTabletContextIds(self: *const T, pcTcidCount: ?*u32, ppTcids: ?[*]?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).GetAllTabletContextIds(@ptrCast(*const IRealTimeStylus, self), pcTcidCount, ppTcids); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_GetStyluses(self: *const T, ppiInkCursors: ?*?*IInkCursors) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).GetStyluses(@ptrCast(*const IRealTimeStylus, self), ppiInkCursors); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_GetStylusForId(self: *const T, sid: u32, ppiInkCursor: ?*?*IInkCursor) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).GetStylusForId(@ptrCast(*const IRealTimeStylus, self), sid, ppiInkCursor); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_SetDesiredPacketDescription(self: *const T, cProperties: u32, pPropertyGuids: [*]const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).SetDesiredPacketDescription(@ptrCast(*const IRealTimeStylus, self), cProperties, pPropertyGuids); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_GetDesiredPacketDescription(self: *const T, pcProperties: ?*u32, ppPropertyGuids: ?[*]?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).GetDesiredPacketDescription(@ptrCast(*const IRealTimeStylus, self), pcProperties, ppPropertyGuids); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus_GetPacketDescriptionData(self: *const T, tcid: u32, pfInkToDeviceScaleX: ?*f32, pfInkToDeviceScaleY: ?*f32, pcPacketProperties: ?*u32, ppPacketProperties: ?[*]?*PACKET_PROPERTY) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus.VTable, self.vtable).GetPacketDescriptionData(@ptrCast(*const IRealTimeStylus, self), tcid, pfInkToDeviceScaleX, pfInkToDeviceScaleY, pcPacketProperties, ppPacketProperties); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRealTimeStylus2_Value = @import("../zig.zig").Guid.initString("b5f2a6cd-3179-4a3e-b9c4-bb5865962be2"); pub const IID_IRealTimeStylus2 = &IID_IRealTimeStylus2_Value; pub const IRealTimeStylus2 = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_FlicksEnabled: fn( self: *const IRealTimeStylus2, pfEnable: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_FlicksEnabled: fn( self: *const IRealTimeStylus2, fEnable: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus2_get_FlicksEnabled(self: *const T, pfEnable: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus2.VTable, self.vtable).get_FlicksEnabled(@ptrCast(*const IRealTimeStylus2, self), pfEnable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus2_put_FlicksEnabled(self: *const T, fEnable: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus2.VTable, self.vtable).put_FlicksEnabled(@ptrCast(*const IRealTimeStylus2, self), fEnable); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IRealTimeStylus3_Value = @import("../zig.zig").Guid.initString("d70230a3-6986-4051-b57a-1cf69f4d9db5"); pub const IID_IRealTimeStylus3 = &IID_IRealTimeStylus3_Value; pub const IRealTimeStylus3 = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MultiTouchEnabled: fn( self: *const IRealTimeStylus3, pfEnable: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MultiTouchEnabled: fn( self: *const IRealTimeStylus3, fEnable: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus3_get_MultiTouchEnabled(self: *const T, pfEnable: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus3.VTable, self.vtable).get_MultiTouchEnabled(@ptrCast(*const IRealTimeStylus3, self), pfEnable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylus3_put_MultiTouchEnabled(self: *const T, fEnable: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylus3.VTable, self.vtable).put_MultiTouchEnabled(@ptrCast(*const IRealTimeStylus3, self), fEnable); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IRealTimeStylusSynchronization_Value = @import("../zig.zig").Guid.initString("aa87eab8-ab4a-4cea-b5cb-46d84c6a2509"); pub const IID_IRealTimeStylusSynchronization = &IID_IRealTimeStylusSynchronization_Value; pub const IRealTimeStylusSynchronization = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AcquireLock: fn( self: *const IRealTimeStylusSynchronization, lock: RealTimeStylusLockType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReleaseLock: fn( self: *const IRealTimeStylusSynchronization, lock: RealTimeStylusLockType, ) 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 IRealTimeStylusSynchronization_AcquireLock(self: *const T, lock: RealTimeStylusLockType) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylusSynchronization.VTable, self.vtable).AcquireLock(@ptrCast(*const IRealTimeStylusSynchronization, self), lock); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRealTimeStylusSynchronization_ReleaseLock(self: *const T, lock: RealTimeStylusLockType) callconv(.Inline) HRESULT { return @ptrCast(*const IRealTimeStylusSynchronization.VTable, self.vtable).ReleaseLock(@ptrCast(*const IRealTimeStylusSynchronization, self), lock); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IStrokeBuilder_Value = @import("../zig.zig").Guid.initString("a5fd4e2d-c44b-4092-9177-260905eb672b"); pub const IID_IStrokeBuilder = &IID_IStrokeBuilder_Value; pub const IStrokeBuilder = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateStroke: fn( self: *const IStrokeBuilder, cPktBuffLength: u32, pPackets: [*]const i32, cPacketProperties: u32, pPacketProperties: [*]const PACKET_PROPERTY, fInkToDeviceScaleX: f32, fInkToDeviceScaleY: f32, ppIInkStroke: ?*?*IInkStrokeDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BeginStroke: fn( self: *const IStrokeBuilder, tcid: u32, sid: u32, pPacket: ?*const i32, cPacketProperties: u32, pPacketProperties: [*]PACKET_PROPERTY, fInkToDeviceScaleX: f32, fInkToDeviceScaleY: f32, ppIInkStroke: ?*?*IInkStrokeDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AppendPackets: fn( self: *const IStrokeBuilder, tcid: u32, sid: u32, cPktBuffLength: u32, pPackets: [*]const i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EndStroke: fn( self: *const IStrokeBuilder, tcid: u32, sid: u32, ppIInkStroke: ?*?*IInkStrokeDisp, pDirtyRect: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Ink: fn( self: *const IStrokeBuilder, ppiInkObj: ?*?*IInkDisp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_Ink: fn( self: *const IStrokeBuilder, piInkObj: ?*IInkDisp, ) 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 IStrokeBuilder_CreateStroke(self: *const T, cPktBuffLength: u32, pPackets: [*]const i32, cPacketProperties: u32, pPacketProperties: [*]const PACKET_PROPERTY, fInkToDeviceScaleX: f32, fInkToDeviceScaleY: f32, ppIInkStroke: ?*?*IInkStrokeDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IStrokeBuilder.VTable, self.vtable).CreateStroke(@ptrCast(*const IStrokeBuilder, self), cPktBuffLength, pPackets, cPacketProperties, pPacketProperties, fInkToDeviceScaleX, fInkToDeviceScaleY, ppIInkStroke); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStrokeBuilder_BeginStroke(self: *const T, tcid: u32, sid: u32, pPacket: ?*const i32, cPacketProperties: u32, pPacketProperties: [*]PACKET_PROPERTY, fInkToDeviceScaleX: f32, fInkToDeviceScaleY: f32, ppIInkStroke: ?*?*IInkStrokeDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IStrokeBuilder.VTable, self.vtable).BeginStroke(@ptrCast(*const IStrokeBuilder, self), tcid, sid, pPacket, cPacketProperties, pPacketProperties, fInkToDeviceScaleX, fInkToDeviceScaleY, ppIInkStroke); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStrokeBuilder_AppendPackets(self: *const T, tcid: u32, sid: u32, cPktBuffLength: u32, pPackets: [*]const i32) callconv(.Inline) HRESULT { return @ptrCast(*const IStrokeBuilder.VTable, self.vtable).AppendPackets(@ptrCast(*const IStrokeBuilder, self), tcid, sid, cPktBuffLength, pPackets); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStrokeBuilder_EndStroke(self: *const T, tcid: u32, sid: u32, ppIInkStroke: ?*?*IInkStrokeDisp, pDirtyRect: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IStrokeBuilder.VTable, self.vtable).EndStroke(@ptrCast(*const IStrokeBuilder, self), tcid, sid, ppIInkStroke, pDirtyRect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStrokeBuilder_get_Ink(self: *const T, ppiInkObj: ?*?*IInkDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IStrokeBuilder.VTable, self.vtable).get_Ink(@ptrCast(*const IStrokeBuilder, self), ppiInkObj); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStrokeBuilder_putref_Ink(self: *const T, piInkObj: ?*IInkDisp) callconv(.Inline) HRESULT { return @ptrCast(*const IStrokeBuilder.VTable, self.vtable).putref_Ink(@ptrCast(*const IStrokeBuilder, self), piInkObj); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IStylusPlugin_Value = @import("../zig.zig").Guid.initString("a81436d8-4757-4fd1-a185-133f97c6c545"); pub const IID_IStylusPlugin = &IID_IStylusPlugin_Value; pub const IStylusPlugin = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, RealTimeStylusEnabled: fn( self: *const IStylusPlugin, piRtsSrc: ?*IRealTimeStylus, cTcidCount: u32, pTcids: [*]const u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RealTimeStylusDisabled: fn( self: *const IStylusPlugin, piRtsSrc: ?*IRealTimeStylus, cTcidCount: u32, pTcids: [*]const u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, StylusInRange: fn( self: *const IStylusPlugin, piRtsSrc: ?*IRealTimeStylus, tcid: u32, sid: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, StylusOutOfRange: fn( self: *const IStylusPlugin, piRtsSrc: ?*IRealTimeStylus, tcid: u32, sid: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, StylusDown: fn( self: *const IStylusPlugin, piRtsSrc: ?*IRealTimeStylus, pStylusInfo: ?*const StylusInfo, cPropCountPerPkt: u32, pPacket: [*]i32, ppInOutPkt: ?*?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, StylusUp: fn( self: *const IStylusPlugin, piRtsSrc: ?*IRealTimeStylus, pStylusInfo: ?*const StylusInfo, cPropCountPerPkt: u32, pPacket: [*]i32, ppInOutPkt: ?*?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, StylusButtonDown: fn( self: *const IStylusPlugin, piRtsSrc: ?*IRealTimeStylus, sid: u32, pGuidStylusButton: ?*const Guid, pStylusPos: ?*POINT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, StylusButtonUp: fn( self: *const IStylusPlugin, piRtsSrc: ?*IRealTimeStylus, sid: u32, pGuidStylusButton: ?*const Guid, pStylusPos: ?*POINT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InAirPackets: fn( self: *const IStylusPlugin, piRtsSrc: ?*IRealTimeStylus, pStylusInfo: ?*const StylusInfo, cPktCount: u32, cPktBuffLength: u32, pPackets: [*]i32, pcInOutPkts: ?*u32, ppInOutPkts: ?*?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Packets: fn( self: *const IStylusPlugin, piRtsSrc: ?*IRealTimeStylus, pStylusInfo: ?*const StylusInfo, cPktCount: u32, cPktBuffLength: u32, pPackets: [*]i32, pcInOutPkts: ?*u32, ppInOutPkts: ?*?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CustomStylusDataAdded: fn( self: *const IStylusPlugin, piRtsSrc: ?*IRealTimeStylus, pGuidId: ?*const Guid, cbData: u32, pbData: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SystemEvent: fn( self: *const IStylusPlugin, piRtsSrc: ?*IRealTimeStylus, tcid: u32, sid: u32, event: u16, eventdata: SYSTEM_EVENT_DATA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TabletAdded: fn( self: *const IStylusPlugin, piRtsSrc: ?*IRealTimeStylus, piTablet: ?*IInkTablet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TabletRemoved: fn( self: *const IStylusPlugin, piRtsSrc: ?*IRealTimeStylus, iTabletIndex: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Error: fn( self: *const IStylusPlugin, piRtsSrc: ?*IRealTimeStylus, piPlugin: ?*IStylusPlugin, dataInterest: RealTimeStylusDataInterest, hrErrorCode: HRESULT, lptrKey: ?*isize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UpdateMapping: fn( self: *const IStylusPlugin, piRtsSrc: ?*IRealTimeStylus, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DataInterest: fn( self: *const IStylusPlugin, pDataInterest: ?*RealTimeStylusDataInterest, ) 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 IStylusPlugin_RealTimeStylusEnabled(self: *const T, piRtsSrc: ?*IRealTimeStylus, cTcidCount: u32, pTcids: [*]const u32) callconv(.Inline) HRESULT { return @ptrCast(*const IStylusPlugin.VTable, self.vtable).RealTimeStylusEnabled(@ptrCast(*const IStylusPlugin, self), piRtsSrc, cTcidCount, pTcids); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStylusPlugin_RealTimeStylusDisabled(self: *const T, piRtsSrc: ?*IRealTimeStylus, cTcidCount: u32, pTcids: [*]const u32) callconv(.Inline) HRESULT { return @ptrCast(*const IStylusPlugin.VTable, self.vtable).RealTimeStylusDisabled(@ptrCast(*const IStylusPlugin, self), piRtsSrc, cTcidCount, pTcids); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStylusPlugin_StylusInRange(self: *const T, piRtsSrc: ?*IRealTimeStylus, tcid: u32, sid: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IStylusPlugin.VTable, self.vtable).StylusInRange(@ptrCast(*const IStylusPlugin, self), piRtsSrc, tcid, sid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStylusPlugin_StylusOutOfRange(self: *const T, piRtsSrc: ?*IRealTimeStylus, tcid: u32, sid: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IStylusPlugin.VTable, self.vtable).StylusOutOfRange(@ptrCast(*const IStylusPlugin, self), piRtsSrc, tcid, sid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStylusPlugin_StylusDown(self: *const T, piRtsSrc: ?*IRealTimeStylus, pStylusInfo: ?*const StylusInfo, cPropCountPerPkt: u32, pPacket: [*]i32, ppInOutPkt: ?*?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IStylusPlugin.VTable, self.vtable).StylusDown(@ptrCast(*const IStylusPlugin, self), piRtsSrc, pStylusInfo, cPropCountPerPkt, pPacket, ppInOutPkt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStylusPlugin_StylusUp(self: *const T, piRtsSrc: ?*IRealTimeStylus, pStylusInfo: ?*const StylusInfo, cPropCountPerPkt: u32, pPacket: [*]i32, ppInOutPkt: ?*?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IStylusPlugin.VTable, self.vtable).StylusUp(@ptrCast(*const IStylusPlugin, self), piRtsSrc, pStylusInfo, cPropCountPerPkt, pPacket, ppInOutPkt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStylusPlugin_StylusButtonDown(self: *const T, piRtsSrc: ?*IRealTimeStylus, sid: u32, pGuidStylusButton: ?*const Guid, pStylusPos: ?*POINT) callconv(.Inline) HRESULT { return @ptrCast(*const IStylusPlugin.VTable, self.vtable).StylusButtonDown(@ptrCast(*const IStylusPlugin, self), piRtsSrc, sid, pGuidStylusButton, pStylusPos); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStylusPlugin_StylusButtonUp(self: *const T, piRtsSrc: ?*IRealTimeStylus, sid: u32, pGuidStylusButton: ?*const Guid, pStylusPos: ?*POINT) callconv(.Inline) HRESULT { return @ptrCast(*const IStylusPlugin.VTable, self.vtable).StylusButtonUp(@ptrCast(*const IStylusPlugin, self), piRtsSrc, sid, pGuidStylusButton, pStylusPos); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStylusPlugin_InAirPackets(self: *const T, piRtsSrc: ?*IRealTimeStylus, pStylusInfo: ?*const StylusInfo, cPktCount: u32, cPktBuffLength: u32, pPackets: [*]i32, pcInOutPkts: ?*u32, ppInOutPkts: ?*?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IStylusPlugin.VTable, self.vtable).InAirPackets(@ptrCast(*const IStylusPlugin, self), piRtsSrc, pStylusInfo, cPktCount, cPktBuffLength, pPackets, pcInOutPkts, ppInOutPkts); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStylusPlugin_Packets(self: *const T, piRtsSrc: ?*IRealTimeStylus, pStylusInfo: ?*const StylusInfo, cPktCount: u32, cPktBuffLength: u32, pPackets: [*]i32, pcInOutPkts: ?*u32, ppInOutPkts: ?*?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IStylusPlugin.VTable, self.vtable).Packets(@ptrCast(*const IStylusPlugin, self), piRtsSrc, pStylusInfo, cPktCount, cPktBuffLength, pPackets, pcInOutPkts, ppInOutPkts); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStylusPlugin_CustomStylusDataAdded(self: *const T, piRtsSrc: ?*IRealTimeStylus, pGuidId: ?*const Guid, cbData: u32, pbData: ?[*:0]const u8) callconv(.Inline) HRESULT { return @ptrCast(*const IStylusPlugin.VTable, self.vtable).CustomStylusDataAdded(@ptrCast(*const IStylusPlugin, self), piRtsSrc, pGuidId, cbData, pbData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStylusPlugin_SystemEvent(self: *const T, piRtsSrc: ?*IRealTimeStylus, tcid: u32, sid: u32, event: u16, eventdata: SYSTEM_EVENT_DATA) callconv(.Inline) HRESULT { return @ptrCast(*const IStylusPlugin.VTable, self.vtable).SystemEvent(@ptrCast(*const IStylusPlugin, self), piRtsSrc, tcid, sid, event, eventdata); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStylusPlugin_TabletAdded(self: *const T, piRtsSrc: ?*IRealTimeStylus, piTablet: ?*IInkTablet) callconv(.Inline) HRESULT { return @ptrCast(*const IStylusPlugin.VTable, self.vtable).TabletAdded(@ptrCast(*const IStylusPlugin, self), piRtsSrc, piTablet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStylusPlugin_TabletRemoved(self: *const T, piRtsSrc: ?*IRealTimeStylus, iTabletIndex: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IStylusPlugin.VTable, self.vtable).TabletRemoved(@ptrCast(*const IStylusPlugin, self), piRtsSrc, iTabletIndex); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStylusPlugin_Error(self: *const T, piRtsSrc: ?*IRealTimeStylus, piPlugin: ?*IStylusPlugin, dataInterest: RealTimeStylusDataInterest, hrErrorCode: HRESULT, lptrKey: ?*isize) callconv(.Inline) HRESULT { return @ptrCast(*const IStylusPlugin.VTable, self.vtable).Error(@ptrCast(*const IStylusPlugin, self), piRtsSrc, piPlugin, dataInterest, hrErrorCode, lptrKey); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStylusPlugin_UpdateMapping(self: *const T, piRtsSrc: ?*IRealTimeStylus) callconv(.Inline) HRESULT { return @ptrCast(*const IStylusPlugin.VTable, self.vtable).UpdateMapping(@ptrCast(*const IStylusPlugin, self), piRtsSrc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStylusPlugin_DataInterest(self: *const T, pDataInterest: ?*RealTimeStylusDataInterest) callconv(.Inline) HRESULT { return @ptrCast(*const IStylusPlugin.VTable, self.vtable).DataInterest(@ptrCast(*const IStylusPlugin, self), pDataInterest); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IStylusSyncPlugin_Value = @import("../zig.zig").Guid.initString("a157b174-482f-4d71-a3f6-3a41ddd11be9"); pub const IID_IStylusSyncPlugin = &IID_IStylusSyncPlugin_Value; pub const IStylusSyncPlugin = extern struct { pub const VTable = extern struct { base: IStylusPlugin.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IStylusPlugin.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IStylusAsyncPlugin_Value = @import("../zig.zig").Guid.initString("a7cca85a-31bc-4cd2-aadc-3289a3af11c8"); pub const IID_IStylusAsyncPlugin = &IID_IStylusAsyncPlugin_Value; pub const IStylusAsyncPlugin = extern struct { pub const VTable = extern struct { base: IStylusPlugin.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IStylusPlugin.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IDynamicRenderer_Value = @import("../zig.zig").Guid.initString("a079468e-7165-46f9-b7af-98ad01a93009"); pub const IID_IDynamicRenderer = &IID_IDynamicRenderer_Value; pub const IDynamicRenderer = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Enabled: fn( self: *const IDynamicRenderer, bEnabled: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Enabled: fn( self: *const IDynamicRenderer, bEnabled: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_HWND: fn( self: *const IDynamicRenderer, hwnd: ?*HANDLE_PTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_HWND: fn( self: *const IDynamicRenderer, hwnd: HANDLE_PTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ClipRectangle: fn( self: *const IDynamicRenderer, prcClipRect: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_ClipRectangle: fn( self: *const IDynamicRenderer, prcClipRect: ?*const RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ClipRegion: fn( self: *const IDynamicRenderer, phClipRgn: ?*HANDLE_PTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_ClipRegion: fn( self: *const IDynamicRenderer, hClipRgn: HANDLE_PTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DrawingAttributes: fn( self: *const IDynamicRenderer, ppiDA: ?*?*IInkDrawingAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, putref_DrawingAttributes: fn( self: *const IDynamicRenderer, piDA: ?*IInkDrawingAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DataCacheEnabled: fn( self: *const IDynamicRenderer, pfCacheData: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DataCacheEnabled: fn( self: *const IDynamicRenderer, fCacheData: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReleaseCachedData: fn( self: *const IDynamicRenderer, strokeId: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const IDynamicRenderer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Draw: fn( self: *const IDynamicRenderer, hDC: HANDLE_PTR, ) 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 IDynamicRenderer_get_Enabled(self: *const T, bEnabled: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicRenderer.VTable, self.vtable).get_Enabled(@ptrCast(*const IDynamicRenderer, self), bEnabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicRenderer_put_Enabled(self: *const T, bEnabled: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicRenderer.VTable, self.vtable).put_Enabled(@ptrCast(*const IDynamicRenderer, self), bEnabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicRenderer_get_HWND(self: *const T, hwnd: ?*HANDLE_PTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicRenderer.VTable, self.vtable).get_HWND(@ptrCast(*const IDynamicRenderer, self), hwnd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicRenderer_put_HWND(self: *const T, hwnd: HANDLE_PTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicRenderer.VTable, self.vtable).put_HWND(@ptrCast(*const IDynamicRenderer, self), hwnd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicRenderer_get_ClipRectangle(self: *const T, prcClipRect: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicRenderer.VTable, self.vtable).get_ClipRectangle(@ptrCast(*const IDynamicRenderer, self), prcClipRect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicRenderer_put_ClipRectangle(self: *const T, prcClipRect: ?*const RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicRenderer.VTable, self.vtable).put_ClipRectangle(@ptrCast(*const IDynamicRenderer, self), prcClipRect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicRenderer_get_ClipRegion(self: *const T, phClipRgn: ?*HANDLE_PTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicRenderer.VTable, self.vtable).get_ClipRegion(@ptrCast(*const IDynamicRenderer, self), phClipRgn); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicRenderer_put_ClipRegion(self: *const T, hClipRgn: HANDLE_PTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicRenderer.VTable, self.vtable).put_ClipRegion(@ptrCast(*const IDynamicRenderer, self), hClipRgn); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicRenderer_get_DrawingAttributes(self: *const T, ppiDA: ?*?*IInkDrawingAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicRenderer.VTable, self.vtable).get_DrawingAttributes(@ptrCast(*const IDynamicRenderer, self), ppiDA); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicRenderer_putref_DrawingAttributes(self: *const T, piDA: ?*IInkDrawingAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicRenderer.VTable, self.vtable).putref_DrawingAttributes(@ptrCast(*const IDynamicRenderer, self), piDA); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicRenderer_get_DataCacheEnabled(self: *const T, pfCacheData: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicRenderer.VTable, self.vtable).get_DataCacheEnabled(@ptrCast(*const IDynamicRenderer, self), pfCacheData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicRenderer_put_DataCacheEnabled(self: *const T, fCacheData: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicRenderer.VTable, self.vtable).put_DataCacheEnabled(@ptrCast(*const IDynamicRenderer, self), fCacheData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicRenderer_ReleaseCachedData(self: *const T, strokeId: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicRenderer.VTable, self.vtable).ReleaseCachedData(@ptrCast(*const IDynamicRenderer, self), strokeId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicRenderer_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicRenderer.VTable, self.vtable).Refresh(@ptrCast(*const IDynamicRenderer, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDynamicRenderer_Draw(self: *const T, hDC: HANDLE_PTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDynamicRenderer.VTable, self.vtable).Draw(@ptrCast(*const IDynamicRenderer, self), hDC); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IGestureRecognizer_Value = @import("../zig.zig").Guid.initString("ae9ef86b-7054-45e3-ae22-3174dc8811b7"); pub const IID_IGestureRecognizer = &IID_IGestureRecognizer_Value; pub const IGestureRecognizer = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Enabled: fn( self: *const IGestureRecognizer, pfEnabled: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Enabled: fn( self: *const IGestureRecognizer, fEnabled: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MaxStrokeCount: fn( self: *const IGestureRecognizer, pcStrokes: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MaxStrokeCount: fn( self: *const IGestureRecognizer, cStrokes: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnableGestures: fn( self: *const IGestureRecognizer, cGestures: u32, pGestures: [*]const i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IGestureRecognizer, ) 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 IGestureRecognizer_get_Enabled(self: *const T, pfEnabled: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IGestureRecognizer.VTable, self.vtable).get_Enabled(@ptrCast(*const IGestureRecognizer, self), pfEnabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGestureRecognizer_put_Enabled(self: *const T, fEnabled: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IGestureRecognizer.VTable, self.vtable).put_Enabled(@ptrCast(*const IGestureRecognizer, self), fEnabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGestureRecognizer_get_MaxStrokeCount(self: *const T, pcStrokes: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IGestureRecognizer.VTable, self.vtable).get_MaxStrokeCount(@ptrCast(*const IGestureRecognizer, self), pcStrokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGestureRecognizer_put_MaxStrokeCount(self: *const T, cStrokes: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IGestureRecognizer.VTable, self.vtable).put_MaxStrokeCount(@ptrCast(*const IGestureRecognizer, self), cStrokes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGestureRecognizer_EnableGestures(self: *const T, cGestures: u32, pGestures: [*]const i32) callconv(.Inline) HRESULT { return @ptrCast(*const IGestureRecognizer.VTable, self.vtable).EnableGestures(@ptrCast(*const IGestureRecognizer, self), cGestures, pGestures); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGestureRecognizer_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IGestureRecognizer.VTable, self.vtable).Reset(@ptrCast(*const IGestureRecognizer, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const RECO_GUIDE = extern struct { xOrigin: i32, yOrigin: i32, cxBox: i32, cyBox: i32, cxBase: i32, cyBase: i32, cHorzBox: i32, cVertBox: i32, cyMid: i32, }; pub const RECO_ATTRS = extern struct { dwRecoCapabilityFlags: u32, awcVendorName: [32]u16, awcFriendlyName: [64]u16, awLanguageId: [64]u16, }; pub const RECO_RANGE = extern struct { iwcBegin: u32, cCount: u32, }; pub const LINE_SEGMENT = extern struct { PtA: POINT, PtB: POINT, }; pub const LATTICE_METRICS = extern struct { lsBaseline: LINE_SEGMENT, iMidlineOffset: i16, }; pub const LINE_METRICS = enum(i32) { BASELINE = 0, MIDLINE = 1, ASCENDER = 2, DESCENDER = 3, }; pub const LM_BASELINE = LINE_METRICS.BASELINE; pub const LM_MIDLINE = LINE_METRICS.MIDLINE; pub const LM_ASCENDER = LINE_METRICS.ASCENDER; pub const LM_DESCENDER = LINE_METRICS.DESCENDER; pub const CONFIDENCE_LEVEL = enum(i32) { STRONG = 0, INTERMEDIATE = 1, POOR = 2, }; pub const CFL_STRONG = CONFIDENCE_LEVEL.STRONG; pub const CFL_INTERMEDIATE = CONFIDENCE_LEVEL.INTERMEDIATE; pub const CFL_POOR = CONFIDENCE_LEVEL.POOR; pub const ALT_BREAKS = enum(i32) { SAME = 0, UNIQUE = 1, FULL = 2, }; pub const ALT_BREAKS_SAME = ALT_BREAKS.SAME; pub const ALT_BREAKS_UNIQUE = ALT_BREAKS.UNIQUE; pub const ALT_BREAKS_FULL = ALT_BREAKS.FULL; pub const enumRECO_TYPE = enum(i32) { STRING = 0, CHAR = 1, }; pub const RECO_TYPE_WSTRING = enumRECO_TYPE.STRING; pub const RECO_TYPE_WCHAR = enumRECO_TYPE.CHAR; pub const RECO_LATTICE_PROPERTY = extern struct { guidProperty: Guid, cbPropertyValue: u16, pPropertyValue: ?*u8, }; pub const RECO_LATTICE_PROPERTIES = extern struct { cProperties: u32, apProps: ?*?*RECO_LATTICE_PROPERTY, }; pub const RECO_LATTICE_ELEMENT = extern struct { score: i32, type: u16, pData: ?*u8, ulNextColumn: u32, ulStrokeNumber: u32, epProp: RECO_LATTICE_PROPERTIES, }; pub const RECO_LATTICE_COLUMN = extern struct { key: u32, cpProp: RECO_LATTICE_PROPERTIES, cStrokes: u32, pStrokes: ?*u32, cLatticeElements: u32, pLatticeElements: ?*RECO_LATTICE_ELEMENT, }; pub const RECO_LATTICE = extern struct { ulColumnCount: u32, pLatticeColumns: ?*RECO_LATTICE_COLUMN, ulPropertyCount: u32, pGuidProperties: ?*Guid, ulBestResultColumnCount: u32, pulBestResultColumns: ?*u32, pulBestResultIndexes: ?*u32, }; pub const CHARACTER_RANGE = extern struct { wcLow: u16, cChars: u16, }; const CLSID_TipAutoCompleteClient_Value = @import("../zig.zig").Guid.initString("807c1e6c-1d00-453f-b920-b61bb7cdd997"); pub const CLSID_TipAutoCompleteClient = &CLSID_TipAutoCompleteClient_Value; const IID_ITipAutoCompleteProvider_Value = @import("../zig.zig").Guid.initString("7c6cf46d-8404-46b9-ad33-f5b6036d4007"); pub const IID_ITipAutoCompleteProvider = &IID_ITipAutoCompleteProvider_Value; pub const ITipAutoCompleteProvider = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, UpdatePendingText: fn( self: *const ITipAutoCompleteProvider, bstrPendingText: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Show: fn( self: *const ITipAutoCompleteProvider, fShow: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITipAutoCompleteProvider_UpdatePendingText(self: *const T, bstrPendingText: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITipAutoCompleteProvider.VTable, self.vtable).UpdatePendingText(@ptrCast(*const ITipAutoCompleteProvider, self), bstrPendingText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITipAutoCompleteProvider_Show(self: *const T, fShow: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ITipAutoCompleteProvider.VTable, self.vtable).Show(@ptrCast(*const ITipAutoCompleteProvider, self), fShow); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ITipAutoCompleteClient_Value = @import("../zig.zig").Guid.initString("5e078e03-8265-4bbe-9487-d242edbef910"); pub const IID_ITipAutoCompleteClient = &IID_ITipAutoCompleteClient_Value; pub const ITipAutoCompleteClient = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AdviseProvider: fn( self: *const ITipAutoCompleteClient, hWndField: ?HWND, pIProvider: ?*ITipAutoCompleteProvider, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnadviseProvider: fn( self: *const ITipAutoCompleteClient, hWndField: ?HWND, pIProvider: ?*ITipAutoCompleteProvider, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UserSelection: fn( self: *const ITipAutoCompleteClient, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PreferredRects: fn( self: *const ITipAutoCompleteClient, prcACList: ?*RECT, prcField: ?*RECT, prcModifiedACList: ?*RECT, pfShownAboveTip: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RequestShowUI: fn( self: *const ITipAutoCompleteClient, hWndList: ?HWND, pfAllowShowing: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITipAutoCompleteClient_AdviseProvider(self: *const T, hWndField: ?HWND, pIProvider: ?*ITipAutoCompleteProvider) callconv(.Inline) HRESULT { return @ptrCast(*const ITipAutoCompleteClient.VTable, self.vtable).AdviseProvider(@ptrCast(*const ITipAutoCompleteClient, self), hWndField, pIProvider); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITipAutoCompleteClient_UnadviseProvider(self: *const T, hWndField: ?HWND, pIProvider: ?*ITipAutoCompleteProvider) callconv(.Inline) HRESULT { return @ptrCast(*const ITipAutoCompleteClient.VTable, self.vtable).UnadviseProvider(@ptrCast(*const ITipAutoCompleteClient, self), hWndField, pIProvider); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITipAutoCompleteClient_UserSelection(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ITipAutoCompleteClient.VTable, self.vtable).UserSelection(@ptrCast(*const ITipAutoCompleteClient, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITipAutoCompleteClient_PreferredRects(self: *const T, prcACList: ?*RECT, prcField: ?*RECT, prcModifiedACList: ?*RECT, pfShownAboveTip: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ITipAutoCompleteClient.VTable, self.vtable).PreferredRects(@ptrCast(*const ITipAutoCompleteClient, self), prcACList, prcField, prcModifiedACList, pfShownAboveTip); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITipAutoCompleteClient_RequestShowUI(self: *const T, hWndList: ?HWND, pfAllowShowing: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ITipAutoCompleteClient.VTable, self.vtable).RequestShowUI(@ptrCast(*const ITipAutoCompleteClient, self), hWndList, pfAllowShowing); } };} pub usingnamespace MethodMixin(@This()); }; //-------------------------------------------------------------------------------- // Section: Functions (27) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn CreateRecognizer( pCLSID: ?*Guid, phrec: ?*?HRECOGNIZER, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn DestroyRecognizer( hrec: ?HRECOGNIZER, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn GetRecoAttributes( hrec: ?HRECOGNIZER, pRecoAttrs: ?*RECO_ATTRS, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn CreateContext( hrec: ?HRECOGNIZER, phrc: ?*?HRECOCONTEXT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn DestroyContext( hrc: ?HRECOCONTEXT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn GetResultPropertyList( hrec: ?HRECOGNIZER, pPropertyCount: ?*u32, pPropertyGuid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn GetUnicodeRanges( hrec: ?HRECOGNIZER, pcRanges: ?*u32, pcr: ?*CHARACTER_RANGE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn AddStroke( hrc: ?HRECOCONTEXT, pPacketDesc: ?*const PACKET_DESCRIPTION, cbPacket: u32, pPacket: ?*const u8, pXForm: ?*const XFORM, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn GetBestResultString( hrc: ?HRECOCONTEXT, pcSize: ?*u32, pwcBestResult: ?[*:0]u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn SetGuide( hrc: ?HRECOCONTEXT, pGuide: ?*const RECO_GUIDE, iIndex: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn AdviseInkChange( hrc: ?HRECOCONTEXT, bNewStroke: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn EndInkInput( hrc: ?HRECOCONTEXT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn Process( hrc: ?HRECOCONTEXT, pbPartialProcessing: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn SetFactoid( hrc: ?HRECOCONTEXT, cwcFactoid: u32, pwcFactoid: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn SetFlags( hrc: ?HRECOCONTEXT, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn GetLatticePtr( hrc: ?HRECOCONTEXT, ppLattice: ?*?*RECO_LATTICE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn SetTextContext( hrc: ?HRECOCONTEXT, cwcBefore: u32, pwcBefore: [*:0]const u16, cwcAfter: u32, pwcAfter: [*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn SetEnabledUnicodeRanges( hrc: ?HRECOCONTEXT, cRanges: u32, pcr: ?*CHARACTER_RANGE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn IsStringSupported( hrc: ?HRECOCONTEXT, wcString: u32, pwcString: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn SetWordList( hrc: ?HRECOCONTEXT, hwl: ?HRECOWORDLIST, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn GetRightSeparator( hrc: ?HRECOCONTEXT, pcSize: ?*u32, pwcRightSeparator: [*:0]u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn GetLeftSeparator( hrc: ?HRECOCONTEXT, pcSize: ?*u32, pwcLeftSeparator: [*:0]u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn DestroyWordList( hwl: ?HRECOWORDLIST, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn AddWordsToWordList( hwl: ?HRECOWORDLIST, pwcWords: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn MakeWordList( hrec: ?HRECOGNIZER, pBuffer: ?PWSTR, phwl: ?*?HRECOWORDLIST, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn GetAllRecognizers( recognizerClsids: ?*?*Guid, count: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "inkobjcore" fn LoadCachedAttributes( clsid: Guid, pRecoAttributes: ?*RECO_ATTRS, ) 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 (18) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BOOL = @import("../foundation.zig").BOOL; const BSTR = @import("../foundation.zig").BSTR; const HANDLE_PTR = @import("../foundation.zig").HANDLE_PTR; const HRESULT = @import("../foundation.zig").HRESULT; const HWND = @import("../foundation.zig").HWND; const IDataObject = @import("../system/com.zig").IDataObject; const IDispatch = @import("../system/com.zig").IDispatch; const IFontDisp = @import("../system/ole.zig").IFontDisp; const IPictureDisp = @import("../system/ole.zig").IPictureDisp; const IUnknown = @import("../system/com.zig").IUnknown; const NMHDR = @import("../ui/controls.zig").NMHDR; const POINT = @import("../foundation.zig").POINT; const PWSTR = @import("../foundation.zig").PWSTR; const RECT = @import("../foundation.zig").RECT; const SAFEARRAY = @import("../system/com.zig").SAFEARRAY; const VARIANT = @import("../system/com.zig").VARIANT; const XFORM = @import("../graphics/gdi.zig").XFORM; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "PfnRecoCallback")) { _ = PfnRecoCallback; } @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/ui/tablet_pc.zig
pub const window = @import("Window.zig"); pub const input = @import("Input.zig"); pub const c = @import("c.zig").c; pub const ArrayTexture = @import("ArrayTexture.zig").Texture2DArray; pub const CubeMap = @import("CubeMap.zig").CubeMap; pub const Buffer = @import("Buffer.zig").Buffer; const shdr = @import("Shader.zig"); pub const ShaderObject = shdr.ShaderObject; pub const ShaderProgram = shdr.ShaderProgram; pub const ShaderType = shdr.ShaderType; pub const VertexMeta = @import("VertexMeta.zig").VertexMeta; pub const FrameBuffer = @import("FrameBuffer.zig").FrameBuffer; pub const CubeFrameBuffer = @import("CubeFrameBuffer.zig").CubeFrameBuffer; pub const image = @import("Image.zig"); pub const ImageType = image.ImageType; pub const MinFilter = image.MinFilter; pub const imageDataSize = image.imageDataSize; pub const Texture2D = image.Texture2D; pub const Constants = @import("Constants.zig"); pub const GraphicsAPI = enum { GL33, D3D11, }; pub fn getGraphicsAPI() GraphicsAPI { return GraphicsAPI.OpenGL33; } pub fn disableDepthTesting() void { c.glDepthFunc(c.GL_ALWAYS); } pub fn enableDepthWriting() void { c.glDepthMask(c.GL_TRUE); } pub fn disableDepthWriting() void { c.glDepthMask(c.GL_FALSE); } // setDepthMode functions enable depth testing fn setDepthFunc(eql: bool, flip: bool) void { if (eql) { if (flip) { c.glDepthFunc(c.GL_LEQUAL); } else { c.glDepthFunc(c.GL_GEQUAL); } } else { if (flip) { c.glDepthFunc(c.GL_LESS); } else { c.glDepthFunc(c.GL_GREATER); } } } pub fn setDepthModeDirectX(equal_passes: bool, flip: bool) void { c.glClipControl(c.GL_LOWER_LEFT, c.GL_ZERO_TO_ONE); c.glClearDepth(0.0); setDepthFunc(equal_passes, flip); } pub fn setDepthModeOpenGL(equal_passes: bool, flip: bool) void { c.glClipControl(c.GL_LOWER_LEFT, c.GL_NEGATIVE_ONE_TO_ONE); c.glClearDepth(1.0); setDepthFunc(equal_passes, !flip); } pub const CullFaceMode = enum(u32) { Front = c.GL_FRONT, Back = c.GL_BACK, }; pub fn cullFace(mode: CullFaceMode) void { c.glCullFace(@enumToInt(mode)); } pub fn enableAdditiveBlending() void { c.glEnable(c.GL_BLEND); c.glBlendFunc(c.GL_ONE, c.GL_ONE); c.glBlendEquation(c.GL_FUNC_ADD); } pub fn enableRegularBlending() void { c.glEnable(c.GL_BLEND); c.glBlendFunc(c.GL_SRC_ALPHA, c.GL_ONE_MINUS_SRC_ALPHA); c.glBlendEquation(c.GL_FUNC_ADD); } pub fn disableBlending() void { c.glDisable(c.GL_BLEND); } // Individual values are meaningless - use for time deltas pub fn getMicroTime() u64 { const freq = c.glfwGetTimerFrequency(); if (freq == 0) { return 0; } if (freq % 10 == 0) { if (freq < 1000000) { return c.glfwGetTimerValue() * (1000000 / freq); } else { // Same calulation but the alternative code would just produce 0 return c.glfwGetTimerValue() / (freq / 1000000); } } else { const m = 1000000.0 / @intToFloat(f64, freq); return @floatToInt(u64, @intToFloat(f64, c.glfwGetTimerValue()) * m); } } test "All tests" { _ = @import("Window.zig"); _ = @import("ArrayTexture.zig"); _ = @import("Buffer.zig"); _ = @import("Image.zig"); _ = @import("Shader.zig"); _ = @import("VertexMeta.zig"); _ = @import("FrameBuffer.zig"); _ = @import("CubeMap.zig"); _ = @import("CubeFrameBuffer.zig"); _ = @import("Input.zig"); }
src/WindowGraphicsInput/WindowGraphicsInput.zig
const std = @import("std"); const print = @import("std").debug.print; pub const WORDSIZE = 8; pub const FIXNUM_MASK = 3; pub const FIXNUM_TAG = 0; pub const FIXNUM_SHIFT = 2; pub const CHAR_MASK = 0xff; pub const CHAR_TAG = 7; pub const CHAR_SHIFT = 8; pub const BOOL_MASK = 0xff; pub const BOOL_TAG = 15; pub const BOOL_SHIFT = 8; pub const PTR_MASK = 7; pub const PAIR_TAG = 1; pub const VEC_TAG = 2; pub const STR_TAG = 3; pub const VOID_TAG = 5; pub const CLOSURE_TAG = 6; fn putchar(x: u8) void { print("{c}", .{x}); } pub fn show(x: i64) void { if ((x & FIXNUM_MASK) == FIXNUM_TAG) { // integer print("{d}", .{x >> FIXNUM_SHIFT}); } else if ((x & CHAR_MASK) == CHAR_TAG) { // character const char = @truncate(u8, @intCast(u64, x >> CHAR_SHIFT)); switch (char) { 0 => print("#\\nul", .{}), ' ' => print("#\\space", .{}), '\n' => print("#\\newline", .{}), else => print("#\\{c}", .{char}), } } else if ((x & BOOL_MASK) == BOOL_TAG) { // boolean if ((x >> BOOL_SHIFT) != 0) { print("#t", .{}); } else { print("#f", .{}); } } else if ((x & PTR_MASK) == VOID_TAG) {} else if ((x & PTR_MASK) == PAIR_TAG) { var ptr = @intToPtr(?[*]i64, @intCast(usize, x - PAIR_TAG)); if (ptr == null) { print("()", .{}); return; } // either a list or a dotted pair var car: i64 = ptr.?[0]; var cdr: i64 = ptr.?[1]; putchar('('); show(car); // show additional space-separated elems while ((cdr & PTR_MASK) == PAIR_TAG) { ptr = @intToPtr(?[*]i64, @intCast(usize, cdr - PAIR_TAG)); if (ptr == null) break; car = ptr.?[0]; cdr = ptr.?[1]; putchar(' '); show(car); } // show dotted pair notation if relevant if ((cdr & PTR_MASK) != PAIR_TAG) { print(" . ", .{}); show(cdr); } putchar(')'); } else if ((x & PTR_MASK) == STR_TAG) { const ptr = @intToPtr([*]i64, @intCast(usize, x - STR_TAG)); var len: i64 = ptr[0]; var body: [*]u8 = @ptrCast([*]u8, ptr + 1); putchar('"'); while (len > 0) { putchar(body[0]); body += 1; len -= 1; } putchar('"'); } else if ((x & PTR_MASK) == VEC_TAG) { var ptr = @intToPtr([*]i64, @intCast(usize, x - VEC_TAG)); var len: i64 = ptr[0]; ptr += 1; print("#(", .{}); while (len > 0) { show(ptr[0]); ptr += 1; len -= 1; if (len != 0) putchar(' '); } print(")", .{}); } else if ((x & PTR_MASK) == CLOSURE_TAG) { print("<procedure>", .{}); } else { print("bad: {d}", .{x}); } }
zig/src/representation.zig
const x86_64 = @import("../index.zig"); const bitjuggle = @import("bitjuggle"); const std = @import("std"); const formatWithoutFields = @import("../common.zig").formatWithoutFields; pub const NUMBER_OF_INTERRUPT_HANDLERS = 256; /// An Interrupt Descriptor Table with 256 entries. /// ## **IMPORTANT** - must be align(16) /// /// The first 32 entries are used for CPU exceptions. The remaining entries are used for interrupts. /// /// This differs from `SimpleInterruptDescriptorTable` by providing function types per handler using /// `Interrupt` calling convention. pub const InterruptDescriptorTable = extern struct { /// A divide error (`#DE`) occurs when the denominator of a DIV instruction or /// an IDIV instruction is 0. A `#DE` also occurs if the result is too large to be /// represented in the destination. /// /// The saved instruction pointer points to the instruction that caused the `#DE`. /// /// The vector number of the `#DE` exception is 0. divide_error: HandlerFuncEntry, /// When the debug-exception mechanism is enabled, a `#DB` exception can occur under any /// of the following circumstances: /// /// <details> /// /// - Instruction execution. /// - Instruction single stepping. /// - Data read. /// - Data write. /// - I/O read. /// - I/O write. /// - Task switch. /// - Debug-register access, or general detect fault (debug register access when DR7.GD=1). /// - Executing the INT1 instruction (opcode 0F1h). /// /// </details> /// /// `#DB` conditions are enabled and disabled using the debug-control register, `DR7` /// and `RFLAGS.TF`. /// /// In the following cases, the saved instruction pointer points to the instruction that /// caused the `#DB`: /// /// - Instruction execution. /// - Invalid debug-register access, or general detect. /// /// In all other cases, the instruction that caused the `#DB` is completed, and the saved /// instruction pointer points to the instruction after the one that caused the `#DB`. /// /// The vector number of the `#DB` exception is 1. debug: HandlerFuncEntry, /// An non maskable interrupt exception (NMI) occurs as a result of system logic /// signaling a non-maskable interrupt to the processor. /// /// The processor recognizes an NMI at an instruction boundary. /// The saved instruction pointer points to the instruction immediately following the /// boundary where the NMI was recognized. /// /// The vector number of the NMI exception is 2. non_maskable_interrupt: HandlerFuncEntry, /// A breakpoint (`#BP`) exception occurs when an `INT3` instruction is executed. The /// `INT3` is normally used by debug software to set instruction breakpoints by replacing /// /// The saved instruction pointer points to the byte after the `INT3` instruction. /// /// The vector number of the `#BP` exception is 3. breakpoint: HandlerFuncEntry, /// An overflow exception (`#OF`) occurs as a result of executing an `INTO` instruction /// while the overflow bit in `RFLAGS` is set to 1. /// /// The saved instruction pointer points to the instruction following the `INTO` /// instruction that caused the `#OF`. /// /// The vector number of the `#OF` exception is 4. overflow: HandlerFuncEntry, /// A bound-range exception (`#BR`) exception can occur as a result of executing /// the `BOUND` instruction. The `BOUND` instruction compares an array index (first /// operand) with the lower bounds and upper bounds of an array (second operand). /// If the array index is not within the array boundary, the `#BR` occurs. /// /// The saved instruction pointer points to the `BOUND` instruction that caused the `#BR`. /// /// The vector number of the `#BR` exception is 5. bound_range_exceeded: HandlerFuncEntry, /// An invalid opcode exception (`#UD`) occurs when an attempt is made to execute an /// invalid or undefined opcode. The validity of an opcode often depends on the /// processor operating mode. /// /// <details><summary>A `#UD` occurs under the following conditions:</summary> /// /// - Execution of any reserved or undefined opcode in any mode. /// - Execution of the `UD2` instruction. /// - Use of the `LOCK` prefix on an instruction that cannot be locked. /// - Use of the `LOCK` prefix on a lockable instruction with a non-memory target location. /// - Execution of an instruction with an invalid-operand type. /// - Execution of the `SYSENTER` or `SYSEXIT` instructions in long mode. /// - Execution of any of the following instructions in 64-bit mode: `AAA`, `AAD`, /// `AAM`, `AAS`, `BOUND`, `CALL` (opcode 9A), `DAA`, `DAS`, `DEC`, `INC`, `INTO`, /// `JMP` (opcode EA), `LDS`, `LES`, `POP` (`DS`, `ES`, `SS`), `POPA`, `PUSH` (`CS`, /// `DS`, `ES`, `SS`), `PUSHA`, `SALC`. /// - Execution of the `ARPL`, `LAR`, `LLDT`, `LSL`, `LTR`, `SLDT`, `STR`, `VERR`, or /// `VERW` instructions when protected mode is not enabled, or when virtual-8086 mode /// is enabled. /// - Execution of any legacy SSE instruction when `CR4.osfxsr` is cleared to 0. /// - Execution of any SSE instruction (uses `YMM`/`XMM` registers), or 64-bit media /// instruction (uses `MMXTM` registers) when `CR0.EM` = 1. /// - Execution of any SSE floating-point instruction (uses `YMM`/`XMM` registers) that /// causes a numeric exception when `CR4.OSXMMEXCPT` = 0. /// - Use of the `DR4` or `DR5` debug registers when `CR4.DE` = 1. /// - Execution of `RSM` when not in `SMM` mode. /// /// </details> /// /// The saved instruction pointer points to the instruction that caused the `#UD`. /// /// The vector number of the `#UD` exception is 6. invalid_opcode: HandlerFuncEntry, /// A device not available exception (`#NM`) occurs under any of the following conditions: /// /// <details> /// /// - An `FWAIT`/`WAIT` instruction is executed when `CR0.MP=1` and `CR0.TS=1`. /// - Any x87 instruction other than `FWAIT` is executed when `CR0.EM=1`. /// - Any x87 instruction is executed when `CR0.TS=1`. The `CR0.MP` bit controls whether the /// `FWAIT`/`WAIT` instruction causes an `#NM` exception when `TS=1`. /// - Any 128-bit or 64-bit media instruction when `CR0.TS=1`. /// /// </details> /// /// The saved instruction pointer points to the instruction that caused the `#NM`. /// /// The vector number of the `#NM` exception is 7. device_not_available: HandlerFuncEntry, /// A double fault (`#DF`) exception can occur when a second exception occurs during /// the handling of a prior (first) exception or interrupt handler. /// /// <details> /// /// Usually, the first and second exceptions can be handled sequentially without /// resulting in a `#DF`. In this case, the first exception is considered _benign_, as /// it does not harm the ability of the processor to handle the second exception. In some /// cases, however, the first exception adversely affects the ability of the processor to /// handle the second exception. These exceptions contribute to the occurrence of a `#DF`, /// and are called _contributory exceptions_. The following exceptions are contributory: /// /// - Invalid-TSS Exception /// - Segment-Not-Present Exception /// - Stack Exception /// - General-Protection Exception /// /// A double-fault exception occurs in the following cases: /// /// - If a contributory exception is followed by another contributory exception. /// - If a divide-by-zero exception is followed by a contributory exception. /// - If a page fault is followed by another page fault or a contributory exception. /// /// If a third interrupting event occurs while transferring control to the `#DF` handler, /// the processor shuts down. /// /// </details> /// /// The returned error code is always zero. The saved instruction pointer is undefined, /// and the program cannot be restarted. /// /// The vector number of the `#DF` exception is 8. double_fault: HandlerDivergingWithErrorCodeFuncEntry, /// This interrupt vector is reserved. It is for a discontinued exception originally used /// by processors that supported external x87-instruction coprocessors. On those processors, /// the exception condition is caused by an invalid-segment or invalid-page access on an /// x87-instruction coprocessor-instruction operand. On current processors, this condition /// causes a general-protection exception to occur. coprocessor_segment_overrun: HandlerFuncEntry, /// An invalid TSS exception (`#TS`) occurs only as a result of a control transfer through /// a gate descriptor that results in an invalid stack-segment reference using an `SS` /// selector in the TSS. /// /// The returned error code is the `SS` segment selector. The saved instruction pointer /// points to the control-transfer instruction that caused the `#TS`. /// /// The vector number of the `#TS` exception is 10. invalid_tss: HandlerWithErrorCodeFuncEntry, /// An segment-not-present exception (`#NP`) occurs when an attempt is made to load a /// segment or gate with a clear present bit. /// /// The returned error code is the segment-selector index of the segment descriptor /// causing the `#NP` exception. The saved instruction pointer points to the instruction /// that loaded the segment selector resulting in the `#NP`. /// /// The vector number of the `#NP` exception is 11. segment_not_present: HandlerWithErrorCodeFuncEntry, /// An stack segment exception (`#SS`) can occur in the following situations: /// /// - Implied stack references in which the stack address is not in canonical /// form. Implied stack references include all push and pop instructions, and any /// instruction using `RSP` or `RBP` as a base register. /// - Attempting to load a stack-segment selector that references a segment descriptor /// containing a clear present bit. /// - Any stack access that fails the stack-limit check. /// /// The returned error code depends on the cause of the `#SS`. If the cause is a cleared /// present bit, the error code is the corresponding segment selector. Otherwise, the /// error code is zero. The saved instruction pointer points to the instruction that /// caused the `#SS`. /// /// The vector number of the `#NP` exception is 12. stack_segment_fault: HandlerWithErrorCodeFuncEntry, /// A general protection fault (`#GP`) can occur in various situations. Common causes include: /// /// - Executing a privileged instruction while `CPL > 0`. /// - Writing a 1 into any register field that is reserved, must be zero (MBZ). /// - Attempting to execute an SSE instruction specifying an unaligned memory operand. /// - Loading a non-canonical base address into the `GDTR` or `IDTR`. /// - Using WRMSR to write a read-only MSR. /// - Any long-mode consistency-check violation. /// /// The returned error code is a segment selector, if the cause of the `#GP` is /// segment-related, and zero otherwise. The saved instruction pointer points to /// the instruction that caused the `#GP`. /// /// The vector number of the `#GP` exception is 13. general_protection_fault: HandlerWithErrorCodeFuncEntry, /// A page fault (`#PF`) can occur during a memory access in any of the following situations: /// /// - A page-translation-table entry or physical page involved in translating the memory /// access is not present in physical memory. This is indicated by a cleared present /// bit in the translation-table entry. /// - An attempt is made by the processor to load the instruction TLB with a translation /// for a non-executable page. /// - The memory access fails the paging-protection checks (user/supervisor, read/write, /// or both). /// - A reserved bit in one of the page-translation-table entries is set to 1. A `#PF` /// occurs for this reason only when `CR4.PSE=1` or `CR4.PAE=1`. /// /// The virtual (linear) address that caused the `#PF` is stored in the `CR2` register. /// The saved instruction pointer points to the instruction that caused the `#PF`. /// /// The page-fault error code is described by the `PageFaultErrorCode` struct. /// /// The vector number of the `#PF` exception is 14. page_fault: PageFaultHandlerFuncEntry, /// vector nr. 15 reserved_1: HandlerFuncEntry, /// The x87 Floating-Point Exception-Pending exception (`#MF`) is used to handle unmasked x87 /// floating-point exceptions. In 64-bit mode, the x87 floating point unit is not used /// anymore, so this exception is only relevant when executing programs in the 32-bit /// compatibility mode. /// /// The vector number of the `#MF` exception is 16. x87_floating_point: HandlerFuncEntry, /// An alignment check exception (`#AC`) occurs when an unaligned-memory data reference /// is performed while alignment checking is enabled. An `#AC` can occur only when CPL=3. /// /// The returned error code is always zero. The saved instruction pointer points to the /// instruction that caused the `#AC`. /// /// The vector number of the `#AC` exception is 17. alignment_check: HandlerWithErrorCodeFuncEntry, /// The machine check exception (`#MC`) is model specific. Processor implementations /// are not required to support the `#MC` exception, and those implementations that do /// support `#MC` can vary in how the `#MC` exception mechanism works. /// /// There is no reliable way to restart the program. /// /// The vector number of the `#MC` exception is 18. machine_check: HandlerDivergingFuncEntry, /// The SIMD Floating-Point Exception (`#XF`) is used to handle unmasked SSE /// floating-point exceptions. The SSE floating-point exceptions reported by /// the `#XF` exception are (including mnemonics): /// /// - IE: Invalid-operation exception (also called #I). /// - DE: Denormalized-operand exception (also called #D). /// - ZE: Zero-divide exception (also called #Z). /// - OE: Overflow exception (also called #O). /// - UE: Underflow exception (also called #U). /// - PE: Precision exception (also called #P or inexact-result exception). /// /// The saved instruction pointer points to the instruction that caused the `#XF`. /// /// The vector number of the `#XF` exception is 19. simd_floating_point: HandlerFuncEntry, /// vector nr. 20 virtualization: HandlerFuncEntry, /// vector nr. 21-29 reserved_2: [9]HandlerFuncEntry, /// The Security Exception (`#SX`) signals security-sensitive events that occur while /// executing the VMM, in the form of an exception so that the VMM may take appropriate /// action. (A VMM would typically intercept comparable sensitive events in the guest.) /// In the current implementation, the only use of the `#SX` is to redirect external INITs /// into an exception so that the VMM may — among other possibilities. /// /// The only error code currently defined is 1, and indicates redirection of INIT has occurred. /// /// The vector number of the ``#SX`` exception is 30. security_exception: HandlerWithErrorCodeFuncEntry, /// vector nr. 31 reserved_3: HandlerFuncEntry, /// User-defined interrupts can be initiated either by system logic or software. They occur /// when: /// /// - System logic signals an external interrupt request to the processor. The signaling /// mechanism and the method of communicating the interrupt vector to the processor are /// implementation dependent. /// - Software executes an `INTn` instruction. The `INTn` instruction operand provides /// the interrupt vector number. /// /// Both methods can be used to initiate an interrupt into vectors 0 through 255. However, /// because vectors 0 through 31 are defined or reserved by the AMD64 architecture, /// software should not use vectors in this range for purposes other than their defined use. /// /// The saved instruction pointer depends on the interrupt source: /// /// - External interrupts are recognized on instruction boundaries. The saved instruction /// pointer points to the instruction immediately following the boundary where the /// external interrupt was recognized. /// - If the interrupt occurs as a result of executing the INTn instruction, the saved /// instruction pointer points to the instruction after the INTn. interrupts: [NUMBER_OF_INTERRUPT_HANDLERS - 32]HandlerFuncEntry, pub fn init() InterruptDescriptorTable { return .{ .divide_error = HandlerFuncEntry.missing(), .debug = HandlerFuncEntry.missing(), .non_maskable_interrupt = HandlerFuncEntry.missing(), .breakpoint = HandlerFuncEntry.missing(), .overflow = HandlerFuncEntry.missing(), .bound_range_exceeded = HandlerFuncEntry.missing(), .invalid_opcode = HandlerFuncEntry.missing(), .device_not_available = HandlerFuncEntry.missing(), .double_fault = HandlerDivergingWithErrorCodeFuncEntry.missing(), .coprocessor_segment_overrun = HandlerFuncEntry.missing(), .invalid_tss = HandlerWithErrorCodeFuncEntry.missing(), .segment_not_present = HandlerWithErrorCodeFuncEntry.missing(), .stack_segment_fault = HandlerWithErrorCodeFuncEntry.missing(), .general_protection_fault = HandlerWithErrorCodeFuncEntry.missing(), .page_fault = PageFaultHandlerFuncEntry.missing(), .reserved_1 = HandlerFuncEntry.missing(), .x87_floating_point = HandlerFuncEntry.missing(), .alignment_check = HandlerWithErrorCodeFuncEntry.missing(), .machine_check = HandlerDivergingFuncEntry.missing(), .simd_floating_point = HandlerFuncEntry.missing(), .virtualization = HandlerFuncEntry.missing(), .reserved_2 = [_]HandlerFuncEntry{HandlerFuncEntry.missing()} ** 9, .security_exception = HandlerWithErrorCodeFuncEntry.missing(), .reserved_3 = HandlerFuncEntry.missing(), .interrupts = [_]HandlerFuncEntry{HandlerFuncEntry.missing()} ** (256 - 32), }; } /// Resets all entries of this IDT in place. pub fn reset(self: *InterruptDescriptorTable) void { self.* = InterruptDescriptorTable.init(); } /// Loads the IDT in the CPU using the `lidt` command. pub fn load(self: *InterruptDescriptorTable) void { const ptr = x86_64.structures.DescriptorTablePointer{ .base = x86_64.VirtAddr.fromPtr(self), .limit = @as(u16, @sizeOf(InterruptDescriptorTable) - 1), }; x86_64.instructions.tables.lidt(&ptr); } /// Returns the IDT entry with the specified index. /// /// Panics if index is outside the IDT (i.e. greater than 255) or if the entry is an /// exception that pushes an error code (use the struct fields for accessing these entries). pub fn indexInterruptHandler(self: *InterruptDescriptorTable, index: usize) *HandlerFuncEntry { return switch (index) { 0 => &self.divide_error, 1 => &self.debug, 2 => &self.non_maskable_interrupt, 3 => &self.breakpoint, 4 => &self.overflow, 5 => &self.bound_range_exceeded, 6 => &self.invalid_opcode, 7 => &self.device_not_available, 9 => &self.coprocessor_segment_overrun, 16 => &self.x87_floating_point, 19 => &self.simd_floating_point, 20 => &self.virtualization, 32...255 => &self.interrupts[index - 32], 15, 31, 21...29 => @panic("entry is reserved"), 8, 10...14, 17, 30 => @panic("entry has an error code"), 18 => @panic("entry is a diverging exception"), else => @panic("no entry with that index"), }; } test { std.testing.refAllDecls(@This()); try std.testing.expectEqual(@bitSizeOf(u64) * 2 * NUMBER_OF_INTERRUPT_HANDLERS, @bitSizeOf(InterruptDescriptorTable)); try std.testing.expectEqual(@sizeOf(u64) * 2 * NUMBER_OF_INTERRUPT_HANDLERS, @sizeOf(InterruptDescriptorTable)); } }; pub const HandlerFunc = fn (interrupt_stack_frame: InterruptStackFrame) callconv(.Interrupt) void; pub const HandlerFuncEntry = extern struct { pointer_low: u16, gdt_selector: u16, options: EntryOptions, pointer_middle: u16, pointer_high: u32, reserved: u32, /// Creates a non-present IDT entry (but sets the must-be-one bits). pub fn missing() HandlerFuncEntry { return .{ .pointer_low = 0, .gdt_selector = 0, .options = EntryOptions.minimal(), .pointer_middle = 0, .pointer_high = 0, .reserved = 0, }; } /// Set the handler function for the IDT entry and sets the present bit. /// /// For the code selector field, this function uses the code segment selector currently active in the CPU. pub fn setHandler(self: *HandlerFuncEntry, handler: HandlerFunc, code_selector: x86_64.structures.gdt.SegmentSelector) void { const addr = @ptrToInt(handler); self.pointer_low = @truncate(u16, addr); self.pointer_middle = @truncate(u16, (addr >> 16)); self.pointer_high = @truncate(u32, (addr >> 32)); self.gdt_selector = code_selector.value; self.options.setPresent(true); } comptime { std.testing.refAllDecls(@This()); } }; pub const HandlerWithErrorCodeFunc = fn (interrupt_stack_frame: InterruptStackFrame, error_code: u64) callconv(.Interrupt) void; pub const HandlerWithErrorCodeFuncEntry = extern struct { pointer_low: u16, gdt_selector: u16, options: EntryOptions, pointer_middle: u16, pointer_high: u32, reserved: u32, /// Creates a non-present IDT entry (but sets the must-be-one bits). pub fn missing() HandlerWithErrorCodeFuncEntry { return .{ .pointer_low = 0, .gdt_selector = 0, .options = EntryOptions.minimal(), .pointer_middle = 0, .pointer_high = 0, .reserved = 0, }; } /// Set the handler function for the IDT entry and sets the present bit. /// /// For the code selector field, this function uses the code segment selector currently active in the CPU. pub fn setHandler(self: *HandlerWithErrorCodeFuncEntry, handler: HandlerWithErrorCodeFunc, code_selector: x86_64.structures.gdt.SegmentSelector) void { const addr = @ptrToInt(handler); self.pointer_low = @truncate(u16, addr); self.pointer_middle = @truncate(u16, (addr >> 16)); self.pointer_high = @truncate(u32, (addr >> 32)); self.gdt_selector = code_selector.value; self.options.setPresent(true); } comptime { std.testing.refAllDecls(@This()); } }; pub const PageFaultHandlerFunc = fn (interrupt_stack_frame: InterruptStackFrame, error_code: PageFaultErrorCode) callconv(.Interrupt) void; pub const PageFaultHandlerFuncEntry = extern struct { pointer_low: u16, gdt_selector: u16, options: EntryOptions, pointer_middle: u16, pointer_high: u32, reserved: u32, /// Creates a non-present IDT entry (but sets the must-be-one bits). pub fn missing() PageFaultHandlerFuncEntry { return .{ .pointer_low = 0, .gdt_selector = 0, .options = EntryOptions.minimal(), .pointer_middle = 0, .pointer_high = 0, .reserved = 0, }; } /// Set the handler function for the IDT entry and sets the present bit. /// /// For the code selector field, this function uses the code segment selector currently active in the CPU. pub fn setHandler(self: *PageFaultHandlerFuncEntry, handler: PageFaultHandlerFunc, code_selector: x86_64.structures.gdt.SegmentSelector) void { const addr = @ptrToInt(handler); self.pointer_low = @truncate(u16, addr); self.pointer_middle = @truncate(u16, (addr >> 16)); self.pointer_high = @truncate(u32, (addr >> 32)); self.gdt_selector = code_selector.value; self.options.setPresent(true); } comptime { std.testing.refAllDecls(@This()); } }; pub const HandlerDivergingFunc = fn (interrupt_stack_frame: InterruptStackFrame) callconv(.Interrupt) noreturn; pub const HandlerDivergingFuncEntry = extern struct { pointer_low: u16, gdt_selector: u16, options: EntryOptions, pointer_middle: u16, pointer_high: u32, reserved: u32, /// Creates a non-present IDT entry (but sets the must-be-one bits). pub fn missing() HandlerDivergingFuncEntry { return .{ .pointer_low = 0, .gdt_selector = 0, .options = EntryOptions.minimal(), .pointer_middle = 0, .pointer_high = 0, .reserved = 0, }; } /// Set the handler function for the IDT entry and sets the present bit. /// /// For the code selector field, this function uses the code segment selector currently active in the CPU. pub fn setHandler(self: *HandlerDivergingFuncEntry, handler: HandlerDivergingFunc, code_selector: x86_64.structures.gdt.SegmentSelector) void { const addr = @ptrToInt(handler); self.pointer_low = @truncate(u16, addr); self.pointer_middle = @truncate(u16, (addr >> 16)); self.pointer_high = @truncate(u32, (addr >> 32)); self.gdt_selector = code_selector.value; self.options.setPresent(true); } comptime { std.testing.refAllDecls(@This()); } }; pub const HandlerDivergingWithErrorCodeFunc = fn (interrupt_stack_frame: InterruptStackFrame, error_code: u64) callconv(.Interrupt) noreturn; pub const HandlerDivergingWithErrorCodeFuncEntry = extern struct { pointer_low: u16, gdt_selector: u16, options: EntryOptions, pointer_middle: u16, pointer_high: u32, reserved: u32, /// Creates a non-present IDT entry (but sets the must-be-one bits). pub fn missing() HandlerDivergingWithErrorCodeFuncEntry { return .{ .pointer_low = 0, .gdt_selector = 0, .options = EntryOptions.minimal(), .pointer_middle = 0, .pointer_high = 0, .reserved = 0, }; } /// Set the handler function for the IDT entry and sets the present bit. /// /// For the code selector field, this function uses the code segment selector currently active in the CPU. pub fn setHandler(self: *HandlerDivergingWithErrorCodeFuncEntry, handler: HandlerDivergingWithErrorCodeFunc, code_selector: x86_64.structures.gdt.SegmentSelector) void { const addr = @ptrToInt(handler); self.pointer_low = @truncate(u16, addr); self.pointer_middle = @truncate(u16, (addr >> 16)); self.pointer_high = @truncate(u32, (addr >> 32)); self.gdt_selector = code_selector.value; self.options.setPresent(true); } comptime { std.testing.refAllDecls(@This()); } }; test { try std.testing.expectEqual(@bitSizeOf(u64) * 2, @bitSizeOf(HandlerFuncEntry)); try std.testing.expectEqual(@sizeOf(u64) * 2, @sizeOf(HandlerFuncEntry)); try std.testing.expectEqual(@bitSizeOf(u64) * 2, @bitSizeOf(HandlerWithErrorCodeFuncEntry)); try std.testing.expectEqual(@sizeOf(u64) * 2, @sizeOf(HandlerWithErrorCodeFuncEntry)); try std.testing.expectEqual(@bitSizeOf(u64) * 2, @bitSizeOf(HandlerDivergingFuncEntry)); try std.testing.expectEqual(@sizeOf(u64) * 2, @sizeOf(HandlerDivergingFuncEntry)); try std.testing.expectEqual(@bitSizeOf(u64) * 2, @bitSizeOf(HandlerDivergingWithErrorCodeFuncEntry)); try std.testing.expectEqual(@sizeOf(u64) * 2, @sizeOf(HandlerDivergingWithErrorCodeFuncEntry)); try std.testing.expectEqual(@bitSizeOf(u64) * 2, @bitSizeOf(PageFaultHandlerFuncEntry)); try std.testing.expectEqual(@sizeOf(u64) * 2, @sizeOf(PageFaultHandlerFuncEntry)); } fn dummyFn(interrupt_stack_frame: InterruptStackFrame) callconv(.Interrupt) void { _ = interrupt_stack_frame; } test "Entry" { var a = HandlerFuncEntry.missing(); a.setHandler(dummyFn, x86_64.structures.gdt.SegmentSelector{ .value = 0 }); } /// Represents the options field of an IDT entry. pub const EntryOptions = packed struct { value: u16, /// Creates a minimal options field with all the must-be-one bits set. pub fn minimal() EntryOptions { return EntryOptions{ .value = 0b1110_0000_0000 }; } /// Is the entry present. pub fn isPresent(self: EntryOptions) bool { return bitjuggle.isBitSet(self.value, 15); } /// Set or reset the preset bit. pub fn setPresent(self: *EntryOptions, present: bool) void { bitjuggle.setBit(&self.value, 15, present); } /// Let the CPU disable hardware interrupts when the handler is invoked. By default, /// interrupts are disabled on handler invocation. pub fn disableInterrupts(self: *EntryOptions, disable: bool) void { bitjuggle.setBit(&self.value, 8, !disable); } /// Set the required privilege level (DPL) for invoking the handler. The DPL can be 0, 1, 2, /// or 3, the default is 0. If CPL < DPL, a general protection fault occurs. pub fn setPrivledgeLevel(self: *EntryOptions, dpl: x86_64.PrivilegeLevel) void { bitjuggle.setBits(&self.value, 13, 2, @as(u16, @enumToInt(dpl))); } /// Assigns a Interrupt Stack Table (IST) stack to this handler. The CPU will then always /// switch to the specified stack before the handler is invoked. This allows kernels to /// recover from corrupt stack pointers (e.g., on kernel stack overflow). /// /// An IST stack is specified by an IST index between 0 and 6 (inclusive). Using the same /// stack for multiple interrupts can be dangerous when nested interrupts are possible. pub fn setStackIndex(self: *EntryOptions, index: u16) void { // The hardware IST index starts at 1, but our software IST index // starts at 0. Therefore we need to add 1 here. bitjuggle.setBits(&self.value, 0, 3, index + 1); } test { std.testing.refAllDecls(@This()); try std.testing.expectEqual(@bitSizeOf(u16), @bitSizeOf(EntryOptions)); try std.testing.expectEqual(@sizeOf(u16), @sizeOf(EntryOptions)); } }; /// Represents the interrupt stack frame pushed by the CPU on interrupt or exception entry. pub const InterruptStackFrame = extern struct { /// This value points to the instruction that should be executed when the interrupt /// handler returns. For most interrupts, this value points to the instruction immediately /// following the last executed instruction. However, for some exceptions (e.g., page faults), /// this value points to the faulting instruction, so that the instruction is restarted on /// return. instruction_pointer: x86_64.VirtAddr, /// The code segment selector, padded with zeros. code_segment: u64, /// The flags register before the interrupt handler was invoked. cpu_flags: u64, /// The stack pointer at the time of the interrupt. stack_pointer: x86_64.VirtAddr, /// The stack segment descriptor at the time of the interrupt (often zero in 64-bit mode). stack_segment: u64, /// `volatile` is used because LLVM optimizations remove non-volatile /// modifications of the interrupt stack frame. pub fn asMut(self: *const InterruptStackFrame) *volatile InterruptStackFrame { return @intToPtr(*volatile InterruptStackFrame, @ptrToInt(self)); } pub fn format(value: InterruptStackFrame, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { _ = fmt; _ = options; try writer.print( "InterruptStackFrame(.instruction_pointer: {}, .code_segment: {}, .cpu_flags: 0x{x}, .stack_pointer: {}, .stack_segment: {})", .{ value.instruction_pointer, value.code_segment, value.cpu_flags, value.stack_pointer, value.stack_segment, }, ); } test { std.testing.refAllDecls(@This()); try std.testing.expectEqual(@bitSizeOf(u64) * 5, @bitSizeOf(InterruptStackFrame)); try std.testing.expectEqual(@sizeOf(u64) * 5, @sizeOf(InterruptStackFrame)); } }; /// Describes an page fault error code. pub const PageFaultErrorCode = packed struct { /// If this flag is set, the page fault was caused by a page-protection violation, /// else the page fault was caused by a not-present page. protection_violation: bool, /// If this flag is set, the memory access that caused the page fault was a write. /// Else the access that caused the page fault is a memory read. This bit does not /// necessarily indicate the cause of the page fault was a read or write violation. caused_by_write: bool, /// If this flag is set, an access in user mode (CPL=3) caused the page fault. Else /// an access in supervisor mode (CPL=0, 1, or 2) caused the page fault. This bit /// does not necessarily indicate the cause of the page fault was a privilege violation. user_mode: bool, /// If this flag is set, the page fault is a result of the processor reading a 1 from /// a reserved field within a page-translation-table entry. malformed_table: bool, /// If this flag is set, it indicates that the access that caused the page fault was an /// instruction fetch. instruction_fetch: bool, z_reserved5_7: u3, z_reserved8_15: u8, z_reserved16_31: u16, z_reserved32_63: u32, const ALL_RESERVED: u64 = blk: { var flags = std.mem.zeroes(PageFaultErrorCode); flags.z_reserved5_7 = std.math.maxInt(u3); flags.z_reserved8_15 = std.math.maxInt(u8); flags.z_reserved16_31 = std.math.maxInt(u16); flags.z_reserved32_63 = std.math.maxInt(u32); break :blk @bitCast(u64, flags); }; const ALL_NOT_RESERVED: u64 = ~ALL_RESERVED; pub fn fromU64(value: u64) PageFaultErrorCode { return @bitCast(PageFaultErrorCode, value & ALL_NOT_RESERVED); } pub fn toU64(self: PageFaultErrorCode) u64 { return @bitCast(u64, self) & ALL_NOT_RESERVED; } pub fn format(value: PageFaultErrorCode, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { _ = fmt; return formatWithoutFields( value, options, writer, &.{ "z_reserved5_7", "z_reserved8_15", "z_reserved16_31", "z_reserved32_63" }, ); } test { try std.testing.expectEqual(@as(usize, 64), @bitSizeOf(PageFaultErrorCode)); try std.testing.expectEqual(@as(usize, 8), @sizeOf(PageFaultErrorCode)); } comptime { std.testing.refAllDecls(@This()); } }; pub const SelectorErrorCode = packed struct { flags: u64, /// Create a `SelectorErrorCode`. Returns `null` is any of the reserved bits (16-64) are set. pub fn init(value: u64) ?SelectorErrorCode { if (value > std.math.maxInt(u16)) return null; return SelectorErrorCode{ .flags = value }; } pub fn initTruncate(value: u64) SelectorErrorCode { return .{ .flags = @truncate(u16, value) }; } /// If true, indicates that the exception occurred during delivery of an event external to the program, such as an interrupt /// or an earlier exception. pub fn external(self: SelectorErrorCode) bool { return bitjuggle.getBit(self.flags, 0) == 1; } /// The descriptor table this error code refers to. pub fn descriptorTable(self: SelectorErrorCode) DescriptorTable { return switch (bitjuggle.getBits(self.flags, 1, 2)) { 0b00 => .Gdt, 0b01 => .Idt, 0b10 => .Ldt, 0b11 => .Idt, else => unreachable, }; } pub fn index(self: SelectorErrorCode) u64 { return bitjuggle.getBits(self.flags, 3, 13); } pub fn isNull(self: SelectorErrorCode) bool { return self.flags == 0; } /// The possible descriptor table values. /// /// Used by `SelectorErrorCode` to indicate which table caused the error. pub const DescriptorTable = enum { /// Global Descriptor Table. Gdt, /// Interrupt Descriptor Table. Idt, /// Logical Descriptor Table. Ldt, }; }; /// An Interrupt Descriptor Table with 256 entries. /// ## **IMPORTANT** - must be align(16) /// /// The first 32 entries are used for CPU exceptions. The remaining entries are used for interrupts. /// /// This differs from `InterruptDescriptorTable` by providing a simplifed view of the IDT with only `naked` handlers. /// Handling the interrupt stack frame and/or error code is left up to the user. pub const SimpleInterruptDescriptorTable = extern struct { entries: [NUMBER_OF_INTERRUPT_HANDLERS]SimpleIDTEntry = [_]SimpleIDTEntry{SimpleIDTEntry.missing()} ** NUMBER_OF_INTERRUPT_HANDLERS, /// Loads the IDT in the CPU using the `lidt` command. pub fn load(self: *SimpleInterruptDescriptorTable) void { const ptr = x86_64.structures.DescriptorTablePointer{ .base = x86_64.VirtAddr.fromPtr(self), .limit = @as(u16, @sizeOf(SimpleInterruptDescriptorTable) - 1), }; x86_64.instructions.tables.lidt(&ptr); } test { try std.testing.expectEqual(@bitSizeOf(u64) * 2 * NUMBER_OF_INTERRUPT_HANDLERS, @bitSizeOf(SimpleInterruptDescriptorTable)); try std.testing.expectEqual(@sizeOf(u64) * 2 * NUMBER_OF_INTERRUPT_HANDLERS, @sizeOf(SimpleInterruptDescriptorTable)); } comptime { std.testing.refAllDecls(@This()); } }; pub fn interruptNumberHasErrorCode(interrupt_number: u8) bool { return switch (interrupt_number) { 0x00...0x07 => false, 0x08 => true, 0x09 => false, 0x0A...0x0E => true, 0x0F...0x10 => false, 0x11 => true, 0x12...0x14 => false, 0x1E => true, else => false, }; } pub const SimpleIDTEntry = extern struct { pointer_low: u16, gdt_selector: u16, options: EntryOptions, pointer_middle: u16, pointer_high: u32, reserved: u32, /// Creates a non-present IDT entry (but sets the must-be-one bits). pub fn missing() SimpleIDTEntry { return .{ .pointer_low = 0, .gdt_selector = 0, .options = EntryOptions.minimal(), .pointer_middle = 0, .pointer_high = 0, .reserved = 0, }; } /// Set the handler function for the IDT entry and sets the present bit. /// /// For the code selector field, this function uses the code segment selector currently active in the CPU. pub fn setHandler(self: *SimpleIDTEntry, handler: fn () callconv(.Naked) void, code_selector: x86_64.structures.gdt.SegmentSelector) void { const addr = @ptrToInt(handler); self.pointer_low = @truncate(u16, addr); self.pointer_middle = @truncate(u16, (addr >> 16)); self.pointer_high = @truncate(u32, (addr >> 32)); self.gdt_selector = code_selector.value; self.options.setPresent(true); } comptime { std.testing.refAllDecls(@This()); } }; comptime { std.testing.refAllDecls(@This()); }
src/structures/idt.zig
const std = @import("std"); const zarc = @import("zarc"); fn printDir(writer: anytype, file_tree: zarc.zip.FileTree, name: []const u8, depth: usize) anyerror!void { if (file_tree.readDir(name)) |d| { for (d.items) |entry| { try writer.writeByteNTimes('\t', depth); try writer.writeAll(entry.filename[if (std.mem.eql(u8, name, "/")) 0 else name.len + 1..]); try writer.writeByte('\n'); if (entry.filename[entry.filename.len - 1] == '/') { try printDir(writer, file_tree, entry.filename[0 .. entry.filename.len - 1], depth + 1); } } } } fn printFileTree(writer: anytype, file_tree: zarc.zip.FileTree) !void { try printDir(writer, file_tree, "/", 0); } pub fn main() !void { const allocator = std.heap.page_allocator; var tests_dir = try std.fs.cwd().openDir("tests/zip", .{ .iterate = true }); defer tests_dir.close(); var main_extract_dir = try std.fs.cwd().makeOpenPath("tests/extract/zip", .{}); defer main_extract_dir.close(); var report = try std.fs.cwd().createFile("tests/zip.report.txt", .{}); defer report.close(); const writer = report.writer(); var it = tests_dir.iterate(); while (try it.next()) |entry| { var archive_file = try tests_dir.openFile(entry.name, .{}); defer archive_file.close(); var extract_dir = try main_extract_dir.makeOpenPath(entry.name, .{}); defer extract_dir.close(); const size = try archive_file.getEndPos(); var timer = try std.time.Timer.start(); const archive = try zarc.zip.readInfo(archive_file.reader()); try writer.print("File: {s}\n", .{entry.name}); const archive_dir = try zarc.zip.readDirectory(allocator, archive_file.reader(), archive); defer archive_dir.deinit(allocator); const time = timer.read(); const load_time = @intToFloat(f64, time) / 1e9; const read_speed = (@intToFloat(f64, archive.ecd.directory_size) * 2 + @intToFloat(f64, archive.directory_offset)) / load_time; try writer.print("Runtime: {d:.3}ms\n\n", .{load_time * 1e3}); try writer.print("Speed: {d:.3} MB/s\n", .{read_speed / 1e6}); try writer.print("Total Size: {d}\n", .{size}); try writer.print("Offset: {d}\n", .{archive.start_offset}); try writer.print("Directory Size: {d}\n", .{archive.ecd.directory_size}); try writer.print("Directory Offset: {d}\n", .{archive.directory_offset}); try writer.print("Entries: {d}\n", .{archive.num_entries}); try writer.print("ZIP64: {}\n", .{archive.is_zip64}); // var tree = try archive_dir.getFileTree(allocator); // defer tree.deinit(allocator); // try printFileTree(writer, tree); // const start = timer.read(); // const total_written = try archive_dir.extract(archive_file.reader(), extract_dir, .{ .skip_components = 1 }); // const stop = timer.read(); // const extract_time = @intToFloat(f64, stop - start) / 1e9; // const extract_speed = @intToFloat(f64, total_written) / extract_time; // try writer.print("Extract Size: {d}\n", .{total_written}); // try writer.print("Extract Speed: {d:.3} MB/s\n", .{extract_speed / 1e6}); try writer.writeAll("\n-----\n\n"); } }
tests/zip.zig
const std = @import("std"); const zfetch = @import("zfetch"); const fmtValueLiteral = @import("fmt-valueliteral").fmtValueLiteral; const ansi = @import("ansi"); pub fn Main(comptime T: type) type { comptime std.debug.assert(@hasDecl(T, "source_url")); comptime std.debug.assert(@hasDecl(T, "dest_file")); comptime std.debug.assert(@hasDecl(T, "dest_header")); comptime std.debug.assert(@hasDecl(T, "dest_footer")); comptime std.debug.assert(@hasDecl(T, "exec")); return struct { pub fn do() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const alloc = &gpa.allocator; defer _ = gpa.deinit(); const max_size = std.math.maxInt(usize); // std.log.info("{s}", .{T.dest_file}); const file = try std.fs.cwd().createFile(T.dest_file, .{}); defer file.close(); const w = file.writer(); try w.writeAll( \\// This file is part of the Unicode Character Database \\// See http://www.unicode.org/reports/tr44/ for more information. \\// \\ \\ ); try w.writeAll(T.dest_header); const req = try zfetch.Request.init(alloc, T.source_url, null); defer req.deinit(); try req.do(.GET, null, null); const r = req.reader(); var line_num: usize = 1; std.debug.print("\n", .{}); const arena = &std.heap.ArenaAllocator.init(alloc); defer arena.deinit(); while (true) { const line = r.readUntilDelimiterAlloc(alloc, '\n', max_size) catch |e| if (e == error.EndOfStream) break else return e; defer alloc.free(line); if (line.len == 0) { continue; } if (line[0] == '#') { continue; } if (!(try T.exec(&arena.allocator, line, w))) { break; } std.debug.print("{s}", .{comptime ansi.csi.CursorUp(1)}); std.debug.print("{s}", .{comptime ansi.csi.EraseInLine(0)}); std.debug.print("{d}\n", .{line_num}); line_num += 1; } try w.writeAll(T.dest_footer); } }; } pub fn stringToEnum(comptime T: type, str: []const u8) !void { if (std.meta.stringToEnum(T, str)) |_| {} else { std.log.warn("{s} is not part of the type {s}", .{ str, @typeName(T) }); } }
scripts/_common.zig
const std = @import("std"); const json = std.json; const time = std.time; const clap = @import("clap"); const nestedtext = @import("nestedtext.zig"); const WriteError = std.os.WriteError; const File = std.fs.File; const Allocator = std.mem.Allocator; var allocator: Allocator = undefined; const logger = std.log.scoped(.cli); // pub const log_level = std.log.Level.debug; // Time that the program starts (milliseconds since epoch). var start: i64 = undefined; const Format = enum { NestedText, Json, }; const Args = struct { input_file: File, output_file: File, input_format: Format = .NestedText, output_format: Format = .Json, }; fn elapsed() i64 { return time.milliTimestamp() - start; } // ----------------------------------------------------------------------------- // Main // ----------------------------------------------------------------------------- fn parseFormat(fmt: []const u8) !Format { if (std.mem.eql(u8, fmt, "nt") or std.mem.eql(u8, fmt, "nestedtext")) { return .NestedText; } else if (std.mem.eql(u8, fmt, "json")) { return .Json; } else { return error.UnrecognisedFormat; } } fn parseArgs() !Args { var stderr = std.io.getStdErr().writer(); // First we specify what parameters our program can take. // We can use 'parseParam()' to parse a string to a 'Param(Help)'. const params = comptime [_]clap.Param(clap.Help){ clap.parseParam("-h, --help Display this help and exit") catch unreachable, clap.parseParam("-f, --infile <PATH> Input file (defaults to stdin)") catch unreachable, clap.parseParam("-o, --outfile <PATH> Output file (defaults to stdout)") catch unreachable, clap.parseParam("-F, --infmt <FMT> Input format (defaults to 'nt')") catch unreachable, clap.parseParam("-O, --outfmt <FMT> Output format (defaults to 'json')") catch unreachable, }; // Initalize diagnostics for reporting parsing errors. var diag = clap.Diagnostic{}; var clap_args = clap.parse(clap.Help, &params, .{ .diagnostic = &diag }) catch |err| { diag.report(stderr, err) catch {}; return err; }; defer clap_args.deinit(); if (clap_args.flag("--help")) { try stderr.print("{s} ", .{clap_args.exe_arg}); try clap.usage(stderr, &params); try stderr.writeByte('\n'); try clap.help(stderr, &params); std.process.exit(0); } var args = Args{ .input_file = undefined, .output_file = undefined }; if (clap_args.option("--infmt")) |fmt| { args.input_format = parseFormat(fmt) catch |err| { try stderr.print( "Unrecognised input format '{s}', should be one of 'json' or 'nt'\n", .{fmt}, ); return err; }; } if (clap_args.option("--outfmt")) |fmt| { args.output_format = parseFormat(fmt) catch |err| { try stderr.print( "Unrecognised output format '{s}', should be one of 'json' or 'nt'\n", .{fmt}, ); return err; }; } if (clap_args.option("--infile")) |infile| { args.input_file = std.fs.cwd().openFile(infile, .{}) catch |err| { try stderr.print("Failed to open file {s}\n", .{infile}); return err; }; } else { args.input_file = std.io.getStdIn(); } if (clap_args.option("--outfile")) |outfile| { args.output_file = std.fs.cwd().createFile(outfile, .{}) catch |err| { try stderr.print("Failed to create file {s}\n", .{outfile}); return err; }; } else { args.output_file = std.io.getStdOut(); } return args; } fn mainWorker() WriteError!u8 { var stderr = std.io.getStdErr().writer(); logger.debug("{d:6} Starting up", .{elapsed()}); const args = parseArgs() catch |err| switch (err) { error.InvalidArgument, error.MissingValue, error.DoesntTakeValue, error.UnrecognisedFormat, => return 2, else => return 1, }; logger.debug("{d:6} Parsed args", .{elapsed()}); const max_size = 1024 * 1024 * 1024; // 1GB const input = args.input_file.readToEndAlloc( allocator, max_size, ) catch |err| switch (err) { error.FileTooBig => { try stderr.print("Failed to read input, {s} - 1GB max\n", .{@errorName(err)}); return 1; }, else => { try stderr.print("Failed to read input, {s}\n", .{@errorName(err)}); return 1; }, }; logger.debug("{d:6} Finished reading input", .{elapsed()}); var buffered_writer = std.io.bufferedWriter(args.output_file.writer()); const out_stream = buffered_writer.writer(); switch (args.input_format) { .NestedText => { var parser = nestedtext.Parser.init(allocator, .{ .copy_strings = false }); var diags: nestedtext.Parser.Diags = undefined; parser.diags = &diags; const tree = parser.parse(input) catch |err| { if (diags == nestedtext.Parser.Diags.ParseError) { try stderr.print( "Failed to parse input as NestedText: {s} (line {d})\n", .{ diags.ParseError.message, diags.ParseError.lineno }, ); } else { try stderr.print( "Failed to parse input NestedText: {s}\n", .{@errorName(err)}, ); } return 1; }; if (tree.root == null) { try stderr.print("An empty file is not valid NestedText\n", .{}); return 1; } logger.debug("{d:6} Parsed NestedText", .{elapsed()}); switch (args.output_format) { .Json => { var json_tree = tree.root.?.toJson(allocator) catch { try stderr.writeAll("Failed to convert NestedText to JSON\n"); return 1; }; logger.debug("{d:6} Converted to JSON", .{elapsed()}); try json_tree.root.jsonStringify(.{}, out_stream); logger.debug("{d:6} Stringified JSON", .{elapsed()}); }, .NestedText => { try tree.root.?.stringify(.{}, out_stream); logger.debug("{d:6} Stringified NestedText", .{elapsed()}); }, } }, .Json => { var parser = json.Parser.init(allocator, false); var tree = parser.parse(input) catch { try stderr.writeAll("Failed to parse input as JSON\n"); return 1; }; logger.debug("{d:6} Parsed JSON", .{elapsed()}); switch (args.output_format) { .Json => { try tree.root.jsonStringify(.{}, out_stream); logger.debug("{d:6} Stringified JSON", .{elapsed()}); }, .NestedText => { var nt_tree = nestedtext.fromJson(allocator, tree.root) catch { try stderr.writeAll("Failed to convert JSON to NestedText\n"); return 1; }; logger.debug("{d:6} Converted to NestedText", .{elapsed()}); try nt_tree.root.?.stringify(.{}, out_stream); logger.debug("{d:6} Stringified NestedText", .{elapsed()}); }, } }, } try buffered_writer.flush(); return 0; } pub fn main() u8 { start = time.milliTimestamp(); // Use an arena allocator - no need to free memory as we go. var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); allocator = arena.allocator(); const rc = mainWorker() catch 1; logger.debug("{d:6} Exiting with: {d}", .{ elapsed(), rc }); return rc; }
src/cli.zig
usingnamespace @import("psptypes.zig"); pub const time_t = u32; const struct_unnamed_5 = extern struct { year: u16, month: u16, day: u16, hour: u16, minutes: u16, seconds: u16, microseconds: u32, }; pub const pspTime = struct_unnamed_5; pub const enum_pspRtcCheckValidErrors = extern enum(c_int) { PSP_TIME_INVALID_YEAR = -1, PSP_TIME_INVALID_MONTH = -2, PSP_TIME_INVALID_DAY = -3, PSP_TIME_INVALID_HOUR = -4, PSP_TIME_INVALID_MINUTES = -5, PSP_TIME_INVALID_SECONDS = -6, PSP_TIME_INVALID_MICROSECONDS = -7, _, }; pub extern fn sceRtcGetTickResolution() u32; pub extern fn sceRtcGetCurrentTick(tick: *u64) c_int; pub extern fn sceRtcGetCurrentClock(time: [*c]pspTime, tz: c_int) c_int; pub extern fn sceRtcGetCurrentClockLocalTime(time: [*c]pspTime) c_int; pub extern fn sceRtcConvertUtcToLocalTime(tickUTC: [*c]const u64, tickLocal: [*c]u64) c_int; pub extern fn sceRtcConvertLocalTimeToUTC(tickLocal: [*c]const u64, tickUTC: [*c]u64) c_int; pub extern fn sceRtcIsLeapYear(year: c_int) c_int; pub extern fn sceRtcGetDaysInMonth(year: c_int, month: c_int) c_int; pub extern fn sceRtcGetDayOfWeek(year: c_int, month: c_int, day: c_int) c_int; pub extern fn sceRtcCheckValid(date: [*c]const pspTime) c_int; pub extern fn sceRtcSetTick(date: [*c]pspTime, tick: [*c]const u64) c_int; pub extern fn sceRtcGetTick(date: [*c]const pspTime, tick: [*c]u64) c_int; pub extern fn sceRtcCompareTick(tick1: [*c]const u64, tick2: [*c]const u64) c_int; pub extern fn sceRtcTickAddTicks(destTick: [*c]u64, srcTick: [*c]const u64, numTicks: u64) c_int; pub extern fn sceRtcTickAddMicroseconds(destTick: [*c]u64, srcTick: [*c]const u64, numMS: u64) c_int; pub extern fn sceRtcTickAddSeconds(destTick: [*c]u64, srcTick: [*c]const u64, numSecs: u64) c_int; pub extern fn sceRtcTickAddMinutes(destTick: [*c]u64, srcTick: [*c]const u64, numMins: u64) c_int; pub extern fn sceRtcTickAddHours(destTick: [*c]u64, srcTick: [*c]const u64, numHours: c_int) c_int; pub extern fn sceRtcTickAddDays(destTick: [*c]u64, srcTick: [*c]const u64, numDays: c_int) c_int; pub extern fn sceRtcTickAddWeeks(destTick: [*c]u64, srcTick: [*c]const u64, numWeeks: c_int) c_int; pub extern fn sceRtcTickAddMonths(destTick: [*c]u64, srcTick: [*c]const u64, numMonths: c_int) c_int; pub extern fn sceRtcTickAddYears(destTick: [*c]u64, srcTick: [*c]const u64, numYears: c_int) c_int; pub extern fn sceRtcSetTime_t(date: [*c]pspTime, time: time_t) c_int; pub extern fn sceRtcGetTime_t(date: [*c]const pspTime, time: [*c]time_t) c_int; pub extern fn sceRtcSetDosTime(date: [*c]pspTime, dosTime: u32) c_int; pub extern fn sceRtcGetDosTime(date: [*c]pspTime, dosTime: u32) c_int; pub extern fn sceRtcSetWin32FileTime(date: [*c]pspTime, win32Time: [*c]u64) c_int; pub extern fn sceRtcGetWin32FileTime(date: [*c]pspTime, win32Time: [*c]u64) c_int; pub extern fn sceRtcParseDateTime(destTick: [*c]u64, dateString: [*c]const u8) c_int; pub extern fn sceRtcFormatRFC2822(pszDateTime: [*c]u8, pUtc: [*c]const u64, iTimeZoneMinutes: c_int) c_int; pub extern fn sceRtcFormatRFC2822LocalTime(pszDateTime: [*c]u8, pUtc: [*c]const u64) c_int; pub extern fn sceRtcFormatRFC3339(pszDateTime: [*c]u8, pUtc: [*c]const u64, iTimeZoneMinutes: c_int) c_int; pub extern fn sceRtcFormatRFC3339LocalTime(pszDateTime: [*c]u8, pUtc: [*c]const u64) c_int; pub extern fn sceRtcParseRFC3339(pUtc: [*c]u64, pszDateTime: [*c]const u8) c_int; pub const pspRtcCheckValidErrors = enum_pspRtcCheckValidErrors;
src/psp/sdk/psprtc.zig
const std = @import("std"); const json = std.json; const Allocator = std.mem.Allocator; const allocPrint = std.fmt.allocPrint; const utils = @import("utils.zig"); const Info = @import("Info.zig"); pub const Host = enum { github, gitlab, codeberg, default, const hosts_map = std.ComptimeStringMap(Host, .{ .{ "github.com", .github }, .{ "gitlab.com", .gitlab }, .{ "codeberg.org", .codeberg }, .{ "github", .github }, .{ "gitlab", .gitlab }, .{ "codeberg", .codeberg }, .{ "gh", .github }, .{ "gl", .gitlab }, .{ "cb", .codeberg }, }); pub fn match(name: []const u8) ?Host { return Host.hosts_map.get(name); } pub fn getUrl(host: Host, allocator: Allocator, author: []const u8, project: []const u8) ![]const u8 { return switch (host) { .default, .github => try allocPrint(allocator, "https://api.github.com/repos/{s}/{s}", .{ author, project }), .gitlab => try allocPrint(allocator, "https://gitlab.com/api/v4/projects/{s}%2F{s}?license=1", .{ author, project }), .codeberg => try allocPrint(allocator, "https://codeberg.org/api/v1/repos/{s}/{s}", .{ author, project }), }; } pub fn request(host: Host, allocator: Allocator, url: []const u8) !Info { return switch (host) { .github, .default => try Github.request(allocator, url), .codeberg => try Gitea.request(allocator, url), .gitlab => try Gitlab.request(allocator, url), }; } }; const Github = struct { const Query = struct { full_name: []const u8, private: bool, fork: bool, archived: bool, is_template: bool, description: ?[]const u8, html_url: []const u8, language: ?[]const u8, size: u32, stargazers_count: u32, watchers_count: u32, forks_count: u32, license: ?struct { name: []const u8 }, created_at: []const u8, updated_at: []const u8, default_branch: []const u8, pub fn free(self: *@This(), allocator: Allocator) void { allocator.free(self.full_name); if (self.description) |d| allocator.free(d); allocator.free(self.html_url); if (self.language) |l| allocator.free(l); if (self.license) |l| allocator.free(l.name); allocator.free(self.created_at); allocator.free(self.updated_at); allocator.free(self.default_branch); } }; pub fn request(allocator: Allocator, url: []const u8) !Info { const source = try utils.requestGet(allocator, url); defer allocator.free(source); var query = blk: { @setEvalBranchQuota(6000); var tokens = json.TokenStream.init(source); var query = try json.parse(Query, &tokens, .{ .allocator = allocator, .ignore_unknown_fields = true, }); errdefer query.free(allocator); break :blk query; }; defer query.free(allocator); return Info{ .name = try allocator.dupe(u8, query.full_name), .is_private = query.private, .is_fork = query.fork, .is_archived = query.archived, .is_template = query.is_template, .description = if (query.description) |d| try allocator.dupe(u8, d) else "", .repository = try allocator.dupe(u8, query.html_url), .language = if (query.language) |l| try allocator.dupe(u8, l) else "", .size = query.size, .stars = query.stargazers_count, .watches = query.watchers_count, .forks = query.forks_count, .license = if (query.license) |l| try allocator.dupe(u8, l.name) else "", .created = try allocator.dupe(u8, query.created_at[0..10]), .modified = try allocator.dupe(u8, query.updated_at[0..10]), .branch = try allocator.dupe(u8, query.default_branch), }; } }; const Gitea = struct { const Query = struct { full_name: []const u8, private: bool, fork: bool, archived: bool, template: bool, description: []const u8, html_url: []const u8, size: u32, stars_count: u32, watchers_count: u32, forks_count: u32, created_at: []const u8, updated_at: []const u8, default_branch: []const u8, pub fn free(self: *@This(), allocator: Allocator) void { allocator.free(self.full_name); allocator.free(self.description); allocator.free(self.html_url); allocator.free(self.created_at); allocator.free(self.updated_at); allocator.free(self.default_branch); } }; pub fn request(allocator: Allocator, url: []const u8) !Info { const source = try utils.requestGet(allocator, url); defer allocator.free(source); var query = blk: { @setEvalBranchQuota(6000); var tokens = json.TokenStream.init(source); var query = try json.parse(Query, &tokens, .{ .allocator = allocator, .ignore_unknown_fields = true, }); errdefer query.free(allocator); break :blk query; }; defer query.free(allocator); return Info{ .name = try allocator.dupe(u8, query.full_name), .is_private = query.private, .is_fork = query.fork, .is_archived = query.archived, .is_template = query.template, .description = try allocator.dupe(u8, query.description), .repository = try allocator.dupe(u8, query.html_url), .language = "", .size = query.size, .stars = query.stars_count, .watches = query.watchers_count, .forks = query.forks_count, .license = "", .created = try allocator.dupe(u8, query.created_at[0..10]), .modified = try allocator.dupe(u8, query.updated_at[0..10]), .branch = try allocator.dupe(u8, query.default_branch), }; } }; const Gitlab = struct { const Query = struct { path_with_namespace: []const u8, description: []const u8, license: ?struct { nickname: []const u8 }, web_url: []const u8, star_count: u32, forks_count: u32, created_at: []const u8, last_activity_at: []const u8, default_branch: []const u8, pub fn free(self: *@This(), allocator: Allocator) void { allocator.free(self.path_with_namespace); allocator.free(self.description); allocator.free(self.web_url); if (self.license) |l| allocator.free(l.nickname); allocator.free(self.created_at); allocator.free(self.last_activity_at); allocator.free(self.default_branch); } }; pub fn request(allocator: Allocator, url: []const u8) !Info { const source = try utils.requestGet(allocator, url); defer allocator.free(source); var query = blk: { @setEvalBranchQuota(6000); var tokens = json.TokenStream.init(source); var query = try json.parse(Query, &tokens, .{ .allocator = allocator, .ignore_unknown_fields = true, }); errdefer query.free(allocator); break :blk query; }; defer query.free(allocator); return Info{ .name = try allocator.dupe(u8, query.path_with_namespace), .is_private = false, .is_fork = false, .is_archived = false, .is_template = false, .description = try allocator.dupe(u8, query.description), .repository = try allocator.dupe(u8, query.web_url), .language = "", .size = 0, .stars = query.star_count, .watches = 0, .forks = query.forks_count, .license = if (query.license) |l| try allocator.dupe(u8, l.nickname) else "", .created = try allocator.dupe(u8, query.created_at[0..10]), .modified = try allocator.dupe(u8, query.last_activity_at[0..10]), .branch = try allocator.dupe(u8, query.default_branch), }; } };
src/hosts.zig
const std = @import("std"); const alphabet = @import("../bio/bio.zig").alphabet; const Sequence = @import("../sequence.zig").Sequence; const SearchHit = @import("../search.zig").SearchHit; const SearchHitList = @import("../search.zig").SearchHitList; const utils = @import("../utils.zig"); const Cigar = @import("../cigar.zig").Cigar; // Query >QryId // %Id TLen Target // 100% 25 DbId3 // 81% 33 DbId1 // Query 27nt >QryId // Target 25nt >DbId3 // Qry 1 + GGTGAGACGTTACGCAATAAATTGA 25 // ||||||||||||||||||||||||| // Tgt 1 + GGTGAGACGTTACGCAATAAATTGA 25 // 25 cols, 25 ids (100.0%), 0 gaps (0.0%) // Query 27nt >QryId // Target 33nt >DbId1 // Qry 1 + GGTGAGACGTTACGCAATAAATTGAGA 27 // |||||||| | |||| ||||||||| // Tgt 3 + CGTGAGACG--ATGCAAAAAATTGAGA 27 // 27 cols, 22 ids (81.5%), 2 gaps (7.4%) pub fn AlnoutWriter(comptime A: type) type { return struct { const MaxColumnsPerAlignmentLine = 60; pub fn write(unbuffered_writer: anytype, query: Sequence(A), hits: SearchHitList(A)) !void { // buffer, IO directly is slow var buffered_writer = std.io.bufferedWriter(unbuffered_writer); var writer = buffered_writer.writer(); try std.fmt.format(writer, "Query >{s}\n", .{query.identifier}); try std.fmt.format(writer, " %Id TLen Target\n", .{}); for (hits.list.items) |hit| { try std.fmt.format(writer, "{d:3.0}% {d:6} {s}\n", .{ hit.cigar.identity() * 100.0, hit.target.length(), hit.target.identifier }); } try std.fmt.format(writer, "\n", .{}); for (hits.list.items) |hit| { if (hit.cigar.isEmpty()) continue; try std.fmt.format(writer, " Query {d}{s} >{s}\n", .{ query.length(), A.Unit, query.identifier }); try std.fmt.format(writer, "Target {d}{s} >{s}\n", .{ hit.target.length(), A.Unit, hit.target.identifier }); try std.fmt.format(writer, "\n", .{}); var query_idx: usize = 0; var target_idx: usize = 0; var cigar = try hit.cigar.clone(); defer cigar.deinit(); const first = cigar.entries.items[0]; switch (first.op) { .deletion => { target_idx = first.count; _ = cigar.entries.orderedRemove(0); }, .insertion => { query_idx = first.count; _ = cigar.entries.orderedRemove(0); }, else => {}, } const last = cigar.entries.items[cigar.entries.items.len - 1]; switch (last.op) { .deletion, .insertion => _ = cigar.entries.orderedRemove(cigar.entries.items.len - 1), else => {}, } const max_length = std.math.max(query.length(), hit.target.length()); var top_iter = cigar.iterator(); var middle_iter = cigar.iterator(); var bottom_iter = cigar.iterator(); while (!top_iter.isEmpty()) { const query_idx_line_start = query_idx; const target_idx_line_start = target_idx; // Qry 1 + GGTGAGACGTTACGCAATAAATTGA 25 try std.fmt.format(writer, "Qry ", .{}); try printLength(writer, max_length, queryPos(query_idx, query, hit), .left); if (A.SupportsStrands) { try std.fmt.format(writer, " {c} ", .{queryStrand(hit)}); } else { try std.fmt.format(writer, " ", .{}); } var count: usize = 0; while (top_iter.next()) |op| { var ch = queryLetter(query_idx, query, hit); switch (op) { .match, .mismatch, .insertion => query_idx += 1, .deletion => ch = '-', } try writer.writeByte(ch); count += 1; if (count % MaxColumnsPerAlignmentLine == 0) break; } try std.fmt.format(writer, " ", .{}); try printLength(writer, max_length, queryPos(query_idx - 1, query, hit), .right); try std.fmt.format(writer, "\n", .{}); // ||||||||||||||||||||||||| try std.fmt.format(writer, " ", .{}); try printPadding(writer, max_length); if (A.SupportsStrands) { try std.fmt.format(writer, " ", .{}); } else { try std.fmt.format(writer, " ", .{}); } var query_match_idx = query_idx_line_start; var target_match_idx = target_idx_line_start; count = 0; while (middle_iter.next()) |op| { const ch: u8 = sym: { switch (op) { .match, .mismatch => { const query_letter = queryLetter(query_match_idx, query, hit); const target_letter = targetLetter(target_match_idx, hit); query_match_idx += 1; target_match_idx += 1; break :sym A.matchSymbol(query_letter, target_letter); }, .deletion => { target_match_idx += 1; break :sym ' '; }, .insertion => { query_match_idx += 1; break :sym ' '; }, } }; try writer.writeByte(ch); count += 1; if (count % MaxColumnsPerAlignmentLine == 0) break; } try std.fmt.format(writer, " ", .{}); try printPadding(writer, max_length); try std.fmt.format(writer, "\n", .{}); // Tgt 1 + GGTGAGACGTTACGCAATAAATTGA 25 try std.fmt.format(writer, "Tgt ", .{}); try printLength(writer, max_length, targetPos(target_idx, hit), .left); if (A.SupportsStrands) { try std.fmt.format(writer, " {c} ", .{targetStrand(hit)}); } else { try std.fmt.format(writer, " ", .{}); } count = 0; while (bottom_iter.next()) |op| { var ch = targetLetter(target_idx, hit); switch (op) { .match, .mismatch, .deletion => target_idx += 1, .insertion => ch = '-', } try writer.writeByte(ch); count += 1; if (count % MaxColumnsPerAlignmentLine == 0) break; } try std.fmt.format(writer, " ", .{}); try printLength(writer, max_length, targetPos(target_idx - 1, hit), .right); try std.fmt.format(writer, "\n", .{}); try std.fmt.format(writer, "\n", .{}); } // Calc stats var num_cols: usize = 0; var num_matches: usize = 0; var num_gaps: usize = 0; var iter = cigar.iterator(); while (iter.next()) |op| { switch (op) { .match => num_matches += 1, .insertion, .deletion => num_gaps += 1, .mismatch => {}, } num_cols += 1; } // 25 cols, 25 ids (100.0%), 0 gaps (0.0%) const ids_percent = 100.0 * @intToFloat(f32, num_matches) / @intToFloat(f32, num_cols); const gaps_percent = 100.0 * @intToFloat(f32, num_gaps) / @intToFloat(f32, num_cols); try std.fmt.format(writer, "{d} cols, {d} ids ({d:.1}%), {d} gaps ({d:.1}%)\n", .{ num_cols, num_matches, ids_percent, num_gaps, gaps_percent }); try std.fmt.format(writer, "\n", .{}); // flush content try buffered_writer.flush(); } } fn queryPos(index: usize, query: Sequence(A), hit: SearchHit(A)) usize { if (hit.reverse_match) { return query.length() - index; } else { return index + 1; } } fn queryLetter(index: usize, query: Sequence(A), hit: SearchHit(A)) u8 { if (hit.reverse_match) { return A.complement(query.data[query.length() - index - 1]); } else { return query.data[index]; } } fn queryStrand(hit: SearchHit(A)) u8 { return if (hit.reverse_match) '-' else '+'; } fn targetPos(index: usize, hit: SearchHit(A)) usize { _ = hit; return index + 1; } fn targetLetter(index: usize, hit: SearchHit(A)) u8 { _ = hit; return hit.target.data[index]; } fn targetStrand(hit: SearchHit(A)) u8 { _ = hit; return '+'; } fn printPadding(writer: anytype, length: usize) !void { const max = std.fmt.count("{d}", .{length}); var cur: usize = 0; while (cur < max) : (cur += 1) { try std.fmt.format(writer, " ", .{}); } } const Pad = enum { left, right }; fn printLength(writer: anytype, max_length: usize, length: usize, pad: Pad) !void { const max = std.fmt.count("{d}", .{max_length}); var cur = std.fmt.count("{d}", .{length}); if (pad == .left) try writer.writeByteNTimes(' ', max - cur); try std.fmt.format(writer, "{d}", .{length}); if (pad == .right) try writer.writeByteNTimes(' ', max - cur); } }; } const DNA = alphabet.DNA; const Protein = alphabet.Protein; test "multiple hits per query" { const allocator = std.testing.allocator; var query = try Sequence(DNA).init(allocator, "QryId", "GGTGAGACGTTACGCAATAAATTGAGA"); defer query.deinit(); var cigar = Cigar.init(allocator); defer cigar.deinit(); var hits = SearchHitList(DNA).init(allocator); defer hits.deinit(); // 25=2I var target3 = try Sequence(DNA).init(allocator, "DbId3", "GGTGAGACGTTACGCAATAAATTGA"); defer target3.deinit(); cigar.clear(); try cigar.addWithCount(.match, 25); try cigar.addWithCount(.insertion, 2); try hits.list.append(try SearchHit(DNA).init(allocator, target3, cigar, false)); // 2D1X8=2I1=1X4=1X9=1I var target1 = try Sequence(DNA).init(allocator, "DbId1", "ATCGTGAGACGATGCAAAAAATTGAGACGGATT"); defer target1.deinit(); cigar.clear(); try cigar.addWithCount(.deletion, 2); try cigar.addWithCount(.mismatch, 1); try cigar.addWithCount(.match, 8); try cigar.addWithCount(.insertion, 2); try cigar.addWithCount(.match, 1); try cigar.addWithCount(.mismatch, 1); try cigar.addWithCount(.match, 4); try cigar.addWithCount(.mismatch, 1); try cigar.addWithCount(.match, 9); try cigar.addWithCount(.insertion, 1); try hits.list.append(try SearchHit(DNA).init(allocator, target1, cigar, false)); var buffer: [4096]u8 = undefined; var fbs = std.io.fixedBufferStream(&buffer); try AlnoutWriter(DNA).write(fbs.writer(), query, hits); var it = std.mem.split(u8, fbs.getWritten(), "\n"); try std.testing.expectEqualStrings("Query >QryId", it.next().?); try std.testing.expectEqualStrings(" %Id TLen Target", it.next().?); try std.testing.expectEqualStrings("100% 25 DbId3", it.next().?); try std.testing.expectEqualStrings(" 81% 33 DbId1", it.next().?); try std.testing.expectEqualStrings("", it.next().?); try std.testing.expectEqualStrings(" Query 27nt >QryId", it.next().?); try std.testing.expectEqualStrings("Target 25nt >DbId3", it.next().?); try std.testing.expectEqualStrings("", it.next().?); try std.testing.expectEqualStrings("Qry 1 + GGTGAGACGTTACGCAATAAATTGA 25", it.next().?); try std.testing.expectEqualStrings(" ||||||||||||||||||||||||| ", it.next().?); try std.testing.expectEqualStrings("Tgt 1 + GGTGAGACGTTACGCAATAAATTGA 25", it.next().?); try std.testing.expectEqualStrings("", it.next().?); try std.testing.expectEqualStrings("25 cols, 25 ids (100.0%), 0 gaps (0.0%)", it.next().?); try std.testing.expectEqualStrings("", it.next().?); try std.testing.expectEqualStrings(" Query 27nt >QryId", it.next().?); try std.testing.expectEqualStrings("Target 33nt >DbId1", it.next().?); try std.testing.expectEqualStrings("", it.next().?); try std.testing.expectEqualStrings("Qry 1 + GGTGAGACGTTACGCAATAAATTGAGA 27", it.next().?); try std.testing.expectEqualStrings(" |||||||| | |||| ||||||||| ", it.next().?); try std.testing.expectEqualStrings("Tgt 3 + CGTGAGACG--ATGCAAAAAATTGAGA 27", it.next().?); try std.testing.expectEqualStrings("", it.next().?); try std.testing.expectEqualStrings("27 cols, 22 ids (81.5%), 2 gaps (7.4%)", it.next().?); } test "dna" { const allocator = std.testing.allocator; var cigar = Cigar.init(allocator); defer cigar.deinit(); var hits = SearchHitList(DNA).init(allocator); defer hits.deinit(); // 2D1X8=2I1=1X4=1X9=1I var query = try Sequence(DNA).init(allocator, "Procavia capensis", "CUUUGCCUGAACGCAAGACUCUUCAACCUCAGGACUUGCAGAAUUGGUAGAAUGCCGUCCUAAGGUUGUUGAGUUCUGUGUUUGGAGGC"); defer query.deinit(); var target = try Sequence(DNA).init(allocator, "Dasypus novemcinctus", "CGUCACCUGAACUCAUGACUCUUCAACUUCAGGACUUGCAGAAUUAAUGGAAUGCCGUCCUAAGGUUGUUGAGUUCUGCGUUUCUGGGC"); defer target.deinit(); try cigar.addFromString("1=1X1=2X7=1X2=1X11=1X17=2X1=1X29=1X4=3X3="); try hits.list.append(try SearchHit(DNA).init(allocator, target, cigar, false)); var buffer: [4096]u8 = undefined; var fbs = std.io.fixedBufferStream(&buffer); try AlnoutWriter(DNA).write(fbs.writer(), query, hits); const expected = \\Query >Procavia capensis \\ %Id TLen Target \\ 85% 89 Dasypus novemcinctus \\ \\ Query 89nt >Procavia capensis \\Target 89nt >Dasypus novemcinctus \\ \\Qry 1 + CUUUGCCUGAACGCAAGACUCUUCAACCUCAGGACUUGCAGAAUUGGUAGAAUGCCGUCC 60 \\ | | ||||||| || ||||||||||| ||||||||||||||||| | ||||||||||| \\Tgt 1 + CGUCACCUGAACUCAUGACUCUUCAACUUCAGGACUUGCAGAAUUAAUGGAAUGCCGUCC 60 \\ \\Qry 61 + UAAGGUUGUUGAGUUCUGUGUUUGGAGGC 89 \\ |||||||||||||||||| |||| ||| \\Tgt 61 + UAAGGUUGUUGAGUUCUGCGUUUCUGGGC 89 \\ \\89 cols, 76 ids (85.4%), 0 gaps (0.0%) \\ \\ ; try std.testing.expectEqualStrings(expected, fbs.getWritten()); } test "dna minus" { const allocator = std.testing.allocator; var cigar = Cigar.init(allocator); defer cigar.deinit(); var hits = SearchHitList(DNA).init(allocator); defer hits.deinit(); // 2D1X8=2I1=1X4=1X9=1I var query = try Sequence(DNA).init(allocator, "RevComp of Procavia capensis", "GCCTCCAAACACAGAACTCAACAACCTTAGGACGGCATTCTACCAATTCTGCAAGTCCTGAGGTTGAAGAGTCTTGCGTTCAGGCAAAG"); defer query.deinit(); var target = try Sequence(DNA).init(allocator, "Dasypus novemcinctus", "CGUCACCUGAACUCAUGACUCUUCAACUUCAGGACUUGCAGAAUUAAUGGAAUGCCGUCCUAAGGUUGUUGAGUUCUGCGUUUCUGGGC"); defer target.deinit(); try cigar.addFromString("1=1X1=2X7=1X2=1X11=1X17=2X1=1X29=1X4=3X3="); try hits.list.append(try SearchHit(DNA).init(allocator, target, cigar, true)); var buffer: [4096]u8 = undefined; var fbs = std.io.fixedBufferStream(&buffer); try AlnoutWriter(DNA).write(fbs.writer(), query, hits); const expected = \\Query >RevComp of Procavia capensis \\ %Id TLen Target \\ 85% 89 Dasypus novemcinctus \\ \\ Query 89nt >RevComp of Procavia capensis \\Target 89nt >Dasypus novemcinctus \\ \\Qry 89 - CTTTGCCTGAACGCAAGACTCTTCAACCTCAGGACTTGCAGAATTGGTAGAATGCCGTCC 30 \\ | + ||+|||| || |||+|++|||| +||||||++||||||++ + |||+||||+|| \\Tgt 1 + CGUCACCUGAACUCAUGACUCUUCAACUUCAGGACUUGCAGAAUUAAUGGAAUGCCGUCC 60 \\ \\Qry 29 - TAAGGTTGTTGAGTTCTGTGTTTGGAGGC 1 \\ +||||++|++|||++|+| |+++ ||| \\Tgt 61 + UAAGGUUGUUGAGUUCUGCGUUUCUGGGC 89 \\ \\89 cols, 76 ids (85.4%), 0 gaps (0.0%) \\ \\ ; try std.testing.expectEqualStrings(expected, fbs.getWritten()); } test "protein" { const allocator = std.testing.allocator; // auto entry1 = std::make_pair( Sequence< Protein >( "query1", "LAFQGVRN" ), // HitList< Protein >( { // { { "target50", "MAFQGVRS" }, "1X6=1X" }, // { { "target114", "LAGQGSAN" }, "4=3X1=" }, // } ) ); // auto entry2 = // std::make_pair( Sequence< Protein >( "query2", "GGGGGYFDEATGVCPF" ), // HitList< Protein >( { // { { "target1337", "YFDEATGICPFQQQ" }, "5I7=1X3=3D" }, // } ) ); // std::ostringstream oss; // Alnout::Writer< Protein > writer( oss ); // writer << entry1; // writer << entry2; // REQUIRE( oss.str() == AlnoutOutputForProtein ); var buffer: [4096]u8 = undefined; var fbs = std.io.fixedBufferStream(&buffer); { var hits = SearchHitList(Protein).init(allocator); defer hits.deinit(); var query = try Sequence(Protein).init(allocator, "query1", "LAFQGVRN"); defer query.deinit(); var target50 = try Sequence(Protein).init(allocator, "target50", "MAFQGVRS"); defer target50.deinit(); var cigar50 = Cigar.init(allocator); defer cigar50.deinit(); try cigar50.addFromString("1X6=1X"); try hits.list.append(try SearchHit(Protein).init(allocator, target50, cigar50, false)); var target114 = try Sequence(Protein).init(allocator, "target114", "LAGQGSAN"); defer target114.deinit(); var cigar114 = Cigar.init(allocator); defer cigar114.deinit(); try cigar114.addFromString("4=3X1="); try hits.list.append(try SearchHit(Protein).init(allocator, target114, cigar114, false)); try AlnoutWriter(Protein).write(fbs.writer(), query, hits); } { var hits = SearchHitList(Protein).init(allocator); defer hits.deinit(); var query = try Sequence(Protein).init(allocator, "query2", "GGGGGYFDEATGVCPF"); defer query.deinit(); var target1337 = try Sequence(Protein).init(allocator, "target1337", "YFDEATGICPFQQQ"); defer target1337.deinit(); var cigar1337 = Cigar.init(allocator); defer cigar1337.deinit(); try cigar1337.addFromString("5I7=1X3=3D"); try hits.list.append(try SearchHit(Protein).init(allocator, target1337, cigar1337, false)); try AlnoutWriter(Protein).write(fbs.writer(), query, hits); } const expected = \\Query >query1 \\ %Id TLen Target \\ 75% 8 target50 \\ 63% 8 target114 \\ \\ Query 8aa >query1 \\Target 8aa >target50 \\ \\Qry 1 LAFQGVRN 8 \\ :||||||. \\Tgt 1 MAFQGVRS 8 \\ \\8 cols, 6 ids (75.0%), 0 gaps (0.0%) \\ \\ Query 8aa >query1 \\Target 8aa >target114 \\ \\Qry 1 LAFQGVRN 8 \\ || || | \\Tgt 1 LAGQGSAN 8 \\ \\8 cols, 5 ids (62.5%), 0 gaps (0.0%) \\ \\Query >query2 \\ %Id TLen Target \\ 91% 14 target1337 \\ \\ Query 16aa >query2 \\Target 14aa >target1337 \\ \\Qry 6 YFDEATGVCPF 16 \\ |||||||:||| \\Tgt 1 YFDEATGICPF 11 \\ \\11 cols, 10 ids (90.9%), 0 gaps (0.0%) \\ \\ ; try std.testing.expectEqualStrings(expected, fbs.getWritten()); }
src/io/alnout_writer.zig
const std = @import("std"); pub fn forAll(comptime T: type) Iterator(T) { return Iterator(T).init(); } fn threwError(func: anytype, item: anytype) bool { const originalStackDepth: usize = blk: { if (@errorReturnTrace()) |trace| { break :blk trace.index; } else { break :blk 0; } }; func(item) catch { if (@errorReturnTrace()) |trace| { // dirty manual tinkering to avoid Zig polluting the return trace trace.index = originalStackDepth; } return true; }; return false; } pub fn testFunction(comptime T: type, duration: i64, func: fn (T) anyerror!void) anyerror!void { var iterator = Iterator(T).init(); iterator.duration = duration; const Hypothesis = struct { elements: std.ArrayList(HypothesisElement), const Self = @This(); const HypothesisElement = union(enum) { // only for numbers BiggerThan: T, SmallerThan: T, pub fn format(value: HypothesisElement, comptime _: []const u8, _: std.fmt.FormatOptions, writer: anytype) !void { switch (value) { .BiggerThan => |v| { try writer.print("bigger than {d}", .{ v }); }, .SmallerThan => |v| { try writer.print("smaller than {d}", .{ v }); }, } } }; // Try to find counter-examples in the given time and adjust the hypothesis // based on that counter-example. pub fn refine(self: *Self, time: i64, callback: fn(T) anyerror!void) void { var prng = std.rand.DefaultPrng.init(@bitCast(u64, std.time.milliTimestamp())); const random = prng.random(); const timePerElement = @divFloor(time, @intCast(i64, self.elements.items.len)); for (self.elements.items) |*element| { const start = std.time.milliTimestamp(); var stepSize: T = 100; while (std.time.milliTimestamp() < start + timePerElement) { switch (element.*) { .BiggerThan => |value| { const add = random.uintLessThanBiased(T, stepSize); if (threwError(callback, value -| add)) { element.* = .{ .BiggerThan = value -| add }; stepSize *|= 2; } else { //stepSize /= 2; } }, .SmallerThan => |value| { const add = random.uintLessThanBiased(T, stepSize); if (threwError(callback, value +| add)) { element.* = .{ .SmallerThan = value +| add }; stepSize *|= 2; } else { //stepSize /= 2; } } } } } } pub fn format(value: Self, comptime _: []const u8, _: std.fmt.FormatOptions, writer: anytype) !void { for (value.elements.items) |item| { try writer.print("{}, ", .{ item }); } } pub fn deinit(self: Self) void { self.elements.deinit(); } }; // This stores a number of values and tries to found what's in common between thems const BreakCondition = struct { items: []T, const Self = @This(); pub fn init(items: []T) Self { return .{ .items = items }; } pub fn hypothetize(self: *Self, callback: fn(T) anyerror!void) !Hypothesis { var elements = std.ArrayList(Hypothesis.HypothesisElement).init(std.testing.allocator); if (comptime std.meta.trait.isNumber(T)) { std.sort.sort(T, self.items, {}, comptime std.sort.asc(T)); const smallest = self.items[0]; const biggest = self.items[self.items.len - 1]; try elements.append(.{ .BiggerThan = smallest }); try elements.append(.{ .SmallerThan = biggest }); } var hypothesis = Hypothesis { .elements = elements }; std.debug.print("\nRefining hypothesis..", .{}); hypothesis.refine(3000, callback); return hypothesis; } }; var errorsWith = std.ArrayList(T).init(std.testing.allocator); defer errorsWith.deinit(); while (iterator.next()) |item| { if (threwError(func, item)) { try errorsWith.append(item); } } if (errorsWith.items.len > 0) { var breakCond = BreakCondition.init(errorsWith.items); const hypothesis = try breakCond.hypothetize(func); defer hypothesis.deinit(); std.debug.print("\nThe function fails when using a value that is {}\n", .{hypothesis}); std.debug.print("---\nError return trace with {any}:\n", .{errorsWith.items[0]}); return try func(errorsWith.items[0]); } } pub fn Iterator(comptime T: type) type { return struct { count: usize = 0, rand: std.rand.DefaultPrng, start: i64, /// Duration in milliseconds duration: i64, pub const Self = @This(); const DETERMINISTIC_TEST = false; pub fn init() Self { return Self{ .rand = std.rand.DefaultPrng.init(if (DETERMINISTIC_TEST) 0 else @truncate(u64, @bitCast(u128, std.time.nanoTimestamp()))), .start = std.time.milliTimestamp(), .duration = 100, }; } pub fn next(self: *Self) ?T { if (!comptime std.meta.trait.hasUniqueRepresentation(T)) { @compileError(@typeName(T) ++ " doesn't have an unique representation"); } //if (self.count >= 10) return null; if (std.time.milliTimestamp() >= self.start + self.duration) { std.log.scoped(.iterator).debug("Did {d} rounds in {d} ms", .{ self.count, std.time.milliTimestamp() - self.start }); return null; } self.count += 1; var bytes: [@sizeOf(T)]u8 = undefined; self.rand.fill(&bytes); return std.mem.bytesToValue(T, &bytes); } }; } const ColorContainer = struct { color: @import("color.zig").Color, }; test "simple struct init" { var all = forAll(@import("color.zig").Color); while (all.next()) |color| { var container = ColorContainer{ .color = color }; try std.testing.expectEqual(color, container.color); } } test "basic bisecting" { // As we're seeking values under 1000 among 4 billion randomly generated values, // we need to run this test for longer try testFunction(u32, 1000, struct { pub fn callback(value: u32) !void { try std.testing.expect(value % 2 != 0); } }.callback); }
src/fuzz.zig
const std = @import("std"); const debug = std.debug; const math = std.math; const mem = std.mem; const testing = std.testing; pub fn defaultLeafSize(comptime T: type) comptime_int { return math.max(1, 256 / @sizeOf(T)); } pub fn List(comptime T: type) type { return CustomList(T, defaultLeafSize(T)); } pub fn CustomList(comptime T: type, comptime leaf_size: comptime_int) type { return struct { pub const Iterator = L.Iterator; pub const BlockIterator = L.BlockIterator; const L = NoAllocatorCustomList(T, leaf_size); list: L = L{}, allocator: *mem.Allocator, pub fn fromSlice(allocator: *mem.Allocator, items: []const T) !@This() { return @This(){ .list = try L.fromSlice(allocator, items), .allocator = allocator, }; } pub fn fromSliceSmall(allocator: *mem.Allocator, items: []const T) @This() { return @This(){ .list = L.fromSliceSmall(items), .allocator = allocator, }; } pub fn len(list: @This()) usize { return list.list.len(); } pub fn iterator(list: *const @This(), start: usize) Iterator { return list.list.iterator(start); } pub fn blockIterator(list: *const @This(), start: usize) BlockIterator { return list.list.blockIterator(start); } pub fn foreach(list: @This(), start: usize, context: var, func: var) @TypeOf(func).ReturnType { return list.list.foreach(start, context, func); } pub fn at(list: @This(), i: usize) T { return list.list.at(i); } pub fn append(list: @This(), item: T) !@This() { return @This(){ .list = try list.list.append(list.allocator, item), .allocator = list.allocator, }; } pub fn appendMut(list: *@This(), item: T) !void { try list.list.appendMut(list.allocator, item); } pub fn appendSlice(list: @This(), items: []const T) !@This() { return @This(){ .list = try list.list.appendSlice(list.allocator, items), .allocator = list.allocator, }; } pub fn appendSliceMut(list: *@This(), items: []const T) !void { try list.list.appendSliceMut(list.allocator, items); } pub fn appendList(list: @This(), other: @This()) !@This() { return @This(){ .list = try list.list.appendList(list.allocator, other.list), .allocator = list.allocator, }; } pub fn insert(list: @This(), i: usize, item: T) !@This() { return @This(){ .list = try list.list.insert(list.allocator, i, item), .allocator = list.allocator, }; } pub fn insertSlice(list: @This(), i: usize, items: []const T) !@This() { return @This(){ .list = try list.list.insertSlice(list.allocator, i, items), .allocator = list.allocator, }; } pub fn insertList(list: @This(), i: usize, other: @This()) !@This() { return @This(){ .list = try list.list.insertList(list.allocator, i, other), .allocator = list.allocator, }; } pub fn remove(list: @This(), i: usize) !@This() { return @This(){ .list = try list.list.remove(list.allocator, i), .allocator = list.allocator, }; } pub fn removeItems(list: @This(), i: usize, length: usize) !@This() { return @This(){ .list = try list.list.removeItems(list.allocator, i, length), .allocator = list.allocator, }; } pub fn slice(list: @This(), start: usize, end: usize) !@This() { return @This(){ .list = try list.list.slice(list.allocator, start, end), .allocator = list.allocator, }; } pub fn toSlice(list: @This(), allocator: *mem.Allocator) ![]T { return list.list.items(list.allocator); } pub fn equal(a: @This(), b: @This()) bool { return L.equal(a.list, b.list); } pub fn dump(list: @This(), stream: var) @TypeOf(stream.writeFn).ReturnType { return list.list.dump(stream); } }; } pub fn NoAllocatorList(comptime T: type) type { return NoAllocatorCustomList(T, defaultLeafSize(T)); } pub fn NoAllocatorCustomList(comptime T: type, comptime leaf_size: comptime_int) type { debug.assert(leaf_size >= 1); return struct { const node_size = math.max((@sizeOf(T) * leaf_size) / @sizeOf(usize), 2); length: usize = 0, depth: usize = 0, data: Data = Data{ .leaf = undefined }, const Data = union { node: Node, leaf: Leaf, }; const Leaf = struct { items: [leaf_size]T = undefined, }; const L = @This(); const Node = struct { length: usize = 0, children: [node_size]*L = undefined, }; /// Creates a new list from a slice of items. pub fn fromSlice(allocator: *mem.Allocator, items: []const T) !@This() { if (items.len <= leaf_size) { var res = @This(){ .length = items.len }; mem.copy(T, &res.data.leaf.items, items); return res; } var nodes = try allocator.alloc(@This(), divCeil(items.len, leaf_size)); for (nodes) |*node, i| { const children = items[i * leaf_size ..]; const length = math.min(children.len, leaf_size); node.* = fromSliceSmall(children[0..length]); } return try fromChildren(allocator, nodes); } pub fn fromSliceSmall(items: []const T) @This() { debug.assert(items.len <= leaf_size); var res = @This(){ .length = items.len }; mem.copy(T, &res.data.leaf.items, items); return res; } /// Creates a new list from a slice of children. fn fromChildren(allocator: *mem.Allocator, children: []@This()) mem.Allocator.Error!@This() { if (children.len == 0) return @This(){}; if (children.len <= node_size) return fromChildrenSmall(children); const nodes = try allocator.alloc(@This(), divCeil(children.len, node_size)); for (nodes) |*node, i| { const c = children[i * node_size ..]; node.* = fromChildrenSmall(c[0..math.min(c.len, node_size)]); } return fromChildren(allocator, nodes); } /// Creates a new list from a slice of children without needing any allocations. /// The slice length must be less than node_size. fn fromChildrenSmall(children: []@This()) @This() { if (children.len == 0) return @This(){}; debug.assert(children.len <= node_size); const child_depth = children[0].depth; var res = @This(){ .depth = child_depth + 1, .data = Data{ .node = undefined }, }; res.data.node.length = children.len; for (children) |*child, i| { debug.assert(child.depth == child_depth); res.length += child.length; res.data.node.children[i] = child; } return res; } /// Creates a new list from a slice of children without needing any allocations. /// The slice length must be less than node_size. fn fromChildrenPointersSmall(children: []const *@This()) @This() { if (children.len == 0) return @This(){}; debug.assert(children.len <= node_size); const child_depth = children[0].depth; var res = @This(){ .depth = child_depth + 1, .data = Data{ .node = undefined }, }; res.data.node.length = children.len; for (children) |child, i| { debug.assert(child.depth == child_depth); res.length += child.length; res.data.node.children[i] = child; } return res; } /// The number of items in the list. /// O(1) pub fn len(list: @This()) usize { return list.length; } /// Get an iterator that can effectivly iterate over all items in the /// list. The list pointer must outlive the iterator itself. /// O(1) pub fn iterator(list: *const @This(), start: usize) Iterator { return Iterator.init(list, start); } /// Get an iterator that can effectivly iterate over all items in the /// list. This iterator returns blocks of items instead of one item /// at the time. The list pointer must outlive the iterator itself. /// O(1) pub fn blockIterator(list: *const @This(), start: usize) BlockIterator { return BlockIterator.init(list, start); } /// Iterate over all items in the list, calling 'func' with each item in order. /// O(length * O(func)) pub fn foreach(list: @This(), start: usize, context: var, func: var) @TypeOf(func).ReturnType { try list.foreachHelper(start, 0, context, func); } fn foreachHelper(list: @This(), start: usize, offset: usize, context: var, func: var) @TypeOf(func).ReturnType { if (list.depth == 0) { for (list.data.leaf.items[start..list.length]) |item, i| try func(context, start + i + offset, item); } else { var new_start = start; var new_offset = offset; for (list.nodeChildren()) |child| { if (child.length <= new_start) { new_start -= child.length; new_offset += child.length; continue; } try child.foreachHelper(new_start, new_offset, context, func); new_offset += child.length; new_start = 0; } } } /// Iterate over all items in the list, calling 'func' with each item in order. /// O(length * O(func)) pub fn foreachBlock(list: @This(), start: usize, context: var, func: var) @TypeOf(func).ReturnType { try list.foreachHelper(start, 0, context, func); } fn foreachBlockHelper(list: @This(), start: usize, offset: usize, context: var, func: var) @TypeOf(func).ReturnType { if (list.depth == 0) { try func(context, start + i + offset, ist.data.leaf.items[start..list.length]); } else { var new_start = start; var new_offset = offset; for (list.nodeChildren()) |child| { if (child.length <= new_start) { new_start -= child.length; new_offset += child.length; continue; } try child.foreachHelper(new_start, new_offset, context, func); new_offset += child.length; new_start = 0; } } } /// Iterate over all items in the list, calling 'func' with each block of items in order. /// O(depth) TODO: More accurate pub fn at(list: @This(), i: usize) T { debug.assert(i < list.length); if (list.depth == 0) { return list.data.leaf.items[i]; } else { const sub_i = list.subIndex(i); return list.data.node.children[sub_i.node_i].at(sub_i.i); } } /// Creates a clone of the list which is safe to do mutations on. /// O(depth) TODO: More accurate pub fn mut(list: @This(), allocator: *mem.Allocator) mem.Allocator.Error!@This() { var res = list; if (res.depth == 0) return res; // TODO: mut should expect that the user is going to append at least on item. // It should therefor make room for this one item when doing the dupe. res.lastNodePtr().* = try (try res.lastNode().mut(allocator)).dupe(allocator); return res; } /// Returns a new list which has 'item' appended to the end. /// O(depth) TODO: More accurate pub fn append(list: @This(), allocator: *mem.Allocator, item: T) !@This() { var res = try list.mut(allocator); try res.appendMut(allocator, item); return res; } /// Appends an item to the end of the list. /// O(depth) TODO: More accurate /// Warning: This method mutates the list. One should ensure that the mutated /// part of the list is not shared with any other lists as this will /// mutate those lists as well. The best way to ensure this is safe, /// is to call 'mut' before using this method. pub fn appendMut(list: *@This(), allocator: *mem.Allocator, item: T) !void { return list.appendSliceMut(allocator, &[_]T{item}); } /// Returns a new list which has 'items' appended to the end. /// O(depth + items.len) TODO: More accurate pub fn appendSlice(list: @This(), allocator: *mem.Allocator, items: []const T) !@This() { var res = try list.mut(allocator); try res.appendSliceMut(allocator, items); return res; } /// Appends items to the end of the list. /// O(depth + items.len) TODO: More accurate /// Warning: This method mutates the list. One should ensure that the mutated /// part of the list is not shared with any other lists as this will /// mutate those lists as well. The best way to ensure this is safe, /// is to call 'mut' before using this method. pub fn appendSliceMut(list: *@This(), allocator: *mem.Allocator, items: []const T) !void { var i: usize = 0; while (i < items.len) { const space = try list.requestSpace(allocator, items[i..].len); mem.copy(T, space, items[i..][0..space.len]); i += space.len; } } /// Request new space from the end of the list. This will increase the lists size /// but the new items in the list will be 'undefined'. The new items added to the /// list will be returned. This function can return N items, where 0 < N <= 'space'. /// If N < 'space' and you really need 'space', then you can call this function /// again with 'space' - N. /// O(depth) TODO: More accurate /// Warning: This method mutates the list. One should ensure that the mutated part /// of the list is not shared with any other lists as this will mutate /// those lists as well. The best way to ensure this is safe, is to call /// 'mut' before using this method. pub fn requestSpace(list: *@This(), allocator: *mem.Allocator, space: usize) ![]T { const s = try list.requestSpaceHelper(allocator, space); if (s.len != 0) return s; if (list.depth == 0 or list.data.node.length == node_size) { const end = try (try createWithDepth(allocator, list.depth)).dupe(allocator); const old = try list.dupe(allocator); list.* = @This(){ .depth = old.depth + 1, .length = old.length, .data = Data{ .node = Node{ .length = 2 } }, }; list.data.node.children[0] = old; list.data.node.children[1] = end; } else { const end = try (try createWithDepth(allocator, list.depth - 1)).dupe(allocator); list.lastNodePtr().* = end; list.data.node.length += 1; } const res = try list.lastNode().requestSpaceHelper(allocator, space); debug.assert(res.len != 0); list.length += res.len; return res; } fn requestSpaceHelper(list: *@This(), allocator: *mem.Allocator, space: usize) mem.Allocator.Error![]T { if (list.depth == 0) { const length = math.min(space, leaf_size - list.length); defer list.length += length; return list.data.leaf.items[list.length..][0..length]; } const s = try list.lastNode().requestSpaceHelper(allocator, space); if (s.len != 0) { list.length += s.len; return s; } if (list.data.node.length != node_size) { const end = try (try createWithDepth(allocator, list.depth - 1)).dupe(allocator); list.data.node.length += 1; list.lastNodePtr().* = end; const res = try end.requestSpaceHelper(allocator, space); debug.assert(res.len != 0); list.length += res.len; return res; } return s; } /// Returns a new list which has 'other' appended to the end. /// O(depth) TODO: More accurate pub fn appendList(list: @This(), allocator: *mem.Allocator, other: @This()) mem.Allocator.Error!@This() { if (other.length == 0) return list; if (list.length == 0) return other; // If the other list is small, then let's just append the items // of that list to this one. // TODO: What is a good small size??? if (other.length <= leaf_size * 2) { var res = try list.mut(allocator); var it = other.blockIterator(0); while (it.next()) |s| try res.appendSliceMut(allocator, s); return res; } // Because we other.length here is now > leaf_size, // this means that other should never be 0 deep. debug.assert(other.depth != 0); if (other.depth == list.depth) { if (list.data.node.length + other.data.node.length <= node_size) { // Depth is the same and a new root node with the same depth // can contain the children of 'list' and 'other' // *->a *->c *->a // *->b *->d *->b // # *->e *->c // # + # = *->d // # # *->e // # # # var res = list; mem.copy(*@This(), res.data.node.children[res.data.node.length..], other.nodeChildren()); res.data.node.length += other.data.node.length; res.length += other.length; return res; } // Depth is the same but a new root node does not have space for // 'list' and 'other'. We therefor need a new root which has depth // + 1 // *->a *->e *------->*->g // *->b *->f *->*->a *->h // *->c *->g # *->b # // *->d + *->h = # *->c # // # # # *->d # // # # # *->e # // *->f const children = try allocator.create([2]@This()); children.* = [_]@This(){ list, other, }; const left = &children[0]; const right = &children[1]; const to_copy = node_size - left.data.node.length; mem.copy(*@This(), left.data.node.children[left.data.node.length..], right.nodeChildren()[0..to_copy]); left.data.node.length = node_size; left.length = left.calcLen(); mem.copy(*@This(), &right.data.node.children, right.data.node.children[to_copy..]); right.data.node.length = other.data.node.length - to_copy; right.length = right.calcLen(); return fromChildrenSmall(children); } if (other.depth < list.depth) { // If 'list.depth' is greater, then we pop the last // node and append 'other' to this node. var left = list; const last = left.lastNode(); left.data.node.length -= 1; left.length -= last.length; var right = try last.appendList(allocator, other); if (left.depth != right.depth) { // 'right.depth' is 'left.depth' - 1. We can therefore just put // 'right' back where we popped a node further up. // list: left: | last: other: right: | result: // *------->*->a *->*->a | *->b *->c *->b | *------->*->a // *->*->b # # # | # # *->c | *->*->b # // # # # # # | # # # | # *->c # // # # # # # | # + # = # | # # # // # # # # # | # # # | # # # // # # # # # | # # # | # # # // # | | # debug.assert(right.depth < left.depth); right = try right.makeDeep(allocator, left.depth - 1); left.data.node.length += 1; left.lastNodePtr().* = try right.dupe(allocator); left.length += right.length; return left; } // Depth of 'left' and 'right' are now the same. Recall append // to hit the 'other.depth == list.depth' case above. return try left.appendList(allocator, right); } // If 'other.depth' is greater, then we pop the first // node and append 'list' to this node. var right = other; const first = right.firstNode(); var left = try list.appendList(allocator, first.*); if (right.depth != left.depth) { // other: | list: first: left: | result: // *------->*->a | *->c *->a *->c | *------->*->c // *->*->b # | # # *->a | *->*->b *->a // # # # | # # # | # # # // # # # | # + # = # | # # # // # # # | # # # | # # # // # # # | # # # | # # # // # | | # debug.assert(left.depth < right.depth); left = try left.makeDeep(allocator, right.depth - 1); right.length -= first.length; right.firstNodePtr().* = try left.dupe(allocator); right.length += left.length; return right; } // Depth of 'left' and 'right' are now the same. Recall append // to hit the 'other.depth == list.depth' case above. mem.copy(*@This(), &right.data.node.children, right.nodeChildren()[1..]); right.data.node.length -= 1; right.length -= first.length; return try left.appendList(allocator, right); } /// Returns list that has 'item' inserted a 'i' /// O(depth) TODO: More accurate pub fn insert(list: @This(), allocator: *mem.Allocator, i: usize, item: T) !@This() { return list.insertSlice(allocator, i, &[_]T{item}); } /// Returns list that has 'item' inserted a 'i' /// O(depth) TODO: More accurate pub fn insertSlice(list: @This(), allocator: *mem.Allocator, i: usize, items: []const T) !@This() { // TODO: Figure out why the layout when inserting at i = 0 is weird //|-- length: 2047 depth: 2 //||-- length: 722 depth: 1 //||103|102|101|100|99|98|... length: 264 //||103|102|101|100|99|98|... length: 264 //||103|102|101|100|99|98|... length: 194 //||-- //|-- //||-- length: 264 depth: 1 //||101|100|99|98|97|104|... length: 264 //||-- //|-- //||-- length: 1 depth: 1 //||101 length: 1 //||-- //|-- //||-- length: 264 depth: 1 //||100|99|98|97|104|103|... length: 264 //||-- //|-- //||-- length: 1 depth: 1 //||100 length: 1 //||-- //|-- //||-- length: 264 depth: 1 //||99|98|97|104|103|102|... length: 264 //||-- //|-- //||-- length: 1 depth: 1 //||99 length: 1 //||-- //|-- //||-- length: 530 depth: 1 //||98|97|104|103|102|101|... length: 264 //||98|97|104|103|102|101|... length: 264 //||98|97 length: 2 //||-- //|-- // TODO: Most of the time, 'slice' reallocs nodes in a way that would // make mutating it actually safe. We should detect this, and not // call 'mut' here if it is true. var first = try (try list.slice(allocator, 0, i)).mut(allocator); try first.appendSliceMut(allocator, items); return try first.appendList(allocator, try list.slice(allocator, i, list.length)); } pub fn insertList(list: @This(), allocator: *mem.Allocator, i: usize, other: @This()) !@This() { var res = try list.slice(allocator, 0, i); res = try res.appendList(allocator, other); return try res.appendList(allocator, try list.slice(allocator, i, list.length)); } /// Returns list that has the item at 'i' removed /// O(depth) TODO: More accurate pub fn remove(list: @This(), allocator: *mem.Allocator, i: usize) !@This() { return list.removeItems(allocator, i, 1); } /// Returns list that has the items from 'i' to 'i + len' (exclusive) removed. /// O(depth) TODO: More accurate pub fn removeItems(list: @This(), allocator: *mem.Allocator, i: usize, length: usize) !@This() { if (length == 0) return list; var res = try list.slice(allocator, 0, i); return res.appendList(allocator, try list.slice(allocator, i + length, list.length)); } /// Slices the 'list' returning a new list containing the elements from start to end (exclusive) /// O(depth) TODO: More accurate pub fn slice(list: @This(), allocator: *mem.Allocator, start: usize, end: usize) mem.Allocator.Error!@This() { debug.assert(start <= end); debug.assert(end <= list.length); if (start == list.length) return @This(){}; if (start == end) return @This(){}; if (start == 0 and end == list.length) return list; if (list.depth == 0) { var res = @This(){}; mem.copy(T, &res.data.leaf.items, list.data.leaf.items[start..end]); res.length = end - start; return res; } // Find first node inside slice var node_start: usize = 0; var first: usize = 0; var first_list: @This() = undefined; const children = list.nodeChildren(); for (children) |child, i| { if (node_start <= start and start < node_start + child.length) { // If both start and end are within this node, then we just slice the // child and return if (node_start < end and end <= node_start + child.length) return child.slice(allocator, start - node_start, end - node_start); first = i; first_list = try child.slice(allocator, start - node_start, child.length); node_start += child.length; break; } node_start += child.length; } else unreachable; // Find last node inside slice var last: usize = first; var last_list: @This() = undefined; for (children[first + 1 ..]) |child, i| { if (node_start < end and end <= node_start + child.length) { last = first + i + 1; last_list = try child.slice(allocator, 0, end - node_start); break; } node_start += child.length; } else unreachable; const mid_nodes = list.data.node.children[first + 1 .. last]; const mid = fromChildrenPointersSmall(mid_nodes); var res = try first_list.appendList(allocator, mid); return try res.appendList(allocator, last_list); } /// Converts the list to a slice. /// O(length) pub fn toSlice(list: @This(), allocator: *mem.Allocator) ![]T { var res = try allocator.alloc(T, list.len()); list.foreach(0, res, struct { fn each(s: []T, i: usize, item: T) error{}!void { s[i] = item; } }.each) catch unreachable; return res; } /// Compare two lists for equallity. /// Note: Function is really fast when lists share large portions /// of their nodes with eachother as we can then do a few /// pointer comparisons instead of comparing the content itself. /// worst case: O(length^2) /// best case: O(1) (when lists share all nodes, or lengths differ) pub fn equal(a: @This(), b: @This()) bool { if (a.length != b.length) return false; if (a.depth == 0 and b.depth == 0) { for (a.data.leaf.items) |a_item, i| { const b_item = b.data.leaf.items[i]; if (!std.meta.eql(a_item, b_item)) return false; } return true; } if (a.depth < b.depth) return equal(b, a); if (b.depth < a.depth) { if (a.data.node.length == 1) return equal(a.lastNode().*, b); } const a_nodes = a.nodeChildren(); const b_nodes = b.nodeChildren(); return equalOnEachCommonLength(a_nodes, b_nodes); } fn equalOnEachCommonLength(a: []const *@This(), b: []const *@This()) bool { var a_len: usize = a[0].length; var b_len: usize = b[0].length; var a_start: usize = 0; var b_start: usize = 0; var a_i: usize = 0; var b_i: usize = 0; while (true) { const a_node = a[a_i]; const b_node = b[b_i]; if (a_len == b_len) { if (!commonLengthEqual(a[a_start .. a_i + 1], b[b_start .. b_i + 1])) return false; a_i += 1; b_i += 1; a_start = a_i; b_start = b_i; if (a_start == a.len) { debug.assert(b_start == b.len); return true; } debug.assert(a_start != a.len and b_start != b.len); a_len = a[a_i].length; b_len = b[b_i].length; } else if (a_len < b_len) { a_i += 1; a_len += a[a_i].length; } else if (b_len < a_len) { b_i += 1; b_len += b[b_i].length; } } } fn commonLengthEqual(a: []const *@This(), b: []const *@This()) bool { if (a.len == 1 and b.len == 1) { debug.assert(a[0].length == b[0].length); return a[0] == b[0] or equal(a[0].*, b[0].*); } if (a.len == 1 and a[0].depth != 0) return equalOnEachCommonLength(a[0].nodeChildren(), b); if (b.len == 1 and b[0].depth != 0) return equalOnEachCommonLength(b[0].nodeChildren(), a); var a_list = fromChildrenPointersSmall(a); var b_list = fromChildrenPointersSmall(b); debug.assert(a_list.length == b_list.length); return itEqual(&a_list.iterator(0), &b_list.iterator(0)); } fn itEqual(a: *Iterator, b: *Iterator) bool { while (true) { const a_i = a.next() orelse break; const b_i = b.next().?; if (!std.meta.eql(a_i, b_i)) return false; } return true; } pub fn dump(list: @This(), stream: var) @TypeOf(stream.writeFn).ReturnType { if (list.depth == 0) { const max_items = 6; for (list.data.leaf.items[0..math.min(list.length, max_items)]) |item, i| { if (i != 0) try stream.writeAll("|"); try stream.print("{}", item); } if (max_items < list.length) try stream.print("|..."); try stream.print(" length: {}", list.length); } else { var lps = try LinePrependStream(@TypeOf(stream.writeFn).ReturnType.ErrorSet).init("|", stream); try lps.stream.print("-- length: {} depth: {}", list.length, list.depth); for (list.nodeChildren()) |child, i| { try lps.stream.write("\n"); try child.dump(&lps.stream); if (child.depth != 0 or i + 1 == list.nodeChildren().len) try lps.stream.write("\n--"); } } } fn LinePrependStream(comptime WriteError: type) type { return struct { const Error = WriteError; const Stream = std.io.OutStream(Error); stream: Stream, child_stream: *Stream, prefix: []const u8, fn init(prefix: []const u8, child_stream: *Stream) !@This() { try child_stream.write(prefix); return @This(){ .stream = Stream{ .writeFn = writeFn }, .child_stream = child_stream, .prefix = prefix, }; } fn writeFn(out_stream: *Stream, bytes: []const u8) Error!void { const self = @fieldParentPtr(@This(), "stream", out_stream); var tmp = bytes; while (mem.indexOfScalar(u8, tmp, '\n')) |i| { try self.child_stream.write(tmp[0..i]); try self.child_stream.write("\n"); try self.child_stream.write(self.prefix); tmp = tmp[i + 1 ..]; } try self.child_stream.write(tmp); } }; } const SubIndex = struct { node_i: usize, i: usize, }; fn subIndex(list: @This(), i: usize) SubIndex { debug.assert(list.depth != 0); debug.assert(i <= list.length); if (i == list.length) { return SubIndex{ .node_i = list.data.node.length - 1, .i = list.lastNode().length, }; } var new_i = i; for (list.nodeChildren()) |child, j| { if (new_i < child.length) { return SubIndex{ .node_i = j, .i = new_i, }; } new_i -= child.length; } unreachable; } fn lastNode(list: @This()) *@This() { return list.lastNodePtr().*; } fn lastNodePtr(list: var) @TypeOf(&list.data.node.children[0]) { debug.assert(list.depth != 0); return &list.data.node.children[list.data.node.length - 1]; } fn firstNode(list: @This()) *@This() { return list.firstNodePtr().*; } fn firstNodePtr(list: var) @TypeOf(&list.data.node.children[0]) { debug.assert(list.depth != 0); return &list.data.node.children[0]; } fn nodeChildren(list: @This()) []const *@This() { debug.assert(list.depth != 0); return list.data.node.children[0..list.data.node.length]; } fn createWithDepth(allocator: *mem.Allocator, depth: usize) !@This() { return try (@This(){}).makeDeep(allocator, depth); } fn calcLen(list: @This()) usize { var res: usize = 0; for (list.nodeChildren()) |child| res += child.length; return res; } fn makeDeep(list: @This(), allocator: *mem.Allocator, depth: usize) !@This() { var res = list; while (res.depth < depth) res = try fromChildren(allocator, @as(*[1]@This(), try res.dupe(allocator))); return res; } fn dupe(list: @This(), allocator: *mem.Allocator) !*@This() { const res = try allocator.create(@This()); res.* = list; return res; } pub const BlockIterator = struct { const Item = struct { curr: usize = 0, list: *const L, }; // TODO: Calc max depth for list that "fills" the entier addr space stack: [32]Item = undefined, stack_len: usize = 0, fn init(list: *const L, start: usize) BlockIterator { var res = BlockIterator{}; if (list.len() == 0) return res; if (list.len() <= start) return res; var new_start = start; var curr = list; while (true) { if (curr.depth == 0) { res.push(Item{ .curr = new_start, .list = curr }); break; } const i = curr.subIndex(new_start); res.push(Item{ .curr = i.node_i, .list = curr }); new_start = i.i; curr = curr.nodeChildren()[i.node_i]; } return res; } fn pop(it: *BlockIterator) void { it.stack_len -= 1; } fn push(it: *BlockIterator, item: Item) void { defer it.stack_len += 1; it.stack[it.stack_len] = item; } fn lastItem(it: *BlockIterator) ?*Item { if (it.stack_len == 0) return null; return &it.stack[it.stack_len - 1]; } pub fn next(it: *BlockIterator) ?[]const T { const curr = it.lastItem() orelse return null; debug.assert(curr.curr < curr.list.len()); debug.assert(curr.list.depth == 0); const res = curr.list.data.leaf.items[curr.curr..curr.list.length]; while (true) { it.pop(); const l = it.lastItem() orelse break; l.curr += 1; if (l.curr < l.list.data.node.length) break; } while (true) { const l = it.lastItem() orelse break; if (l.list.depth == 0) break; it.push(Item{ .list = l.list.data.node.children[l.curr] }); } return res; } }; pub const Iterator = struct { inner: BlockIterator, curr: []const T = &[_]T{}, curr_i: usize = 0, fn init(list: *const L, start: usize) Iterator { return Iterator{ .inner = BlockIterator.init(list, start), }; } pub fn next(it: *Iterator) ?T { while (it.curr.len <= it.curr_i) { it.curr = it.inner.next() orelse return null; it.curr_i = 0; } defer it.curr_i += 1; return it.curr[it.curr_i]; } }; }; } fn divCeil(a: var, b: var) @TypeOf(a / b) { return (a + (b - 1)) / b; } test "divCeil" { testing.expectEqual(@as(u64, 0), divCeil(0, 5)); testing.expectEqual(@as(u64, 1), divCeil(1, 5)); testing.expectEqual(@as(u64, 1), divCeil(5, 5)); testing.expectEqual(@as(u64, 2), divCeil(6, 5)); testing.expectEqual(@as(u64, 2), divCeil(10, 5)); testing.expectEqual(@as(u64, 3), divCeil(11, 5)); testing.expectEqual(@as(u64, 3), divCeil(15, 5)); }
src/core/list.zig
const std = @import("std"); //私たちの古いRPG文字構造を覚えていますか?構造体は本当に単なるAです //メモリに対処するための非常に便利な方法。これらの分野(金、 //健康、経験)はすべて特定のサイズの値です。それらを追加してください //一緒に、あなたは全体として構造体のサイズを持っています。 const Character = struct { gold: u32 = 0, health: u8 = 100, experience: u32 = 0, }; //ここでは、定数である "the_narrator"という文字を作成します //キャラクタ構造の(不変)インスタンス。それはあなたのものに保存されています //データとしてプログラムされ、命令コードのようにロードされています //プログラムが実行されたときにRAM。このデータの相対位置 //メモリはハードコーディングされていて、アドレスも値も変化しません。 const the_narrator = Character{ .gold = 12, .health = 99, .experience = 9000, }; //この "global_wizard"文字は非常に似ています。アドレスfor. //このデータは変更されませんが、これはvarであるため、データ自体はできます。 // constではありません。 var global_wizard = Character{}; // A function is instruction code at a particular address. Function // parameters in Zig are always immutable. They are stored in "the // stack". A stack is a type of data structure and "the stack" is a // specific bit of RAM reserved for your program. The CPU has special // support for adding and removing things from "the stack", so it is // an extremely efficient place for memory storage. // // Also, when a function executes, the input arguments are often // loaded into the beating heart of the CPU itself in registers. // // Our main() function here has no input parameters, but it will have // a stack entry (called a "frame"). pub fn main() void { //ここで、「glorp」文字はスタックに割り当てられます // glorpの各インスタンスが変わること、したがってユニークな //この機能の呼び出しに。 var glorp = Character{ .gold = 30, }; // "redward_xp"値は興味深いです。不公平です // value、それでもローカルであってもグローバルに入れることができます //すべての呼び出し間でデータと共有されます。しかし、そのようなものであること //小さい値、それは単にリテラルとしてインライン化されるかもしれません //命令コードで使用されている場所に値。それは上昇しています //コンパイラに。 const reward_xp: u32 = 200; //輸入した「STD」の構造体への周りを囲みましょう // 頂点で。それが一度だけ定期的なZig値であるので //インポートされた、そのフィールドに新しい名前を割り当てることもできます。 //宣言「デバッグ」とは別の構造体を指し、「印刷」は //その構造内のパブリック関数名前空間。 // // std.debug.print関数を名前付きのconstに割り当てましょう。 //「印刷」して、後でこの新しい名前を使用できるように! const print = std.debug.print; // Now let's look at assigning and pointing to values in Zig. // // We'll try three different ways of making a new name to access // our glorp Character and change one of its values. // // "glorp_access1" is incorrectly named! We asked Zig to set aside // memory for another Character struct. So when we assign glorp to // glorp_access1 here, we're actually assigning all of the fields // to make a copy! Now we have two separate characters. // // You don't need to fix this. But notice what gets printed in // your program's output for this one compared to the other two // assignments below! var glorp_access1: Character = glorp; glorp_access1.gold = 111; print("1:{}!. ", .{glorp.gold == glorp_access1.gold}); // ノート: // //私たちがこれをしようとしたら // var、ゴールドフィールドを変更するとコンパイラエラーが発生します // const値は不変であるため! // // "glorp_access2"が欲しいものをします。それはオリジナルを指します // Glorpのアドレス。また暗黙のうちに入手することを忘れないでください // Structフィールドとの間接参照なので、「ゴールド」フィールドにアクセスする // glorp_access2からのアクセスはGlorpからアクセスするように見えます //それ自体 var glorp_access2: *Character = &glorp; glorp_access2.gold = 222; print("2:{}!. ", .{glorp.gold == glorp_access2.gold}); // "glorp_access3"は面白いです。それはポインターですが、それは // const。それはゴールド値を変更しませんか?番号!あなたのように //私たちの以前のポインター実験、定数から思い出すことができます //ポインタはそれが指しているものを変えることはできませんが、 //それが指すアドレスはまだ変わっています!だからそれを変えることができます。 const glorp_access3: *Character = &glorp; glorp_access3.gold = 333; print("3:{}!. ", .{glorp.gold == glorp_access3.gold}); // ノート: // //これを* const文字ポインタで行おうとしたら、 //それはうまくいかないため、コンパイラエラーが発生します //値が不変になるため! // //中を移動する... // //関数への引数を渡すことはほとんど同じです // constに割り当てをする(ジグがすべてを執行するため、 //関数パラメータはconstです。 // //これを知って、あなたが期待どおりに働くことができるかどうかを確認してください - //指定された金額を付属の文字のものに追加する必要があります。 //ポイントを経験します。 // print("XP before:{}, ", .{glorp.experience}); // Fix 1 of 2 goes here: levelUp(&glorp, reward_xp); print("after:{}.\n", .{glorp.experience}); } // Fix 2 of 2 goes here: fn levelUp(character_access: *Character, xp: u32) void { character_access.experience += xp; } //もっともっとあります! // //データセグメント(コンパイル時に割り当て)と「スタック」 // //(実行時に割り当てられている)プログラムデータの唯一の場所ではありません //メモリに保存できます。彼らはただ最も効率的です。ときどき //私たちのプログラムがどのくらいのメモリが必要になるかわからない //プログラムが実行されています。また、スタックのサイズには制限があります //プログラムに割り当てられたメモリ(オペレーティングシステムによって設定されたことが多い)。 //これらの機会は「ヒープ」を持っています。 // //あなたは好きなだけ多くのヒープメモリを使用できます(物理内) //制限事項は、もちろん管理できません。 //を追加して削除するための組み込みのCPUサポートがないため //スタックと一緒に持っているものです。また、の種類に応じて //割り当て、あなたのプログラムは管理するために高価な仕事をする必要があるかもしれません //ヒープメモリの使用。後でヒープアロケータについて学びます。 // //さや!これは多くの情報でした。あなたは知っていることを嬉しく思います //次の運動が私たちを学ぶZig言語に戻ってきたこと //特徴私たちはもっと多くのことをするために使うことができます!
exercises/051_values.zig
const std = @import("std"); const deps = @import("./deps.zig"); const vkgen = deps.imports.vulkan_zig; const Step = std.build.Step; const Builder = std.build.Builder; const LibExeObjStep = std.build.LibExeObjStep; const Pkg = std.build.Pkg; pub const ResourceGenStep = struct { step: Step, shader_step: *vkgen.ShaderCompileStep, builder: *Builder, package: std.build.Pkg, output_file: std.build.GeneratedFile, resources: std.ArrayList(u8), pub fn init(builder: *Builder, out: []const u8) *ResourceGenStep { const self = builder.allocator.create(ResourceGenStep) catch unreachable; const full_out_path = std.fs.path.join(builder.allocator, &[_][]const u8{ builder.build_root, builder.cache_root, out, }) catch unreachable; self.* = .{ .step = Step.init(.custom, "resources", builder.allocator, make), .shader_step = vkgen.ShaderCompileStep.init(builder, &[_][]const u8{ "glslc", "--target-env=vulkan1.1" }), .builder = builder, .package = .{ .name = "resources", .path = .{ .generated = &self.output_file }, .dependencies = null, }, .output_file = .{ .step = &self.step, .path = full_out_path, }, .resources = std.ArrayList(u8).init(builder.allocator), }; self.step.dependOn(&self.shader_step.step); return self; } fn renderPath(path: []const u8, writer: anytype) void { const separators = &[_]u8{ std.fs.path.sep_windows, std.fs.path.sep_posix }; var i: usize = 0; while (std.mem.indexOfAnyPos(u8, path, i, separators)) |j| { writer.writeAll(path[i..j]) catch unreachable; switch (std.fs.path.sep) { std.fs.path.sep_windows => writer.writeAll("\\\\") catch unreachable, std.fs.path.sep_posix => writer.writeByte(std.fs.path.sep_posix) catch unreachable, else => unreachable, } i = j + 1; } writer.writeAll(path[i..]) catch unreachable; } pub fn addShader(self: *ResourceGenStep, name: []const u8, source: []const u8) void { const shader_out_path = self.shader_step.add(source); var writer = self.resources.writer(); writer.print("pub const {s} = @embedFile(\"", .{name}) catch unreachable; renderPath(shader_out_path, writer); writer.writeAll("\");\n") catch unreachable; } fn make(step: *Step) !void { const self = @fieldParentPtr(ResourceGenStep, "step", step); const cwd = std.fs.cwd(); const dir = std.fs.path.dirname(self.output_file.path.?).?; try cwd.makePath(dir); try cwd.writeFile(self.output_file.path.?, self.resources.items); } }; pub fn linkGlfw(b: *LibExeObjStep) void { const glfw = b.builder.addStaticLibrary("glfw", null); const glfw_path = "./external/glfw/"; inline for (.{ "win32_thread.c", "wgl_context.c", "win32_init.c", "win32_monitor.c", "win32_time.c", "win32_joystick.c", "win32_window.c", "win32_module.c", "null_init.c", "null_monitor.c", "null_window.c", "null_joystick.c", "platform.c", "monitor.c", "init.c", "vulkan.c", "input.c", "osmesa_context.c", "egl_context.c", "context.c", "window.c", }) |f| { glfw.addCSourceFile(glfw_path ++ "src/" ++ f, &.{"-D_GLFW_WIN32"}); } glfw.linkLibC(); glfw.addIncludeDir(glfw_path ++ "src"); b.addIncludeDir(glfw_path ++ "include"); b.linkLibrary(glfw); } pub fn build(b: *Builder) void { const target = b.standardTargetOptions(.{}); const mode = b.standardReleaseOptions(); const triangle_exe = b.addExecutable("triangle", "./src/triangle.zig"); triangle_exe.setTarget(target); triangle_exe.setBuildMode(mode); triangle_exe.install(); triangle_exe.linkLibC(); triangle_exe.linkSystemLibrary("gdi32"); const external = "./external"; triangle_exe.addIncludeDir(external); linkGlfw(triangle_exe); triangle_exe.addCSourceFile(external ++ "/cgltf.c", &.{"-std=c99"}); triangle_exe.addCSourceFile(external ++ "/stb_image.c", &.{"-std=c99"}); const vk_sdk_path = b.option([]const u8, "vulkan-sdk", "Path to vulkan sdk"); const gen = if (vk_sdk_path) |path| vkgen.VkGenerateStep.initFromSdk(b, path, "vk.zig").package else Pkg{ .name = "vulkan", .path = .{ .path = "zig-cache/vk.zig" }, .dependencies = null }; triangle_exe.addPackage(gen); const compile_shader = b.option(bool, "shader", "Compile shader when build"); const res = blk: { if (compile_shader) |_| { const res = ResourceGenStep.init(b, "resources.zig"); res.addShader("triangle_vert", "src/shaders/triangle.vert"); res.addShader("triangle_frag", "src/shaders/triangle.frag"); break :blk res.package; } break :blk Pkg{ .name = "resources", .path = .{ .path = "zig-cache/resources.zig" }, .dependencies = null }; }; triangle_exe.addPackage(res); const zalgebra = Pkg{ .name = "zalgebra", .path = .{ .path = "external/zalgebra/src/main.zig" }, .dependencies = null }; triangle_exe.addPackage(zalgebra); const triangle_run_cmd = triangle_exe.run(); triangle_run_cmd.step.dependOn(b.getInstallStep()); const triangle_run_step = b.step("run", "Run the triangle example"); triangle_run_step.dependOn(&triangle_run_cmd.step); }
build.zig
const std = @import("std"); const builtin = @import("builtin"); const kernel = @import("root").kernel; const io = kernel.io; const print = kernel.print; pub const serial_log = @import("serial_log.zig"); pub const cga_console = @import("cga_console.zig"); pub const segments = @import("segments.zig"); pub const interrupts = @import("interrupts.zig"); pub const multiboot = @import("multiboot.zig"); pub const pmemory = @import("memory.zig"); pub const util = @import("util.zig"); pub const pci = @import("pci.zig"); pub const ata = @import("ata.zig"); pub const acpi = @import("acpi.zig"); pub const ps2 = @import("ps2.zig"); pub const threading = @import("threading.zig"); pub const vbe = @import("vbe.zig"); pub const timing = @import("timing.zig"); pub const bios_int = @import("bios_int.zig"); pub const frame_size = pmemory.frame_size; pub const MemoryMgrImpl = pmemory.ManagerImpl; pub const enable_interrupts = util.enable_interrupts; pub const disable_interrupts = util.disable_interrupts; pub const idle = util.idle; pub const Time = u64; pub const time = timing.rdtsc; pub const seconds_to_time = timing.seconds_to_ticks; pub const milliseconds_to_time = timing.milliseconds_to_ticks; pub fn panic(msg: []const u8, trace: ?*std.builtin.StackTrace) noreturn { _ = msg; _ = trace; asm volatile ("int $50"); unreachable; } // Kernel Boundaries ========================================================== extern var _REAL_START: u32; pub fn kernel_real_start() usize { return @ptrToInt(&_REAL_START); } extern var _REAL_END: u32; pub fn kernel_real_end() usize { return @ptrToInt(&_REAL_END); } extern var _VIRTUAL_START: u32; pub fn kernel_virtual_start() usize { return @ptrToInt(&_VIRTUAL_START); } extern var _VIRTUAL_END: u32; pub fn kernel_virtual_end() usize { return @ptrToInt(&_VIRTUAL_END); } extern var _KERNEL_SIZE: u32; pub fn kernel_size() usize { return @ptrToInt(&_KERNEL_SIZE); } extern var _VIRTUAL_OFFSET: u32; pub fn kernel_to_real(addr: usize) usize { return addr - @ptrToInt(&_VIRTUAL_OFFSET); } pub fn kernel_to_virtual(addr: usize) usize { return addr + @ptrToInt(&_VIRTUAL_OFFSET); } pub fn kernel_range_real_start_available() usize { return @intCast(usize, multiboot.kernel_range_start_available); } pub fn kernel_range_virtual_start_available() usize { return kernel_to_virtual( @intCast(usize, multiboot.kernel_range_start_available)); } // Console Implementation ===================================================== fn console_write(file: *io.File, from: []const u8) io.FileError!usize { _ = file; for (from) |value| { serial_log.print_char(value); kernel.console.print(value); } return from.len; } fn console_read(file: *io.File, to: []u8) io.FileError!usize { _ = file; _ = to; return 0; } // Boot Stack ================================================================= extern var stack: [util.Ki(16)]u8 align(16) linksection(".bss"); pub fn print_stack_left() void { print.format("stack left: {}\n", asm volatile ("mov %%esp, %[x]" : [x] "=r" (-> usize)) - @ptrToInt(&stack)); } // Platform Initialization ==================================================== pub fn init() !void { // Finish Setup of Console Logging serial_log.init(); cga_console.init(); kernel.console = &cga_console.console; kernel.console_file.write_impl = console_write; kernel.console_file.read_impl = console_read; // Setup Basic CPU Utilities segments.init(); interrupts.init(); timing.estimate_cpu_speed(); // List Multiboot Tags if (print.debug_print) { _ = try multiboot.find_tag(.End); } // Setup Global Memory Management var real_memory_map = kernel.memory.RealMemoryMap{}; const mmap_tag = try multiboot.find_tag(.Mmap); pmemory.process_multiboot2_mmap(&real_memory_map, &mmap_tag); try kernel.memory_mgr.init(&real_memory_map); // Threading try kernel.threading_mgr.init(); // Setup Devices kernel.device_mgr.init(kernel.alloc); ps2.init(); pci.find_pci_devices(); bios_int.init(); vbe.init(); try acpi.init(); // Start Ticking timing.set_pit_freq(.Irq0, 100); interrupts.pic.allow_irq(0, true); } pub fn done() void { acpi.power_off(); }
kernel/platform/platform.zig
pub const zero_width = [_][2]u21{ [2]u21{ 0x0300, 0x036f, }, // Combining Grave Accent ..Combining Latin Small Le [2]u21{ 0x0483, 0x0489, }, // Combining Cyrillic Titlo..Combining Cyrillic Milli [2]u21{ 0x0591, 0x05bd, }, // Hebrew Accent Etnahta ..Hebrew Point Meteg [2]u21{ 0x05bf, 0x05bf, }, // Hebrew Point Rafe ..Hebrew Point Rafe [2]u21{ 0x05c1, 0x05c2, }, // Hebrew Point Shin Dot ..Hebrew Point Sin Dot [2]u21{ 0x05c4, 0x05c5, }, // Hebrew Mark Upper Dot ..Hebrew Mark Lower Dot [2]u21{ 0x05c7, 0x05c7, }, // Hebrew Point Qamats Qata..Hebrew Point Qamats Qata [2]u21{ 0x0610, 0x061a, }, // Arabic Sign Sallallahou ..Arabic Small Kasra [2]u21{ 0x064b, 0x065f, }, // Arabic Fathatan ..Arabic Wavy Hamza Below [2]u21{ 0x0670, 0x0670, }, // Arabic Letter Superscrip..Arabic Letter Superscrip [2]u21{ 0x06d6, 0x06dc, }, // Arabic Small High Ligatu..Arabic Small High Seen [2]u21{ 0x06df, 0x06e4, }, // Arabic Small High Rounde..Arabic Small High Madda [2]u21{ 0x06e7, 0x06e8, }, // Arabic Small High Yeh ..Arabic Small High Noon [2]u21{ 0x06ea, 0x06ed, }, // Arabic Empty Centre Low ..Arabic Small Low Meem [2]u21{ 0x0711, 0x0711, }, // Syriac Letter Superscrip..Syriac Letter Superscrip [2]u21{ 0x0730, 0x074a, }, // Syriac Pthaha Above ..Syriac Barrekh [2]u21{ 0x07a6, 0x07b0, }, // Thaana Abafili ..Thaana Sukun [2]u21{ 0x07eb, 0x07f3, }, // Nko Combining Short High..Nko Combining Double Dot [2]u21{ 0x07fd, 0x07fd, }, // Nko Dantayalan ..Nko Dantayalan [2]u21{ 0x0816, 0x0819, }, // Samaritan Mark In ..Samaritan Mark Dagesh [2]u21{ 0x081b, 0x0823, }, // Samaritan Mark Epentheti..Samaritan Vowel Sign A [2]u21{ 0x0825, 0x0827, }, // Samaritan Vowel Sign Sho..Samaritan Vowel Sign U [2]u21{ 0x0829, 0x082d, }, // Samaritan Vowel Sign Lon..Samaritan Mark Nequdaa [2]u21{ 0x0859, 0x085b, }, // Mandaic Affrication Mark..Mandaic Gemination Mark [2]u21{ 0x08d3, 0x08e1, }, // Arabic Small Low Waw ..Arabic Small High Sign S [2]u21{ 0x08e3, 0x0902, }, // Arabic Turned Damma Belo..Devanagari Sign Anusvara [2]u21{ 0x093a, 0x093a, }, // Devanagari Vowel Sign Oe..Devanagari Vowel Sign Oe [2]u21{ 0x093c, 0x093c, }, // Devanagari Sign Nukta ..Devanagari Sign Nukta [2]u21{ 0x0941, 0x0948, }, // Devanagari Vowel Sign U ..Devanagari Vowel Sign Ai [2]u21{ 0x094d, 0x094d, }, // Devanagari Sign Virama ..Devanagari Sign Virama [2]u21{ 0x0951, 0x0957, }, // Devanagari Stress Sign U..Devanagari Vowel Sign Uu [2]u21{ 0x0962, 0x0963, }, // Devanagari Vowel Sign Vo..Devanagari Vowel Sign Vo [2]u21{ 0x0981, 0x0981, }, // Bengali Sign Candrabindu..Bengali Sign Candrabindu [2]u21{ 0x09bc, 0x09bc, }, // Bengali Sign Nukta ..Bengali Sign Nukta [2]u21{ 0x09c1, 0x09c4, }, // Bengali Vowel Sign U ..Bengali Vowel Sign Vocal [2]u21{ 0x09cd, 0x09cd, }, // Bengali Sign Virama ..Bengali Sign Virama [2]u21{ 0x09e2, 0x09e3, }, // Bengali Vowel Sign Vocal..Bengali Vowel Sign Vocal [2]u21{ 0x09fe, 0x09fe, }, // Bengali Sandhi Mark ..Bengali Sandhi Mark [2]u21{ 0x0a01, 0x0a02, }, // Gurmukhi Sign Adak Bindi..Gurmukhi Sign Bindi [2]u21{ 0x0a3c, 0x0a3c, }, // Gurmukhi Sign Nukta ..Gurmukhi Sign Nukta [2]u21{ 0x0a41, 0x0a42, }, // Gurmukhi Vowel Sign U ..Gurmukhi Vowel Sign Uu [2]u21{ 0x0a47, 0x0a48, }, // Gurmukhi Vowel Sign Ee ..Gurmukhi Vowel Sign Ai [2]u21{ 0x0a4b, 0x0a4d, }, // Gurmukhi Vowel Sign Oo ..Gurmukhi Sign Virama [2]u21{ 0x0a51, 0x0a51, }, // Gurmukhi Sign Udaat ..Gurmukhi Sign Udaat [2]u21{ 0x0a70, 0x0a71, }, // Gurmukhi Tippi ..Gurmukhi Addak [2]u21{ 0x0a75, 0x0a75, }, // Gurmukhi Sign Yakash ..Gurmukhi Sign Yakash [2]u21{ 0x0a81, 0x0a82, }, // Gujarati Sign Candrabind..Gujarati Sign Anusvara [2]u21{ 0x0abc, 0x0abc, }, // Gujarati Sign Nukta ..Gujarati Sign Nukta [2]u21{ 0x0ac1, 0x0ac5, }, // Gujarati Vowel Sign U ..Gujarati Vowel Sign Cand [2]u21{ 0x0ac7, 0x0ac8, }, // Gujarati Vowel Sign E ..Gujarati Vowel Sign Ai [2]u21{ 0x0acd, 0x0acd, }, // Gujarati Sign Virama ..Gujarati Sign Virama [2]u21{ 0x0ae2, 0x0ae3, }, // Gujarati Vowel Sign Voca..Gujarati Vowel Sign Voca [2]u21{ 0x0afa, 0x0aff, }, // Gujarati Sign Sukun ..Gujarati Sign Two-circle [2]u21{ 0x0b01, 0x0b01, }, // Oriya Sign Candrabindu ..Oriya Sign Candrabindu [2]u21{ 0x0b3c, 0x0b3c, }, // Oriya Sign Nukta ..Oriya Sign Nukta [2]u21{ 0x0b3f, 0x0b3f, }, // Oriya Vowel Sign I ..Oriya Vowel Sign I [2]u21{ 0x0b41, 0x0b44, }, // Oriya Vowel Sign U ..Oriya Vowel Sign Vocalic [2]u21{ 0x0b4d, 0x0b4d, }, // Oriya Sign Virama ..Oriya Sign Virama [2]u21{ 0x0b55, 0x0b56, }, // [2]u21{ nil } ..Oriya Ai Length Mark [2]u21{ 0x0b62, 0x0b63, }, // Oriya Vowel Sign Vocalic..Oriya Vowel Sign Vocalic [2]u21{ 0x0b82, 0x0b82, }, // Tamil Sign Anusvara ..Tamil Sign Anusvara [2]u21{ 0x0bc0, 0x0bc0, }, // Tamil Vowel Sign Ii ..Tamil Vowel Sign Ii [2]u21{ 0x0bcd, 0x0bcd, }, // Tamil Sign Virama ..Tamil Sign Virama [2]u21{ 0x0c00, 0x0c00, }, // Telugu Sign Combining Ca..Telugu Sign Combining Ca [2]u21{ 0x0c04, 0x0c04, }, // Telugu Sign Combining An..Telugu Sign Combining An [2]u21{ 0x0c3e, 0x0c40, }, // Telugu Vowel Sign Aa ..Telugu Vowel Sign Ii [2]u21{ 0x0c46, 0x0c48, }, // Telugu Vowel Sign E ..Telugu Vowel Sign Ai [2]u21{ 0x0c4a, 0x0c4d, }, // Telugu Vowel Sign O ..Telugu Sign Virama [2]u21{ 0x0c55, 0x0c56, }, // Telugu Length Mark ..Telugu Ai Length Mark [2]u21{ 0x0c62, 0x0c63, }, // Telugu Vowel Sign Vocali..Telugu Vowel Sign Vocali [2]u21{ 0x0c81, 0x0c81, }, // Kannada Sign Candrabindu..Kannada Sign Candrabindu [2]u21{ 0x0cbc, 0x0cbc, }, // Kannada Sign Nukta ..Kannada Sign Nukta [2]u21{ 0x0cbf, 0x0cbf, }, // Kannada Vowel Sign I ..Kannada Vowel Sign I [2]u21{ 0x0cc6, 0x0cc6, }, // Kannada Vowel Sign E ..Kannada Vowel Sign E [2]u21{ 0x0ccc, 0x0ccd, }, // Kannada Vowel Sign Au ..Kannada Sign Virama [2]u21{ 0x0ce2, 0x0ce3, }, // Kannada Vowel Sign Vocal..Kannada Vowel Sign Vocal [2]u21{ 0x0d00, 0x0d01, }, // Malayalam Sign Combining..Malayalam Sign Candrabin [2]u21{ 0x0d3b, 0x0d3c, }, // Malayalam Sign Vertical ..Malayalam Sign Circular [2]u21{ 0x0d41, 0x0d44, }, // Malayalam Vowel Sign U ..Malayalam Vowel Sign Voc [2]u21{ 0x0d4d, 0x0d4d, }, // Malayalam Sign Virama ..Malayalam Sign Virama [2]u21{ 0x0d62, 0x0d63, }, // Malayalam Vowel Sign Voc..Malayalam Vowel Sign Voc [2]u21{ 0x0d81, 0x0d81, }, // [2]u21{ nil } .. [2]u21{ 0x0dca, 0x0dca, }, // Sinhala Sign Al-lakuna ..Sinhala Sign Al-lakuna [2]u21{ 0x0dd2, 0x0dd4, }, // Sinhala Vowel Sign Ketti..Sinhala Vowel Sign Ketti [2]u21{ 0x0dd6, 0x0dd6, }, // Sinhala Vowel Sign Diga ..Sinhala Vowel Sign Diga [2]u21{ 0x0e31, 0x0e31, }, // Thai Character Mai Han-a..Thai Character Mai Han-a [2]u21{ 0x0e34, 0x0e3a, }, // Thai Character Sara I ..Thai Character Phinthu [2]u21{ 0x0e47, 0x0e4e, }, // Thai Character Maitaikhu..Thai Character Yamakkan [2]u21{ 0x0eb1, 0x0eb1, }, // Lao Vowel Sign Mai Kan ..Lao Vowel Sign Mai Kan [2]u21{ 0x0eb4, 0x0ebc, }, // Lao Vowel Sign I ..Lao Semivowel Sign Lo [2]u21{ 0x0ec8, 0x0ecd, }, // Lao Tone Mai Ek ..Lao Niggahita [2]u21{ 0x0f18, 0x0f19, }, // Tibetan Astrological Sig..Tibetan Astrological Sig [2]u21{ 0x0f35, 0x0f35, }, // Tibetan Mark Ngas Bzung ..Tibetan Mark Ngas Bzung [2]u21{ 0x0f37, 0x0f37, }, // Tibetan Mark Ngas Bzung ..Tibetan Mark Ngas Bzung [2]u21{ 0x0f39, 0x0f39, }, // Tibetan Mark Tsa -phru ..Tibetan Mark Tsa -phru [2]u21{ 0x0f71, 0x0f7e, }, // Tibetan Vowel Sign Aa ..Tibetan Sign Rjes Su Nga [2]u21{ 0x0f80, 0x0f84, }, // Tibetan Vowel Sign Rever..Tibetan Mark Halanta [2]u21{ 0x0f86, 0x0f87, }, // Tibetan Sign Lci Rtags ..Tibetan Sign Yang Rtags [2]u21{ 0x0f8d, 0x0f97, }, // Tibetan Subjoined Sign L..Tibetan Subjoined Letter [2]u21{ 0x0f99, 0x0fbc, }, // Tibetan Subjoined Letter..Tibetan Subjoined Letter [2]u21{ 0x0fc6, 0x0fc6, }, // Tibetan Symbol Padma Gda..Tibetan Symbol Padma Gda [2]u21{ 0x102d, 0x1030, }, // Myanmar Vowel Sign I ..Myanmar Vowel Sign Uu [2]u21{ 0x1032, 0x1037, }, // Myanmar Vowel Sign Ai ..Myanmar Sign Dot Below [2]u21{ 0x1039, 0x103a, }, // Myanmar Sign Virama ..Myanmar Sign Asat [2]u21{ 0x103d, 0x103e, }, // Myanmar Consonant Sign M..Myanmar Consonant Sign M [2]u21{ 0x1058, 0x1059, }, // Myanmar Vowel Sign Vocal..Myanmar Vowel Sign Vocal [2]u21{ 0x105e, 0x1060, }, // Myanmar Consonant Sign M..Myanmar Consonant Sign M [2]u21{ 0x1071, 0x1074, }, // Myanmar Vowel Sign Geba ..Myanmar Vowel Sign Kayah [2]u21{ 0x1082, 0x1082, }, // Myanmar Consonant Sign S..Myanmar Consonant Sign S [2]u21{ 0x1085, 0x1086, }, // Myanmar Vowel Sign Shan ..Myanmar Vowel Sign Shan [2]u21{ 0x108d, 0x108d, }, // Myanmar Sign Shan Counci..Myanmar Sign Shan Counci [2]u21{ 0x109d, 0x109d, }, // Myanmar Vowel Sign Aiton..Myanmar Vowel Sign Aiton [2]u21{ 0x135d, 0x135f, }, // Ethiopic Combining Gemin..Ethiopic Combining Gemin [2]u21{ 0x1712, 0x1714, }, // Tagalog Vowel Sign I ..Tagalog Sign Virama [2]u21{ 0x1732, 0x1734, }, // Hanunoo Vowel Sign I ..Hanunoo Sign Pamudpod [2]u21{ 0x1752, 0x1753, }, // Buhid Vowel Sign I ..Buhid Vowel Sign U [2]u21{ 0x1772, 0x1773, }, // Tagbanwa Vowel Sign I ..Tagbanwa Vowel Sign U [2]u21{ 0x17b4, 0x17b5, }, // Khmer Vowel Inherent Aq ..Khmer Vowel Inherent Aa [2]u21{ 0x17b7, 0x17bd, }, // Khmer Vowel Sign I ..Khmer Vowel Sign Ua [2]u21{ 0x17c6, 0x17c6, }, // Khmer Sign Nikahit ..Khmer Sign Nikahit [2]u21{ 0x17c9, 0x17d3, }, // Khmer Sign Muusikatoan ..Khmer Sign Bathamasat [2]u21{ 0x17dd, 0x17dd, }, // Khmer Sign Atthacan ..Khmer Sign Atthacan [2]u21{ 0x180b, 0x180d, }, // Mongolian Free Variation..Mongolian Free Variation [2]u21{ 0x1885, 0x1886, }, // Mongolian Letter Ali Gal..Mongolian Letter Ali Gal [2]u21{ 0x18a9, 0x18a9, }, // Mongolian Letter Ali Gal..Mongolian Letter Ali Gal [2]u21{ 0x1920, 0x1922, }, // Limbu Vowel Sign A ..Limbu Vowel Sign U [2]u21{ 0x1927, 0x1928, }, // Limbu Vowel Sign E ..Limbu Vowel Sign O [2]u21{ 0x1932, 0x1932, }, // Limbu Small Letter Anusv..Limbu Small Letter Anusv [2]u21{ 0x1939, 0x193b, }, // Limbu Sign Mukphreng ..Limbu Sign Sa-i [2]u21{ 0x1a17, 0x1a18, }, // Buginese Vowel Sign I ..Buginese Vowel Sign U [2]u21{ 0x1a1b, 0x1a1b, }, // Buginese Vowel Sign Ae ..Buginese Vowel Sign Ae [2]u21{ 0x1a56, 0x1a56, }, // Tai Tham Consonant Sign ..Tai Tham Consonant Sign [2]u21{ 0x1a58, 0x1a5e, }, // Tai Tham Sign Mai Kang L..Tai Tham Consonant Sign [2]u21{ 0x1a60, 0x1a60, }, // Tai Tham Sign Sakot ..Tai Tham Sign Sakot [2]u21{ 0x1a62, 0x1a62, }, // Tai Tham Vowel Sign Mai ..Tai Tham Vowel Sign Mai [2]u21{ 0x1a65, 0x1a6c, }, // Tai Tham Vowel Sign I ..Tai Tham Vowel Sign Oa B [2]u21{ 0x1a73, 0x1a7c, }, // Tai Tham Vowel Sign Oa A..Tai Tham Sign Khuen-lue [2]u21{ 0x1a7f, 0x1a7f, }, // Tai Tham Combining Crypt..Tai Tham Combining Crypt [2]u21{ 0x1ab0, 0x1ac0, }, // Combining Doubled Circum.. [2]u21{ 0x1b00, 0x1b03, }, // Balinese Sign Ulu Ricem ..Balinese Sign Surang [2]u21{ 0x1b34, 0x1b34, }, // Balinese Sign Rerekan ..Balinese Sign Rerekan [2]u21{ 0x1b36, 0x1b3a, }, // Balinese Vowel Sign Ulu ..Balinese Vowel Sign Ra R [2]u21{ 0x1b3c, 0x1b3c, }, // Balinese Vowel Sign La L..Balinese Vowel Sign La L [2]u21{ 0x1b42, 0x1b42, }, // Balinese Vowel Sign Pepe..Balinese Vowel Sign Pepe [2]u21{ 0x1b6b, 0x1b73, }, // Balinese Musical Symbol ..Balinese Musical Symbol [2]u21{ 0x1b80, 0x1b81, }, // Sundanese Sign Panyecek ..Sundanese Sign Panglayar [2]u21{ 0x1ba2, 0x1ba5, }, // Sundanese Consonant Sign..Sundanese Vowel Sign Pan [2]u21{ 0x1ba8, 0x1ba9, }, // Sundanese Vowel Sign Pam..Sundanese Vowel Sign Pan [2]u21{ 0x1bab, 0x1bad, }, // Sundanese Sign Virama ..Sundanese Consonant Sign [2]u21{ 0x1be6, 0x1be6, }, // Batak Sign Tompi ..Batak Sign Tompi [2]u21{ 0x1be8, 0x1be9, }, // Batak Vowel Sign Pakpak ..Batak Vowel Sign Ee [2]u21{ 0x1bed, 0x1bed, }, // Batak Vowel Sign Karo O ..Batak Vowel Sign Karo O [2]u21{ 0x1bef, 0x1bf1, }, // Batak Vowel Sign U For S..Batak Consonant Sign H [2]u21{ 0x1c2c, 0x1c33, }, // Lepcha Vowel Sign E ..Lepcha Consonant Sign T [2]u21{ 0x1c36, 0x1c37, }, // Lepcha Sign Ran ..Lepcha Sign Nukta [2]u21{ 0x1cd0, 0x1cd2, }, // Vedic Tone Karshana ..Vedic Tone Prenkha [2]u21{ 0x1cd4, 0x1ce0, }, // Vedic Sign Yajurvedic Mi..Vedic Tone Rigvedic Kash [2]u21{ 0x1ce2, 0x1ce8, }, // Vedic Sign Visarga Svari..Vedic Sign Visarga Anuda [2]u21{ 0x1ced, 0x1ced, }, // Vedic Sign Tiryak ..Vedic Sign Tiryak [2]u21{ 0x1cf4, 0x1cf4, }, // Vedic Tone Candra Above ..Vedic Tone Candra Above [2]u21{ 0x1cf8, 0x1cf9, }, // Vedic Tone Ring Above ..Vedic Tone Double Ring A [2]u21{ 0x1dc0, 0x1df9, }, // Combining Dotted Grave A..Combining Wide Inverted [2]u21{ 0x1dfb, 0x1dff, }, // Combining Deletion Mark ..Combining Right Arrowhea [2]u21{ 0x20d0, 0x20f0, }, // Combining Left Harpoon A..Combining Asterisk Above [2]u21{ 0x2cef, 0x2cf1, }, // Coptic Combining Ni Abov..Coptic Combining Spiritu [2]u21{ 0x2d7f, 0x2d7f, }, // Tifinagh Consonant Joine..Tifinagh Consonant Joine [2]u21{ 0x2de0, 0x2dff, }, // Combining Cyrillic Lette..Combining Cyrillic Lette [2]u21{ 0x302a, 0x302d, }, // Ideographic Level Tone M..Ideographic Entering Ton [2]u21{ 0x3099, 0x309a, }, // Combining Katakana-hirag..Combining Katakana-hirag [2]u21{ 0xa66f, 0xa672, }, // Combining Cyrillic Vzmet..Combining Cyrillic Thous [2]u21{ 0xa674, 0xa67d, }, // Combining Cyrillic Lette..Combining Cyrillic Payer [2]u21{ 0xa69e, 0xa69f, }, // Combining Cyrillic Lette..Combining Cyrillic Lette [2]u21{ 0xa6f0, 0xa6f1, }, // Bamum Combining Mark Koq..Bamum Combining Mark Tuk [2]u21{ 0xa802, 0xa802, }, // Syloti Nagri Sign Dvisva..Syloti Nagri Sign Dvisva [2]u21{ 0xa806, 0xa806, }, // Syloti Nagri Sign Hasant..Syloti Nagri Sign Hasant [2]u21{ 0xa80b, 0xa80b, }, // Syloti Nagri Sign Anusva..Syloti Nagri Sign Anusva [2]u21{ 0xa825, 0xa826, }, // Syloti Nagri Vowel Sign ..Syloti Nagri Vowel Sign [2]u21{ 0xa82c, 0xa82c, }, // [2]u21{ nil } .. [2]u21{ 0xa8c4, 0xa8c5, }, // Saurashtra Sign Virama ..Saurashtra Sign Candrabi [2]u21{ 0xa8e0, 0xa8f1, }, // Combining Devanagari Dig..Combining Devanagari Sig [2]u21{ 0xa8ff, 0xa8ff, }, // Devanagari Vowel Sign Ay..Devanagari Vowel Sign Ay [2]u21{ 0xa926, 0xa92d, }, // Kayah Li Vowel Ue ..Kayah Li Tone Calya Plop [2]u21{ 0xa947, 0xa951, }, // Rejang Vowel Sign I ..Rejang Consonant Sign R [2]u21{ 0xa980, 0xa982, }, // Javanese Sign Panyangga ..Javanese Sign Layar [2]u21{ 0xa9b3, 0xa9b3, }, // Javanese Sign Cecak Telu..Javanese Sign Cecak Telu [2]u21{ 0xa9b6, 0xa9b9, }, // Javanese Vowel Sign Wulu..Javanese Vowel Sign Suku [2]u21{ 0xa9bc, 0xa9bd, }, // Javanese Vowel Sign Pepe..Javanese Consonant Sign [2]u21{ 0xa9e5, 0xa9e5, }, // Myanmar Sign Shan Saw ..Myanmar Sign Shan Saw [2]u21{ 0xaa29, 0xaa2e, }, // Cham Vowel Sign Aa ..Cham Vowel Sign Oe [2]u21{ 0xaa31, 0xaa32, }, // Cham Vowel Sign Au ..Cham Vowel Sign Ue [2]u21{ 0xaa35, 0xaa36, }, // Cham Consonant Sign La ..Cham Consonant Sign Wa [2]u21{ 0xaa43, 0xaa43, }, // Cham Consonant Sign Fina..Cham Consonant Sign Fina [2]u21{ 0xaa4c, 0xaa4c, }, // Cham Consonant Sign Fina..Cham Consonant Sign Fina [2]u21{ 0xaa7c, 0xaa7c, }, // Myanmar Sign Tai Laing T..Myanmar Sign Tai Laing T [2]u21{ 0xaab0, 0xaab0, }, // Tai Viet Mai Kang ..Tai Viet Mai Kang [2]u21{ 0xaab2, 0xaab4, }, // Tai Viet Vowel I ..Tai Viet Vowel U [2]u21{ 0xaab7, 0xaab8, }, // Tai Viet Mai Khit ..Tai Viet Vowel Ia [2]u21{ 0xaabe, 0xaabf, }, // Tai Viet Vowel Am ..Tai Viet Tone Mai Ek [2]u21{ 0xaac1, 0xaac1, }, // Tai Viet Tone Mai Tho ..Tai Viet Tone Mai Tho [2]u21{ 0xaaec, 0xaaed, }, // Meetei Mayek Vowel Sign ..Meetei Mayek Vowel Sign [2]u21{ 0xaaf6, 0xaaf6, }, // Meetei Mayek Virama ..Meetei Mayek Virama [2]u21{ 0xabe5, 0xabe5, }, // Meetei Mayek Vowel Sign ..Meetei Mayek Vowel Sign [2]u21{ 0xabe8, 0xabe8, }, // Meetei Mayek Vowel Sign ..Meetei Mayek Vowel Sign [2]u21{ 0xabed, 0xabed, }, // Meetei Mayek Apun Iyek ..Meetei Mayek Apun Iyek [2]u21{ 0xfb1e, 0xfb1e, }, // Hebrew Point Judeo-spani..Hebrew Point Judeo-spani [2]u21{ 0xfe00, 0xfe0f, }, // Variation Selector-1 ..Variation Selector-16 [2]u21{ 0xfe20, 0xfe2f, }, // Combining Ligature Left ..Combining Cyrillic Titlo [2]u21{ 0x101fd, 0x101fd, }, // Phaistos Disc Sign Combi..Phaistos Disc Sign Combi [2]u21{ 0x102e0, 0x102e0, }, // Coptic Epact Thousands M..Coptic Epact Thousands M [2]u21{ 0x10376, 0x1037a, }, // Combining Old Permic Let..Combining Old Permic Let [2]u21{ 0x10a01, 0x10a03, }, // Kharoshthi Vowel Sign I ..Kharoshthi Vowel Sign Vo [2]u21{ 0x10a05, 0x10a06, }, // Kharoshthi Vowel Sign E ..Kharoshthi Vowel Sign O [2]u21{ 0x10a0c, 0x10a0f, }, // Kharoshthi Vowel Length ..Kharoshthi Sign Visarga [2]u21{ 0x10a38, 0x10a3a, }, // Kharoshthi Sign Bar Abov..Kharoshthi Sign Dot Belo [2]u21{ 0x10a3f, 0x10a3f, }, // Kharoshthi Virama ..Kharoshthi Virama [2]u21{ 0x10ae5, 0x10ae6, }, // Manichaean Abbreviation ..Manichaean Abbreviation [2]u21{ 0x10d24, 0x10d27, }, // Hanifi Rohingya Sign Har..Hanifi Rohingya Sign Tas [2]u21{ 0x10eab, 0x10eac, }, // [2]u21{ nil } .. [2]u21{ 0x10f46, 0x10f50, }, // Sogdian Combining Dot Be..Sogdian Combining Stroke [2]u21{ 0x11001, 0x11001, }, // Brahmi Sign Anusvara ..Brahmi Sign Anusvara [2]u21{ 0x11038, 0x11046, }, // Brahmi Vowel Sign Aa ..Brahmi Virama [2]u21{ 0x1107f, 0x11081, }, // Brahmi Number Joiner ..Kaithi Sign Anusvara [2]u21{ 0x110b3, 0x110b6, }, // Kaithi Vowel Sign U ..Kaithi Vowel Sign Ai [2]u21{ 0x110b9, 0x110ba, }, // Kaithi Sign Virama ..Kaithi Sign Nukta [2]u21{ 0x11100, 0x11102, }, // Chakma Sign Candrabindu ..Chakma Sign Visarga [2]u21{ 0x11127, 0x1112b, }, // Chakma Vowel Sign A ..Chakma Vowel Sign Uu [2]u21{ 0x1112d, 0x11134, }, // Chakma Vowel Sign Ai ..Chakma Maayyaa [2]u21{ 0x11173, 0x11173, }, // Mahajani Sign Nukta ..Mahajani Sign Nukta [2]u21{ 0x11180, 0x11181, }, // Sharada Sign Candrabindu..Sharada Sign Anusvara [2]u21{ 0x111b6, 0x111be, }, // Sharada Vowel Sign U ..Sharada Vowel Sign O [2]u21{ 0x111c9, 0x111cc, }, // Sharada Sandhi Mark ..Sharada Extra Short Vowe [2]u21{ 0x111cf, 0x111cf, }, // [2]u21{ nil } .. [2]u21{ 0x1122f, 0x11231, }, // Khojki Vowel Sign U ..Khojki Vowel Sign Ai [2]u21{ 0x11234, 0x11234, }, // Khojki Sign Anusvara ..Khojki Sign Anusvara [2]u21{ 0x11236, 0x11237, }, // Khojki Sign Nukta ..Khojki Sign Shadda [2]u21{ 0x1123e, 0x1123e, }, // Khojki Sign Sukun ..Khojki Sign Sukun [2]u21{ 0x112df, 0x112df, }, // Khudawadi Sign Anusvara ..Khudawadi Sign Anusvara [2]u21{ 0x112e3, 0x112ea, }, // Khudawadi Vowel Sign U ..Khudawadi Sign Virama [2]u21{ 0x11300, 0x11301, }, // Grantha Sign Combining A..Grantha Sign Candrabindu [2]u21{ 0x1133b, 0x1133c, }, // Combining Bindu Below ..Grantha Sign Nukta [2]u21{ 0x11340, 0x11340, }, // Grantha Vowel Sign Ii ..Grantha Vowel Sign Ii [2]u21{ 0x11366, 0x1136c, }, // Combining Grantha Digit ..Combining Grantha Digit [2]u21{ 0x11370, 0x11374, }, // Combining Grantha Letter..Combining Grantha Letter [2]u21{ 0x11438, 0x1143f, }, // Newa Vowel Sign U ..Newa Vowel Sign Ai [2]u21{ 0x11442, 0x11444, }, // Newa Sign Virama ..Newa Sign Anusvara [2]u21{ 0x11446, 0x11446, }, // Newa Sign Nukta ..Newa Sign Nukta [2]u21{ 0x1145e, 0x1145e, }, // Newa Sandhi Mark ..Newa Sandhi Mark [2]u21{ 0x114b3, 0x114b8, }, // Tirhuta Vowel Sign U ..Tirhuta Vowel Sign Vocal [2]u21{ 0x114ba, 0x114ba, }, // Tirhuta Vowel Sign Short..Tirhuta Vowel Sign Short [2]u21{ 0x114bf, 0x114c0, }, // Tirhuta Sign Candrabindu..Tirhuta Sign Anusvara [2]u21{ 0x114c2, 0x114c3, }, // Tirhuta Sign Virama ..Tirhuta Sign Nukta [2]u21{ 0x115b2, 0x115b5, }, // Siddham Vowel Sign U ..Siddham Vowel Sign Vocal [2]u21{ 0x115bc, 0x115bd, }, // Siddham Sign Candrabindu..Siddham Sign Anusvara [2]u21{ 0x115bf, 0x115c0, }, // Siddham Sign Virama ..Siddham Sign Nukta [2]u21{ 0x115dc, 0x115dd, }, // Siddham Vowel Sign Alter..Siddham Vowel Sign Alter [2]u21{ 0x11633, 0x1163a, }, // Modi Vowel Sign U ..Modi Vowel Sign Ai [2]u21{ 0x1163d, 0x1163d, }, // Modi Sign Anusvara ..Modi Sign Anusvara [2]u21{ 0x1163f, 0x11640, }, // Modi Sign Virama ..Modi Sign Ardhacandra [2]u21{ 0x116ab, 0x116ab, }, // Takri Sign Anusvara ..Takri Sign Anusvara [2]u21{ 0x116ad, 0x116ad, }, // Takri Vowel Sign Aa ..Takri Vowel Sign Aa [2]u21{ 0x116b0, 0x116b5, }, // Takri Vowel Sign U ..Takri Vowel Sign Au [2]u21{ 0x116b7, 0x116b7, }, // Takri Sign Nukta ..Takri Sign Nukta [2]u21{ 0x1171d, 0x1171f, }, // Ahom Consonant Sign Medi..Ahom Consonant Sign Medi [2]u21{ 0x11722, 0x11725, }, // Ahom Vowel Sign I ..Ahom Vowel Sign Uu [2]u21{ 0x11727, 0x1172b, }, // Ahom Vowel Sign Aw ..Ahom Sign Killer [2]u21{ 0x1182f, 0x11837, }, // Dogra Vowel Sign U ..Dogra Sign Anusvara [2]u21{ 0x11839, 0x1183a, }, // Dogra Sign Virama ..Dogra Sign Nukta [2]u21{ 0x1193b, 0x1193c, }, // [2]u21{ nil } .. [2]u21{ 0x1193e, 0x1193e, }, // [2]u21{ nil } .. [2]u21{ 0x11943, 0x11943, }, // [2]u21{ nil } .. [2]u21{ 0x119d4, 0x119d7, }, // [2]u21{ nil } .. [2]u21{ 0x119da, 0x119db, }, // [2]u21{ nil } .. [2]u21{ 0x119e0, 0x119e0, }, // [2]u21{ nil } .. [2]u21{ 0x11a01, 0x11a0a, }, // Zanabazar Square Vowel S..Zanabazar Square Vowel L [2]u21{ 0x11a33, 0x11a38, }, // Zanabazar Square Final C..Zanabazar Square Sign An [2]u21{ 0x11a3b, 0x11a3e, }, // Zanabazar Square Cluster..Zanabazar Square Cluster [2]u21{ 0x11a47, 0x11a47, }, // Zanabazar Square Subjoin..Zanabazar Square Subjoin [2]u21{ 0x11a51, 0x11a56, }, // Soyombo Vowel Sign I ..Soyombo Vowel Sign Oe [2]u21{ 0x11a59, 0x11a5b, }, // Soyombo Vowel Sign Vocal..Soyombo Vowel Length Mar [2]u21{ 0x11a8a, 0x11a96, }, // Soyombo Final Consonant ..Soyombo Sign Anusvara [2]u21{ 0x11a98, 0x11a99, }, // Soyombo Gemination Mark ..Soyombo Subjoiner [2]u21{ 0x11c30, 0x11c36, }, // Bhaiksuki Vowel Sign I ..Bhaiksuki Vowel Sign Voc [2]u21{ 0x11c38, 0x11c3d, }, // Bhaiksuki Vowel Sign E ..Bhaiksuki Sign Anusvara [2]u21{ 0x11c3f, 0x11c3f, }, // Bhaiksuki Sign Virama ..Bhaiksuki Sign Virama [2]u21{ 0x11c92, 0x11ca7, }, // Marchen Subjoined Letter..Marchen Subjoined Letter [2]u21{ 0x11caa, 0x11cb0, }, // Marchen Subjoined Letter..Marchen Vowel Sign Aa [2]u21{ 0x11cb2, 0x11cb3, }, // Marchen Vowel Sign U ..Marchen Vowel Sign E [2]u21{ 0x11cb5, 0x11cb6, }, // Marchen Sign Anusvara ..Marchen Sign Candrabindu [2]u21{ 0x11d31, 0x11d36, }, // Masaram Gondi Vowel Sign..Masaram Gondi Vowel Sign [2]u21{ 0x11d3a, 0x11d3a, }, // Masaram Gondi Vowel Sign..Masaram Gondi Vowel Sign [2]u21{ 0x11d3c, 0x11d3d, }, // Masaram Gondi Vowel Sign..Masaram Gondi Vowel Sign [2]u21{ 0x11d3f, 0x11d45, }, // Masaram Gondi Vowel Sign..Masaram Gondi Virama [2]u21{ 0x11d47, 0x11d47, }, // Masaram Gondi Ra-kara ..Masaram Gondi Ra-kara [2]u21{ 0x11d90, 0x11d91, }, // Gunjala Gondi Vowel Sign..Gunjala Gondi Vowel Sign [2]u21{ 0x11d95, 0x11d95, }, // Gunjala Gondi Sign Anusv..Gunjala Gondi Sign Anusv [2]u21{ 0x11d97, 0x11d97, }, // Gunjala Gondi Virama ..Gunjala Gondi Virama [2]u21{ 0x11ef3, 0x11ef4, }, // Makasar Vowel Sign I ..Makasar Vowel Sign U [2]u21{ 0x16af0, 0x16af4, }, // Bassa Vah Combining High..Bassa Vah Combining High [2]u21{ 0x16b30, 0x16b36, }, // Pahawh Hmong Mark Cim Tu..Pahawh Hmong Mark Cim Ta [2]u21{ 0x16f4f, 0x16f4f, }, // [2]u21{ nil } .. [2]u21{ 0x16f8f, 0x16f92, }, // Miao Tone Right ..Miao Tone Below [2]u21{ 0x16fe4, 0x16fe4, }, // [2]u21{ nil } .. [2]u21{ 0x1bc9d, 0x1bc9e, }, // Duployan Thick Letter Se..Duployan Double Mark [2]u21{ 0x1d167, 0x1d169, }, // Musical Symbol Combining..Musical Symbol Combining [2]u21{ 0x1d17b, 0x1d182, }, // Musical Symbol Combining..Musical Symbol Combining [2]u21{ 0x1d185, 0x1d18b, }, // Musical Symbol Combining..Musical Symbol Combining [2]u21{ 0x1d1aa, 0x1d1ad, }, // Musical Symbol Combining..Musical Symbol Combining [2]u21{ 0x1d242, 0x1d244, }, // Combining Greek Musical ..Combining Greek Musical [2]u21{ 0x1da00, 0x1da36, }, // Signwriting Head Rim ..Signwriting Air Sucking [2]u21{ 0x1da3b, 0x1da6c, }, // Signwriting Mouth Closed..Signwriting Excitement [2]u21{ 0x1da75, 0x1da75, }, // Signwriting Upper Body T..Signwriting Upper Body T [2]u21{ 0x1da84, 0x1da84, }, // Signwriting Location Hea..Signwriting Location Hea [2]u21{ 0x1da9b, 0x1da9f, }, // Signwriting Fill Modifie..Signwriting Fill Modifie [2]u21{ 0x1daa1, 0x1daaf, }, // Signwriting Rotation Mod..Signwriting Rotation Mod [2]u21{ 0x1e000, 0x1e006, }, // Combining Glagolitic Let..Combining Glagolitic Let [2]u21{ 0x1e008, 0x1e018, }, // Combining Glagolitic Let..Combining Glagolitic Let [2]u21{ 0x1e01b, 0x1e021, }, // Combining Glagolitic Let..Combining Glagolitic Let [2]u21{ 0x1e023, 0x1e024, }, // Combining Glagolitic Let..Combining Glagolitic Let [2]u21{ 0x1e026, 0x1e02a, }, // Combining Glagolitic Let..Combining Glagolitic Let [2]u21{ 0x1e130, 0x1e136, }, // [2]u21{ nil } .. [2]u21{ 0x1e2ec, 0x1e2ef, }, // [2]u21{ nil } .. [2]u21{ 0x1e8d0, 0x1e8d6, }, // Mende Kikakui Combining ..Mende Kikakui Combining [2]u21{ 0x1e944, 0x1e94a, }, // <NAME> ..Adlam Nukta [2]u21{ 0xe0100, 0xe01ef, }, // Variation Selector-17 ..Variation Selector-256 };
src/table_zero.zig
const x86 = @import("src/x86.zig"); const example = @import("example-hello.zig"); const SyscallLinux64 = example.SyscallLinux64; const STDOUT = example.STDOUT; const reg = x86.Operand.register; const imm = x86.Operand.immediate; const memRm = x86.Operand.memoryRmDef; const m64 = x86.Machine.init(.x64); // program data var data1: u64 align(16) = 0x4141414141414141; // "AAAAAAAA" var data2: u64 align(16) = 0x2020202020202020; var message = "hello world!\n".*; pub fn main() anyerror!void { const instr_list = [_]x86.Instruction { // Print the string hello world try m64.build2(.MOV, reg(.RAX), imm(SyscallLinux64.write)), try m64.build2(.MOV, reg(.RDI), imm(STDOUT)), try m64.build2(.MOV, reg(.RSI), imm(@ptrToInt(&message))), try m64.build2(.MOV, reg(.RDX), imm(message.len)), try m64.build0(.SYSCALL), // Use MM registers to flip case of "AAAAAAAA" string // Then move the string into [message] try m64.build2(.MOV, reg(.RAX), imm(@ptrToInt(&data1))), try m64.build2(.MOV, reg(.RBX), imm(@ptrToInt(&data2))), try m64.build2(.MOVD, reg(.MM0), memRm(.QWORD, .RAX, 0)), try m64.build2(.MOVD, reg(.MM1), memRm(.QWORD, .RBX, 0)), try m64.build2(.PADDB, reg(.MM0), reg(.MM1)), try m64.build2(.MOVQ, reg(.RAX), reg(.MM0)), try m64.build2(.MOV, reg(.RCX), imm(@ptrToInt(&message))), try m64.build2(.MOV, memRm(.QWORD, .RCX, 0), reg(.RAX)), // print modified message string, first 8 bytes should contain 'aaaaaaaa' try m64.build2(.MOV, reg(.RAX), imm(SyscallLinux64.write)), try m64.build2(.MOV, reg(.RDI), imm(STDOUT)), try m64.build2(.MOV, reg(.RSI), imm(@ptrToInt(&message))), try m64.build2(.MOV, reg(.RDX), imm(message.len)), try m64.build0(.SYSCALL), // invert the bytes again, first 8 bytes should now contain 'AAAAAAAA' try m64.build2(.PXOR, reg(.MM0), reg(.MM1)), try m64.build2(.MOV, reg(.RCX), imm(@ptrToInt(&message))), try m64.build2(.MOVQ, memRm(.QWORD, .RCX, 0), reg(.MM0)), // print the message again try m64.build2(.MOV, reg(.RAX), imm(SyscallLinux64.write)), try m64.build2(.MOV, reg(.RDI), imm(STDOUT)), try m64.build2(.MOV, reg(.RSI), imm(@ptrToInt(&message))), try m64.build2(.MOV, reg(.RDX), imm(message.len)), try m64.build0(.SYSCALL), // exit(0) try m64.build2(.MOV, reg(.RAX), imm(SyscallLinux64.exit)), try m64.build2(.MOV, reg(.RDI), imm(0)), try m64.build0(.SYSCALL), }; const buf = example.makeExecutableMemory(instr_list[0..]); const program = @ptrCast(fn () void, buf); program(); }
example-mmx.zig
const std = @import("std"); usingnamespace (@import("../machine.zig")); usingnamespace (@import("../util.zig")); // QuickRef: https://www.felixcloutier.com/x86/mov const reg = Operand.register; const regRm = Operand.registerRm; const mem = Operand.memoryDef; const memRm = Operand.memoryRmDef; const memRmSeg = Operand.memoryRm; const memRm8 = Operand.memoryRm8; const memSib = Operand.memorySibDef; const memSib8 = Operand.memorySib8; const imm = Operand.immediate; const imm8 = Operand.immediate8; const imm16 = Operand.immediate16; const imm32 = Operand.immediate32; const imm64 = Operand.immediate64; const immSigned = Operand.immediateSigned; const moffset8 = Operand.moffset8; const moffset16 = Operand.moffset16; const moffset32 = Operand.moffset32; const moffset64 = Operand.moffset64; test "mov x64 register" { const m16 = Machine.init(.x86_16); const m32 = Machine.init(.x86_32); const m64 = Machine.init(.x64); const rm8 = Operand.memoryRm(.DefaultSeg, .BYTE, .EAX, 0); const rm16 = Operand.memoryRm(.DefaultSeg, .WORD, .EAX, 0); const rm32 = Operand.memoryRm(.DefaultSeg, .DWORD, .EAX, 0); const rm64 = Operand.memoryRm(.DefaultSeg, .QWORD, .EAX, 0); const rm_mem8 = Operand.memoryRm(.DefaultSeg, .BYTE, .EAX, 0); const rm_mem16 = Operand.memoryRm(.DefaultSeg, .WORD, .EAX, 0); const rm_mem32 = Operand.memoryRm(.DefaultSeg, .DWORD, .EAX, 0); const rm_mem64 = Operand.memoryRm(.DefaultSeg, .QWORD, .EAX, 0); const moffs8_addr16 = moffset16(.DefaultSeg, .BYTE, 0); const moffs16_addr16 = moffset16(.DefaultSeg, .WORD, 0); const moffs32_addr16 = moffset16(.DefaultSeg, .DWORD, 0); const moffs64_addr16 = moffset16(.DefaultSeg, .QWORD, 0); const moffs8_addr32 = moffset32(.DefaultSeg, .BYTE, 0); const moffs16_addr32 = moffset32(.DefaultSeg, .WORD, 0); const moffs32_addr32 = moffset32(.DefaultSeg, .DWORD, 0); const moffs64_addr32 = moffset32(.DefaultSeg, .QWORD, 0); const moffs8_addr64 = moffset64(.DefaultSeg, .BYTE, 0); const moffs16_addr64 = moffset64(.DefaultSeg, .WORD, 0); const moffs32_addr64 = moffset64(.DefaultSeg, .DWORD, 0); const moffs64_addr64 = moffset64(.DefaultSeg, .QWORD, 0); debugPrint(false); { testOp2(m64, .MOV, reg(.AL), imm8(0), "B0 00"); testOp2(m64, .MOV, reg(.CL), imm8(0), "B1 00"); testOp2(m64, .MOV, reg(.DL), imm8(0), "B2 00"); testOp2(m64, .MOV, reg(.BL), imm8(0), "B3 00"); testOp2(m64, .MOV, reg(.AH), imm8(0), "B4 00"); testOp2(m64, .MOV, reg(.CH), imm8(0), "B5 00"); testOp2(m64, .MOV, reg(.DH), imm8(0), "B6 00"); testOp2(m64, .MOV, reg(.BH), imm8(0), "B7 00"); testOp2(m64, .MOV, reg(.SPL), imm8(0), "40 B4 00"); testOp2(m64, .MOV, reg(.BPL), imm8(0), "40 B5 00"); testOp2(m64, .MOV, reg(.SIL), imm8(0), "40 B6 00"); testOp2(m64, .MOV, reg(.DIL), imm8(0), "40 B7 00"); testOp2(m32, .MOV, reg(.SPL), imm8(0), AsmError.InvalidMode); testOp2(m32, .MOV, reg(.BPL), imm8(0), AsmError.InvalidMode); testOp2(m32, .MOV, reg(.SIL), imm8(0), AsmError.InvalidMode); testOp2(m32, .MOV, reg(.DIL), imm8(0), AsmError.InvalidMode); testOp2(m64, .MOV, reg(.MM0), imm8(0), AsmError.InvalidOperand); testOp2(m64, .MOV, reg(.XMM0), imm8(0), AsmError.InvalidOperand); testOp2(m64, .MOV, reg(.YMM0), imm8(0), AsmError.InvalidOperand); testOp2(m64, .MOV, reg(.ZMM0), imm8(0), AsmError.InvalidOperand); testOp2(m64, .MOV, reg(.CR0), imm8(0), AsmError.InvalidOperand); testOp2(m64, .MOV, reg(.DR0), imm8(0), AsmError.InvalidOperand); testOp2(m64, .MOV, reg(.DR0), imm8(0), AsmError.InvalidOperand); testOp2(m64, .MOV, reg(.SS), imm8(0), AsmError.InvalidOperand); testOp2(m64, .MOV, reg(.SS), imm8(0), AsmError.InvalidOperand); } { testOp2(m64, .MOV, reg(.SPL), imm8(0), "40 B4 00"); testOp2(m64, .MOV, reg(.AX), imm16(0x1100), "66 B8 00 11"); testOp2(m64, .MOV, reg(.EAX), imm32(0x33221100), "B8 00 11 22 33"); testOp2(m64, .MOV, reg(.RAX), imm64(0x7766554433221100), "48 B8 00 11 22 33 44 55 66 77"); // testOp2(m64, .MOV, reg(.RAX), imm(0), "B8 00 00 00 00"); testOp2(m64, .MOV, reg(.RAX), immSigned(0), "B8 00 00 00 00"); testOp2(m64, .MOV, reg(.RAX), imm(0x80000000), "B8 00 00 00 80"); testOp2(m64, .MOV, reg(.RAX), immSigned(-1), "48 B8 FFFF FFFF FFFF FFFF"); testOp2(m64, .MOV, reg(.RAX), immSigned(-0x8000), "48 B8 00 80 FFFF FFFF FFFF"); // testOp2(m64, .MOV, reg(.R9), immSigned(0x7766554433221100), "49 B9 00 11 22 33 44 55 66 77"); } { testOp2(m64, .MOV, reg(.AH), regRm(.SIL), AsmError.InvalidRegisterCombination); testOp2(m64, .MOV, reg(.MM0), reg(.RAX), AsmError.InvalidOperand); testOp2(m64, .MOV, reg(.YMM28), reg(.CR9), AsmError.InvalidOperand); testOp2(m64, .MOV, reg(.ST0), reg(.ST1), AsmError.InvalidOperand); testOp2(m64, .MOV, regRm(.ST3), regRm(.ST7), AsmError.InvalidOperand); testOp2(m64, .MOV, reg(.RAX), reg(.ST0), AsmError.InvalidOperand); testOp2(m64, .MOV, regRm(.XMM9), regRm(.YMM28), AsmError.InvalidOperand); testOp2(m64, .MOV, regRm(.ZMM31), reg(.SS), AsmError.InvalidOperand); testOp2(m64, .MOV, regRm(.CR0), regRm(.DR0), AsmError.InvalidOperand); } { testOp2(m64, .MOV, memSib(.BYTE, 1, .RAX, .RAX, 0), imm8(0), "C6 04 00 00"); testOp2(m64, .MOV, memSib(.WORD, 1, .EAX, .EAX, 0), imm16(0x1100), "66 67 C7 04 00 00 11"); testOp2(m64, .MOV, memSib(.DWORD, 1, .RAX, .RAX, 0), imm32(0x33221100), "C7 04 00 00 11 22 33"); testOp2(m64, .MOV, memSib(.QWORD, 1, .RAX, .RAX, 0), imm32(0x33221100), "48 C7 04 00 00 11 22 33"); // testOp2(m64, .MOV, memSib(.QWORD, 1, .RAX, .RAX, -1), imm32(0x33221100), "48 C7 44 00 ff 00 11 22 33"); testOp2(m64, .MOV, memSib(.QWORD, 1, .RAX, .RAX, -129), imm32(0x33221100), "48 C7 84 00 7f ff ff ff 00 11 22 33"); testOp2(m64, .MOV, memSib(.QWORD, 1, .RAX, .RAX, 0x80), imm32(0x33221100), "48 C7 84 00 80 00 00 00 00 11 22 33"); } { testOp2(m64, .MOV, memSib(.QWORD, 1, .RAX, .RAX, 0), reg(.RAX), "48 89 04 00"); testOp2(m64, .MOV, mem(.QWORD, 1, null, .RBP, 0), reg(.RAX), "48 89 45 00"); testOp2(m64, .MOV, mem(.QWORD, 1, null, .R13, 0), reg(.RAX), "49 89 45 00"); testOp2(m64, .MOV, mem(.QWORD, 4, .RSP, null, 0), reg(.RAX), AsmError.InvalidMemoryAddressing); testOp2(m64, .MOV, mem(.QWORD, 4, .RBP, null, 0), reg(.RAX), "48 89 04 ad 00 00 00 00"); testOp2(m64, .MOV, mem(.QWORD, 4, .R13, null, 0), reg(.RAX), "4a 89 04 ad 00 00 00 00"); testOp2(m64, .MOV, memSib8(.DefaultSeg, .QWORD, 4, .RBP, null, 0), reg(.RAX), AsmError.InvalidMemoryAddressing); testOp2(m64, .MOV, memSib8(.DefaultSeg, .QWORD, 1, null, null, 0), reg(.RAX), AsmError.InvalidMemoryAddressing); testOp2(m64, .MOV, memRm8(.DefaultSeg, .QWORD, .RSP, 0), reg(.RAX), AsmError.InvalidMemoryAddressing); } { testOp2(m64, .MOV, mem(.QWORD, 1, null, .RSP, 0), reg(.RAX), "48 89 04 24"); testOp2(m64, .MOV, memSib(.BYTE, 1, .RAX, .RAX, 0), reg(.AL), "88 04 00"); } { testOp2(m64, .MOV, reg(.AL), reg(.AL), "88 c0"); testOp2(m64, .MOV, reg(.AL), regRm(.AL), "8a c0"); testOp2(m64, .MOV, regRm(.AL), reg(.AL), "88 c0"); testOp2(m64, .MOV, regRm(.AL), reg(.R9B), "44 88 c8"); testOp2(m64, .MOV, regRm(.R9B), reg(.AL), "41 88 c1"); testOp2(m64, .MOV, regRm(.R9B), reg(.R15B), "45 88 f9"); testOp2(m64, .MOV, regRm(.R9B), regRm(.R15B), AsmError.InvalidOperand); } { testOp2(m64, .MOV, reg(.AX), memRmSeg(.FS, .WORD, .EAX, 0), "64 66 67 8b 00"); testOp2(m64, .MOV, memRmSeg(.GS, .BYTE, .EDI, 0x11), reg(.AH), "65 67 88 67 11"); testOp2(m64, .MOV, reg(.FS), memRmSeg(.GS, .WORD, .EDI, 0x33221100), "65 66 67 8e a7 00 11 22 33"); const op2 = Operand.memoryRm(.GS, .DWORD, .EDI, 0x33221100); testOp2(m64, .MOV, reg(.FS), op2, "65 67 8e a7 00 11 22 33"); } { const op2 = Operand.memoryRm(.GS, .QWORD, .EDI, 0x33221100); testOp2(m64, .MOV, reg(.FS), op2, "65 67 48 8e a7 00 11 22 33"); } { const op2 = Operand.memoryRm(.GS, .BYTE, .EDI, 0x33221100); testOp2(m64, .MOV, reg(.FS), op2, AsmError.InvalidOperand); } { testOp2(m64, .MOV, reg(.AL), moffset64(.DefaultSeg, .BYTE, 0x7766554433221100), "A0 00 11 22 33 44 55 66 77"); testOp2(m64, .MOV, reg(.AX), moffset64(.DefaultSeg, .WORD, 0x7766554433221100), "66 A1 00 11 22 33 44 55 66 77"); testOp2(m64, .MOV, reg(.EAX), moffset64(.DefaultSeg, .DWORD, 0x7766554433221100), "A1 00 11 22 33 44 55 66 77"); testOp2(m64, .MOV, reg(.RAX), moffset64(.DefaultSeg, .QWORD, 0x7766554433221100), "48 A1 00 11 22 33 44 55 66 77"); testOp2(m64, .MOV, moffset64(.DefaultSeg, .WORD, 0x7766554433221100), reg(.AX), "66 A3 00 11 22 33 44 55 66 77"); testOp2(m64, .MOV, moffset64(.DefaultSeg, .DWORD, 0x7766554433221100), reg(.EAX), "A3 00 11 22 33 44 55 66 77"); testOp2(m64, .MOV, moffset64(.DefaultSeg, .QWORD, 0x7766554433221100), reg(.RAX), "48 A3 00 11 22 33 44 55 66 77"); testOp2(m64, .MOV, moffset64(.DefaultSeg, .QWORD, 0x7766554433221100), reg(.AL), AsmError.InvalidOperand); } { // MOV testOp2(m64, .MOV, reg(.AL), rm8, "678a00"); testOp2(m64, .MOV, reg(.AX), rm16, "66678b00"); testOp2(m64, .MOV, reg(.EAX), rm32, "678b00"); testOp2(m64, .MOV, reg(.RAX), rm64, "67488b00"); // testOp2(m64, .MOV, rm8, reg(.AL), "678800"); testOp2(m64, .MOV, rm16, reg(.AX), "66678900"); testOp2(m64, .MOV, rm32, reg(.EAX), "678900"); testOp2(m64, .MOV, rm64, reg(.RAX), "67488900"); // testOp2(m64, .MOV, rm16, reg(.FS), "66678c20"); testOp2(m64, .MOV, rm32, reg(.FS), "678c20"); testOp2(m64, .MOV, rm64, reg(.FS), "67488c20"); // testOp2(m64, .MOV, reg(.FS), rm16, "66678e20"); testOp2(m64, .MOV, reg(.FS), rm32, "678e20"); testOp2(m64, .MOV, reg(.FS), rm64, "67488e20"); } { { testOp2(m16, .MOV, reg(.AL), moffs8_addr16, "a00000"); testOp2(m16, .MOV, reg(.AX), moffs16_addr16, "a10000"); testOp2(m16, .MOV, reg(.EAX), moffs32_addr16, "66a10000"); testOp2(m16, .MOV, reg(.RAX), moffs64_addr16, AsmError.InvalidOperand); // testOp2(m16, .MOV, moffs8_addr16, reg(.AL), "a20000"); testOp2(m16, .MOV, moffs16_addr16, reg(.AX), "a30000"); testOp2(m16, .MOV, moffs32_addr16, reg(.EAX), "66a30000"); testOp2(m16, .MOV, moffs64_addr16, reg(.RAX), AsmError.InvalidOperand); // testOp2(m16, .MOV, moffs8_addr32, reg(.AL), AsmError.InvalidOperand); testOp2(m16, .MOV, moffs8_addr64, reg(.AL), AsmError.InvalidOperand); } { testOp2(m32, .MOV, reg(.AL), moffs8_addr32, "a000000000"); testOp2(m32, .MOV, reg(.AX), moffs16_addr32, "66a100000000"); testOp2(m32, .MOV, reg(.EAX), moffs32_addr32, "a100000000"); testOp2(m32, .MOV, reg(.RAX), moffs64_addr32, AsmError.InvalidOperand); // testOp2(m32, .MOV, moffs8_addr32, reg(.AL), "a200000000"); testOp2(m32, .MOV, moffs16_addr32, reg(.AX), "66a300000000"); testOp2(m32, .MOV, moffs32_addr32, reg(.EAX), "a300000000"); testOp2(m32, .MOV, moffs64_addr32, reg(.RAX), AsmError.InvalidOperand); // testOp2(m32, .MOV, moffs8_addr16, reg(.AL), AsmError.InvalidOperand); testOp2(m32, .MOV, moffs8_addr64, reg(.AL), AsmError.InvalidOperand); } { testOp2(m64, .MOV, reg(.AL), moffs8_addr64, "a00000000000000000"); testOp2(m64, .MOV, reg(.AX), moffs16_addr64, "66a10000000000000000"); testOp2(m64, .MOV, reg(.EAX), moffs32_addr64, "a10000000000000000"); testOp2(m64, .MOV, reg(.RAX), moffs64_addr64, "48a10000000000000000"); // testOp2(m64, .MOV, moffs8_addr64, reg(.AL), "a20000000000000000"); testOp2(m64, .MOV, moffs16_addr64, reg(.AX), "66a30000000000000000"); testOp2(m64, .MOV, moffs32_addr64, reg(.EAX), "a30000000000000000"); testOp2(m64, .MOV, moffs64_addr64, reg(.RAX), "48a30000000000000000"); // testOp2(m64, .MOV, moffs8_addr16, reg(.AL), AsmError.InvalidOperand); testOp2(m64, .MOV, moffs8_addr32, reg(.AL), AsmError.InvalidOperand); } } { testOp2(m64, .MOV, reg(.AL), imm(0), "b000"); testOp2(m64, .MOV, reg(.AX), imm(0x7FFF), "66b8ff7f"); testOp2(m64, .MOV, reg(.EAX), imm(0x7FFFFFFF), "b8ffffff7f"); testOp2(m64, .MOV, reg(.RAX), imm(0x7FFFFFFF), "b8ffffff7f"); testOp2(m64, .MOV, reg(.RAX), imm(0x7FFFFFFFFFFFFFFF), "48b8ffffffffffffff7f"); // testOp2(m64, .MOV, rm8, imm(0), "67c60000"); testOp2(m64, .MOV, rm16, imm(0x7FFF), "6667c700ff7f"); testOp2(m64, .MOV, rm32, imm(0x7FFFFFFF), "67c700ffffff7f"); testOp2(m64, .MOV, rm64, imm(0x7FFFFFFF), "6748c700ffffff7f"); // 386 MOV to/from Control Registers testOp2(m64, .MOV, reg(.EAX), reg(.CR0), AsmError.InvalidOperand); testOp2(m64, .MOV, reg(.RAX), reg(.CR0), "0f20c0"); // testOp2(m64, .MOV, reg(.CR0), reg(.EAX), AsmError.InvalidOperand); testOp2(m64, .MOV, reg(.CR0), reg(.RAX), "0f22c0"); // 386 MOV to/from Debug Registers testOp2(m64, .MOV, reg(.EAX), reg(.DR0), AsmError.InvalidOperand); testOp2(m64, .MOV, reg(.RAX), reg(.DR0), "0f21c0"); // testOp2(m64, .MOV, reg(.DR0), reg(.EAX), AsmError.InvalidOperand); testOp2(m64, .MOV, reg(.DR0), reg(.RAX), "0f23c0"); } }
src/x86/tests/mov.zig
const std = @import("std"); const c = @import("c.zig").c; const glfw = @import("glfw"); const theme = @import("theme.zig"); // https://github.com/dwyl/english-words/ const words_raw = @embedFile("../res/wordlist.txt"); // swedish word list https://github.com/martinlindhe/wordlist_swedish pub fn main() !void { std.debug.print("-*- wordle helper -*-\n", .{}); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); var allocator = gpa.allocator(); var words = try std.ArrayList([kMaxWordLen+1]u8).initCapacity(allocator, 10000); var word_length: c_int = 5; try gatherWords(@intCast(usize, word_length), words_raw, &words); defer words.deinit(); var filtered_words = try words.clone(); defer filtered_words.deinit(); var rasterized_words = std.ArrayList(u8).init(allocator); try rasterizeWords(filtered_words, &rasterized_words); defer rasterized_words.deinit(); var filter = Filter.init(); var font: *c.ImFont = undefined; var run: bool = true; var display_size = c.ImVec2{ .x = 400, .y = 720, }; // setup glfw & imgui var window: glfw.Window = undefined; var context: *c.ImGuiContext = undefined; var io: *c.ImGuiIO = undefined; { try glfw.init(glfw.InitHints{}); window = try glfw.Window.create( @floatToInt(u32, display_size.x), @floatToInt(u32, display_size.y), "wordle helper", null, null, glfw.Window.Hints{ .context_version_major = 3, .context_version_minor = 0, }); try glfw.makeContextCurrent(window); try glfw.swapInterval(1); // vsync std.debug.print("imgui version: {s}\n", .{c.igGetVersion()}); context = c.igCreateContext(null); theme.setImguiTheme(&c.igGetStyle().*.Colors); if (!c.ImGui_ImplGlfw_InitForOpenGL(@ptrCast(*c.GLFWwindow, window.handle), true)) { std.debug.panic("", .{}); } const glsl_version = "#version 130"; if (!c.ImGui_ImplOpenGL3_Init(glsl_version)) { std.debug.panic("could not init opengl", .{}); } io = c.igGetIO(); var text_pixels: [*c]u8 = undefined; var text_w: i32 = undefined; var text_h: i32 = undefined; c.ImFontAtlas_GetTexDataAsRGBA32(io.Fonts, &text_pixels, &text_w, &text_h, null); font = c.ImFontAtlas_AddFontFromFileTTF(io.Fonts, "res/font/CascadiaMonoPL.ttf", 15.0, null, c.ImFontAtlas_GetGlyphRangesDefault(io.Fonts)); _ = c.ImFontAtlas_Build(io.Fonts); io.DisplaySize = display_size; io.DeltaTime = 1.0 / 60.0; } // run loop var show_demo_window = false; while (run) { if (glfw.pollEvents()) {} else |err| { std.debug.panic("failed to poll events: {}", .{err}); } // escape can exit the program var action: glfw.Action = window.getKey(glfw.Key.escape); if (action == glfw.Action.press or window.shouldClose()) { run = false; } c.ImGui_ImplOpenGL3_NewFrame(); c.ImGui_ImplGlfw_NewFrame(); c.igNewFrame(); c.igPushFont(font); /////////////////////////////////////////////////////////////////////////////// // YOUR CODE GOES HERE { var flags: c.ImGuiWindowFlags = c.ImGuiWindowFlags_NoTitleBar; flags |= c.ImGuiWindowFlags_NoMove; flags |= c.ImGuiWindowFlags_NoResize; flags |= c.ImGuiWindowFlags_NoCollapse; c.igSetNextWindowPos(c.ImVec2{ .x = 0, .y = 0 }, c.ImGuiCond_Always, c.ImVec2{ .x = 0, .y = 0 }); const wsize = try window.getSize(); const size = c.ImVec2{ .x = @intToFloat(f32, wsize.width), .y = @intToFloat(f32, wsize.height) }; c.igSetNextWindowSize(size, c.ImGuiCond_Always); _ = c.igBegin("main-window", null, flags); //var text_size: c.ImVec2 = undefined; //c.igCalcTextSize(&text_size, "toggle imgui demo", null, true, 1000.0); //if (c.igButton("toggle imgui demo", c.ImVec2{.x = text_size.x + 8, .y = text_size.y + 8})) { // show_demo_window = !show_demo_window; //} if (c.igSliderInt("word length", &word_length, 1, kMaxWordLen, null, 0)) { // user moved slider, recompute the list of words try gatherWords(@intCast(usize, word_length), words_raw, &words); try filterWords(words, &filtered_words, filter); try rasterizeWords(filtered_words, &rasterized_words); } c.igPushStyleColor_Vec4(c.ImGuiCol_Text, theme.green); if (c.igInputTextWithHint( "green letters", "> list green letters", @ptrCast([*c]u8, filter.green_letters[0..]), @intCast(usize, word_length+1), c.ImGuiInputTextFlags_CharsUppercase, null, null )) { // user entered a filter, filter the words! try filterWords(words, &filtered_words, filter); try rasterizeWords(filtered_words, &rasterized_words); } c.igPopStyleColor(1); c.igPushStyleColor_Vec4(c.ImGuiCol_Text, theme.yellow); if (c.igInputTextWithHint( "yellow letters", "> list yellow letters", @ptrCast([*c]u8, filter.yellow_letters[0..]), @intCast(usize, word_length+1), c.ImGuiInputTextFlags_CharsUppercase, null, null )) { // user entered a filter, filter the words! try filterWords(words, &filtered_words, filter); try rasterizeWords(filtered_words, &rasterized_words); } c.igPopStyleColor(1); c.igPushStyleColor_Vec4(c.ImGuiCol_Text, theme.base00); if (c.igInputTextWithHint( "gray letters", "> list gray letters", @ptrCast([*c]u8, filter.gray_letters[0..]), @intCast(usize, filter.gray_letters.len), c.ImGuiInputTextFlags_CharsUppercase, null, null )) { // user entered a filter, filter the words! try filterWords(words, &filtered_words, filter); try rasterizeWords(filtered_words, &rasterized_words); } c.igPopStyleColor(1); c.igSeparator(); c.igText("Found %i words.", filtered_words.items.len); c.igSeparator(); c.igTextUnformatted( @ptrCast([*c]const u8, rasterized_words.items), @ptrCast([*c]const u8, &rasterized_words.items[rasterized_words.items.len-1]) ); c.igEnd(); } // draw imgui's demo window if (show_demo_window) { c.igShowDemoWindow(&show_demo_window); } /////////////////////////////////////////////////////////////////////////////// c.igPopFont(); c.igRender(); if (window.getFramebufferSize()) |size| { c.glViewport(0, 0, @intCast(c_int, size.width), @intCast(c_int, size.height)); c.glClearColor(0.9, 0.9, 0.9, 0); c.glClear(c.GL_COLOR_BUFFER_BIT); c.ImGui_ImplOpenGL3_RenderDrawData(c.igGetDrawData()); } else |err| { std.debug.panic("failed to get frame buffer size: {}", .{err}); } if (window.swapBuffers()) {} else |err| { std.debug.panic("failed to swap buffers: {}", .{err}); } } // cleanup c.igDestroyContext(context); window.destroy(); glfw.terminate(); } const kMaxWordLen: usize = 6; fn gatherWords(word_len: usize, input: [:0]const u8, words: *std.ArrayList([kMaxWordLen+1]u8)) !void { std.debug.assert(word_len <= kMaxWordLen); words.clearRetainingCapacity(); var iter = std.mem.split(u8, input, "\n"); while (iter.next()) |line| { if (line.len > 0) { var adjust: usize = if (line[line.len-1] == 13) 1 else 0; if (line.len == word_len + adjust) { var buf: [kMaxWordLen+1]u8 = [_]u8{' '} ** (kMaxWordLen+1); buf[kMaxWordLen] = '\n'; for (line[0..line.len-adjust]) |l, i| { buf[i] = l; } try words.append(buf); } } } } fn filterWords(words: std.ArrayList([kMaxWordLen+1]u8), filtered_words: *std.ArrayList([kMaxWordLen+1]u8), filter: Filter) !void { filtered_words.clearRetainingCapacity(); try filtered_words.ensureTotalCapacity(words.items.len); for (words.items) |word| { var pass = true; // green for (word) |w, i| { if (filter.green_letters[i] == 0) break; if (filter.green_letters[i] != ' ' and (filter.green_letters[i] != w and filter.green_letters[i] + 32 != w)) { pass = false; break; } } // gray for (word) |w| { for (filter.gray_letters) |g| { if (g == 0) break; if (g == w or g +32 == w) { pass = false; break; } } } // yellow for (filter.yellow_letters) |y| { if (y == 0) break; var yellow_found = false; for (word) |w| { if (y == w or y + 32 == w) { yellow_found = true; break; } } if (!yellow_found) { pass = false; break; } } if (pass) { filtered_words.appendAssumeCapacity(word); } } } fn rasterizeWords(words: std.ArrayList([kMaxWordLen+1]u8), rasterized_words: *std.ArrayList(u8)) !void { rasterized_words.clearRetainingCapacity(); try rasterized_words.ensureTotalCapacity((kMaxWordLen+1) * words.items.len + 1); for (words.items) |word| { rasterized_words.appendSliceAssumeCapacity(word[0..word.len]); } rasterized_words.appendAssumeCapacity(0); } const Filter = struct { green_letters: [kMaxWordLen+1]u8, yellow_letters: [kMaxWordLen+1]u8, gray_letters: [30]u8, pub fn init() Filter { var filter = Filter{.green_letters = undefined, .gray_letters = undefined, .yellow_letters = undefined}; filter.green_letters = [_]u8{0} ** filter.green_letters.len; filter.yellow_letters = [_]u8{0} ** filter.yellow_letters.len; filter.gray_letters = [_]u8{0} ** filter.gray_letters.len; return filter; } };
src/main.zig
const std = @import("std"); // Enable different modules in ftmodule.h. // /include has config overrides. // Minor changes: // 1. Added "#include <freetype/internal/ftmmtypes.h>" to ttgxvar.h to fix "unknown type name 'GX_ItemVarStoreRec'" pub const pkg = std.build.Pkg{ .name = "freetype", .source = .{ .path = srcPath() ++ "/freetype.zig" }, }; pub fn addPackage(step: *std.build.LibExeObjStep) void { step.addPackage(pkg); step.addIncludeDir(srcPath() ++ "/include"); step.addIncludeDir(srcPath() ++ "/vendor/include"); step.linkLibC(); } pub fn buildAndLink(step: *std.build.LibExeObjStep) void { const target = step.target; const build_mode = step.build_mode; const b = step.builder; const lib = b.addStaticLibrary("freetype2", null); lib.setTarget(target); lib.setBuildMode(build_mode); lib.addIncludeDir(srcPath() ++ "/include"); lib.addIncludeDir(srcPath() ++ "/vendor/include"); lib.linkLibC(); var c_flags = std.ArrayList([]const u8).init(step.builder.allocator); c_flags.append("-DFT2_BUILD_LIBRARY") catch @panic("error"); if (build_mode == .Debug) { c_flags.append("-DFT_DEBUG_LEVEL_ERROR") catch @panic("error"); } const src_files: []const []const u8 = &.{ srcPath() ++ "/vendor/src/base/ftinit.c", srcPath() ++ "/vendor/src/base/ftsystem.c", srcPath() ++ "/vendor/src/base/ftobjs.c", srcPath() ++ "/vendor/src/base/ftstream.c", srcPath() ++ "/vendor/src/base/ftutil.c", srcPath() ++ "/vendor/src/base/ftdebug.c", srcPath() ++ "/vendor/src/base/ftgloadr.c", srcPath() ++ "/vendor/src/base/ftfntfmt.c", srcPath() ++ "/vendor/src/base/ftrfork.c", srcPath() ++ "/vendor/src/base/ftcalc.c", srcPath() ++ "/vendor/src/base/fttrigon.c", srcPath() ++ "/vendor/src/base/ftoutln.c", srcPath() ++ "/vendor/src/base/ftlcdfil.c", srcPath() ++ "/vendor/src/base/fterrors.c", srcPath() ++ "/vendor/src/base/ftbitmap.c", // ttf driver, depends on sfnt driver. srcPath() ++ "/vendor/src/truetype/ttdriver.c", srcPath() ++ "/vendor/src/truetype/ttgload.c", srcPath() ++ "/vendor/src/truetype/ttgxvar.c", srcPath() ++ "/vendor/src/truetype/ttinterp.c", srcPath() ++ "/vendor/src/truetype/ttobjs.c", srcPath() ++ "/vendor/src/truetype/ttpload.c", // sfnt driver. srcPath() ++ "/vendor/src/sfnt/sfdriver.c", srcPath() ++ "/vendor/src/sfnt/sfobjs.c", srcPath() ++ "/vendor/src/sfnt/ttload.c", srcPath() ++ "/vendor/src/sfnt/ttmtx.c", srcPath() ++ "/vendor/src/sfnt/ttkern.c", srcPath() ++ "/vendor/src/sfnt/ttcolr.c", srcPath() ++ "/vendor/src/sfnt/ttcmap.c", srcPath() ++ "/vendor/src/sfnt/ttcpal.c", srcPath() ++ "/vendor/src/sfnt/ttsvg.c", srcPath() ++ "/vendor/src/sfnt/ttsbit.c", srcPath() ++ "/vendor/src/sfnt/ttpost.c", // srcPath() ++ "/vendor/src/sfnt/sfwoff.c", // Renderers. srcPath() ++ "/vendor/src/smooth/smooth.c", srcPath() ++ "/vendor/src/smooth/ftgrays.c", }; lib.addCSourceFiles(src_files, c_flags.items); if (target.getOsTag() == .windows) { } else { } step.linkLibrary(lib); } fn srcPath() []const u8 { return std.fs.path.dirname(@src().file) orelse unreachable; }
lib/freetype2/lib.zig
const std = @import("std"); const stdx = @import("stdx"); const builtin = @import("builtin"); const platform = @import("platform.zig"); const KeyCode = platform.KeyCode; const KeyDownEvent = platform.KeyDownEvent; const KeyUpEvent = platform.KeyUpEvent; const MouseButton = platform.MouseButton; const MouseDownEvent = platform.MouseDownEvent; const MouseUpEvent = platform.MouseUpEvent; const MouseMoveEvent = platform.MouseMoveEvent; const MouseScrollEvent = platform.MouseScrollEvent; const WindowResizeEvent = platform.WindowResizeEvent; const FetchResultEvent = platform.FetchResultEvent; const sdl = @import("sdl"); const IsWasm = builtin.target.isWasm(); const log = stdx.log.scoped(.event_dispatcher); /// Responsible for transforming platform specific events and emitting them in a compatible format. /// Users can then register handlers for these events. pub const EventDispatcher = struct { const Self = @This(); quit_cbs: std.ArrayList(HandlerEntry(OnQuitHandler)), keydown_cbs: std.ArrayList(HandlerEntry(OnKeyDownHandler)), keyup_cbs: std.ArrayList(HandlerEntry(OnKeyUpHandler)), mousedown_cbs: std.ArrayList(HandlerEntry(OnMouseDownHandler)), mouseup_cbs: std.ArrayList(HandlerEntry(OnMouseUpHandler)), mousemove_cbs: std.ArrayList(HandlerEntry(OnMouseMoveHandler)), mousescroll_cbs: std.ArrayList(HandlerEntry(OnMouseScrollHandler)), winresize_cbs: std.ArrayList(HandlerEntry(OnWindowResizeHandler)), fetchresult_cbs: std.ArrayList(HandlerEntry(OnFetchResultHandler)), // Used for SDL to keep track of the current mouse pos. cur_mouse_x: i16, cur_mouse_y: i16, pub fn init(alloc: std.mem.Allocator) Self { return .{ .quit_cbs = std.ArrayList(HandlerEntry(OnQuitHandler)).init(alloc), .keydown_cbs = std.ArrayList(HandlerEntry(OnKeyDownHandler)).init(alloc), .keyup_cbs = std.ArrayList(HandlerEntry(OnKeyUpHandler)).init(alloc), .mousedown_cbs = std.ArrayList(HandlerEntry(OnMouseDownHandler)).init(alloc), .mouseup_cbs = std.ArrayList(HandlerEntry(OnMouseUpHandler)).init(alloc), .mousemove_cbs = std.ArrayList(HandlerEntry(OnMouseMoveHandler)).init(alloc), .mousescroll_cbs = std.ArrayList(HandlerEntry(OnMouseScrollHandler)).init(alloc), .winresize_cbs = std.ArrayList(HandlerEntry(OnWindowResizeHandler)).init(alloc), .fetchresult_cbs = std.ArrayList(HandlerEntry(OnFetchResultHandler)).init(alloc), .cur_mouse_x = 0, .cur_mouse_y = 0, }; } pub fn deinit(self: Self) void { self.quit_cbs.deinit(); self.keydown_cbs.deinit(); self.keyup_cbs.deinit(); self.mousedown_cbs.deinit(); self.mouseup_cbs.deinit(); self.mousemove_cbs.deinit(); self.mousescroll_cbs.deinit(); self.winresize_cbs.deinit(); self.fetchresult_cbs.deinit(); } /// It is recommended to process events before a Window.beginFrame since an event can trigger /// a user callback that alters the graphics buffer. eg. Resizing the window. pub fn processEvents(self: *Self) void { if (IsWasm) { processWasmEvents(self); } else { processSdlEvents(self); } } pub fn addOnQuit(self: *Self, ctx: ?*anyopaque, handler: OnQuitHandler) void { self.quit_cbs.append(.{ .ctx = ctx, .cb = handler }) catch unreachable; } pub fn removeOnQuit(self: *Self, handler: OnQuitHandler) void { for (self.quit_cbs.items) |it, idx| { if (it.cb == handler) { self.quit_cbs.orderedRemove(idx); } } } pub fn addOnKeyDown(self: *Self, ctx: ?*anyopaque, handler: OnKeyDownHandler) void { self.keydown_cbs.append(.{ .ctx = ctx, .cb = handler }) catch unreachable; } pub fn removeOnKeyDown(self: *Self, handler: OnKeyDownHandler) void { for (self.keydown_cbs.items) |it, idx| { if (it.cb == handler) { self.keydown_cbs.orderedRemove(idx); } } } pub fn addOnKeyUp(self: *Self, ctx: ?*anyopaque, handler: OnKeyUpHandler) void { self.keyup_cbs.append(.{ .ctx = ctx, .cb = handler }) catch unreachable; } pub fn removeOnKeyUp(self: *Self, handler: OnKeyUpHandler) void { for (self.keyup_cbs.items) |it, idx| { if (it.cb == handler) { self.keyup_cbs.orderedRemove(idx); } } } pub fn addOnMouseDown(self: *Self, ctx: ?*anyopaque, handler: OnMouseDownHandler) void { self.mousedown_cbs.append(.{ .ctx = ctx, .cb = handler }) catch unreachable; } pub fn removeOnMouseDown(self: *Self, handler: OnMouseDownHandler) void { for (self.mousedown_cbs.items) |it, idx| { if (it.cb == handler) { self.mousedown_cbs.orderedRemove(idx); } } } pub fn addOnMouseUp(self: *Self, ctx: ?*anyopaque, handler: OnMouseUpHandler) void { self.mouseup_cbs.append(.{ .ctx = ctx, .cb = handler }) catch unreachable; } pub fn removeOnMouseUp(self: *Self, handler: OnMouseUpHandler) void { for (self.mouseup_cbs.items) |it, idx| { if (it.cb == handler) { self.mouseup_cbs.orderedRemove(idx); } } } pub fn addOnMouseMove(self: *Self, ctx: ?*anyopaque, handler: OnMouseMoveHandler) void { self.mousemove_cbs.append(.{ .ctx = ctx, .cb = handler }) catch unreachable; } pub fn removeOnMouseMove(self: *Self, handler: OnMouseMoveHandler) void { for (self.mousemove_cbs.items) |it, idx| { if (it.cb == handler) { self.mousemove_cbs.orderedRemove(idx); } } } pub fn addOnMouseScroll(self: *Self, ctx: ?*anyopaque, handler: OnMouseScrollHandler) void { self.mousescroll_cbs.append(.{ .ctx = ctx, .cb = handler }) catch unreachable; } pub fn removeOnMouseScroll(self: *Self, handler: OnMouseScrollHandler) void { for (self.mousescroll_cbs.items) |it, idx| { if (it.cb == handler) { self.mousescroll_cbs.orderedRemove(idx); } } } pub fn addOnWindowResize(self: *Self, ctx: ?*anyopaque, handler: OnWindowResizeHandler) void { self.winresize_cbs.append(.{ .ctx = ctx, .cb = handler }) catch unreachable; } pub fn removeOnWindowResize(self: *Self, handler: OnWindowResizeHandler) void { for (self.winresize_cbs.items) |it, idx| { if (it.cb == handler) { self.winresize_cbs.orderedRemove(idx); } } } pub fn addOnFetchResult(self: *Self, ctx: ?*anyopaque, handler: OnFetchResultHandler) void { self.fetchresult_cbs.append(.{ .ctx = ctx, .cb = handler }) catch unreachable; } pub fn removeOnFetchResult(self: *Self, handler: OnFetchResultHandler) void { for (self.fetchresult_cbs.items) |it, idx| { if (it.cb == handler) { self.fetchresult_cbs.orderedRemove(idx); } } } }; fn processSdlEvents(dispatcher: *EventDispatcher) void { var event: sdl.SDL_Event = undefined; while (sdl.SDL_PollEvent(&event) != 0) { switch (event.@"type") { sdl.SDL_QUIT => { for (dispatcher.quit_cbs.items) |handler| { handler.cb(handler.ctx); } break; }, sdl.SDL_KEYDOWN => { const std_event = platform.initSdlKeyDownEvent(event.key); for (dispatcher.keydown_cbs.items) |handler| { handler.cb(handler.ctx, std_event); } }, sdl.SDL_KEYUP => { const std_event = platform.initSdlKeyUpEvent(event.key); for (dispatcher.keyup_cbs.items) |handler| { handler.cb(handler.ctx, std_event); } }, sdl.SDL_MOUSEBUTTONDOWN => { const std_event = platform.initSdlMouseDownEvent(event.button); for (dispatcher.mousedown_cbs.items) |handler| { const res = handler.cb(handler.ctx, std_event); if (res == .Stop) { break; } } }, sdl.SDL_MOUSEBUTTONUP => { const std_event = platform.initSdlMouseUpEvent(event.button); for (dispatcher.mouseup_cbs.items) |handler| { handler.cb(handler.ctx, std_event); } }, sdl.SDL_MOUSEMOTION => { if (dispatcher.mousemove_cbs.items.len > 0) { const std_event = platform.initSdlMouseMoveEvent(event.motion); for (dispatcher.mousemove_cbs.items) |handler| { handler.cb(handler.ctx, std_event); } } dispatcher.cur_mouse_x = @intCast(i16, event.motion.x); dispatcher.cur_mouse_y = @intCast(i16, event.motion.y); }, sdl.SDL_MOUSEWHEEL => { if (dispatcher.mousescroll_cbs.items.len > 0) { const std_event = platform.initSdlMouseScrollEvent(dispatcher.cur_mouse_x, dispatcher.cur_mouse_y, event.wheel); for (dispatcher.mousescroll_cbs.items) |handler| { handler.cb(handler.ctx, std_event); } } }, sdl.SDL_WINDOWEVENT => { switch (event.window.event) { sdl.SDL_WINDOWEVENT_HIDDEN => { // Minimized. // TODO: Don't perform drawing. }, sdl.SDL_WINDOWEVENT_SHOWN => { // Restored. // TODO: Reenable drawing. }, sdl.SDL_WINDOWEVENT_RESIZED => { const width = @intCast(u16, event.window.data1); const height = @intCast(u16, event.window.data2); const std_event = WindowResizeEvent.init(width, height); for (dispatcher.winresize_cbs.items) |handler| { handler.cb(handler.ctx, std_event); } }, else => {}, } }, else => {}, } } } /// Assumes the global wasm input buffer contains a valid slice of the commands to be processed. fn processWasmEvents(dispatcher: EventDispatcher) void { const Command = struct { const KeyDown = 1; const KeyUp = 2; const MouseDown = 3; const MouseUp = 4; const MouseMove = 5; const MouseScroll = 6; const WindowResize = 7; const FetchResult = 8; }; const input_buf = stdx.wasm.js_buffer.input_buf.items; // Process each command. var i: usize = 0; while (i < input_buf.len) { const ctype = input_buf[i]; switch (ctype) { Command.KeyDown => { const code = input_buf[i+1]; const mods = input_buf[i+2]; const repeat = input_buf[i+3] == 1; const std_code = platform.webToCanonicalKeyCode(code); const std_event = KeyDownEvent.initWithMods(std_code, mods, repeat); i += 4; for (dispatcher.keydown_cbs.items) |handler| { handler.cb(handler.ctx, std_event); } }, Command.KeyUp => { const code = input_buf[i+1]; const mods = input_buf[i+2]; const std_code = platform.webToCanonicalKeyCode(code); const std_event = KeyUpEvent.initWithMods(std_code, mods); i += 3; for (dispatcher.keyup_cbs.items) |handler| { handler.cb(handler.ctx, std_event); } }, Command.MouseDown => { const button = input_buf[i+1]; const x = std.mem.readIntLittle(i16, input_buf[i+2..i+4][0..2]); const y = std.mem.readIntLittle(i16, input_buf[i+4..i+6][0..2]); const clicks = input_buf[i+6]; const std_button = std.meta.intToEnum(MouseButton, button) catch stdx.debug.panicFmt("unsupported button: {}", .{button}); const std_event = MouseDownEvent.init(std_button, x, y, clicks); i += 7; for (dispatcher.mousedown_cbs.items) |handler| { const res = handler.cb(handler.ctx, std_event); if (res == .Stop) { break; } } }, Command.MouseUp => { const button = input_buf[i+1]; const x = std.mem.readIntLittle(i16, input_buf[i+2..i+4][0..2]); const y = std.mem.readIntLittle(i16, input_buf[i+4..i+6][0..2]); const clicks = input_buf[i+6]; const std_button = std.meta.intToEnum(MouseButton, button) catch stdx.debug.panicFmt("unsupported button: {}", .{button}); const std_event = MouseUpEvent.init(std_button, x, y, clicks); i += 7; for (dispatcher.mouseup_cbs.items) |handler| { handler.cb(handler.ctx, std_event); } }, Command.MouseMove => { if (dispatcher.mousemove_cbs.items.len > 0) { const x = std.mem.readIntLittle(i16, input_buf[i+1..i+3][0..2]); const y = std.mem.readIntLittle(i16, input_buf[i+3..i+5][0..2]); const std_event = MouseMoveEvent.init(x, y); for (dispatcher.mousemove_cbs.items) |handler| { handler.cb(handler.ctx, std_event); } } i += 5; }, Command.MouseScroll => { const x = std.mem.readIntLittle(i16, input_buf[i+1..i+3][0..2]); const y = std.mem.readIntLittle(i16, input_buf[i+3..i+5][0..2]); const delta_y = @bitCast(f32, std.mem.readIntLittle(u32, input_buf[i+5..i+9][0..4])); const std_event = MouseScrollEvent.init(x, y, delta_y); for (dispatcher.mousescroll_cbs.items) |handler| { handler.cb(handler.ctx, std_event); } i += 9; }, Command.WindowResize => { const width = std.mem.readIntLittle(u16, input_buf[i+1..i+3][0..2]); const height = std.mem.readIntLittle(u16, input_buf[i+3..i+5][0..2]); const std_event = WindowResizeEvent.init(width, height); i += 5; for (dispatcher.winresize_cbs.items) |handler| { handler.cb(handler.ctx, std_event); } }, Command.FetchResult => { const fetch_id = std.mem.readIntLittle(u32, input_buf[i+1..i+5][0..4]); const len = std.mem.readIntLittle(u32, input_buf[i+5..i+9][0..4]); const buf = input_buf[i+9..i+9+len]; const std_event = FetchResultEvent{ .fetch_id = fetch_id, .buf = buf, }; for (dispatcher.fetchresult_cbs.items) |handler| { handler.cb(handler.ctx, std_event); } i += 9 + len; }, else => { stdx.panicFmt("unknown command {}", .{ctype}); }, } } } fn HandlerEntry(comptime Handler: type) type { return struct { ctx: ?*anyopaque, cb: Handler, }; } const OnQuitHandler = fn (?*anyopaque) void; const OnKeyDownHandler = fn(?*anyopaque, KeyDownEvent) void; const OnKeyUpHandler = fn(?*anyopaque, KeyUpEvent) void; const OnMouseDownHandler = fn(?*anyopaque, MouseDownEvent) EventResult; const OnMouseUpHandler = fn(?*anyopaque, MouseUpEvent) void; const OnMouseMoveHandler = fn(?*anyopaque, MouseMoveEvent) void; const OnMouseScrollHandler = fn(?*anyopaque, MouseScrollEvent) void; const OnWindowResizeHandler = fn(?*anyopaque, WindowResizeEvent) void; const OnFetchResultHandler = fn(?*anyopaque, FetchResultEvent) void; pub const EventResult = enum(u1) { /// Event will continue to propagate down to children. Continue = 0, /// Stop the event from propagating to children. Stop = 1, };
platform/event_dispatcher.zig
const std = @import("std"); const DocumentStore = @import("document_store.zig"); const analysis = @import("analysis.zig"); const types = @import("types.zig"); const offsets = @import("offsets.zig"); const log = std.log.scoped(.references); const ast = std.zig.ast; fn tokenReference( handle: *DocumentStore.Handle, tok: ast.TokenIndex, encoding: offsets.Encoding, context: anytype, comptime handler: anytype, ) !void { const loc = offsets.tokenRelativeLocation(handle.tree, 0, handle.tree.tokens.items(.start)[tok], encoding) catch return; try handler(context, types.Location{ .uri = handle.uri(), .range = .{ .start = .{ .line = @intCast(i64, loc.line), .character = @intCast(i64, loc.column), }, .end = .{ .line = @intCast(i64, loc.line), .character = @intCast(i64, loc.column + offsets.tokenLength(handle.tree, tok, encoding)), }, }, }); } pub fn labelReferences( arena: *std.heap.ArenaAllocator, decl: analysis.DeclWithHandle, encoding: offsets.Encoding, include_decl: bool, context: anytype, comptime handler: anytype, ) !void { std.debug.assert(decl.decl.* == .label_decl); const handle = decl.handle; const tree = handle.tree; const token_tags = tree.tokens.items(.tag); // Find while / for / block from label -> iterate over children nodes, find break and continues, change their labels if they match. // This case can be implemented just by scanning tokens. const first_tok = tree.firstToken(decl.decl.label_decl); const last_tok = tree.firstToken(decl.decl.label_decl); if (include_decl) { // The first token is always going to be the label try tokenReference(handle, first_tok, encoding, context, handler); } var curr_tok = first_tok + 1; while (curr_tok < last_tok - 2) : (curr_tok += 1) { const curr_id = token_tags[curr_tok]; if ((curr_id == .keyword_break or curr_id == .keyword_continue) and token_tags[curr_tok + 1] == .colon and token_tags[curr_tok + 2] == .identifier) { if (std.mem.eql(u8, tree.tokenSlice(curr_tok + 2), tree.tokenSlice(first_tok))) { try tokenReference(handle, first_tok, encoding, context, handler); } } } } fn symbolReferencesInternal( arena: *std.heap.ArenaAllocator, store: *DocumentStore, node_handle: analysis.NodeWithHandle, decl: analysis.DeclWithHandle, encoding: offsets.Encoding, context: anytype, comptime handler: anytype, ) error{OutOfMemory}!void { const node = node_handle.node; const handle = node_handle.handle; const tree = handle.tree; if (node > tree.nodes.len) return; const node_tags = tree.nodes.items(.tag); const datas = tree.nodes.items(.data); const main_tokens = tree.nodes.items(.main_token); const starts = tree.tokens.items(.start); switch (node_tags[node]) { .block, .block_semicolon, .block_two, .block_two_semicolon => { const statements: []const ast.Node.Index = switch (node_tags[node]) { .block, .block_semicolon => tree.extra_data[datas[node].lhs..datas[node].rhs], .block_two, .block_two_semicolon => blk: { const statements = &[_]ast.Node.Index{ datas[node].lhs, datas[node].rhs }; const len: usize = if (datas[node].lhs == 0) @as(usize, 0) else if (datas[node].rhs == 0) @as(usize, 1) else @as(usize, 2); break :blk statements[0..len]; }, else => unreachable, }; for (statements) |stmt| try symbolReferencesInternal(arena, store, .{ .node = stmt, .handle = handle }, decl, encoding, context, handler); }, .container_decl, .container_decl_trailing, .container_decl_arg, .container_decl_arg_trailing, .container_decl_two, .container_decl_two_trailing, .tagged_union, .tagged_union_trailing, .tagged_union_two, .tagged_union_two_trailing, .tagged_union_enum_tag, .tagged_union_enum_tag_trailing, .root, .error_set_decl, => { var buf: [2]ast.Node.Index = undefined; for (analysis.declMembers(tree, node_tags[node], node, &buf)) |member| try symbolReferencesInternal(arena, store, .{ .node = member, .handle = handle }, decl, encoding, context, handler); }, .global_var_decl, .local_var_decl, .simple_var_decl, .aligned_var_decl, => { const var_decl = analysis.varDecl(tree, node).?; if (var_decl.ast.type_node != 0) { try symbolReferencesInternal(arena, store, .{ .node = var_decl.ast.type_node, .handle = handle }, decl, encoding, context, handler); } if (var_decl.ast.init_node != 0) { try symbolReferencesInternal(arena, store, .{ .node = var_decl.ast.init_node, .handle = handle }, decl, encoding, context, handler); } }, .@"usingnamespace" => { try symbolReferencesInternal(arena, store, .{ .node = datas[node].lhs, .handle = handle }, decl, encoding, context, handler); }, .container_field, .container_field_align, .container_field_init, => { const field = analysis.containerField(tree, node).?; if (field.ast.type_expr != 0) { try symbolReferencesInternal(arena, store, .{ .node = field.ast.type_expr, .handle = handle }, decl, encoding, context, handler); } if (field.ast.value_expr != 0) { try symbolReferencesInternal(arena, store, .{ .node = field.ast.value_expr, .handle = handle }, decl, encoding, context, handler); } }, .identifier => { if (try analysis.lookupSymbolGlobal(store, arena, handle, tree.getNodeSource(node), starts[main_tokens[node]])) |child| { if (std.meta.eql(decl, child)) { try tokenReference(handle, main_tokens[node], encoding, context, handler); } } }, .fn_proto, .fn_proto_multi, .fn_proto_one, .fn_proto_simple, .fn_decl, => { var buf: [1]ast.Node.Index = undefined; const fn_proto = analysis.fnProto(tree, node, &buf).?; var it = fn_proto.iterate(tree); while (it.next()) |param| { if (param.type_expr != 0) try symbolReferencesInternal(arena, store, .{ .node = param.type_expr, .handle = handle }, decl, encoding, context, handler); } if (fn_proto.ast.return_type != 0) { try symbolReferencesInternal(arena, store, .{ .node = fn_proto.ast.return_type, .handle = handle }, decl, encoding, context, handler); } if (fn_proto.ast.align_expr != 0) { try symbolReferencesInternal(arena, store, .{ .node = fn_proto.ast.align_expr, .handle = handle }, decl, encoding, context, handler); } if (fn_proto.ast.section_expr != 0) { try symbolReferencesInternal(arena, store, .{ .node = fn_proto.ast.section_expr, .handle = handle }, decl, encoding, context, handler); } if (fn_proto.ast.callconv_expr != 0) { try symbolReferencesInternal(arena, store, .{ .node = fn_proto.ast.callconv_expr, .handle = handle }, decl, encoding, context, handler); } if (node_tags[node] == .fn_decl) { try symbolReferencesInternal(arena, store, .{ .node = datas[node].rhs, .handle = handle }, decl, encoding, context, handler); } }, .anyframe_type => { try symbolReferencesInternal(arena, store, .{ .node = datas[node].rhs, .handle = handle }, decl, encoding, context, handler); }, .@"defer" => { try symbolReferencesInternal(arena, store, .{ .node = datas[node].rhs, .handle = handle }, decl, encoding, context, handler); }, .@"comptime" => { try symbolReferencesInternal(arena, store, .{ .node = datas[node].lhs, .handle = handle }, decl, encoding, context, handler); }, .@"nosuspend" => { try symbolReferencesInternal(arena, store, .{ .node = datas[node].lhs, .handle = handle }, decl, encoding, context, handler); }, .@"switch", .switch_comma, => { // TODO When renaming a union(enum) field, also rename switch items that refer to it. try symbolReferencesInternal(arena, store, .{ .node = datas[node].lhs, .handle = handle }, decl, encoding, context, handler); const extra = tree.extraData(datas[node].rhs, ast.Node.SubRange); const cases = tree.extra_data[extra.start..extra.end]; for (cases) |case| { try symbolReferencesInternal(arena, store, .{ .node = case, .handle = handle }, decl, encoding, context, handler); } }, .switch_case_one => { const case_one = tree.switchCaseOne(node); if (case_one.ast.target_expr != 0) try symbolReferencesInternal(arena, store, .{ .node = case_one.ast.target_expr, .handle = handle }, decl, encoding, context, handler); for (case_one.ast.values) |val| try symbolReferencesInternal(arena, store, .{ .node = val, .handle = handle }, decl, encoding, context, handler); }, .switch_case => { const case = tree.switchCase(node); if (case.ast.target_expr != 0) try symbolReferencesInternal(arena, store, .{ .node = case.ast.target_expr, .handle = handle }, decl, encoding, context, handler); for (case.ast.values) |val| try symbolReferencesInternal(arena, store, .{ .node = val, .handle = handle }, decl, encoding, context, handler); }, .@"while", .while_simple, .while_cont, .for_simple, .@"for", => { const loop: ast.full.While = switch (node_tags[node]) { .@"while" => tree.whileFull(node), .while_simple => tree.whileSimple(node), .while_cont => tree.whileCont(node), .for_simple => tree.forSimple(node), .@"for" => tree.forFull(node), else => unreachable, }; try symbolReferencesInternal(arena, store, .{ .node = loop.ast.cond_expr, .handle = handle }, decl, encoding, context, handler); if (loop.ast.cont_expr != 0) { try symbolReferencesInternal(arena, store, .{ .node = loop.ast.cont_expr, .handle = handle }, decl, encoding, context, handler); } try symbolReferencesInternal(arena, store, .{ .node = loop.ast.then_expr, .handle = handle }, decl, encoding, context, handler); if (loop.ast.else_expr != 0) { try symbolReferencesInternal(arena, store, .{ .node = loop.ast.else_expr, .handle = handle }, decl, encoding, context, handler); } }, .@"if", .if_simple, => { const if_node: ast.full.If = if (node_tags[node] == .@"if") tree.ifFull(node) else tree.ifSimple(node); try symbolReferencesInternal(arena, store, .{ .node = if_node.ast.cond_expr, .handle = handle }, decl, encoding, context, handler); try symbolReferencesInternal(arena, store, .{ .node = if_node.ast.then_expr, .handle = handle }, decl, encoding, context, handler); if (if_node.ast.else_expr != 0) { try symbolReferencesInternal(arena, store, .{ .node = if_node.ast.else_expr, .handle = handle }, decl, encoding, context, handler); } }, .array_type, .array_type_sentinel, => { try symbolReferencesInternal(arena, store, .{ .node = datas[node].lhs, .handle = handle }, decl, encoding, context, handler); try symbolReferencesInternal(arena, store, .{ .node = datas[node].rhs, .handle = handle }, decl, encoding, context, handler); }, .ptr_type, .ptr_type_aligned, .ptr_type_bit_range, .ptr_type_sentinel, => { const ptr_type = analysis.ptrType(tree, node).?; if (ptr_type.ast.align_node != 0) { try symbolReferencesInternal(arena, store, .{ .node = ptr_type.ast.align_node, .handle = handle }, decl, encoding, context, handler); if (node_tags[node] == .ptr_type_bit_range) { try symbolReferencesInternal(arena, store, .{ .node = ptr_type.ast.bit_range_start, .handle = handle, }, decl, encoding, context, handler); try symbolReferencesInternal(arena, store, .{ .node = ptr_type.ast.bit_range_end, .handle = handle, }, decl, encoding, context, handler); } } if (ptr_type.ast.sentinel != 0) { try symbolReferencesInternal(arena, store, .{ .node = ptr_type.ast.sentinel, .handle = handle }, decl, encoding, context, handler); } try symbolReferencesInternal(arena, store, .{ .node = ptr_type.ast.child_type, .handle = handle }, decl, encoding, context, handler); }, .address_of, .@"await", .bit_not, .bool_not, .optional_type, .negation, .negation_wrap, .@"resume", .@"try" => { try symbolReferencesInternal(arena, store, .{ .node = datas[node].lhs, .handle = handle }, decl, encoding, context, handler); }, .array_init, .array_init_comma, .array_init_dot, .array_init_dot_comma, .array_init_one, .array_init_one_comma, .array_init_dot_two, .array_init_dot_two_comma, => |n| { var buf: [2]ast.Node.Index = undefined; const array_init = switch (n) { .array_init, .array_init_comma => tree.arrayInit(node), .array_init_dot, .array_init_dot_comma => tree.arrayInitDot(node), .array_init_one, .array_init_one_comma => tree.arrayInitOne(buf[0..1], node), .array_init_dot_two, .array_init_dot_two_comma => tree.arrayInitDotTwo(&buf, node), else => unreachable, }; if (array_init.ast.type_expr != 0) try symbolReferencesInternal(arena, store, .{ .node = array_init.ast.type_expr, .handle = handle }, decl, encoding, context, handler); for (array_init.ast.elements) |e| try symbolReferencesInternal(arena, store, .{ .node = e, .handle = handle }, decl, encoding, context, handler); }, .struct_init, .struct_init_comma, .struct_init_dot, .struct_init_dot_comma, .struct_init_dot_two, .struct_init_dot_two_comma, .struct_init_one, .struct_init_one_comma, => |n| { var buf: [2]ast.Node.Index = undefined; const struct_init: ast.full.StructInit = switch (n) { .struct_init, .struct_init_comma => tree.structInit(node), .struct_init_dot, .struct_init_dot_comma => tree.structInitDot(node), .struct_init_one, .struct_init_one_comma => tree.structInitOne(buf[0..1], node), .struct_init_dot_two, .struct_init_dot_two_comma => tree.structInitDotTwo(&buf, node), else => unreachable, }; if (struct_init.ast.type_expr != 0) try symbolReferencesInternal(arena, store, .{ .node = struct_init.ast.type_expr, .handle = handle }, decl, encoding, context, handler); for (struct_init.ast.fields) |field| try symbolReferencesInternal(arena, store, .{ .node = field, .handle = handle }, decl, encoding, context, handler); }, .call, .call_comma, .call_one, .call_one_comma, .async_call, .async_call_comma, .async_call_one, .async_call_one_comma, => |c| { var buf: [1]ast.Node.Index = undefined; const call: ast.full.Call = switch (c) { .call, .call_comma, .async_call, .async_call_comma => tree.callFull(node), .call_one, .call_one_comma, .async_call_one, .async_call_one_comma => tree.callOne(&buf, node), else => unreachable, }; if (call.ast.fn_expr != 0) try symbolReferencesInternal(arena, store, .{ .node = call.ast.fn_expr, .handle = handle }, decl, encoding, context, handler); for (call.ast.params) |param| { try symbolReferencesInternal(arena, store, .{ .node = param, .handle = handle }, decl, encoding, context, handler); } }, .slice, .slice_sentinel, .slice_open, => |s| { const slice: ast.full.Slice = switch (s) { .slice => tree.slice(node), .slice_open => tree.sliceOpen(node), .slice_sentinel => tree.sliceSentinel(node), else => unreachable, }; try symbolReferencesInternal(arena, store, .{ .node = slice.ast.sliced, .handle = handle }, decl, encoding, context, handler); try symbolReferencesInternal(arena, store, .{ .node = slice.ast.start, .handle = handle }, decl, encoding, context, handler); if (slice.ast.end != 0) try symbolReferencesInternal(arena, store, .{ .node = slice.ast.end, .handle = handle }, decl, encoding, context, handler); if (slice.ast.sentinel != 0) try symbolReferencesInternal(arena, store, .{ .node = slice.ast.sentinel, .handle = handle }, decl, encoding, context, handler); }, .array_access => { try symbolReferencesInternal(arena, store, .{ .node = datas[node].lhs, .handle = handle }, decl, encoding, context, handler); try symbolReferencesInternal(arena, store, .{ .node = datas[node].rhs, .handle = handle }, decl, encoding, context, handler); }, .deref, .unwrap_optional, => { try symbolReferencesInternal(arena, store, .{ .node = datas[node].lhs, .handle = handle }, decl, encoding, context, handler); }, .grouped_expression => { try symbolReferencesInternal(arena, store, .{ .node = datas[node].lhs, .handle = handle }, decl, encoding, context, handler); }, .@"return", .@"break", .@"continue", => { if (datas[node].lhs != 0) { try symbolReferencesInternal(arena, store, .{ .node = datas[node].lhs, .handle = handle }, decl, encoding, context, handler); } }, .@"suspend" => { if (datas[node].lhs != 0) { try symbolReferencesInternal(arena, store, .{ .node = datas[node].lhs, .handle = handle }, decl, encoding, context, handler); } }, .builtin_call, .builtin_call_comma, .builtin_call_two, .builtin_call_two_comma, => |builtin_tag| { const data = datas[node]; const params = switch (builtin_tag) { .builtin_call, .builtin_call_comma => tree.extra_data[data.lhs..data.rhs], .builtin_call_two, .builtin_call_two_comma => if (data.lhs == 0) &[_]ast.Node.Index{} else if (data.rhs == 0) &[_]ast.Node.Index{data.lhs} else &[_]ast.Node.Index{ data.lhs, data.rhs }, else => unreachable, }; for (params) |param| try symbolReferencesInternal(arena, store, .{ .node = param, .handle = handle }, decl, encoding, context, handler); }, .@"asm", .asm_simple, => |a| { const _asm: ast.full.Asm = if (a == .@"asm") tree.asmFull(node) else tree.asmSimple(node); if (_asm.ast.items.len == 0) try symbolReferencesInternal(arena, store, .{ .node = _asm.ast.template, .handle = handle }, decl, encoding, context, handler); for (_asm.inputs) |input| try symbolReferencesInternal(arena, store, .{ .node = input, .handle = handle }, decl, encoding, context, handler); for (_asm.outputs) |output| try symbolReferencesInternal(arena, store, .{ .node = output, .handle = handle }, decl, encoding, context, handler); }, .test_decl => { try symbolReferencesInternal(arena, store, .{ .node = datas[node].rhs, .handle = handle }, decl, encoding, context, handler); }, .field_access => { try symbolReferencesInternal(arena, store, .{ .node = datas[node].lhs, .handle = handle }, decl, encoding, context, handler); const rhs_str = tree.tokenSlice(datas[node].rhs); var bound_type_params = analysis.BoundTypeParams.init(&arena.allocator); const left_type = try analysis.resolveFieldAccessLhsType( store, arena, (try analysis.resolveTypeOfNodeInternal(store, arena, .{ .node = datas[node].lhs, .handle = handle, }, &bound_type_params)) orelse return, &bound_type_params, ); const left_type_node = switch (left_type.type.data) { .other => |n| n, else => return, }; if (try analysis.lookupSymbolContainer( store, arena, .{ .node = left_type_node, .handle = left_type.handle }, rhs_str, !left_type.type.is_type_val, )) |child| { if (std.meta.eql(child, decl)) { try tokenReference(handle, datas[node].rhs, encoding, context, handler); } } }, .add, .add_wrap, .array_cat, .array_mult, .assign, .assign_bit_and, .assign_bit_or, .assign_bit_shift_left, .assign_bit_shift_right, .assign_bit_xor, .assign_div, .assign_sub, .assign_sub_wrap, .assign_mod, .assign_add, .assign_add_wrap, .assign_mul, .assign_mul_wrap, .bang_equal, .bit_and, .bit_or, .bit_shift_left, .bit_shift_right, .bit_xor, .bool_or, .div, .equal_equal, .error_union, .greater_or_equal, .greater_than, .less_or_equal, .less_than, .merge_error_sets, .mod, .mul, .mul_wrap, .switch_range, .sub, .sub_wrap, .@"orelse", => { try symbolReferencesInternal(arena, store, .{ .node = datas[node].lhs, .handle = handle }, decl, encoding, context, handler); try symbolReferencesInternal(arena, store, .{ .node = datas[node].rhs, .handle = handle }, decl, encoding, context, handler); }, else => {}, } } pub fn symbolReferences( arena: *std.heap.ArenaAllocator, store: *DocumentStore, decl_handle: analysis.DeclWithHandle, encoding: offsets.Encoding, include_decl: bool, context: anytype, comptime handler: anytype, skip_std_references: bool, ) !void { std.debug.assert(decl_handle.decl.* != .label_decl); const curr_handle = decl_handle.handle; switch (decl_handle.decl.*) { .ast_node => |decl_node| { var handles = std.ArrayList(*DocumentStore.Handle).init(&arena.allocator); var handle_it = store.handles.iterator(); while (handle_it.next()) |entry| { if (skip_std_references and std.mem.indexOf(u8, entry.key, "std") != null) { if (!include_decl or entry.value != curr_handle) continue; } try handles.append(entry.value); } for (handles.items) |handle| { if (include_decl and handle == curr_handle) { try tokenReference(curr_handle, decl_handle.nameToken(), encoding, context, handler); } try symbolReferencesInternal(arena, store, .{ .node = 0, .handle = handle }, decl_handle, encoding, context, handler); } }, .param_decl => |param| { // Rename the param tok. if (include_decl) { try tokenReference(curr_handle, decl_handle.nameToken(), encoding, context, handler); } const fn_node: ast.full.FnProto = loop: for (curr_handle.document_scope.scopes) |scope| { switch (scope.data) { .function => |proto| { var buf: [1]ast.Node.Index = undefined; const fn_proto = analysis.fnProto(curr_handle.tree, proto, &buf).?; var it = fn_proto.iterate(curr_handle.tree); while (it.next()) |candidate| { if (std.meta.eql(candidate, param)) { if (curr_handle.tree.nodes.items(.tag)[proto] == .fn_decl) { try symbolReferencesInternal( arena, store, .{ .node = curr_handle.tree.nodes.items(.data)[proto].rhs, .handle = curr_handle }, decl_handle, encoding, context, handler, ); } break :loop fn_proto; } } }, else => {}, } } else { log.warn("Could not find param decl's function", .{}); return; }; }, .pointer_payload, .switch_payload, .array_payload, .array_index => { if (include_decl) { try tokenReference(curr_handle, decl_handle.nameToken(), encoding, context, handler); } try symbolReferencesInternal(arena, store, .{ .node = 0, .handle = curr_handle }, decl_handle, encoding, context, handler); }, .label_decl => unreachable, } }
src/references.zig
const std = @import("../../std.zig"); const builtin = @import("builtin"); const assert = std.debug.assert; const mem = std.mem; const net = std.net; const os = std.os; const linux = os.linux; const testing = std.testing; const io_uring_params = linux.io_uring_params; const io_uring_sqe = linux.io_uring_sqe; const io_uring_cqe = linux.io_uring_cqe; pub const IO_Uring = struct { fd: os.fd_t = -1, sq: SubmissionQueue, cq: CompletionQueue, flags: u32, features: u32, /// A friendly way to setup an io_uring, with default io_uring_params. /// `entries` must be a power of two between 1 and 4096, although the kernel will make the final /// call on how many entries the submission and completion queues will ultimately have, /// see https://github.com/torvalds/linux/blob/v5.8/fs/io_uring.c#L8027-L8050. /// Matches the interface of io_uring_queue_init() in liburing. pub fn init(entries: u13, flags: u32) !IO_Uring { var params = mem.zeroInit(io_uring_params, .{ .flags = flags, .sq_thread_idle = 1000, }); return try IO_Uring.init_params(entries, &params); } /// A powerful way to setup an io_uring, if you want to tweak io_uring_params such as submission /// queue thread cpu affinity or thread idle timeout (the kernel and our default is 1 second). /// `params` is passed by reference because the kernel needs to modify the parameters. /// Matches the interface of io_uring_queue_init_params() in liburing. pub fn init_params(entries: u13, p: *io_uring_params) !IO_Uring { if (entries == 0) return error.EntriesZero; if (!std.math.isPowerOfTwo(entries)) return error.EntriesNotPowerOfTwo; assert(p.sq_entries == 0); assert(p.cq_entries == 0 or p.flags & linux.IORING_SETUP_CQSIZE != 0); assert(p.features == 0); assert(p.wq_fd == 0 or p.flags & linux.IORING_SETUP_ATTACH_WQ != 0); assert(p.resv[0] == 0); assert(p.resv[1] == 0); assert(p.resv[2] == 0); const res = linux.io_uring_setup(entries, p); switch (linux.getErrno(res)) { .SUCCESS => {}, .FAULT => return error.ParamsOutsideAccessibleAddressSpace, // The resv array contains non-zero data, p.flags contains an unsupported flag, // entries out of bounds, IORING_SETUP_SQ_AFF was specified without IORING_SETUP_SQPOLL, // or IORING_SETUP_CQSIZE was specified but io_uring_params.cq_entries was invalid: .INVAL => return error.ArgumentsInvalid, .MFILE => return error.ProcessFdQuotaExceeded, .NFILE => return error.SystemFdQuotaExceeded, .NOMEM => return error.SystemResources, // IORING_SETUP_SQPOLL was specified but effective user ID lacks sufficient privileges, // or a container seccomp policy prohibits io_uring syscalls: .PERM => return error.PermissionDenied, .NOSYS => return error.SystemOutdated, else => |errno| return os.unexpectedErrno(errno), } const fd = @intCast(os.fd_t, res); assert(fd >= 0); errdefer os.close(fd); // Kernel versions 5.4 and up use only one mmap() for the submission and completion queues. // This is not an optional feature for us... if the kernel does it, we have to do it. // The thinking on this by the kernel developers was that both the submission and the // completion queue rings have sizes just over a power of two, but the submission queue ring // is significantly smaller with u32 slots. By bundling both in a single mmap, the kernel // gets the submission queue ring for free. // See https://patchwork.kernel.org/patch/11115257 for the kernel patch. // We do not support the double mmap() done before 5.4, because we want to keep the // init/deinit mmap paths simple and because io_uring has had many bug fixes even since 5.4. if ((p.features & linux.IORING_FEAT_SINGLE_MMAP) == 0) { return error.SystemOutdated; } // Check that the kernel has actually set params and that "impossible is nothing". assert(p.sq_entries != 0); assert(p.cq_entries != 0); assert(p.cq_entries >= p.sq_entries); // From here on, we only need to read from params, so pass `p` by value as immutable. // The completion queue shares the mmap with the submission queue, so pass `sq` there too. var sq = try SubmissionQueue.init(fd, p.*); errdefer sq.deinit(); var cq = try CompletionQueue.init(fd, p.*, sq); errdefer cq.deinit(); // Check that our starting state is as we expect. assert(sq.head.* == 0); assert(sq.tail.* == 0); assert(sq.mask == p.sq_entries - 1); // Allow flags.* to be non-zero, since the kernel may set IORING_SQ_NEED_WAKEUP at any time. assert(sq.dropped.* == 0); assert(sq.array.len == p.sq_entries); assert(sq.sqes.len == p.sq_entries); assert(sq.sqe_head == 0); assert(sq.sqe_tail == 0); assert(cq.head.* == 0); assert(cq.tail.* == 0); assert(cq.mask == p.cq_entries - 1); assert(cq.overflow.* == 0); assert(cq.cqes.len == p.cq_entries); return IO_Uring{ .fd = fd, .sq = sq, .cq = cq, .flags = p.flags, .features = p.features, }; } pub fn deinit(self: *IO_Uring) void { assert(self.fd >= 0); // The mmaps depend on the fd, so the order of these calls is important: self.cq.deinit(); self.sq.deinit(); os.close(self.fd); self.fd = -1; } /// Returns a pointer to a vacant SQE, or an error if the submission queue is full. /// We follow the implementation (and atomics) of liburing's `io_uring_get_sqe()` exactly. /// However, instead of a null we return an error to force safe handling. /// Any situation where the submission queue is full tends more towards a control flow error, /// and the null return in liburing is more a C idiom than anything else, for lack of a better /// alternative. In Zig, we have first-class error handling... so let's use it. /// Matches the implementation of io_uring_get_sqe() in liburing. pub fn get_sqe(self: *IO_Uring) !*io_uring_sqe { const head = @atomicLoad(u32, self.sq.head, .Acquire); // Remember that these head and tail offsets wrap around every four billion operations. // We must therefore use wrapping addition and subtraction to avoid a runtime crash. const next = self.sq.sqe_tail +% 1; if (next -% head > self.sq.sqes.len) return error.SubmissionQueueFull; var sqe = &self.sq.sqes[self.sq.sqe_tail & self.sq.mask]; self.sq.sqe_tail = next; return sqe; } /// Submits the SQEs acquired via get_sqe() to the kernel. You can call this once after you have /// called get_sqe() multiple times to setup multiple I/O requests. /// Returns the number of SQEs submitted. /// Matches the implementation of io_uring_submit() in liburing. pub fn submit(self: *IO_Uring) !u32 { return self.submit_and_wait(0); } /// Like submit(), but allows waiting for events as well. /// Returns the number of SQEs submitted. /// Matches the implementation of io_uring_submit_and_wait() in liburing. pub fn submit_and_wait(self: *IO_Uring, wait_nr: u32) !u32 { const submitted = self.flush_sq(); var flags: u32 = 0; if (self.sq_ring_needs_enter(&flags) or wait_nr > 0) { if (wait_nr > 0 or (self.flags & linux.IORING_SETUP_IOPOLL) != 0) { flags |= linux.IORING_ENTER_GETEVENTS; } return try self.enter(submitted, wait_nr, flags); } return submitted; } /// Tell the kernel we have submitted SQEs and/or want to wait for CQEs. /// Returns the number of SQEs submitted. pub fn enter(self: *IO_Uring, to_submit: u32, min_complete: u32, flags: u32) !u32 { assert(self.fd >= 0); const res = linux.io_uring_enter(self.fd, to_submit, min_complete, flags, null); switch (linux.getErrno(res)) { .SUCCESS => {}, // The kernel was unable to allocate memory or ran out of resources for the request. // The application should wait for some completions and try again: .AGAIN => return error.SystemResources, // The SQE `fd` is invalid, or IOSQE_FIXED_FILE was set but no files were registered: .BADF => return error.FileDescriptorInvalid, // The file descriptor is valid, but the ring is not in the right state. // See io_uring_register(2) for how to enable the ring. .BADFD => return error.FileDescriptorInBadState, // The application attempted to overcommit the number of requests it can have pending. // The application should wait for some completions and try again: .BUSY => return error.CompletionQueueOvercommitted, // The SQE is invalid, or valid but the ring was setup with IORING_SETUP_IOPOLL: .INVAL => return error.SubmissionQueueEntryInvalid, // The buffer is outside the process' accessible address space, or IORING_OP_READ_FIXED // or IORING_OP_WRITE_FIXED was specified but no buffers were registered, or the range // described by `addr` and `len` is not within the buffer registered at `buf_index`: .FAULT => return error.BufferInvalid, .NXIO => return error.RingShuttingDown, // The kernel believes our `self.fd` does not refer to an io_uring instance, // or the opcode is valid but not supported by this kernel (more likely): .OPNOTSUPP => return error.OpcodeNotSupported, // The operation was interrupted by a delivery of a signal before it could complete. // This can happen while waiting for events with IORING_ENTER_GETEVENTS: .INTR => return error.SignalInterrupt, else => |errno| return os.unexpectedErrno(errno), } return @intCast(u32, res); } /// Sync internal state with kernel ring state on the SQ side. /// Returns the number of all pending events in the SQ ring, for the shared ring. /// This return value includes previously flushed SQEs, as per liburing. /// The rationale is to suggest that an io_uring_enter() call is needed rather than not. /// Matches the implementation of __io_uring_flush_sq() in liburing. pub fn flush_sq(self: *IO_Uring) u32 { if (self.sq.sqe_head != self.sq.sqe_tail) { // Fill in SQEs that we have queued up, adding them to the kernel ring. const to_submit = self.sq.sqe_tail -% self.sq.sqe_head; var tail = self.sq.tail.*; var i: usize = 0; while (i < to_submit) : (i += 1) { self.sq.array[tail & self.sq.mask] = self.sq.sqe_head & self.sq.mask; tail +%= 1; self.sq.sqe_head +%= 1; } // Ensure that the kernel can actually see the SQE updates when it sees the tail update. @atomicStore(u32, self.sq.tail, tail, .Release); } return self.sq_ready(); } /// Returns true if we are not using an SQ thread (thus nobody submits but us), /// or if IORING_SQ_NEED_WAKEUP is set and the SQ thread must be explicitly awakened. /// For the latter case, we set the SQ thread wakeup flag. /// Matches the implementation of sq_ring_needs_enter() in liburing. pub fn sq_ring_needs_enter(self: *IO_Uring, flags: *u32) bool { assert(flags.* == 0); if ((self.flags & linux.IORING_SETUP_SQPOLL) == 0) return true; if ((@atomicLoad(u32, self.sq.flags, .Unordered) & linux.IORING_SQ_NEED_WAKEUP) != 0) { flags.* |= linux.IORING_ENTER_SQ_WAKEUP; return true; } return false; } /// Returns the number of flushed and unflushed SQEs pending in the submission queue. /// In other words, this is the number of SQEs in the submission queue, i.e. its length. /// These are SQEs that the kernel is yet to consume. /// Matches the implementation of io_uring_sq_ready in liburing. pub fn sq_ready(self: *IO_Uring) u32 { // Always use the shared ring state (i.e. head and not sqe_head) to avoid going out of sync, // see https://github.com/axboe/liburing/issues/92. return self.sq.sqe_tail -% @atomicLoad(u32, self.sq.head, .Acquire); } /// Returns the number of CQEs in the completion queue, i.e. its length. /// These are CQEs that the application is yet to consume. /// Matches the implementation of io_uring_cq_ready in liburing. pub fn cq_ready(self: *IO_Uring) u32 { return @atomicLoad(u32, self.cq.tail, .Acquire) -% self.cq.head.*; } /// Copies as many CQEs as are ready, and that can fit into the destination `cqes` slice. /// If none are available, enters into the kernel to wait for at most `wait_nr` CQEs. /// Returns the number of CQEs copied, advancing the CQ ring. /// Provides all the wait/peek methods found in liburing, but with batching and a single method. /// The rationale for copying CQEs rather than copying pointers is that pointers are 8 bytes /// whereas CQEs are not much more at only 16 bytes, and this provides a safer faster interface. /// Safer, because you no longer need to call cqe_seen(), avoiding idempotency bugs. /// Faster, because we can now amortize the atomic store release to `cq.head` across the batch. /// See https://github.com/axboe/liburing/issues/103#issuecomment-686665007. /// Matches the implementation of io_uring_peek_batch_cqe() in liburing, but supports waiting. pub fn copy_cqes(self: *IO_Uring, cqes: []io_uring_cqe, wait_nr: u32) !u32 { const count = self.copy_cqes_ready(cqes, wait_nr); if (count > 0) return count; if (self.cq_ring_needs_flush() or wait_nr > 0) { _ = try self.enter(0, wait_nr, linux.IORING_ENTER_GETEVENTS); return self.copy_cqes_ready(cqes, wait_nr); } return 0; } fn copy_cqes_ready(self: *IO_Uring, cqes: []io_uring_cqe, wait_nr: u32) u32 { _ = wait_nr; const ready = self.cq_ready(); const count = std.math.min(cqes.len, ready); var head = self.cq.head.*; var tail = head +% count; // TODO Optimize this by using 1 or 2 memcpy's (if the tail wraps) rather than a loop. var i: usize = 0; // Do not use "less-than" operator since head and tail may wrap: while (head != tail) { cqes[i] = self.cq.cqes[head & self.cq.mask]; // Copy struct by value. head +%= 1; i += 1; } self.cq_advance(count); return count; } /// Returns a copy of an I/O completion, waiting for it if necessary, and advancing the CQ ring. /// A convenience method for `copy_cqes()` for when you don't need to batch or peek. pub fn copy_cqe(ring: *IO_Uring) !io_uring_cqe { var cqes: [1]io_uring_cqe = undefined; const count = try ring.copy_cqes(&cqes, 1); assert(count == 1); return cqes[0]; } /// Matches the implementation of cq_ring_needs_flush() in liburing. pub fn cq_ring_needs_flush(self: *IO_Uring) bool { return (@atomicLoad(u32, self.sq.flags, .Unordered) & linux.IORING_SQ_CQ_OVERFLOW) != 0; } /// For advanced use cases only that implement custom completion queue methods. /// If you use copy_cqes() or copy_cqe() you must not call cqe_seen() or cq_advance(). /// Must be called exactly once after a zero-copy CQE has been processed by your application. /// Not idempotent, calling more than once will result in other CQEs being lost. /// Matches the implementation of cqe_seen() in liburing. pub fn cqe_seen(self: *IO_Uring, cqe: *io_uring_cqe) void { _ = cqe; self.cq_advance(1); } /// For advanced use cases only that implement custom completion queue methods. /// Matches the implementation of cq_advance() in liburing. pub fn cq_advance(self: *IO_Uring, count: u32) void { if (count > 0) { // Ensure the kernel only sees the new head value after the CQEs have been read. @atomicStore(u32, self.cq.head, self.cq.head.* +% count, .Release); } } /// Queues (but does not submit) an SQE to perform an `fsync(2)`. /// Returns a pointer to the SQE so that you can further modify the SQE for advanced use cases. /// For example, for `fdatasync()` you can set `IORING_FSYNC_DATASYNC` in the SQE's `rw_flags`. /// N.B. While SQEs are initiated in the order in which they appear in the submission queue, /// operations execute in parallel and completions are unordered. Therefore, an application that /// submits a write followed by an fsync in the submission queue cannot expect the fsync to /// apply to the write, since the fsync may complete before the write is issued to the disk. /// You should preferably use `link_with_next_sqe()` on a write's SQE to link it with an fsync, /// or else insert a full write barrier using `drain_previous_sqes()` when queueing an fsync. pub fn fsync(self: *IO_Uring, user_data: u64, fd: os.fd_t, flags: u32) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_fsync(sqe, fd, flags); sqe.user_data = user_data; return sqe; } /// Queues (but does not submit) an SQE to perform a no-op. /// Returns a pointer to the SQE so that you can further modify the SQE for advanced use cases. /// A no-op is more useful than may appear at first glance. /// For example, you could call `drain_previous_sqes()` on the returned SQE, to use the no-op to /// know when the ring is idle before acting on a kill signal. pub fn nop(self: *IO_Uring, user_data: u64) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_nop(sqe); sqe.user_data = user_data; return sqe; } /// Queues (but does not submit) an SQE to perform a `read(2)`. /// Returns a pointer to the SQE. pub fn read( self: *IO_Uring, user_data: u64, fd: os.fd_t, buffer: []u8, offset: u64, ) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_read(sqe, fd, buffer, offset); sqe.user_data = user_data; return sqe; } /// Queues (but does not submit) an SQE to perform a `write(2)`. /// Returns a pointer to the SQE. pub fn write( self: *IO_Uring, user_data: u64, fd: os.fd_t, buffer: []const u8, offset: u64, ) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_write(sqe, fd, buffer, offset); sqe.user_data = user_data; return sqe; } /// Queues (but does not submit) an SQE to perform a `preadv()`. /// Returns a pointer to the SQE so that you can further modify the SQE for advanced use cases. /// For example, if you want to do a `preadv2()` then set `rw_flags` on the returned SQE. /// See https://linux.die.net/man/2/preadv. pub fn readv( self: *IO_Uring, user_data: u64, fd: os.fd_t, iovecs: []const os.iovec, offset: u64, ) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_readv(sqe, fd, iovecs, offset); sqe.user_data = user_data; return sqe; } /// Queues (but does not submit) an SQE to perform a IORING_OP_READ_FIXED. /// The `buffer` provided must be registered with the kernel by calling `register_buffers` first. /// The `buffer_index` must be the same as its index in the array provided to `register_buffers`. /// /// Returns a pointer to the SQE so that you can further modify the SQE for advanced use cases. pub fn read_fixed( self: *IO_Uring, user_data: u64, fd: os.fd_t, buffer: *os.iovec, offset: u64, buffer_index: u16, ) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_read_fixed(sqe, fd, buffer, offset, buffer_index); sqe.user_data = user_data; return sqe; } /// Queues (but does not submit) an SQE to perform a `pwritev()`. /// Returns a pointer to the SQE so that you can further modify the SQE for advanced use cases. /// For example, if you want to do a `pwritev2()` then set `rw_flags` on the returned SQE. /// See https://linux.die.net/man/2/pwritev. pub fn writev( self: *IO_Uring, user_data: u64, fd: os.fd_t, iovecs: []const os.iovec_const, offset: u64, ) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_writev(sqe, fd, iovecs, offset); sqe.user_data = user_data; return sqe; } /// Queues (but does not submit) an SQE to perform a IORING_OP_WRITE_FIXED. /// The `buffer` provided must be registered with the kernel by calling `register_buffers` first. /// The `buffer_index` must be the same as its index in the array provided to `register_buffers`. /// /// Returns a pointer to the SQE so that you can further modify the SQE for advanced use cases. pub fn write_fixed( self: *IO_Uring, user_data: u64, fd: os.fd_t, buffer: *os.iovec, offset: u64, buffer_index: u16, ) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_write_fixed(sqe, fd, buffer, offset, buffer_index); sqe.user_data = user_data; return sqe; } /// Queues (but does not submit) an SQE to perform an `accept4(2)` on a socket. /// Returns a pointer to the SQE. pub fn accept( self: *IO_Uring, user_data: u64, fd: os.fd_t, addr: *os.sockaddr, addrlen: *os.socklen_t, flags: u32, ) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_accept(sqe, fd, addr, addrlen, flags); sqe.user_data = user_data; return sqe; } /// Queue (but does not submit) an SQE to perform a `connect(2)` on a socket. /// Returns a pointer to the SQE. pub fn connect( self: *IO_Uring, user_data: u64, fd: os.fd_t, addr: *const os.sockaddr, addrlen: os.socklen_t, ) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_connect(sqe, fd, addr, addrlen); sqe.user_data = user_data; return sqe; } /// Queues (but does not submit) an SQE to perform a `epoll_ctl(2)`. /// Returns a pointer to the SQE. pub fn epoll_ctl( self: *IO_Uring, user_data: u64, epfd: os.fd_t, fd: os.fd_t, op: u32, ev: ?*linux.epoll_event, ) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_epoll_ctl(sqe, epfd, fd, op, ev); sqe.user_data = user_data; return sqe; } /// Queues (but does not submit) an SQE to perform a `recv(2)`. /// Returns a pointer to the SQE. pub fn recv( self: *IO_Uring, user_data: u64, fd: os.fd_t, buffer: []u8, flags: u32, ) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_recv(sqe, fd, buffer, flags); sqe.user_data = user_data; return sqe; } /// Queues (but does not submit) an SQE to perform a `send(2)`. /// Returns a pointer to the SQE. pub fn send( self: *IO_Uring, user_data: u64, fd: os.fd_t, buffer: []const u8, flags: u32, ) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_send(sqe, fd, buffer, flags); sqe.user_data = user_data; return sqe; } /// Queues (but does not submit) an SQE to perform an `openat(2)`. /// Returns a pointer to the SQE. pub fn openat( self: *IO_Uring, user_data: u64, fd: os.fd_t, path: [*:0]const u8, flags: u32, mode: os.mode_t, ) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_openat(sqe, fd, path, flags, mode); sqe.user_data = user_data; return sqe; } /// Queues (but does not submit) an SQE to perform a `close(2)`. /// Returns a pointer to the SQE. pub fn close(self: *IO_Uring, user_data: u64, fd: os.fd_t) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_close(sqe, fd); sqe.user_data = user_data; return sqe; } /// Queues (but does not submit) an SQE to register a timeout operation. /// Returns a pointer to the SQE. /// /// The timeout will complete when either the timeout expires, or after the specified number of /// events complete (if `count` is greater than `0`). /// /// `flags` may be `0` for a relative timeout, or `IORING_TIMEOUT_ABS` for an absolute timeout. /// /// The completion event result will be `-ETIME` if the timeout completed through expiration, /// `0` if the timeout completed after the specified number of events, or `-ECANCELED` if the /// timeout was removed before it expired. /// /// io_uring timeouts use the `CLOCK.MONOTONIC` clock source. pub fn timeout( self: *IO_Uring, user_data: u64, ts: *const os.linux.kernel_timespec, count: u32, flags: u32, ) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_timeout(sqe, ts, count, flags); sqe.user_data = user_data; return sqe; } /// Queues (but does not submit) an SQE to remove an existing timeout operation. /// Returns a pointer to the SQE. /// /// The timeout is identified by its `user_data`. /// /// The completion event result will be `0` if the timeout was found and cancelled successfully, /// `-EBUSY` if the timeout was found but expiration was already in progress, or /// `-ENOENT` if the timeout was not found. pub fn timeout_remove( self: *IO_Uring, user_data: u64, timeout_user_data: u64, flags: u32, ) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_timeout_remove(sqe, timeout_user_data, flags); sqe.user_data = user_data; return sqe; } /// Queues (but does not submit) an SQE to perform a `poll(2)`. /// Returns a pointer to the SQE. pub fn poll_add( self: *IO_Uring, user_data: u64, fd: os.fd_t, poll_mask: u32, ) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_poll_add(sqe, fd, poll_mask); sqe.user_data = user_data; return sqe; } /// Queues (but does not submit) an SQE to remove an existing poll operation. /// Returns a pointer to the SQE. pub fn poll_remove( self: *IO_Uring, user_data: u64, target_user_data: u64, ) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_poll_remove(sqe, target_user_data); sqe.user_data = user_data; return sqe; } /// Queues (but does not submit) an SQE to perform an `fallocate(2)`. /// Returns a pointer to the SQE. pub fn fallocate( self: *IO_Uring, user_data: u64, fd: os.fd_t, mode: i32, offset: u64, len: u64, ) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_fallocate(sqe, fd, mode, offset, len); sqe.user_data = user_data; return sqe; } /// Queues (but does not submit) an SQE to perform an `statx(2)`. /// Returns a pointer to the SQE. pub fn statx( self: *IO_Uring, user_data: u64, fd: os.fd_t, path: [:0]const u8, flags: u32, mask: u32, buf: *linux.Statx, ) !*io_uring_sqe { const sqe = try self.get_sqe(); io_uring_prep_statx(sqe, fd, path, flags, mask, buf); sqe.user_data = user_data; return sqe; } /// Registers an array of file descriptors. /// Every time a file descriptor is put in an SQE and submitted to the kernel, the kernel must /// retrieve a reference to the file, and once I/O has completed the file reference must be /// dropped. The atomic nature of this file reference can be a slowdown for high IOPS workloads. /// This slowdown can be avoided by pre-registering file descriptors. /// To refer to a registered file descriptor, IOSQE_FIXED_FILE must be set in the SQE's flags, /// and the SQE's fd must be set to the index of the file descriptor in the registered array. /// Registering file descriptors will wait for the ring to idle. /// Files are automatically unregistered by the kernel when the ring is torn down. /// An application need unregister only if it wants to register a new array of file descriptors. pub fn register_files(self: *IO_Uring, fds: []const os.fd_t) !void { assert(self.fd >= 0); const res = linux.io_uring_register( self.fd, .REGISTER_FILES, @ptrCast(*const c_void, fds.ptr), @intCast(u32, fds.len), ); try handle_registration_result(res); } /// Registers the file descriptor for an eventfd that will be notified of completion events on /// an io_uring instance. /// Only a single a eventfd can be registered at any given point in time. pub fn register_eventfd(self: *IO_Uring, fd: os.fd_t) !void { assert(self.fd >= 0); const res = linux.io_uring_register( self.fd, .REGISTER_EVENTFD, @ptrCast(*const c_void, &fd), 1, ); try handle_registration_result(res); } /// Registers the file descriptor for an eventfd that will be notified of completion events on /// an io_uring instance. Notifications are only posted for events that complete in an async manner. /// This means that events that complete inline while being submitted do not trigger a notification event. /// Only a single eventfd can be registered at any given point in time. pub fn register_eventfd_async(self: *IO_Uring, fd: os.fd_t) !void { assert(self.fd >= 0); const res = linux.io_uring_register( self.fd, .REGISTER_EVENTFD_ASYNC, @ptrCast(*const c_void, &fd), 1, ); try handle_registration_result(res); } /// Unregister the registered eventfd file descriptor. pub fn unregister_eventfd(self: *IO_Uring) !void { assert(self.fd >= 0); const res = linux.io_uring_register( self.fd, .UNREGISTER_EVENTFD, null, 0, ); try handle_registration_result(res); } /// Registers an array of buffers for use with `read_fixed` and `write_fixed`. pub fn register_buffers(self: *IO_Uring, buffers: []const os.iovec) !void { assert(self.fd >= 0); const res = linux.io_uring_register( self.fd, .REGISTER_BUFFERS, buffers.ptr, @intCast(u32, buffers.len), ); try handle_registration_result(res); } /// Unregister the registered buffers. pub fn unregister_buffers(self: *IO_Uring) !void { assert(self.fd >= 0); const res = linux.io_uring_register(self.fd, .UNREGISTER_BUFFERS, null, 0); switch (linux.getErrno(res)) { .SUCCESS => {}, .NXIO => return error.BuffersNotRegistered, else => |errno| return os.unexpectedErrno(errno), } } fn handle_registration_result(res: usize) !void { switch (linux.getErrno(res)) { .SUCCESS => {}, // One or more fds in the array are invalid, or the kernel does not support sparse sets: .BADF => return error.FileDescriptorInvalid, .BUSY => return error.FilesAlreadyRegistered, .INVAL => return error.FilesEmpty, // Adding `nr_args` file references would exceed the maximum allowed number of files the // user is allowed to have according to the per-user RLIMIT_NOFILE resource limit and // the CAP_SYS_RESOURCE capability is not set, or `nr_args` exceeds the maximum allowed // for a fixed file set (older kernels have a limit of 1024 files vs 64K files): .MFILE => return error.UserFdQuotaExceeded, // Insufficient kernel resources, or the caller had a non-zero RLIMIT_MEMLOCK soft // resource limit but tried to lock more memory than the limit permitted (not enforced // when the process is privileged with CAP_IPC_LOCK): .NOMEM => return error.SystemResources, // Attempt to register files on a ring already registering files or being torn down: .NXIO => return error.RingShuttingDownOrAlreadyRegisteringFiles, else => |errno| return os.unexpectedErrno(errno), } } /// Unregisters all registered file descriptors previously associated with the ring. pub fn unregister_files(self: *IO_Uring) !void { assert(self.fd >= 0); const res = linux.io_uring_register(self.fd, .UNREGISTER_FILES, null, 0); switch (linux.getErrno(res)) { .SUCCESS => {}, .NXIO => return error.FilesNotRegistered, else => |errno| return os.unexpectedErrno(errno), } } }; pub const SubmissionQueue = struct { head: *u32, tail: *u32, mask: u32, flags: *u32, dropped: *u32, array: []u32, sqes: []io_uring_sqe, mmap: []align(mem.page_size) u8, mmap_sqes: []align(mem.page_size) u8, // We use `sqe_head` and `sqe_tail` in the same way as liburing: // We increment `sqe_tail` (but not `tail`) for each call to `get_sqe()`. // We then set `tail` to `sqe_tail` once, only when these events are actually submitted. // This allows us to amortize the cost of the @atomicStore to `tail` across multiple SQEs. sqe_head: u32 = 0, sqe_tail: u32 = 0, pub fn init(fd: os.fd_t, p: io_uring_params) !SubmissionQueue { assert(fd >= 0); assert((p.features & linux.IORING_FEAT_SINGLE_MMAP) != 0); const size = std.math.max( p.sq_off.array + p.sq_entries * @sizeOf(u32), p.cq_off.cqes + p.cq_entries * @sizeOf(io_uring_cqe), ); const mmap = try os.mmap( null, size, os.PROT.READ | os.PROT.WRITE, os.MAP.SHARED | os.MAP.POPULATE, fd, linux.IORING_OFF_SQ_RING, ); errdefer os.munmap(mmap); assert(mmap.len == size); // The motivation for the `sqes` and `array` indirection is to make it possible for the // application to preallocate static io_uring_sqe entries and then replay them when needed. const size_sqes = p.sq_entries * @sizeOf(io_uring_sqe); const mmap_sqes = try os.mmap( null, size_sqes, os.PROT.READ | os.PROT.WRITE, os.MAP.SHARED | os.MAP.POPULATE, fd, linux.IORING_OFF_SQES, ); errdefer os.munmap(mmap_sqes); assert(mmap_sqes.len == size_sqes); const array = @ptrCast([*]u32, @alignCast(@alignOf(u32), &mmap[p.sq_off.array])); const sqes = @ptrCast([*]io_uring_sqe, @alignCast(@alignOf(io_uring_sqe), &mmap_sqes[0])); // We expect the kernel copies p.sq_entries to the u32 pointed to by p.sq_off.ring_entries, // see https://github.com/torvalds/linux/blob/v5.8/fs/io_uring.c#L7843-L7844. assert( p.sq_entries == @ptrCast(*u32, @alignCast(@alignOf(u32), &mmap[p.sq_off.ring_entries])).*, ); return SubmissionQueue{ .head = @ptrCast(*u32, @alignCast(@alignOf(u32), &mmap[p.sq_off.head])), .tail = @ptrCast(*u32, @alignCast(@alignOf(u32), &mmap[p.sq_off.tail])), .mask = @ptrCast(*u32, @alignCast(@alignOf(u32), &mmap[p.sq_off.ring_mask])).*, .flags = @ptrCast(*u32, @alignCast(@alignOf(u32), &mmap[p.sq_off.flags])), .dropped = @ptrCast(*u32, @alignCast(@alignOf(u32), &mmap[p.sq_off.dropped])), .array = array[0..p.sq_entries], .sqes = sqes[0..p.sq_entries], .mmap = mmap, .mmap_sqes = mmap_sqes, }; } pub fn deinit(self: *SubmissionQueue) void { os.munmap(self.mmap_sqes); os.munmap(self.mmap); } }; pub const CompletionQueue = struct { head: *u32, tail: *u32, mask: u32, overflow: *u32, cqes: []io_uring_cqe, pub fn init(fd: os.fd_t, p: io_uring_params, sq: SubmissionQueue) !CompletionQueue { assert(fd >= 0); assert((p.features & linux.IORING_FEAT_SINGLE_MMAP) != 0); const mmap = sq.mmap; const cqes = @ptrCast( [*]io_uring_cqe, @alignCast(@alignOf(io_uring_cqe), &mmap[p.cq_off.cqes]), ); assert(p.cq_entries == @ptrCast(*u32, @alignCast(@alignOf(u32), &mmap[p.cq_off.ring_entries])).*); return CompletionQueue{ .head = @ptrCast(*u32, @alignCast(@alignOf(u32), &mmap[p.cq_off.head])), .tail = @ptrCast(*u32, @alignCast(@alignOf(u32), &mmap[p.cq_off.tail])), .mask = @ptrCast(*u32, @alignCast(@alignOf(u32), &mmap[p.cq_off.ring_mask])).*, .overflow = @ptrCast(*u32, @alignCast(@alignOf(u32), &mmap[p.cq_off.overflow])), .cqes = cqes[0..p.cq_entries], }; } pub fn deinit(self: *CompletionQueue) void { _ = self; // A no-op since we now share the mmap with the submission queue. // Here for symmetry with the submission queue, and for any future feature support. } }; pub fn io_uring_prep_nop(sqe: *io_uring_sqe) void { sqe.* = .{ .opcode = .NOP, .flags = 0, .ioprio = 0, .fd = 0, .off = 0, .addr = 0, .len = 0, .rw_flags = 0, .user_data = 0, .buf_index = 0, .personality = 0, .splice_fd_in = 0, .__pad2 = [2]u64{ 0, 0 }, }; } pub fn io_uring_prep_fsync(sqe: *io_uring_sqe, fd: os.fd_t, flags: u32) void { sqe.* = .{ .opcode = .FSYNC, .flags = 0, .ioprio = 0, .fd = fd, .off = 0, .addr = 0, .len = 0, .rw_flags = flags, .user_data = 0, .buf_index = 0, .personality = 0, .splice_fd_in = 0, .__pad2 = [2]u64{ 0, 0 }, }; } pub fn io_uring_prep_rw( op: linux.IORING_OP, sqe: *io_uring_sqe, fd: os.fd_t, addr: u64, len: usize, offset: u64, ) void { sqe.* = .{ .opcode = op, .flags = 0, .ioprio = 0, .fd = fd, .off = offset, .addr = addr, .len = @intCast(u32, len), .rw_flags = 0, .user_data = 0, .buf_index = 0, .personality = 0, .splice_fd_in = 0, .__pad2 = [2]u64{ 0, 0 }, }; } pub fn io_uring_prep_read(sqe: *io_uring_sqe, fd: os.fd_t, buffer: []u8, offset: u64) void { io_uring_prep_rw(.READ, sqe, fd, @ptrToInt(buffer.ptr), buffer.len, offset); } pub fn io_uring_prep_write(sqe: *io_uring_sqe, fd: os.fd_t, buffer: []const u8, offset: u64) void { io_uring_prep_rw(.WRITE, sqe, fd, @ptrToInt(buffer.ptr), buffer.len, offset); } pub fn io_uring_prep_readv( sqe: *io_uring_sqe, fd: os.fd_t, iovecs: []const os.iovec, offset: u64, ) void { io_uring_prep_rw(.READV, sqe, fd, @ptrToInt(iovecs.ptr), iovecs.len, offset); } pub fn io_uring_prep_writev( sqe: *io_uring_sqe, fd: os.fd_t, iovecs: []const os.iovec_const, offset: u64, ) void { io_uring_prep_rw(.WRITEV, sqe, fd, @ptrToInt(iovecs.ptr), iovecs.len, offset); } pub fn io_uring_prep_read_fixed(sqe: *io_uring_sqe, fd: os.fd_t, buffer: *os.iovec, offset: u64, buffer_index: u16) void { io_uring_prep_rw(.READ_FIXED, sqe, fd, @ptrToInt(buffer.iov_base), buffer.iov_len, offset); sqe.buf_index = buffer_index; } pub fn io_uring_prep_write_fixed(sqe: *io_uring_sqe, fd: os.fd_t, buffer: *os.iovec, offset: u64, buffer_index: u16) void { io_uring_prep_rw(.WRITE_FIXED, sqe, fd, @ptrToInt(buffer.iov_base), buffer.iov_len, offset); sqe.buf_index = buffer_index; } pub fn io_uring_prep_accept( sqe: *io_uring_sqe, fd: os.fd_t, addr: *os.sockaddr, addrlen: *os.socklen_t, flags: u32, ) void { // `addr` holds a pointer to `sockaddr`, and `addr2` holds a pointer to socklen_t`. // `addr2` maps to `sqe.off` (u64) instead of `sqe.len` (which is only a u32). io_uring_prep_rw(.ACCEPT, sqe, fd, @ptrToInt(addr), 0, @ptrToInt(addrlen)); sqe.rw_flags = flags; } pub fn io_uring_prep_connect( sqe: *io_uring_sqe, fd: os.fd_t, addr: *const os.sockaddr, addrlen: os.socklen_t, ) void { // `addrlen` maps to `sqe.off` (u64) instead of `sqe.len` (which is only a u32). io_uring_prep_rw(.CONNECT, sqe, fd, @ptrToInt(addr), 0, addrlen); } pub fn io_uring_prep_epoll_ctl( sqe: *io_uring_sqe, epfd: os.fd_t, fd: os.fd_t, op: u32, ev: ?*linux.epoll_event, ) void { io_uring_prep_rw(.EPOLL_CTL, sqe, epfd, @ptrToInt(ev), op, @intCast(u64, fd)); } pub fn io_uring_prep_recv(sqe: *io_uring_sqe, fd: os.fd_t, buffer: []u8, flags: u32) void { io_uring_prep_rw(.RECV, sqe, fd, @ptrToInt(buffer.ptr), buffer.len, 0); sqe.rw_flags = flags; } pub fn io_uring_prep_send(sqe: *io_uring_sqe, fd: os.fd_t, buffer: []const u8, flags: u32) void { io_uring_prep_rw(.SEND, sqe, fd, @ptrToInt(buffer.ptr), buffer.len, 0); sqe.rw_flags = flags; } pub fn io_uring_prep_openat( sqe: *io_uring_sqe, fd: os.fd_t, path: [*:0]const u8, flags: u32, mode: os.mode_t, ) void { io_uring_prep_rw(.OPENAT, sqe, fd, @ptrToInt(path), mode, 0); sqe.rw_flags = flags; } pub fn io_uring_prep_close(sqe: *io_uring_sqe, fd: os.fd_t) void { sqe.* = .{ .opcode = .CLOSE, .flags = 0, .ioprio = 0, .fd = fd, .off = 0, .addr = 0, .len = 0, .rw_flags = 0, .user_data = 0, .buf_index = 0, .personality = 0, .splice_fd_in = 0, .__pad2 = [2]u64{ 0, 0 }, }; } pub fn io_uring_prep_timeout( sqe: *io_uring_sqe, ts: *const os.linux.kernel_timespec, count: u32, flags: u32, ) void { io_uring_prep_rw(.TIMEOUT, sqe, -1, @ptrToInt(ts), 1, count); sqe.rw_flags = flags; } pub fn io_uring_prep_timeout_remove(sqe: *io_uring_sqe, timeout_user_data: u64, flags: u32) void { sqe.* = .{ .opcode = .TIMEOUT_REMOVE, .flags = 0, .ioprio = 0, .fd = -1, .off = 0, .addr = timeout_user_data, .len = 0, .rw_flags = flags, .user_data = 0, .buf_index = 0, .personality = 0, .splice_fd_in = 0, .__pad2 = [2]u64{ 0, 0 }, }; } pub fn io_uring_prep_poll_add( sqe: *io_uring_sqe, fd: os.fd_t, poll_mask: u32, ) void { io_uring_prep_rw(.POLL_ADD, sqe, fd, @ptrToInt(@as(?*c_void, null)), 0, 0); sqe.rw_flags = std.mem.nativeToLittle(u32, poll_mask); } pub fn io_uring_prep_poll_remove( sqe: *io_uring_sqe, target_user_data: u64, ) void { io_uring_prep_rw(.POLL_REMOVE, sqe, -1, target_user_data, 0, 0); } pub fn io_uring_prep_fallocate( sqe: *io_uring_sqe, fd: os.fd_t, mode: i32, offset: u64, len: u64, ) void { sqe.* = .{ .opcode = .FALLOCATE, .flags = 0, .ioprio = 0, .fd = fd, .off = offset, .addr = len, .len = @intCast(u32, mode), .rw_flags = 0, .user_data = 0, .buf_index = 0, .personality = 0, .splice_fd_in = 0, .__pad2 = [2]u64{ 0, 0 }, }; } pub fn io_uring_prep_statx( sqe: *io_uring_sqe, fd: os.fd_t, path: [*:0]const u8, flags: u32, mask: u32, buf: *linux.Statx, ) void { io_uring_prep_rw(.STATX, sqe, fd, @ptrToInt(path), mask, @ptrToInt(buf)); sqe.rw_flags = flags; } test "structs/offsets/entries" { if (builtin.os.tag != .linux) return error.SkipZigTest; try testing.expectEqual(@as(usize, 120), @sizeOf(io_uring_params)); try testing.expectEqual(@as(usize, 64), @sizeOf(io_uring_sqe)); try testing.expectEqual(@as(usize, 16), @sizeOf(io_uring_cqe)); try testing.expectEqual(0, linux.IORING_OFF_SQ_RING); try testing.expectEqual(0x8000000, linux.IORING_OFF_CQ_RING); try testing.expectEqual(0x10000000, linux.IORING_OFF_SQES); try testing.expectError(error.EntriesZero, IO_Uring.init(0, 0)); try testing.expectError(error.EntriesNotPowerOfTwo, IO_Uring.init(3, 0)); } test "nop" { if (builtin.os.tag != .linux) return error.SkipZigTest; var ring = IO_Uring.init(1, 0) catch |err| switch (err) { error.SystemOutdated => return error.SkipZigTest, error.PermissionDenied => return error.SkipZigTest, else => return err, }; defer { ring.deinit(); testing.expectEqual(@as(os.fd_t, -1), ring.fd) catch @panic("test failed"); } const sqe = try ring.nop(0xaaaaaaaa); try testing.expectEqual(io_uring_sqe{ .opcode = .NOP, .flags = 0, .ioprio = 0, .fd = 0, .off = 0, .addr = 0, .len = 0, .rw_flags = 0, .user_data = 0xaaaaaaaa, .buf_index = 0, .personality = 0, .splice_fd_in = 0, .__pad2 = [2]u64{ 0, 0 }, }, sqe.*); try testing.expectEqual(@as(u32, 0), ring.sq.sqe_head); try testing.expectEqual(@as(u32, 1), ring.sq.sqe_tail); try testing.expectEqual(@as(u32, 0), ring.sq.tail.*); try testing.expectEqual(@as(u32, 0), ring.cq.head.*); try testing.expectEqual(@as(u32, 1), ring.sq_ready()); try testing.expectEqual(@as(u32, 0), ring.cq_ready()); try testing.expectEqual(@as(u32, 1), try ring.submit()); try testing.expectEqual(@as(u32, 1), ring.sq.sqe_head); try testing.expectEqual(@as(u32, 1), ring.sq.sqe_tail); try testing.expectEqual(@as(u32, 1), ring.sq.tail.*); try testing.expectEqual(@as(u32, 0), ring.cq.head.*); try testing.expectEqual(@as(u32, 0), ring.sq_ready()); try testing.expectEqual(io_uring_cqe{ .user_data = 0xaaaaaaaa, .res = 0, .flags = 0, }, try ring.copy_cqe()); try testing.expectEqual(@as(u32, 1), ring.cq.head.*); try testing.expectEqual(@as(u32, 0), ring.cq_ready()); const sqe_barrier = try ring.nop(0xbbbbbbbb); sqe_barrier.flags |= linux.IOSQE_IO_DRAIN; try testing.expectEqual(@as(u32, 1), try ring.submit()); try testing.expectEqual(io_uring_cqe{ .user_data = 0xbbbbbbbb, .res = 0, .flags = 0, }, try ring.copy_cqe()); try testing.expectEqual(@as(u32, 2), ring.sq.sqe_head); try testing.expectEqual(@as(u32, 2), ring.sq.sqe_tail); try testing.expectEqual(@as(u32, 2), ring.sq.tail.*); try testing.expectEqual(@as(u32, 2), ring.cq.head.*); } test "readv" { if (builtin.os.tag != .linux) return error.SkipZigTest; var ring = IO_Uring.init(1, 0) catch |err| switch (err) { error.SystemOutdated => return error.SkipZigTest, error.PermissionDenied => return error.SkipZigTest, else => return err, }; defer ring.deinit(); const fd = try os.openZ("/dev/zero", os.O.RDONLY | os.O.CLOEXEC, 0); defer os.close(fd); // Linux Kernel 5.4 supports IORING_REGISTER_FILES but not sparse fd sets (i.e. an fd of -1). // Linux Kernel 5.5 adds support for sparse fd sets. // Compare: // https://github.com/torvalds/linux/blob/v5.4/fs/io_uring.c#L3119-L3124 vs // https://github.com/torvalds/linux/blob/v5.8/fs/io_uring.c#L6687-L6691 // We therefore avoid stressing sparse fd sets here: var registered_fds = [_]os.fd_t{0} ** 1; const fd_index = 0; registered_fds[fd_index] = fd; try ring.register_files(registered_fds[0..]); var buffer = [_]u8{42} ** 128; var iovecs = [_]os.iovec{os.iovec{ .iov_base = &buffer, .iov_len = buffer.len }}; const sqe = try ring.readv(0xcccccccc, fd_index, iovecs[0..], 0); try testing.expectEqual(linux.IORING_OP.READV, sqe.opcode); sqe.flags |= linux.IOSQE_FIXED_FILE; try testing.expectError(error.SubmissionQueueFull, ring.nop(0)); try testing.expectEqual(@as(u32, 1), try ring.submit()); try testing.expectEqual(linux.io_uring_cqe{ .user_data = 0xcccccccc, .res = buffer.len, .flags = 0, }, try ring.copy_cqe()); try testing.expectEqualSlices(u8, &([_]u8{0} ** buffer.len), buffer[0..]); try ring.unregister_files(); } test "writev/fsync/readv" { if (builtin.os.tag != .linux) return error.SkipZigTest; var ring = IO_Uring.init(4, 0) catch |err| switch (err) { error.SystemOutdated => return error.SkipZigTest, error.PermissionDenied => return error.SkipZigTest, else => return err, }; defer ring.deinit(); const path = "test_io_uring_writev_fsync_readv"; const file = try std.fs.cwd().createFile(path, .{ .read = true, .truncate = true }); defer file.close(); defer std.fs.cwd().deleteFile(path) catch {}; const fd = file.handle; const buffer_write = [_]u8{42} ** 128; const iovecs_write = [_]os.iovec_const{ os.iovec_const{ .iov_base = &buffer_write, .iov_len = buffer_write.len }, }; var buffer_read = [_]u8{0} ** 128; var iovecs_read = [_]os.iovec{ os.iovec{ .iov_base = &buffer_read, .iov_len = buffer_read.len }, }; const sqe_writev = try ring.writev(0xdddddddd, fd, iovecs_write[0..], 17); try testing.expectEqual(linux.IORING_OP.WRITEV, sqe_writev.opcode); try testing.expectEqual(@as(u64, 17), sqe_writev.off); sqe_writev.flags |= linux.IOSQE_IO_LINK; const sqe_fsync = try ring.fsync(0xeeeeeeee, fd, 0); try testing.expectEqual(linux.IORING_OP.FSYNC, sqe_fsync.opcode); try testing.expectEqual(fd, sqe_fsync.fd); sqe_fsync.flags |= linux.IOSQE_IO_LINK; const sqe_readv = try ring.readv(0xffffffff, fd, iovecs_read[0..], 17); try testing.expectEqual(linux.IORING_OP.READV, sqe_readv.opcode); try testing.expectEqual(@as(u64, 17), sqe_readv.off); try testing.expectEqual(@as(u32, 3), ring.sq_ready()); try testing.expectEqual(@as(u32, 3), try ring.submit_and_wait(3)); try testing.expectEqual(@as(u32, 0), ring.sq_ready()); try testing.expectEqual(@as(u32, 3), ring.cq_ready()); try testing.expectEqual(linux.io_uring_cqe{ .user_data = 0xdddddddd, .res = buffer_write.len, .flags = 0, }, try ring.copy_cqe()); try testing.expectEqual(@as(u32, 2), ring.cq_ready()); try testing.expectEqual(linux.io_uring_cqe{ .user_data = 0xeeeeeeee, .res = 0, .flags = 0, }, try ring.copy_cqe()); try testing.expectEqual(@as(u32, 1), ring.cq_ready()); try testing.expectEqual(linux.io_uring_cqe{ .user_data = 0xffffffff, .res = buffer_read.len, .flags = 0, }, try ring.copy_cqe()); try testing.expectEqual(@as(u32, 0), ring.cq_ready()); try testing.expectEqualSlices(u8, buffer_write[0..], buffer_read[0..]); } test "write/read" { if (builtin.os.tag != .linux) return error.SkipZigTest; var ring = IO_Uring.init(2, 0) catch |err| switch (err) { error.SystemOutdated => return error.SkipZigTest, error.PermissionDenied => return error.SkipZigTest, else => return err, }; defer ring.deinit(); const path = "test_io_uring_write_read"; const file = try std.fs.cwd().createFile(path, .{ .read = true, .truncate = true }); defer file.close(); defer std.fs.cwd().deleteFile(path) catch {}; const fd = file.handle; const buffer_write = [_]u8{97} ** 20; var buffer_read = [_]u8{98} ** 20; const sqe_write = try ring.write(0x11111111, fd, buffer_write[0..], 10); try testing.expectEqual(linux.IORING_OP.WRITE, sqe_write.opcode); try testing.expectEqual(@as(u64, 10), sqe_write.off); sqe_write.flags |= linux.IOSQE_IO_LINK; const sqe_read = try ring.read(0x22222222, fd, buffer_read[0..], 10); try testing.expectEqual(linux.IORING_OP.READ, sqe_read.opcode); try testing.expectEqual(@as(u64, 10), sqe_read.off); try testing.expectEqual(@as(u32, 2), try ring.submit()); const cqe_write = try ring.copy_cqe(); const cqe_read = try ring.copy_cqe(); // Prior to Linux Kernel 5.6 this is the only way to test for read/write support: // https://lwn.net/Articles/809820/ if (cqe_write.err() == .INVAL) return error.SkipZigTest; if (cqe_read.err() == .INVAL) return error.SkipZigTest; try testing.expectEqual(linux.io_uring_cqe{ .user_data = 0x11111111, .res = buffer_write.len, .flags = 0, }, cqe_write); try testing.expectEqual(linux.io_uring_cqe{ .user_data = 0x22222222, .res = buffer_read.len, .flags = 0, }, cqe_read); try testing.expectEqualSlices(u8, buffer_write[0..], buffer_read[0..]); } test "write_fixed/read_fixed" { if (builtin.os.tag != .linux) return error.SkipZigTest; var ring = IO_Uring.init(2, 0) catch |err| switch (err) { error.SystemOutdated => return error.SkipZigTest, error.PermissionDenied => return error.SkipZigTest, else => return err, }; defer ring.deinit(); const path = "test_io_uring_write_read_fixed"; const file = try std.fs.cwd().createFile(path, .{ .read = true, .truncate = true }); defer file.close(); defer std.fs.cwd().deleteFile(path) catch {}; const fd = file.handle; var raw_buffers: [2][11]u8 = undefined; // First buffer will be written to the file. std.mem.set(u8, &raw_buffers[0], 'z'); std.mem.copy(u8, &raw_buffers[0], "foobar"); var buffers = [2]os.iovec{ .{ .iov_base = &raw_buffers[0], .iov_len = raw_buffers[0].len }, .{ .iov_base = &raw_buffers[1], .iov_len = raw_buffers[1].len }, }; try ring.register_buffers(&buffers); const sqe_write = try ring.write_fixed(0x45454545, fd, &buffers[0], 3, 0); try testing.expectEqual(linux.IORING_OP.WRITE_FIXED, sqe_write.opcode); try testing.expectEqual(@as(u64, 3), sqe_write.off); sqe_write.flags |= linux.IOSQE_IO_LINK; const sqe_read = try ring.read_fixed(0x12121212, fd, &buffers[1], 0, 1); try testing.expectEqual(linux.IORING_OP.READ_FIXED, sqe_read.opcode); try testing.expectEqual(@as(u64, 0), sqe_read.off); try testing.expectEqual(@as(u32, 2), try ring.submit()); const cqe_write = try ring.copy_cqe(); const cqe_read = try ring.copy_cqe(); try testing.expectEqual(linux.io_uring_cqe{ .user_data = 0x45454545, .res = @intCast(i32, buffers[0].iov_len), .flags = 0, }, cqe_write); try testing.expectEqual(linux.io_uring_cqe{ .user_data = 0x12121212, .res = @intCast(i32, buffers[1].iov_len), .flags = 0, }, cqe_read); try testing.expectEqualSlices(u8, "\x00\x00\x00", buffers[1].iov_base[0..3]); try testing.expectEqualSlices(u8, "foobar", buffers[1].iov_base[3..9]); try testing.expectEqualSlices(u8, "zz", buffers[1].iov_base[9..11]); } test "openat" { if (builtin.os.tag != .linux) return error.SkipZigTest; var ring = IO_Uring.init(1, 0) catch |err| switch (err) { error.SystemOutdated => return error.SkipZigTest, error.PermissionDenied => return error.SkipZigTest, else => return err, }; defer ring.deinit(); const path = "test_io_uring_openat"; defer std.fs.cwd().deleteFile(path) catch {}; const flags: u32 = os.O.CLOEXEC | os.O.RDWR | os.O.CREAT; const mode: os.mode_t = 0o666; const sqe_openat = try ring.openat(0x33333333, linux.AT.FDCWD, path, flags, mode); try testing.expectEqual(io_uring_sqe{ .opcode = .OPENAT, .flags = 0, .ioprio = 0, .fd = linux.AT.FDCWD, .off = 0, .addr = @ptrToInt(path), .len = mode, .rw_flags = flags, .user_data = 0x33333333, .buf_index = 0, .personality = 0, .splice_fd_in = 0, .__pad2 = [2]u64{ 0, 0 }, }, sqe_openat.*); try testing.expectEqual(@as(u32, 1), try ring.submit()); const cqe_openat = try ring.copy_cqe(); try testing.expectEqual(@as(u64, 0x33333333), cqe_openat.user_data); if (cqe_openat.err() == .INVAL) return error.SkipZigTest; // AT.FDCWD is not fully supported before kernel 5.6: // See https://lore.kernel.org/io-uring/20200207155039.12819-1-axboe@kernel.dk/T/ // We use IORING_FEAT_RW_CUR_POS to know if we are pre-5.6 since that feature was added in 5.6. if (cqe_openat.err() == .BADF and (ring.features & linux.IORING_FEAT_RW_CUR_POS) == 0) { return error.SkipZigTest; } if (cqe_openat.res <= 0) std.debug.print("\ncqe_openat.res={}\n", .{cqe_openat.res}); try testing.expect(cqe_openat.res > 0); try testing.expectEqual(@as(u32, 0), cqe_openat.flags); os.close(cqe_openat.res); } test "close" { if (builtin.os.tag != .linux) return error.SkipZigTest; var ring = IO_Uring.init(1, 0) catch |err| switch (err) { error.SystemOutdated => return error.SkipZigTest, error.PermissionDenied => return error.SkipZigTest, else => return err, }; defer ring.deinit(); const path = "test_io_uring_close"; const file = try std.fs.cwd().createFile(path, .{}); errdefer file.close(); defer std.fs.cwd().deleteFile(path) catch {}; const sqe_close = try ring.close(0x44444444, file.handle); try testing.expectEqual(linux.IORING_OP.CLOSE, sqe_close.opcode); try testing.expectEqual(file.handle, sqe_close.fd); try testing.expectEqual(@as(u32, 1), try ring.submit()); const cqe_close = try ring.copy_cqe(); if (cqe_close.err() == .INVAL) return error.SkipZigTest; try testing.expectEqual(linux.io_uring_cqe{ .user_data = 0x44444444, .res = 0, .flags = 0, }, cqe_close); } test "accept/connect/send/recv" { if (builtin.os.tag != .linux) return error.SkipZigTest; var ring = IO_Uring.init(16, 0) catch |err| switch (err) { error.SystemOutdated => return error.SkipZigTest, error.PermissionDenied => return error.SkipZigTest, else => return err, }; defer ring.deinit(); const address = try net.Address.parseIp4("127.0.0.1", 3131); const kernel_backlog = 1; const server = try os.socket(address.any.family, os.SOCK.STREAM | os.SOCK.CLOEXEC, 0); defer os.close(server); try os.setsockopt(server, os.SOL.SOCKET, os.SO.REUSEADDR, &mem.toBytes(@as(c_int, 1))); try os.bind(server, &address.any, address.getOsSockLen()); try os.listen(server, kernel_backlog); const buffer_send = [_]u8{ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 }; var buffer_recv = [_]u8{ 0, 1, 0, 1, 0 }; var accept_addr: os.sockaddr = undefined; var accept_addr_len: os.socklen_t = @sizeOf(@TypeOf(accept_addr)); _ = try ring.accept(0xaaaaaaaa, server, &accept_addr, &accept_addr_len, 0); try testing.expectEqual(@as(u32, 1), try ring.submit()); const client = try os.socket(address.any.family, os.SOCK.STREAM | os.SOCK.CLOEXEC, 0); defer os.close(client); _ = try ring.connect(0xcccccccc, client, &address.any, address.getOsSockLen()); try testing.expectEqual(@as(u32, 1), try ring.submit()); var cqe_accept = try ring.copy_cqe(); if (cqe_accept.err() == .INVAL) return error.SkipZigTest; var cqe_connect = try ring.copy_cqe(); if (cqe_connect.err() == .INVAL) return error.SkipZigTest; // The accept/connect CQEs may arrive in any order, the connect CQE will sometimes come first: if (cqe_accept.user_data == 0xcccccccc and cqe_connect.user_data == 0xaaaaaaaa) { const a = cqe_accept; const b = cqe_connect; cqe_accept = b; cqe_connect = a; } try testing.expectEqual(@as(u64, 0xaaaaaaaa), cqe_accept.user_data); if (cqe_accept.res <= 0) std.debug.print("\ncqe_accept.res={}\n", .{cqe_accept.res}); try testing.expect(cqe_accept.res > 0); try testing.expectEqual(@as(u32, 0), cqe_accept.flags); try testing.expectEqual(linux.io_uring_cqe{ .user_data = 0xcccccccc, .res = 0, .flags = 0, }, cqe_connect); const send = try ring.send(0xeeeeeeee, client, buffer_send[0..], 0); send.flags |= linux.IOSQE_IO_LINK; _ = try ring.recv(0xffffffff, cqe_accept.res, buffer_recv[0..], 0); try testing.expectEqual(@as(u32, 2), try ring.submit()); const cqe_send = try ring.copy_cqe(); if (cqe_send.err() == .INVAL) return error.SkipZigTest; try testing.expectEqual(linux.io_uring_cqe{ .user_data = 0xeeeeeeee, .res = buffer_send.len, .flags = 0, }, cqe_send); const cqe_recv = try ring.copy_cqe(); if (cqe_recv.err() == .INVAL) return error.SkipZigTest; try testing.expectEqual(linux.io_uring_cqe{ .user_data = 0xffffffff, .res = buffer_recv.len, .flags = 0, }, cqe_recv); try testing.expectEqualSlices(u8, buffer_send[0..buffer_recv.len], buffer_recv[0..]); } test "timeout (after a relative time)" { if (builtin.os.tag != .linux) return error.SkipZigTest; var ring = IO_Uring.init(1, 0) catch |err| switch (err) { error.SystemOutdated => return error.SkipZigTest, error.PermissionDenied => return error.SkipZigTest, else => return err, }; defer ring.deinit(); const ms = 10; const margin = 5; const ts = os.linux.kernel_timespec{ .tv_sec = 0, .tv_nsec = ms * 1000000 }; const started = std.time.milliTimestamp(); const sqe = try ring.timeout(0x55555555, &ts, 0, 0); try testing.expectEqual(linux.IORING_OP.TIMEOUT, sqe.opcode); try testing.expectEqual(@as(u32, 1), try ring.submit()); const cqe = try ring.copy_cqe(); const stopped = std.time.milliTimestamp(); try testing.expectEqual(linux.io_uring_cqe{ .user_data = 0x55555555, .res = -@as(i32, @enumToInt(linux.E.TIME)), .flags = 0, }, cqe); // Tests should not depend on timings: skip test if outside margin. if (!std.math.approxEqAbs(f64, ms, @intToFloat(f64, stopped - started), margin)) return error.SkipZigTest; } test "timeout (after a number of completions)" { if (builtin.os.tag != .linux) return error.SkipZigTest; var ring = IO_Uring.init(2, 0) catch |err| switch (err) { error.SystemOutdated => return error.SkipZigTest, error.PermissionDenied => return error.SkipZigTest, else => return err, }; defer ring.deinit(); const ts = os.linux.kernel_timespec{ .tv_sec = 3, .tv_nsec = 0 }; const count_completions: u64 = 1; const sqe_timeout = try ring.timeout(0x66666666, &ts, count_completions, 0); try testing.expectEqual(linux.IORING_OP.TIMEOUT, sqe_timeout.opcode); try testing.expectEqual(count_completions, sqe_timeout.off); _ = try ring.nop(0x77777777); try testing.expectEqual(@as(u32, 2), try ring.submit()); const cqe_nop = try ring.copy_cqe(); try testing.expectEqual(linux.io_uring_cqe{ .user_data = 0x77777777, .res = 0, .flags = 0, }, cqe_nop); const cqe_timeout = try ring.copy_cqe(); try testing.expectEqual(linux.io_uring_cqe{ .user_data = 0x66666666, .res = 0, .flags = 0, }, cqe_timeout); } test "timeout_remove" { if (builtin.os.tag != .linux) return error.SkipZigTest; var ring = IO_Uring.init(2, 0) catch |err| switch (err) { error.SystemOutdated => return error.SkipZigTest, error.PermissionDenied => return error.SkipZigTest, else => return err, }; defer ring.deinit(); const ts = os.linux.kernel_timespec{ .tv_sec = 3, .tv_nsec = 0 }; const sqe_timeout = try ring.timeout(0x88888888, &ts, 0, 0); try testing.expectEqual(linux.IORING_OP.TIMEOUT, sqe_timeout.opcode); try testing.expectEqual(@as(u64, 0x88888888), sqe_timeout.user_data); const sqe_timeout_remove = try ring.timeout_remove(0x99999999, 0x88888888, 0); try testing.expectEqual(linux.IORING_OP.TIMEOUT_REMOVE, sqe_timeout_remove.opcode); try testing.expectEqual(@as(u64, 0x88888888), sqe_timeout_remove.addr); try testing.expectEqual(@as(u64, 0x99999999), sqe_timeout_remove.user_data); try testing.expectEqual(@as(u32, 2), try ring.submit()); const cqe_timeout = try ring.copy_cqe(); // IORING_OP_TIMEOUT_REMOVE is not supported by this kernel version: // Timeout remove operations set the fd to -1, which results in EBADF before EINVAL. // We use IORING_FEAT_RW_CUR_POS as a safety check here to make sure we are at least pre-5.6. // We don't want to skip this test for newer kernels. if (cqe_timeout.user_data == 0x99999999 and cqe_timeout.err() == .BADF and (ring.features & linux.IORING_FEAT_RW_CUR_POS) == 0) { return error.SkipZigTest; } try testing.expectEqual(linux.io_uring_cqe{ .user_data = 0x88888888, .res = -@as(i32, @enumToInt(linux.E.CANCELED)), .flags = 0, }, cqe_timeout); const cqe_timeout_remove = try ring.copy_cqe(); try testing.expectEqual(linux.io_uring_cqe{ .user_data = 0x99999999, .res = 0, .flags = 0, }, cqe_timeout_remove); } test "fallocate" { if (builtin.os.tag != .linux) return error.SkipZigTest; var ring = IO_Uring.init(1, 0) catch |err| switch (err) { error.SystemOutdated => return error.SkipZigTest, error.PermissionDenied => return error.SkipZigTest, else => return err, }; defer ring.deinit(); const path = "test_io_uring_fallocate"; const file = try std.fs.cwd().createFile(path, .{ .truncate = true, .mode = 0o666 }); defer file.close(); defer std.fs.cwd().deleteFile(path) catch {}; try testing.expectEqual(@as(u64, 0), (try file.stat()).size); const len: u64 = 65536; const sqe = try ring.fallocate(0xaaaaaaaa, file.handle, 0, 0, len); try testing.expectEqual(linux.IORING_OP.FALLOCATE, sqe.opcode); try testing.expectEqual(file.handle, sqe.fd); try testing.expectEqual(@as(u32, 1), try ring.submit()); const cqe = try ring.copy_cqe(); switch (cqe.err()) { .SUCCESS => {}, // This kernel's io_uring does not yet implement fallocate(): .INVAL => return error.SkipZigTest, // This kernel does not implement fallocate(): .NOSYS => return error.SkipZigTest, // The filesystem containing the file referred to by fd does not support this operation; // or the mode is not supported by the filesystem containing the file referred to by fd: .OPNOTSUPP => return error.SkipZigTest, else => |errno| std.debug.panic("unhandled errno: {}", .{errno}), } try testing.expectEqual(linux.io_uring_cqe{ .user_data = 0xaaaaaaaa, .res = 0, .flags = 0, }, cqe); try testing.expectEqual(len, (try file.stat()).size); } test "statx" { if (builtin.os.tag != .linux) return error.SkipZigTest; var ring = IO_Uring.init(1, 0) catch |err| switch (err) { error.SystemOutdated => return error.SkipZigTest, error.PermissionDenied => return error.SkipZigTest, else => return err, }; defer ring.deinit(); const path = "test_io_uring_statx"; const file = try std.fs.cwd().createFile(path, .{ .truncate = true, .mode = 0o666 }); defer file.close(); defer std.fs.cwd().deleteFile(path) catch {}; try testing.expectEqual(@as(u64, 0), (try file.stat()).size); try file.writeAll("foobar"); var buf: linux.Statx = undefined; const sqe = try ring.statx( 0xaaaaaaaa, linux.AT.FDCWD, path, 0, linux.STATX_SIZE, &buf, ); try testing.expectEqual(linux.IORING_OP.STATX, sqe.opcode); try testing.expectEqual(@as(i32, linux.AT.FDCWD), sqe.fd); try testing.expectEqual(@as(u32, 1), try ring.submit()); const cqe = try ring.copy_cqe(); switch (cqe.err()) { .SUCCESS => {}, // This kernel's io_uring does not yet implement statx(): .INVAL => return error.SkipZigTest, // This kernel does not implement statx(): .NOSYS => return error.SkipZigTest, // The filesystem containing the file referred to by fd does not support this operation; // or the mode is not supported by the filesystem containing the file referred to by fd: .OPNOTSUPP => return error.SkipZigTest, // The kernel is too old to support FDCWD for dir_fd .BADF => return error.SkipZigTest, else => |errno| std.debug.panic("unhandled errno: {}", .{errno}), } try testing.expectEqual(linux.io_uring_cqe{ .user_data = 0xaaaaaaaa, .res = 0, .flags = 0, }, cqe); try testing.expect(buf.mask & os.linux.STATX_SIZE == os.linux.STATX_SIZE); try testing.expectEqual(@as(u64, 6), buf.size); }
lib/std/os/linux/io_uring.zig
const std = @import("std"); const TestContext = @import("../../src/test.zig").TestContext; // These tests should work with all platforms, but we're using linux_x64 for // now for consistency. Will be expanded eventually. const linux_x64 = std.zig.CrossTarget{ .cpu_arch = .x86_64, .os_tag = .linux, }; pub fn addCases(ctx: *TestContext) !void { { var case = ctx.exeFromCompiledC("hello world with updates", .{}); // Regular old hello world case.addCompareOutput( \\extern fn puts(s: [*:0]const u8) c_int; \\export fn main() c_int { \\ _ = puts("hello world!"); \\ return 0; \\} , "hello world!" ++ std.cstr.line_sep); // Now change the message only // TODO fix C backend not supporting updates // https://github.com/ziglang/zig/issues/7589 //case.addCompareOutput( // \\extern fn puts(s: [*:0]const u8) c_int; // \\export fn main() c_int { // \\ _ = puts("yo"); // \\ return 0; // \\} //, "yo" ++ std.cstr.line_sep); } { var case = ctx.exeFromCompiledC("alloc and retptr", .{}); case.addCompareOutput( \\fn add(a: i32, b: i32) i32 { \\ return a + b; \\} \\ \\fn addIndirect(a: i32, b: i32) i32 { \\ return add(a, b); \\} \\ \\export fn main() c_int { \\ return addIndirect(1, 2) - 3; \\} , ""); } { var case = ctx.exeFromCompiledC("inferred local const and var", .{}); case.addCompareOutput( \\fn add(a: i32, b: i32) i32 { \\ return a + b; \\} \\ \\export fn main() c_int { \\ const x = add(1, 2); \\ var y = add(3, 0); \\ y -= x; \\ return y; \\} , ""); } ctx.c("empty start function", linux_x64, \\export fn _start() noreturn { \\ unreachable; \\} , \\zig_noreturn void _start(void) { \\ zig_breakpoint(); \\ zig_unreachable(); \\} \\ ); ctx.h("simple header", linux_x64, \\export fn start() void{} , \\void start(void); \\ ); ctx.c("less empty start function", linux_x64, \\fn main() noreturn { \\ unreachable; \\} \\ \\export fn _start() noreturn { \\ main(); \\} , \\static zig_noreturn void main(void); \\ \\zig_noreturn void _start(void) { \\ main(); \\} \\ \\static zig_noreturn void main(void) { \\ zig_breakpoint(); \\ zig_unreachable(); \\} \\ ); // TODO: implement return values // TODO: figure out a way to prevent asm constants from being generated ctx.c("inline asm", linux_x64, \\fn exitGood() noreturn { \\ asm volatile ("syscall" \\ : \\ : [number] "{rax}" (231), \\ [arg1] "{rdi}" (0) \\ ); \\ unreachable; \\} \\ \\export fn _start() noreturn { \\ exitGood(); \\} , \\static zig_noreturn void exitGood(void); \\ \\static uint8_t exitGood__anon_0[6] = "{rax}"; \\static uint8_t exitGood__anon_1[6] = "{rdi}"; \\static uint8_t exitGood__anon_2[8] = "syscall"; \\ \\zig_noreturn void _start(void) { \\ exitGood(); \\} \\ \\static zig_noreturn void exitGood(void) { \\ register uintptr_t rax_constant __asm__("rax") = 231; \\ register uintptr_t rdi_constant __asm__("rdi") = 0; \\ __asm volatile ("syscall" :: ""(rax_constant), ""(rdi_constant)); \\ zig_breakpoint(); \\ zig_unreachable(); \\} \\ ); ctx.c("exit with parameter", linux_x64, \\export fn _start() noreturn { \\ exit(0); \\} \\ \\fn exit(code: usize) noreturn { \\ asm volatile ("syscall" \\ : \\ : [number] "{rax}" (231), \\ [arg1] "{rdi}" (code) \\ ); \\ unreachable; \\} \\ , \\static zig_noreturn void exit(uintptr_t arg0); \\ \\static uint8_t exit__anon_0[6] = "{rax}"; \\static uint8_t exit__anon_1[6] = "{rdi}"; \\static uint8_t exit__anon_2[8] = "syscall"; \\ \\zig_noreturn void _start(void) { \\ exit(0); \\} \\ \\static zig_noreturn void exit(uintptr_t arg0) { \\ register uintptr_t rax_constant __asm__("rax") = 231; \\ register uintptr_t rdi_constant __asm__("rdi") = arg0; \\ __asm volatile ("syscall" :: ""(rax_constant), ""(rdi_constant)); \\ zig_breakpoint(); \\ zig_unreachable(); \\} \\ ); ctx.c("exit with u8 parameter", linux_x64, \\export fn _start() noreturn { \\ exit(0); \\} \\ \\fn exit(code: u8) noreturn { \\ asm volatile ("syscall" \\ : \\ : [number] "{rax}" (231), \\ [arg1] "{rdi}" (code) \\ ); \\ unreachable; \\} \\ , \\static zig_noreturn void exit(uint8_t arg0); \\ \\static uint8_t exit__anon_0[6] = "{rax}"; \\static uint8_t exit__anon_1[6] = "{rdi}"; \\static uint8_t exit__anon_2[8] = "syscall"; \\ \\zig_noreturn void _start(void) { \\ exit(0); \\} \\ \\static zig_noreturn void exit(uint8_t arg0) { \\ uintptr_t const __temp_0 = (uintptr_t)arg0; \\ register uintptr_t rax_constant __asm__("rax") = 231; \\ register uintptr_t rdi_constant __asm__("rdi") = __temp_0; \\ __asm volatile ("syscall" :: ""(rax_constant), ""(rdi_constant)); \\ zig_breakpoint(); \\ zig_unreachable(); \\} \\ ); ctx.c("exit with u8 arithmetic", linux_x64, \\export fn _start() noreturn { \\ exitMath(1); \\} \\ \\fn exitMath(a: u8) noreturn { \\ exit(0 + a - a); \\} \\ \\fn exit(code: u8) noreturn { \\ asm volatile ("syscall" \\ : \\ : [number] "{rax}" (231), \\ [arg1] "{rdi}" (code) \\ ); \\ unreachable; \\} \\ , \\static zig_noreturn void exitMath(uint8_t arg0); \\static zig_noreturn void exit(uint8_t arg0); \\ \\static uint8_t exit__anon_0[6] = "{rax}"; \\static uint8_t exit__anon_1[6] = "{rdi}"; \\static uint8_t exit__anon_2[8] = "syscall"; \\ \\zig_noreturn void _start(void) { \\ exitMath(1); \\} \\ \\static zig_noreturn void exitMath(uint8_t arg0) { \\ uint8_t const __temp_0 = 0 + arg0; \\ uint8_t const __temp_1 = __temp_0 - arg0; \\ exit(__temp_1); \\} \\ \\static zig_noreturn void exit(uint8_t arg0) { \\ uintptr_t const __temp_0 = (uintptr_t)arg0; \\ register uintptr_t rax_constant __asm__("rax") = 231; \\ register uintptr_t rdi_constant __asm__("rdi") = __temp_0; \\ __asm volatile ("syscall" :: ""(rax_constant), ""(rdi_constant)); \\ zig_breakpoint(); \\ zig_unreachable(); \\} \\ ); ctx.c("exit with u8 arithmetic inverted", linux_x64, \\export fn _start() noreturn { \\ exitMath(1); \\} \\ \\fn exitMath(a: u8) noreturn { \\ exit(a + 0 - a); \\} \\ \\fn exit(code: u8) noreturn { \\ asm volatile ("syscall" \\ : \\ : [number] "{rax}" (231), \\ [arg1] "{rdi}" (code) \\ ); \\ unreachable; \\} \\ , \\static zig_noreturn void exitMath(uint8_t arg0); \\static zig_noreturn void exit(uint8_t arg0); \\ \\static uint8_t exit__anon_0[6] = "{rax}"; \\static uint8_t exit__anon_1[6] = "{rdi}"; \\static uint8_t exit__anon_2[8] = "syscall"; \\ \\zig_noreturn void _start(void) { \\ exitMath(1); \\} \\ \\static zig_noreturn void exitMath(uint8_t arg0) { \\ uint8_t const __temp_0 = arg0 + 0; \\ uint8_t const __temp_1 = __temp_0 - arg0; \\ exit(__temp_1); \\} \\ \\static zig_noreturn void exit(uint8_t arg0) { \\ uintptr_t const __temp_0 = (uintptr_t)arg0; \\ register uintptr_t rax_constant __asm__("rax") = 231; \\ register uintptr_t rdi_constant __asm__("rdi") = __temp_0; \\ __asm volatile ("syscall" :: ""(rax_constant), ""(rdi_constant)); \\ zig_breakpoint(); \\ zig_unreachable(); \\} \\ ); ctx.h("header with single param function", linux_x64, \\export fn start(a: u8) void{} , \\void start(uint8_t arg0); \\ ); ctx.h("header with multiple param function", linux_x64, \\export fn start(a: u8, b: u8, c: u8) void{} , \\void start(uint8_t arg0, uint8_t arg1, uint8_t arg2); \\ ); ctx.h("header with u32 param function", linux_x64, \\export fn start(a: u32) void{} , \\void start(uint32_t arg0); \\ ); ctx.h("header with usize param function", linux_x64, \\export fn start(a: usize) void{} , \\void start(uintptr_t arg0); \\ ); ctx.h("header with bool param function", linux_x64, \\export fn start(a: bool) void{} , \\void start(bool arg0); \\ ); ctx.h("header with noreturn function", linux_x64, \\export fn start() noreturn { \\ unreachable; \\} , \\zig_noreturn void start(void); \\ ); ctx.h("header with multiple functions", linux_x64, \\export fn a() void{} \\export fn b() void{} \\export fn c() void{} , \\void a(void); \\void b(void); \\void c(void); \\ ); ctx.h("header with multiple includes", linux_x64, \\export fn start(a: u32, b: usize) void{} , \\void start(uint32_t arg0, uintptr_t arg1); \\ ); }
test/stage2/cbe.zig
const std = @import("../std.zig"); const assert = std.debug.assert; const State = enum { Start, Backslash, }; pub const ParseStringLiteralError = error{ OutOfMemory, /// When this is returned, index will be the position of the character. InvalidCharacter, }; /// caller owns returned memory pub fn parseStringLiteral( allocator: *std.mem.Allocator, bytes: []const u8, bad_index: *usize, // populated if error.InvalidCharacter is returned ) ParseStringLiteralError![]u8 { assert(bytes.len >= 2 and bytes[0] == '"' and bytes[bytes.len - 1] == '"'); var list = std.ArrayList(u8).init(allocator); errdefer list.deinit(); const slice = bytes[1..]; try list.ensureCapacity(slice.len - 1); var state = State.Start; var index: usize = 0; while (index < slice.len) : (index += 1) { const b = slice[index]; switch (state) { State.Start => switch (b) { '\\' => state = State.Backslash, '\n' => { bad_index.* = index; return error.InvalidCharacter; }, '"' => return list.toOwnedSlice(), else => try list.append(b), }, State.Backslash => switch (b) { 'n' => { try list.append('\n'); state = State.Start; }, 'r' => { try list.append('\r'); state = State.Start; }, '\\' => { try list.append('\\'); state = State.Start; }, 't' => { try list.append('\t'); state = State.Start; }, '\'' => { try list.append('\''); state = State.Start; }, '"' => { try list.append('"'); state = State.Start; }, 'x' => { // TODO: add more/better/broader tests for this. const index_continue = index + 3; if (slice.len >= index_continue) if (std.fmt.parseUnsigned(u8, slice[index + 1 .. index_continue], 16)) |char| { try list.append(char); state = State.Start; index = index_continue - 1; // loop-header increments again continue; } else |_| {}; bad_index.* = index; return error.InvalidCharacter; }, 'u' => { // TODO: add more/better/broader tests for this. if (slice.len > index + 2 and slice[index + 1] == '{') if (std.mem.indexOfScalarPos(u8, slice[0..std.math.min(index + 9, slice.len)], index + 3, '}')) |index_end| { const hex_str = slice[index + 2 .. index_end]; if (std.fmt.parseUnsigned(u32, hex_str, 16)) |uint| { if (uint <= 0x10ffff) { try list.appendSlice(std.mem.toBytes(uint)[0..]); state = State.Start; index = index_end; // loop-header increments continue; } } else |_| {} }; bad_index.* = index; return error.InvalidCharacter; }, else => { bad_index.* = index; return error.InvalidCharacter; }, }, else => unreachable, } } unreachable; } test "parseStringLiteral" { const expect = std.testing.expect; const eql = std.mem.eql; var fixed_buf_mem: [32]u8 = undefined; var fixed_buf_alloc = std.heap.FixedBufferAllocator.init(fixed_buf_mem[0..]); var alloc = &fixed_buf_alloc.allocator; var bad_index: usize = undefined; expect(eql(u8, "foo", try parseStringLiteral(alloc, "\"foo\"", &bad_index))); expect(eql(u8, "foo", try parseStringLiteral(alloc, "\"f\x6f\x6f\"", &bad_index))); expect(eql(u8, "f💯", try parseStringLiteral(alloc, "\"f\u{1f4af}\"", &bad_index))); }
lib/std/zig/parse_string_literal.zig
const std = @import("std"); const mem = std.mem; const Allocator = mem.Allocator; const assert = std.debug.assert; const Preprocessor = @import("Preprocessor.zig"); const Source = @import("Source.zig"); const Tokenizer = @import("Tokenizer.zig"); const Token = Tokenizer.Token; const Diagnostics = @import("Diagnostics.zig"); const LangOpts = @import("LangOpts.zig"); const Compilation = @This(); pub const Error = error{ /// A fatal error has ocurred and compilation has stopped. FatalError, } || Allocator.Error; gpa: *Allocator, sources: std.StringArrayHashMap(Source), diag: Diagnostics, include_dirs: std.ArrayList([]const u8), system_include_dirs: std.ArrayList([]const u8), output_name: ?[]const u8 = null, target: std.Target = std.Target.current, only_preprocess: bool = false, langopts: LangOpts = .{}, pub fn init(gpa: *Allocator) Compilation { return .{ .gpa = gpa, .sources = std.StringArrayHashMap(Source).init(gpa), .diag = Diagnostics.init(gpa), .include_dirs = std.ArrayList([]const u8).init(gpa), .system_include_dirs = std.ArrayList([]const u8).init(gpa), }; } pub fn deinit(comp: *Compilation) void { for (comp.sources.values()) |source| { comp.gpa.free(source.path); comp.gpa.free(source.buf); } comp.sources.deinit(); comp.diag.deinit(); comp.include_dirs.deinit(); comp.system_include_dirs.deinit(); } /// Generate builtin macros that will be available to each source file. pub fn generateBuiltinMacros(comp: *Compilation) !Source { var buf = std.ArrayList(u8).init(comp.gpa); defer buf.deinit(); try buf.appendSlice( \\#define __VERSION__ "Aro ++ @import("lib.zig").version_str ++ "\"\n" ++ \\#define __STDC__ 1 \\#define __STDC_HOSTED__ 1 \\#define __STDC_VERSION__ 201710L \\#define __STDC_NO_ATOMICS__ 1 \\#define __STDC_NO_COMPLEX__ 1 \\#define __STDC_NO_THREADS__ 1 \\#define __STDC_NO_VLA__ 1 \\ ); switch (comp.target.os.tag) { .linux => try buf.appendSlice( \\#define unix 1 \\#define __unix 1 \\#define __unix__ 1 \\#define linux 1 \\#define __linux 1 \\#define __linux__ 1 \\ ), .windows => if (comp.target.cpu.arch.ptrBitWidth() == 32) try buf.appendSlice("#define _WIN32 1\n") else try buf.appendSlice( \\#define _WIN32 1 \\#define _WIN64 1 \\ ), else => {}, } switch (comp.target.cpu.arch) { .x86_64 => try buf.appendSlice( \\#define __amd64__ 1 \\#define __amd64 1 \\#define __x86_64 1 \\#define __x86_64__ 1 \\ ), else => {}, } try buf.appendSlice(if (comp.target.cpu.arch.endian() == .Little) \\#define __ORDER_LITTLE_ENDIAN__ 1234 \\#define __ORDER_BIG_ENDIAN__ 4321 \\#define __ORDER_PDP_ENDIAN__ 3412 \\#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ \\#define __LITTLE_ENDIAN__ 1 \\ else \\#define __ORDER_LITTLE_ENDIAN__ 1234 \\#define __ORDER_BIG_ENDIAN__ 4321 \\#define __ORDER_PDP_ENDIAN__ 3412 \\#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__; \\#define __BIG_ENDIAN__ 1 \\ ); const duped_path = try comp.gpa.dupe(u8, "<builtin>"); errdefer comp.gpa.free(duped_path); const contents = buf.toOwnedSlice(); errdefer comp.gpa.free(contents); const source = Source{ .id = @intToEnum(Source.Id, comp.sources.count() + 2), .path = duped_path, .buf = contents, }; try comp.sources.put(duped_path, source); return source; } pub fn getSource(comp: *Compilation, id: Source.Id) Source { return comp.sources.values()[@enumToInt(id) - 2]; } pub fn addSource(comp: *Compilation, path: []const u8) !Source { if (comp.sources.get(path)) |some| return some; const file = try std.fs.cwd().openFile(path, .{}); defer file.close(); const duped_path = try comp.gpa.dupe(u8, path); errdefer comp.gpa.free(duped_path); const contents = try file.reader().readAllAlloc(comp.gpa, std.math.maxInt(u32)); errdefer comp.gpa.free(contents); const source = Source{ .id = @intToEnum(Source.Id, comp.sources.count() + 2), .path = duped_path, .buf = contents, }; try comp.sources.put(duped_path, source); return source; } pub fn findInclude(comp: *Compilation, tok: Token, filename: []const u8, search_cwd: bool) !Source { var path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; var fib = std.heap.FixedBufferAllocator.init(&path_buf); if (search_cwd) blk: { const source = comp.getSource(tok.source); const path = if (std.fs.path.dirname(source.path)) |some| std.fs.path.join(&fib.allocator, &.{ some, filename }) catch break :blk else filename; if (comp.addSource(path)) |some| return some else |err| switch (err) { error.OutOfMemory => return error.OutOfMemory, else => {}, } } for (comp.include_dirs.items) |dir| { fib.end_index = 0; const path = std.fs.path.join(&fib.allocator, &.{ dir, filename }) catch continue; if (comp.addSource(path)) |some| return some else |err| switch (err) { error.OutOfMemory => return error.OutOfMemory, else => {}, } } for (comp.system_include_dirs.items) |dir| { fib.end_index = 0; const path = std.fs.path.join(&fib.allocator, &.{ dir, filename }) catch continue; if (comp.addSource(path)) |some| return some else |err| switch (err) { error.OutOfMemory => return error.OutOfMemory, else => {}, } } return comp.fatal(tok, "'{s}' not found", .{filename}); } pub fn fatal(comp: *Compilation, tok: Token, comptime fmt: []const u8, args: anytype) Error { const source = comp.getSource(tok.source); const lcs = source.lineColString(tok.start); return comp.diag.fatal(source.path, lcs, fmt, args); } pub fn addDiagnostic(comp: *Compilation, msg: Diagnostics.Message) Error!void { if (comp.langopts.suppress(msg.tag)) return; return comp.diag.add(msg); } pub const renderErrors = Diagnostics.render;
src/Compilation.zig
const std = @import("std"); const assert = std.debug.assert; const mem = std.mem; const Allocator = mem.Allocator; const EpochSeconds = std.time.epoch.EpochSeconds; const Diagnostics = @import("Diagnostics.zig"); const LangOpts = @import("LangOpts.zig"); const Preprocessor = @import("Preprocessor.zig"); const Source = @import("Source.zig"); const Tokenizer = @import("Tokenizer.zig"); const Token = Tokenizer.Token; const Type = @import("Type.zig"); const Compilation = @This(); pub const Error = error{ /// A fatal error has ocurred and compilation has stopped. FatalError, } || Allocator.Error; gpa: *Allocator, sources: std.StringArrayHashMap(Source), diag: Diagnostics, include_dirs: std.ArrayList([]const u8), system_include_dirs: std.ArrayList([]const u8), output_name: ?[]const u8 = null, builtin_header_path: ?[]u8 = null, target: std.Target = std.Target.current, only_preprocess: bool = false, only_compile: bool = false, verbose_ast: bool = false, langopts: LangOpts = .{}, pub fn init(gpa: *Allocator) Compilation { return .{ .gpa = gpa, .sources = std.StringArrayHashMap(Source).init(gpa), .diag = Diagnostics.init(gpa), .include_dirs = std.ArrayList([]const u8).init(gpa), .system_include_dirs = std.ArrayList([]const u8).init(gpa), }; } pub fn deinit(comp: *Compilation) void { for (comp.sources.values()) |source| { comp.gpa.free(source.path); comp.gpa.free(source.buf); } comp.sources.deinit(); comp.diag.deinit(); comp.include_dirs.deinit(); comp.system_include_dirs.deinit(); if (comp.builtin_header_path) |some| comp.gpa.free(some); } fn generateDateAndTime(w: anytype) !void { // TODO take timezone into account here once it is supported in Zig std const timestamp = std.math.clamp(std.time.timestamp(), 0, std.math.maxInt(i64)); const epoch_seconds = EpochSeconds{ .secs = @intCast(u64, timestamp) }; const epoch_day = epoch_seconds.getEpochDay(); const day_seconds = epoch_seconds.getDaySeconds(); const year_day = epoch_day.calculateYearDay(); const month_day = year_day.calculateMonthDay(); const month_names = [_][]const u8{ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; std.debug.assert(std.time.epoch.Month.jan.numeric() == 1); const month_name = month_names[month_day.month.numeric() - 1]; try w.print("#define __DATE__ \"{s} {d: >2} {d}\"\n", .{ month_name, month_day.day_index + 1, year_day.year, }); try w.print("#define __TIME__ \"{d:0>2}:{d:0>2}:{d:0>2}\"\n", .{ day_seconds.getHoursIntoDay(), day_seconds.getMinutesIntoHour(), day_seconds.getSecondsIntoMinute(), }); const day_names = [_][]const u8{ "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" }; // days since Thu Oct 1 1970 const day_name = day_names[(epoch_day.day + 3) % 7]; try w.print("#define __TIMESTAMP__ \"{s} {s} {d: >2} {d:0>2}:{d:0>2}:{d:0>2} {d}\"\n", .{ day_name, month_name, month_day.day_index + 1, day_seconds.getHoursIntoDay(), day_seconds.getMinutesIntoHour(), day_seconds.getSecondsIntoMinute(), year_day.year, }); } /// Generate builtin macros that will be available to each source file. pub fn generateBuiltinMacros(comp: *Compilation) !Source { var buf = std.ArrayList(u8).init(comp.gpa); defer buf.deinit(); const w = buf.writer(); // standard macros try w.writeAll( \\#define __VERSION__ "Aro ++ @import("lib.zig").version_str ++ "\"\n" ++ \\#define __Aro__ \\#define __STDC__ 1 \\#define __STDC_HOSTED__ 1 \\#define __STDC_NO_ATOMICS__ 1 \\#define __STDC_NO_COMPLEX__ 1 \\#define __STDC_NO_THREADS__ 1 \\#define __STDC_NO_VLA__ 1 \\ ); if (comp.langopts.standard.StdCVersionMacro()) |stdc_version| { try w.print("#define __STDC_VERSION__ {s}\n", .{stdc_version}); } // os macros switch (comp.target.os.tag) { .linux => try w.writeAll( \\#define linux 1 \\#define __linux 1 \\#define __linux__ 1 \\ ), .windows => if (comp.target.cpu.arch.ptrBitWidth() == 32) try w.writeAll( \\#define WIN32 1 \\#define _WIN32 1 \\#define __WIN32 1 \\#define __WIN32__ 1 \\ ) else try w.writeAll( \\#define WIN32 1 \\#define WIN64 1 \\#define _WIN32 1 \\#define _WIN64 1 \\#define __WIN32 1 \\#define __WIN64 1 \\#define __WIN32__ 1 \\#define __WIN64__ 1 \\ ), .freebsd => try w.print("#define __FreeBSD__ {d}\n", .{comp.target.os.version_range.semver.min.major}), .netbsd => try w.writeAll("#define __NetBSD__ 1\n"), .openbsd => try w.writeAll("#define __OpenBSD__ 1\n"), .dragonfly => try w.writeAll("#define __DragonFly__ 1\n"), .solaris => try w.writeAll( \\#define sun 1 \\#define __sun 1 \\ ), .macos => try w.writeAll( \\#define __APPLE__ 1 \\#define __MACH__ 1 \\ ), else => {}, } // unix and other additional os macros switch (comp.target.os.tag) { .freebsd, .netbsd, .openbsd, .dragonfly, .linux, => try w.writeAll( \\#define unix 1 \\#define __unix 1 \\#define __unix__ 1 \\ ), else => {}, } if (comp.target.abi == .android) { try w.writeAll("#define __ANDROID__ 1\n"); } // architecture macros switch (comp.target.cpu.arch) { .x86_64 => try w.writeAll( \\#define __amd64__ 1 \\#define __amd64 1 \\#define __x86_64 1 \\#define __x86_64__ 1 \\ ), .i386 => try w.writeAll( \\#define i386 1 \\#define __i386 1 \\#define __i386__ 1 \\ ), .mips, .mipsel, .mips64, .mips64el, => try w.writeAll( \\#define __mips__ 1 \\#define mips 1 \\ ), .powerpc, .powerpcle, => try w.writeAll( \\#define __powerpc__ 1 \\#define __POWERPC__ 1 \\#define __ppc__ 1 \\#define __PPC__ 1 \\#define _ARCH_PPC 1 \\ ), .powerpc64, .powerpc64le, => try w.writeAll( \\#define __powerpc 1 \\#define __powerpc__ 1 \\#define __powerpc64__ 1 \\#define __POWERPC__ 1 \\#define __ppc__ 1 \\#define __ppc64__ 1 \\#define __PPC__ 1 \\#define __PPC64__ 1 \\#define _ARCH_PPC 1 \\#define _ARCH_PPC64 1 \\ ), .sparcv9 => try w.writeAll( \\#define __sparc__ 1 \\#define __sparc 1 \\#define __sparc_v9__ 1 \\ ), .sparc, .sparcel => try w.writeAll( \\#define __sparc__ 1 \\#define __sparc 1 \\ ), .arm, .armeb => try w.writeAll( \\#define __arm__ 1 \\#define __arm 1 \\ ), .thumb, .thumbeb => try w.writeAll( \\#define __arm__ 1 \\#define __arm 1 \\#define __thumb__ 1 \\ ), .aarch64, .aarch64_be => try w.writeAll("#define __aarch64__ 1\n"), else => {}, } if (comp.target.os.tag != .windows) switch (comp.target.cpu.arch.ptrBitWidth()) { 64 => try w.writeAll( \\#define _LP64 1 \\#define __LP64__ 1 \\ ), 32 => try w.writeAll("#define _ILP32 1\n"), else => {}, }; try w.writeAll( \\#define __ORDER_LITTLE_ENDIAN__ 1234 \\#define __ORDER_BIG_ENDIAN__ 4321 \\#define __ORDER_PDP_ENDIAN__ 3412 \\ ); if (comp.target.cpu.arch.endian() == .Little) try w.writeAll( \\#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ \\#define __LITTLE_ENDIAN__ 1 \\ ) else try w.writeAll( \\#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__; \\#define __BIG_ENDIAN__ 1 \\ ); // timestamps try generateDateAndTime(w); // types if (Type.getCharSignedness(comp) == .unsigned) try w.writeAll("#define __CHAR_UNSIGNED__ 1\n"); try w.writeAll("#define __CHAR_BIT__ 8\n"); // int maxs try comp.generateIntMax(w, "__SCHAR_MAX__", .{ .specifier = .schar }); try comp.generateIntMax(w, "__SHRT_MAX__", .{ .specifier = .short }); try comp.generateIntMax(w, "__INT_MAX__", .{ .specifier = .int }); try comp.generateIntMax(w, "__LONG_MAX__", .{ .specifier = .long }); try comp.generateIntMax(w, "__LONG_LONG_MAX__", .{ .specifier = .long_long }); try comp.generateIntMax(w, "__WCHAR_MAX__", Type.wideChar(comp)); // try comp.generateIntMax(w, "__WINT_MAX__", Type.wideChar(comp)); // try comp.generateIntMax(w, "__INTMAX_MAX__", Type.wideChar(comp)); try comp.generateIntMax(w, "__SIZE_MAX__", Type.sizeT(comp)); // try comp.generateIntMax(w, "__UINTMAX_MAX__", Type.wideChar(comp)); try comp.generateIntMax(w, "__PTRDIFF_MAX__", Type.ptrDiffT(comp)); // try comp.generateIntMax(w, "__INTPTR_MAX__", Type.wideChar(comp)); // try comp.generateIntMax(w, "__UINTPTR_MAX__", Type.sizeT(comp)); // sizeof types try comp.generateSizeofType(w, "__SIZEOF_FLOAT__", .{ .specifier = .float }); try comp.generateSizeofType(w, "__SIZEOF_DOUBLE__", .{ .specifier = .double }); try comp.generateSizeofType(w, "__SIZEOF_LONG_DOUBLE__", .{ .specifier = .long_double }); try comp.generateSizeofType(w, "__SIZEOF_SHORT__", .{ .specifier = .short }); try comp.generateSizeofType(w, "__SIZEOF_INT__", .{ .specifier = .int }); try comp.generateSizeofType(w, "__SIZEOF_LONG__", .{ .specifier = .long }); try comp.generateSizeofType(w, "__SIZEOF_LONG_LONG__", .{ .specifier = .long_long }); try comp.generateSizeofType(w, "__SIZEOF_POINTER__", .{ .specifier = .pointer }); try comp.generateSizeofType(w, "__SIZEOF_PTRDIFF_T__", Type.ptrDiffT(comp)); try comp.generateSizeofType(w, "__SIZEOF_SIZE_T__", Type.sizeT(comp)); try comp.generateSizeofType(w, "__SIZEOF_WCHAR_T__", Type.wideChar(comp)); // try comp.generateSizeofType(w, "__SIZEOF_WINT_T__", .{ .specifier = .pointer }); // various int types try generateTypeMacro(w, "__PTRDIFF_TYPE__", Type.ptrDiffT(comp)); try generateTypeMacro(w, "__SIZE_TYPE__", Type.sizeT(comp)); try generateTypeMacro(w, "__WCHAR_TYPE__", Type.wideChar(comp)); const duped_path = try comp.gpa.dupe(u8, "<builtin>"); errdefer comp.gpa.free(duped_path); const contents = buf.toOwnedSlice(); errdefer comp.gpa.free(contents); const source = Source{ .id = @intToEnum(Source.Id, comp.sources.count() + 2), .path = duped_path, .buf = contents, }; try comp.sources.put(duped_path, source); return source; } fn generateTypeMacro(w: anytype, name: []const u8, ty: Type) !void { try w.print("#define {s} ", .{name}); try ty.print(w); try w.writeByte('\n'); } fn generateIntMax(comp: *Compilation, w: anytype, name: []const u8, ty: Type) !void { const bit_count = @intCast(u8, ty.sizeof(comp).? * 8); const unsigned = ty.isUnsignedInt(comp); const max = if (bit_count == 128) @as(u128, if (unsigned) std.math.maxInt(u128) else std.math.maxInt(u128)) else (@as(u64, 1) << @truncate(u6, bit_count - @boolToInt(!unsigned))) - 1; try w.print("#define {s} {d}\n", .{ name, max }); } fn generateSizeofType(comp: *Compilation, w: anytype, name: []const u8, ty: Type) !void { try w.print("#define {s} {d}\n", .{ name, ty.sizeof(comp).? }); } pub fn defineSystemIncludes(comp: *Compilation) !void { var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; var search_path: []const u8 = std.fs.selfExePath(&buf) catch return error.SelfExeNotFound; while (std.fs.path.dirname(search_path)) |dirname| : (search_path = dirname) { var base_dir = std.fs.cwd().openDir(dirname, .{}) catch continue; defer base_dir.close(); base_dir.access("include/stddef.h", .{}) catch continue; const path = try std.fs.path.join(comp.gpa, &.{ dirname, "include" }); comp.builtin_header_path = path; try comp.system_include_dirs.append(path); break; } else return error.AroIncludeNotFound; try comp.system_include_dirs.append("/usr/include"); } pub fn getSource(comp: *Compilation, id: Source.Id) Source { return comp.sources.values()[@enumToInt(id) - 2]; } pub fn addSource(comp: *Compilation, path: []const u8) !Source { if (comp.sources.get(path)) |some| return some; const file = try std.fs.cwd().openFile(path, .{}); defer file.close(); const duped_path = try comp.gpa.dupe(u8, path); errdefer comp.gpa.free(duped_path); const contents = try file.reader().readAllAlloc(comp.gpa, std.math.maxInt(u32)); errdefer comp.gpa.free(contents); const source = Source{ .id = @intToEnum(Source.Id, comp.sources.count() + 2), .path = duped_path, .buf = contents, }; try comp.sources.put(duped_path, source); return source; } pub fn findInclude(comp: *Compilation, tok: Token, filename: []const u8, search_cwd: bool) !Source { var path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; var fib = std.heap.FixedBufferAllocator.init(&path_buf); if (search_cwd) blk: { const source = comp.getSource(tok.source); const path = if (std.fs.path.dirname(source.path)) |some| std.fs.path.join(&fib.allocator, &.{ some, filename }) catch break :blk else filename; if (comp.addSource(path)) |some| return some else |err| switch (err) { error.OutOfMemory => return error.OutOfMemory, else => {}, } } for (comp.include_dirs.items) |dir| { fib.end_index = 0; const path = std.fs.path.join(&fib.allocator, &.{ dir, filename }) catch continue; if (comp.addSource(path)) |some| return some else |err| switch (err) { error.OutOfMemory => return error.OutOfMemory, else => {}, } } for (comp.system_include_dirs.items) |dir| { fib.end_index = 0; const path = std.fs.path.join(&fib.allocator, &.{ dir, filename }) catch continue; if (comp.addSource(path)) |some| return some else |err| switch (err) { error.OutOfMemory => return error.OutOfMemory, else => {}, } } return comp.fatal(tok, "'{s}' not found", .{filename}); } pub fn fatal(comp: *Compilation, tok: Token, comptime fmt: []const u8, args: anytype) Error { const source = comp.getSource(tok.source); const lcs = source.lineColString(tok.start); return comp.diag.fatal(source.path, lcs, fmt, args); } pub fn addDiagnostic(comp: *Compilation, msg: Diagnostics.Message) Error!void { if (comp.langopts.suppress(msg.tag)) return; return comp.diag.add(msg); } pub const renderErrors = Diagnostics.render;
src/Compilation.zig
const std = @import("std"); const mem = std.mem; const Allocator = mem.Allocator; const Sha256 = std.crypto.hash.sha2.Sha256; const Hmac256 = std.crypto.auth.hmac.sha2.HmacSha256; const Chacha20Poly1305 = std.crypto.aead.chacha_poly.ChaCha20Poly1305; pub const asn1 = @import("asn1.zig"); pub const x509 = @import("x509.zig"); const mixtime = @import("mixtime.zig").mixtime; comptime { std.testing.refAllDecls(x509); std.testing.refAllDecls(asn1); } // zig fmt: off const client_hello_start: [61]u8 = [_]u8{ // Record header: Handshake record type, protocol version, handshake size 0x16, 0x03, 0x01, undefined, undefined, // Handshake message type, bytes of client hello 0x01, undefined, undefined, undefined, // Client version (hardcoded to TLS 1.2 even for TLS 1.3) 0x03, 0x03, } ++ ([1]u8{undefined} ** 32) ++ [_]u8{ // Session ID 0x00, // Cipher suites, we just use TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (CC A8) for now 0x00, 0x02, 0xCC, 0xA8, // Compression methods (no compression) 0x01, 0x00, // Extensions length undefined, undefined, // Extension: server // id, length, length of entry 0x00, 0x00, undefined, undefined, undefined, undefined, // entry type, length of bytes 0x00, undefined, undefined, }; const client_hello_end = [37]u8 { // Extension: supported groups, for now just x25519 (00 1D) 0x00, 0x0A, 0x00, 0x04, 0x00, 0x02, 0x00, 0x1D, // Extension: EC point formats => uncompressed point format 0x00, 0x0B, 0x00, 0x02, 0x01, 0x00, // Extension: Signature algorithms // RSA/PKCS1/SHA256, ECDSA/SECP256r1/SHA256, RSA/PKCS1/SHA512, ECDSA/SECP521r1/SHA512 0x00, 0x0D, 0x00, 0x0A, 0x00, 0x08, 0x04, 0x01, 0x04, 0x03, 0x06, 0x01, 0x06, 0x02, // Extension: Renegotiation Info => new connection 0xFF, 0x01, 0x00, 0x01, 0x00, // Extension: SCT (signed certificate timestamp) 0x00, 0x12, 0x00, 0x00 }; // zig fmt: on fn handshake_record_length(reader: anytype) !usize { return try record_length(0x16, reader); } // Assumes a sha256 reader fn record_length(t: u8, reader: anytype) !usize { try check_record_type(t, reader); var record_header: [4]u8 = undefined; try reader.readNoEof(&record_header); if (!mem.eql(u8, record_header[0..2], "\x03\x03") and !mem.eql(u8, record_header[0..2], "\x03\x01")) return error.ServerInvalidVersion; return mem.readIntSliceBig(u16, record_header[2..4]); } pub const ServerAlert = error{ AlertCloseNotify, AlertUnexpectedMessage, AlertBadRecordMAC, AlertDecryptionFailed, AlertRecordOverflow, AlertDecompressionFailure, AlertHandshakeFailure, AlertNoCertificate, AlertBadCertificate, AlertUnsupportedCertificate, AlertCertificateRevoked, AlertCertificateExpired, AlertCertificateUnknown, AlertIllegalParameter, AlertUnknownCA, AlertAccessDenied, AlertDecodeError, AlertDecryptError, AlertExportRestriction, AlertProtocolVersion, AlertInsufficientSecurity, AlertInternalError, AlertUserCanceled, AlertNoRenegotiation, AlertUnsupportedExtension, }; fn check_record_type( expected: u8, reader: anytype, ) (@TypeOf(reader).Error || ServerAlert || error{ ServerMalformedResponse, EndOfStream })!void { const record_type = try reader.readByte(); // Alert if (record_type == 0x15) { // Skip SSL version, length of record try reader.skipBytes(4, .{}); const severity = try reader.readByte(); const err_num = try reader.readByte(); return switch (err_num) { 0 => error.AlertCloseNotify, 10 => error.AlertUnexpectedMessage, 20 => error.AlertBadRecordMAC, 21 => error.AlertDecryptionFailed, 22 => error.AlertRecordOverflow, 30 => error.AlertDecompressionFailure, 40 => error.AlertHandshakeFailure, 41 => error.AlertNoCertificate, 42 => error.AlertBadCertificate, 43 => error.AlertUnsupportedCertificate, 44 => error.AlertCertificateRevoked, 45 => error.AlertCertificateExpired, 46 => error.AlertCertificateUnknown, 47 => error.AlertIllegalParameter, 48 => error.AlertUnknownCA, 49 => error.AlertAccessDenied, 50 => error.AlertDecodeError, 51 => error.AlertDecryptError, 60 => error.AlertExportRestriction, 70 => error.AlertProtocolVersion, 71 => error.AlertInsufficientSecurity, 80 => error.AlertInternalError, 90 => error.AlertUserCanceled, 100 => error.AlertNoRenegotiation, 110 => error.AlertUnsupportedExtension, else => error.ServerMalformedResponse, }; } if (record_type != expected) return error.ServerMalformedResponse; } fn Sha256Reader(comptime Reader: anytype) type { const State = struct { sha256: *Sha256, reader: Reader, }; const S = struct { pub fn read(state: State, buffer: []u8) Reader.Error!usize { const amt = try state.reader.read(buffer); if (amt != 0) { state.sha256.update(buffer[0..amt]); } return amt; } }; return std.io.Reader(State, Reader.Error, S.read); } fn sha256_reader(sha256: *Sha256, reader: anytype) Sha256Reader(@TypeOf(reader)) { return .{ .context = .{ .sha256 = sha256, .reader = reader } }; } fn Sha256Writer(comptime Writer: anytype) type { const State = struct { sha256: *Sha256, writer: Writer, }; const S = struct { pub fn write(state: State, buffer: []const u8) Writer.Error!usize { const amt = try state.writer.write(buffer); if (amt != 0) { state.sha256.update(buffer[0..amt]); } return amt; } }; return std.io.Writer(State, Writer.Error, S.write); } fn sha256_writer(sha256: *Sha256, writer: anytype) Sha256Writer(@TypeOf(writer)) { return .{ .context = .{ .sha256 = sha256, .writer = writer } }; } fn CertificateReaderState(comptime Reader: type) type { return struct { reader: Reader, length: usize, idx: usize = 0, }; } fn CertificateReader(comptime Reader: type) type { const S = struct { pub fn read(state: *CertificateReaderState(Reader), buffer: []u8) Reader.Error!usize { const out_bytes = std.math.min(buffer.len, state.length - state.idx); const res = try state.reader.readAll(buffer[0..out_bytes]); state.idx += res; return res; } }; return std.io.Reader(*CertificateReaderState(Reader), Reader.Error, S.read); } pub const CertificateVerifier = union(enum) { none, function: anytype, }; pub fn CertificateVerifierReader(comptime Reader: type) type { return CertificateReader(Sha256Reader(Reader)); } pub const HandshakeOptions = mixtime(.{ .{ "rand", .runtime, ?*std.rand.Random }, .{ "reader", .runtime }, .{ "writer", .runtime }, .{ "cert_verifier", .compiletime, CertificateVerifier }, // @TODO Things like supported cipher suites, compression methods, extensions as comptime here? // @TODO Comptime slice of supported cipher suites, generate the handshake accordingly at comptime. }); pub fn ClientConnectError(comptime verifier: CertificateVerifier, comptime Reader: type, comptime Writer: type) type { const Additional = error{ RandomBytesFailed, ServerInvalidVersion, ServerMalformedResponse, EndOfStream, ServerInvalidCipherSuite, ServerInvalidCompressionMethod, ServerInvalidRenegotiationData, ServerInvalidECPointCompression, ServerInvalidExtension, ServerInvalidCurve, ServerInvalidSignature, X25519KeyPairCreateFailed, X25519MultFailed, ServerAuthenticationFailed, ServerInvalidVerifyData, }; const err_msg = "Certificate verifier function cannot be generic, use CertificateVerifierReader to get the reader argument type"; return Reader.Error || Writer.Error || ServerAlert || Additional || switch (verifier) { .none => error{}, .function => |f| @typeInfo(@typeInfo(@TypeOf(f)).Fn.return_type orelse @compileError(err_msg)).ErrorUnion.error_set || error{CertificateVerificationFailed}, }; } pub fn client_connect( opt_tup: anytype, hostname: []const u8, ) ClientConnectError( opt_tup.cert_verifier, @TypeOf(opt_tup.reader), @TypeOf(opt_tup.writer), )!Client(@TypeOf(opt_tup.reader), @TypeOf(opt_tup.writer)) { const options = HandshakeOptions.make(opt_tup); var handshake_record_hash = Sha256.init(.{}); const reader = options.reader; const writer = options.writer; const hashing_reader = sha256_reader(&handshake_record_hash, reader); const hashing_writer = sha256_writer(&handshake_record_hash, writer); var client_random: [32]u8 = undefined; const rand = options.rand orelse blk: { var secret_seed: [std.rand.Gimli.secret_seed_length]u8 = undefined; std.crypto.random.bytes(&secret_seed); break :blk &std.rand.Gimli.init(secret_seed).random; }; rand.bytes(&client_random); var server_random: [32]u8 = undefined; { var msg_buf = client_hello_start; mem.writeIntBig(u16, msg_buf[3..5], @intCast(u16, hostname.len + 0x5D)); mem.writeIntBig(u24, msg_buf[6..9], @intCast(u24, hostname.len + 0x59)); mem.copy(u8, msg_buf[11..43], &client_random); mem.writeIntBig(u16, msg_buf[50..52], @intCast(u16, hostname.len + 0x2E)); mem.writeIntBig(u16, msg_buf[54..56], @intCast(u16, hostname.len + 5)); mem.writeIntBig(u16, msg_buf[56..58], @intCast(u16, hostname.len + 3)); mem.writeIntBig(u16, msg_buf[59..61], @intCast(u16, hostname.len)); try writer.writeAll(msg_buf[0..5]); try hashing_writer.writeAll(msg_buf[5..]); } try hashing_writer.writeAll(hostname); try hashing_writer.writeAll(&client_hello_end); // Read server hello { const length = try handshake_record_length(reader); if (length < 44) return error.ServerMalformedResponse; { var hs_hdr_and_server_ver: [6]u8 = undefined; try hashing_reader.readNoEof(&hs_hdr_and_server_ver); if (hs_hdr_and_server_ver[0] != 0x02) return error.ServerMalformedResponse; if (!mem.eql(u8, hs_hdr_and_server_ver[4..6], "\x03\x03")) return error.ServerInvalidVersion; } try hashing_reader.readNoEof(&server_random); // Just skip the session id for now const sess_id_len = try hashing_reader.readByte(); if (sess_id_len != 0) try hashing_reader.skipBytes(sess_id_len, .{}); // TODO: More cipher suites if (!try hashing_reader.isBytes("\xCC\xA8")) return error.ServerInvalidCipherSuite; // Compression method if ((try hashing_reader.readByte()) != 0x00) return error.ServerInvalidCompressionMethod; const exts_length = try hashing_reader.readIntBig(u16); var ext_byte_idx: usize = 0; while (ext_byte_idx < exts_length) { var ext_tag: [2]u8 = undefined; try hashing_reader.readNoEof(&ext_tag); const ext_len = try hashing_reader.readIntBig(u16); ext_byte_idx += 4 + ext_len; if (ext_tag[0] == 0xFF and ext_tag[1] == 0x01) { // Renegotiation info if (ext_len != 0x01 or (try hashing_reader.readByte()) != 0x00) return error.ServerInvalidRenegotiationData; } else if (ext_tag[0] == 0x00 and ext_tag[1] == 0x00) { // Server name if (ext_len != 0) try hashing_reader.skipBytes(ext_len, .{}); } else if (ext_tag[0] == 0x00 and ext_tag[1] == 0x0B) { const format_count = try hashing_reader.readByte(); var found_uncompressed = false; var i: usize = 0; while (i < format_count) : (i += 1) { const byte = try hashing_reader.readByte(); if (byte == 0x0) found_uncompressed = true; } if (!found_uncompressed) return error.ServerInvalidECPointCompression; } else return error.ServerInvalidExtension; } if (ext_byte_idx != exts_length) return error.ServerMalformedResponse; } // Read server certificates { const length = try handshake_record_length(reader); { var handshake_header: [4]u8 = undefined; try hashing_reader.readNoEof(&handshake_header); if (handshake_header[0] != 0x0b) return error.ServerMalformedResponse; } const certs_length = try hashing_reader.readIntBig(u24); switch (options.cert_verifier) { .none => try hashing_reader.skipBytes(certs_length, .{}), .function => |f| { var reader_state = CertificateReaderState(@TypeOf(hashing_reader)){ .reader = hashing_reader, .length = certs_length, }; var cert_reader = CertificateReader(@TypeOf(hashing_reader)){ .context = &reader_state }; if (!try f(cert_reader)) return error.CertificateVerificationFailed; try hashing_reader.skipBytes(reader_state.length - reader_state.idx, .{}); }, } } // Read server ephemeral public key var server_public_key: [32]u8 = undefined; { const length = try handshake_record_length(reader); { var handshake_header: [4]u8 = undefined; try hashing_reader.readNoEof(&handshake_header); if (handshake_header[0] != 0x0c) return error.ServerMalformedResponse; // Only x25519 supported for now. if (!try hashing_reader.isBytes("\x03\x00\x1D")) return error.ServerInvalidCurve; } const pub_key_len = try hashing_reader.readByte(); if (pub_key_len != 32) return error.ServerMalformedResponse; try hashing_reader.readNoEof(&server_public_key); // Signed public key const signature_id = try hashing_reader.readIntBig(u16); const signature_len = try hashing_reader.readIntBig(u16); switch (signature_id) { // RSA/PKCS1/SHA256 0x0401 => { if (signature_len != 256) return error.ServerMalformedResponse; }, // ECDSA/SECP256r1/SHA256 0x0403 => { if (signature_len != 256) return error.ServerMalformedResponse; }, // RSA/PKCS1/SHA512 0x0601 => { if (signature_len != 512) return error.ServerMalformedResponse; }, // ECDSA/SECP521r1/SHA512 0x0602 => { if (signature_len != 512) return error.ServerMalformedResponse; }, else => return error.ServerInvalidSignature, } // TODO Verify the signature try hashing_reader.skipBytes(signature_len, .{}); } // Read server hello done { const length = try handshake_record_length(reader); if (length != 4 or !try hashing_reader.isBytes("\x0e\x00\x00\x00")) return error.ServerMalformedResponse; } // Generate keys for the session var client_key_pair_seed: [32]u8 = undefined; rand.bytes(&client_key_pair_seed); const client_key_pair = std.crypto.dh.X25519.KeyPair.create(client_key_pair_seed) catch return error.X25519KeyPairCreateFailed; { // Client key exchange try writer.writeAll(&[5]u8{ 0x16, 0x03, 0x03, 0x00, 0x25 }); try hashing_writer.writeAll(&[5]u8{ 0x10, 0x00, 0x00, 0x21, 0x20 }); try hashing_writer.writeAll(&client_key_pair.public_key); } // Client encryption keys calculation for ECDHE_RSA cipher suites with SHA256 hash var master_secret: [48]u8 = undefined; // No MAC keys for CHACHA20POLY1305 var client_key: [32]u8 = undefined; var server_key: [32]u8 = undefined; var client_iv: [12]u8 = undefined; var server_iv: [12]u8 = undefined; { const pre_master_secret = std.crypto.dh.X25519.scalarmult(client_key_pair.secret_key, server_public_key) catch return error.X25519MultFailed; var seed: [77]u8 = undefined; seed[0..13].* = "master secret".*; seed[13..45].* = client_random; seed[45..77].* = server_random; var a1: [32 + seed.len]u8 = undefined; Hmac256.create(a1[0..32], &seed, &pre_master_secret); var a2: [32 + seed.len]u8 = undefined; Hmac256.create(a2[0..32], a1[0..32], &pre_master_secret); a1[32..].* = seed; a2[32..].* = seed; var p1: [32]u8 = undefined; Hmac256.create(&p1, &a1, &pre_master_secret); var p2: [32]u8 = undefined; Hmac256.create(&p2, &a2, &pre_master_secret); master_secret[0..32].* = p1; master_secret[32..48].* = p2[0..16].*; // Key expansion seed[0..13].* = "key expansion".*; seed[13..45].* = server_random; seed[45..77].* = client_random; a1[32..].* = seed; a2[32..].* = seed; // client write key: 32 bytes // server write key: 32 bytes // client write IV: 12 bytes // server write IV: 12 bytes // TOTAL: 88 bytes // We generate 32 bytes of data at a time, so we need 3 rounds for 96 bytes. // Execute two rounds Hmac256.create(a1[0..32], &seed, &master_secret); Hmac256.create(a2[0..32], a1[0..32], &master_secret); Hmac256.create(&p1, &a1, &master_secret); Hmac256.create(&p2, &a2, &master_secret); client_key = p1; server_key = p2; // Last round Hmac256.create(a1[0..32], a2[0..32], &master_secret); Hmac256.create(&p1, &a1, &master_secret); client_iv = p1[0..12].*; server_iv = p1[12..24].*; } // Client change cipher spec and client handshake finished { // https://tools.ietf.org/id/draft-mavrogiannopoulos-chacha-tls-03.html // The message we need to encrypt is the following: // 0x14 0x00 0x00 0x0c // <12 bytes of verify_data> // seed = "client finished" + SHA256(all handshake messages) // a1 = HMAC-SHA256(key=MasterSecret, data=seed) // p1 = HMAC-SHA256(key=MasterSecret, data=a1 + seed) // verify_data = p1[0..12] var verify_message: [16]u8 = undefined; verify_message[0..4].* = "\x14\x00\x00\x0C".*; { var seed: [47]u8 = undefined; seed[0..15].* = "client finished".*; // We still need to update the hash one time, so we copy // to get the current digest here. var hash_copy = handshake_record_hash; hash_copy.final(seed[15..47]); var a1: [32 + seed.len]u8 = undefined; Hmac256.create(a1[0..32], &seed, &master_secret); a1[32..].* = seed; var p1: [32]u8 = undefined; Hmac256.create(&p1, &a1, &master_secret); verify_message[4..16].* = p1[0..12].*; } handshake_record_hash.update(&verify_message); // Encypt the message! var nonce: [12]u8 = client_iv; var additional_data: [13]u8 = undefined; mem.writeIntBig(u64, additional_data[0..8], 0); additional_data[8..13].* = [5]u8{ 0x16, 0x03, 0x03, 0x00, 0x10 }; var encrypted: [32]u8 = undefined; Chacha20Poly1305.encrypt( encrypted[0..16], encrypted[16..], &verify_message, &additional_data, nonce, client_key, ); try writer.writeAll(&[11]u8{ // Client change cipher spec 0x14, 0x03, 0x03, 0x00, 0x01, 0x01, // Verify data 0x16, 0x03, 0x03, 0x00, 0x20, }); try writer.writeAll(&encrypted); } // Server change cipher spec { const length = try record_length(0x14, reader); if (length != 1 or (try reader.readByte()) != 0x01) return error.ServerMalformedResponse; } // Server handshake finished { const length = try handshake_record_length(reader); if (length != 32) return error.ServerMalformedResponse; var msg_in: [32]u8 = undefined; try reader.readNoEof(&msg_in); var decrypted: [16]u8 = undefined; const nonce: [12]u8 = server_iv; var additional_data: [13]u8 = undefined; mem.writeIntBig(u64, additional_data[0..8], 0); additional_data[8..13].* = [5]u8{ 0x16, 0x03, 0x03, 0x00, 0x10 }; Chacha20Poly1305.decrypt( &decrypted, msg_in[0..16], msg_in[16..].*, &additional_data, nonce, server_key, ) catch return error.ServerAuthenticationFailed; var verify_message: [16]u8 = undefined; verify_message[0..4].* = "\x14\x00\x00\x0C".*; { var seed: [47]u8 = undefined; seed[0..15].* = "server finished".*; handshake_record_hash.final(seed[15..47]); var a1: [32 + seed.len]u8 = undefined; Hmac256.create(a1[0..32], &seed, &master_secret); a1[32..].* = seed; var p1: [32]u8 = undefined; Hmac256.create(&p1, &a1, &master_secret); verify_message[4..16].* = p1[0..12].*; } if (!mem.eql(u8, &decrypted, &verify_message)) return error.ServerInvalidVerifyData; } return Client(@TypeOf(reader), @TypeOf(writer)){ .client_key = client_key, .server_key = server_key, .client_iv = client_iv, .server_iv = server_iv, .parent_reader = reader, .parent_writer = writer, }; } // @TODO Split into another file // TODO See stdlib, this is a modified non vectorized implementation const ChaCha20Stream = struct { const math = std.math; const BlockVec = [16]u32; fn initContext(key: [8]u32, d: [4]u32) BlockVec { const c = "expand 32-byte k"; const constant_le = comptime [4]u32{ mem.readIntLittle(u32, c[0..4]), mem.readIntLittle(u32, c[4..8]), mem.readIntLittle(u32, c[8..12]), mem.readIntLittle(u32, c[12..16]), }; return BlockVec{ constant_le[0], constant_le[1], constant_le[2], constant_le[3], key[0], key[1], key[2], key[3], key[4], key[5], key[6], key[7], d[0], d[1], d[2], d[3], }; } const QuarterRound = struct { a: usize, b: usize, c: usize, d: usize, }; fn Rp(a: usize, b: usize, c: usize, d: usize) QuarterRound { return QuarterRound{ .a = a, .b = b, .c = c, .d = d, }; } inline fn chacha20Core(x: *BlockVec, input: BlockVec) void { x.* = input; const rounds = comptime [_]QuarterRound{ Rp(0, 4, 8, 12), Rp(1, 5, 9, 13), Rp(2, 6, 10, 14), Rp(3, 7, 11, 15), Rp(0, 5, 10, 15), Rp(1, 6, 11, 12), Rp(2, 7, 8, 13), Rp(3, 4, 9, 14), }; comptime var j: usize = 0; inline while (j < 20) : (j += 2) { inline for (rounds) |r| { x[r.a] +%= x[r.b]; x[r.d] = math.rotl(u32, x[r.d] ^ x[r.a], @as(u32, 16)); x[r.c] +%= x[r.d]; x[r.b] = math.rotl(u32, x[r.b] ^ x[r.c], @as(u32, 12)); x[r.a] +%= x[r.b]; x[r.d] = math.rotl(u32, x[r.d] ^ x[r.a], @as(u32, 8)); x[r.c] +%= x[r.d]; x[r.b] = math.rotl(u32, x[r.b] ^ x[r.c], @as(u32, 7)); } } } inline fn hashToBytes(out: *[64]u8, x: BlockVec) void { var i: usize = 0; while (i < 4) : (i += 1) { mem.writeIntLittle(u32, out[16 * i + 0 ..][0..4], x[i * 4 + 0]); mem.writeIntLittle(u32, out[16 * i + 4 ..][0..4], x[i * 4 + 1]); mem.writeIntLittle(u32, out[16 * i + 8 ..][0..4], x[i * 4 + 2]); mem.writeIntLittle(u32, out[16 * i + 12 ..][0..4], x[i * 4 + 3]); } } inline fn contextFeedback(x: *BlockVec, ctx: BlockVec) void { var i: usize = 0; while (i < 16) : (i += 1) { x[i] +%= ctx[i]; } } // TODO: Optimize this fn chacha20Xor(out: []u8, in: []const u8, key: [8]u32, ctx: *BlockVec, idx: *usize, buf: *[64]u8) void { var x: BlockVec = undefined; const start_idx = idx.*; var i: usize = 0; while (i < in.len) { if (idx.* % 64 == 0) { if (idx.* != 0) { ctx.*[12] += 1; } chacha20Core(x[0..], ctx.*); contextFeedback(&x, ctx.*); hashToBytes(buf, x); } out[i] = in[i] ^ buf[idx.* % 64]; i += 1; idx.* += 1; } } }; fn keyToWords(key: [32]u8) [8]u32 { var k: [8]u32 = undefined; var i: usize = 0; while (i < 8) : (i += 1) { k[i] = mem.readIntLittle(u32, key[i * 4 ..][0..4]); } return k; } pub fn Client(comptime _Reader: type, comptime _Writer: type) type { return struct { const internal_buffer_size = 4 * 1024; const ReaderError = _Reader.Error || ServerAlert || error{ ServerMalformedResponse, ServerInvalidVersion }; pub const Reader = std.io.Reader(*@This(), ReaderError, read); pub const Writer = std.io.Writer(*@This(), _Writer.Error, write); client_seq: u64 = 1, server_seq: u64 = 1, server_iv: [12]u8, client_iv: [12]u8, client_key: [32]u8, server_key: [32]u8, parent_reader: _Reader, parent_writer: _Writer, reader_state: union(enum) { in_record: struct { left: usize, context: ChaCha20Stream.BlockVec, idx: usize, buf: [64]u8, }, none, } = .none, pub fn reader(self: *@This()) Reader { return .{ .context = self }; } pub fn writer(self: *@This()) Writer { return .{ .context = self }; } pub fn read(self: *@This(), buffer: []u8) ReaderError!usize { switch (self.reader_state) { .none => { const len = (record_length(0x17, self.parent_reader) catch |err| switch (err) { error.EndOfStream => return 0, else => |e| return e, }) - 16; const curr_bytes = std.math.min(std.math.min(len, internal_buffer_size), buffer.len); var nonce: [12]u8 = undefined; nonce[0..4].* = mem.zeroes([4]u8); mem.writeIntBig(u64, nonce[4..12], self.server_seq); for (nonce) |*n, i| { n.* ^= self.server_iv[i]; } // Partially decrypt the data. var encrypted: [internal_buffer_size]u8 = undefined; const actually_read = try self.parent_reader.read(encrypted[0..curr_bytes]); var c: [4]u32 = undefined; c[0] = 1; c[1] = mem.readIntLittle(u32, nonce[0..4]); c[2] = mem.readIntLittle(u32, nonce[4..8]); c[3] = mem.readIntLittle(u32, nonce[8..12]); const server_key = keyToWords(self.server_key); var context = ChaCha20Stream.initContext(server_key, c); var idx: usize = 0; var buf: [64]u8 = undefined; ChaCha20Stream.chacha20Xor( buffer[0..actually_read], encrypted[0..actually_read], server_key, &context, &idx, &buf, ); if (actually_read < len) { self.reader_state = .{ .in_record = .{ .left = len - actually_read, .context = context, .idx = idx, .buf = buf, }, }; } else { // @TODO Verify Poly1305. self.parent_reader.skipBytes(16, .{}) catch |err| switch (err) { error.EndOfStream => return 0, else => |e| return e, }; self.server_seq += 1; } return actually_read; }, .in_record => |*record_info| { const curr_bytes = std.math.min(std.math.min(internal_buffer_size, buffer.len), record_info.left); // Partially decrypt the data. var encrypted: [internal_buffer_size]u8 = undefined; const actually_read = try self.parent_reader.read(encrypted[0..curr_bytes]); ChaCha20Stream.chacha20Xor( buffer[0..actually_read], encrypted[0..actually_read], keyToWords(self.server_key), &record_info.context, &record_info.idx, &record_info.buf, ); record_info.left -= actually_read; if (record_info.left == 0) { // @TODO Verify Poly1305. self.parent_reader.skipBytes(16, .{}) catch |err| switch (err) { error.EndOfStream => return 0, else => |e| return e, }; self.reader_state = .none; self.server_seq += 1; } return actually_read; }, } } pub fn write(self: *@This(), buffer: []const u8) _Writer.Error!usize { if (buffer.len == 0) return 0; const curr_bytes = @truncate(u16, std.math.min(buffer.len, internal_buffer_size)); var encrypted_data: [internal_buffer_size]u8 = undefined; var tag_data: [16]u8 = undefined; try self.parent_writer.writeAll(&[3]u8{ 0x17, 0x03, 0x03 }); try self.parent_writer.writeIntBig(u16, curr_bytes + 16); var nonce: [12]u8 = undefined; nonce[0..4].* = mem.zeroes([4]u8); mem.writeIntBig(u64, nonce[4..12], self.client_seq); for (nonce) |*n, i| { n.* ^= self.client_iv[i]; } var additional_data: [13]u8 = undefined; mem.writeIntBig(u64, additional_data[0..8], self.client_seq); additional_data[8..11].* = [3]u8{ 0x17, 0x03, 0x03 }; mem.writeIntBig(u16, additional_data[11..], curr_bytes); Chacha20Poly1305.encrypt( encrypted_data[0..curr_bytes], &tag_data, buffer[0..curr_bytes], &additional_data, nonce, self.client_key, ); try self.parent_writer.writeAll(encrypted_data[0..curr_bytes]); try self.parent_writer.writeAll(&tag_data); self.client_seq += 1; return curr_bytes; } pub fn close_notify(self: *@This()) !void { try self.writer().writeAll(&[5]u8{ 0x15, 0x03, 0x03, 0x00, 0x12, }); var encrypted_data: [2]u8 = undefined; var tag_data: [16]u8 = undefined; var nonce: [12]u8 = undefined; nonce[0..4].* = mem.zeroes([4]u8); mem.writeIntBig(u64, nonce[4..12], self.client_seq); for (nonce) |*n, i| { n.* ^= self.client_iv[i]; } var additional_data: [13]u8 = undefined; mem.writeIntBig(u64, additional_data[0..8], self.client_seq); additional_data[8..13].* = [5]u8{ 0x15, 0x03, 0x03, 0x00, 0x02 }; Chacha20Poly1305.encrypt( &encrypted_data, &tag_data, "\x01\x00", &additional_data, nonce, self.client_key, ); self.client_seq += 1; } }; } test "Dummy" { const sock = try std.net.tcpConnectToHost(std.testing.allocator, "en.wikipedia.org", 443); defer sock.close(); var client = try client_connect(.{ .rand = null, .reader = sock.reader(), .writer = sock.writer(), .cert_verifier = .none, }, "en.wikipedia.org"); defer client.close_notify() catch {}; try client.writer().writeAll("GET / HTTP/1.1\r\nHost: en.wikipedia.org\r\nAccept: */*\r\n\r\n"); { const header = try client.reader().readUntilDelimiterAlloc(std.testing.allocator, '\n', std.math.maxInt(usize)); std.testing.expectEqualStrings("HTTP/1.1 301 Moved Permanently", mem.trim(u8, header, &std.ascii.spaces)); std.testing.allocator.free(header); } { const header = try client.reader().readUntilDelimiterAlloc(std.testing.allocator, '\n', std.math.maxInt(usize)); std.testing.allocator.free(header); } { const header = try client.reader().readUntilDelimiterAlloc(std.testing.allocator, '\n', std.math.maxInt(usize)); std.testing.expectEqualStrings("Server: mw1264.eqiad.wmnet", mem.trim(u8, header, &std.ascii.spaces)); std.testing.allocator.free(header); } { const header = try client.reader().readUntilDelimiterAlloc(std.testing.allocator, '\n', std.math.maxInt(usize)); std.testing.expectEqualStrings("X-Content-Type-Options: nosniff", mem.trim(u8, header, &std.ascii.spaces)); std.testing.allocator.free(header); } { const header = try client.reader().readUntilDelimiterAlloc(std.testing.allocator, '\n', std.math.maxInt(usize)); std.testing.expectEqualStrings("P3p: CP=\"See https://en.wikipedia.org/wiki/Special:CentralAutoLogin/P3P for more info.\"", mem.trim(u8, header, &std.ascii.spaces)); std.testing.allocator.free(header); } }
src/main.zig
const std = @import("std"); const expect = @import("std").testing.expect; const zbox = @import("zbox"); pub const log_level: std.log.Level = .debug; pub usingnamespace @import("log_handler"); pub const BorderStyle = enum { border_style_none, border_style_separate, border_style_overlap, }; const box_0011 = '┓'; const box_0101 = '━'; const box_0110 = '┏'; const box_0111 = '┳'; const box_1001 = '┛'; const box_1010 = '┃'; const box_1011 = '┫'; const box_1100 = '┗'; const box_1101 = '┻'; const box_1110 = '┣'; const box_1111 = '╋'; pub const UserInterfaceConfiguration = struct { border_style: BorderStyle = BorderStyle.border_style_separate, }; pub const UserInterface = struct { allocator: *std.mem.Allocator = undefined, backend: BackendZbox = undefined, remainder_layout_area: LayoutArea = undefined, term_layout_area: LayoutArea = undefined, configuration: UserInterfaceConfiguration = undefined, pub fn init(allocator: *std.mem.Allocator, configuration: UserInterfaceConfiguration) !UserInterface { const backend = try BackendZbox.init(allocator); const term_size = try BackendZbox.termSize(); var remainder_layout_area = LayoutArea{ .x = 0, .y = 0, .w = @intCast(usize, term_size.w), .h = @intCast(usize, term_size.h), }; var self = UserInterface{ .backend = backend, .allocator = allocator, .remainder_layout_area = remainder_layout_area, .term_layout_area = remainder_layout_area, .configuration = configuration, }; return self; } pub fn deinit() !void { zbox.deinit(); } pub fn render(self: *UserInterface) !void { try self.backend.render(); } pub fn clear(self: *UserInterface) void { self.remainder_layout_area = self.term_layout_area; self.backend.clear(); } pub fn renderBorder(self: *UserInterface, layout_area: *LayoutArea) void { self.backend.drawBox(layout_area); } pub fn renderLabel(self: *UserInterface, layout_area: *LayoutArea, x: usize, y: usize, text: []const u8) void { const p = self.padding(); var x_offset: usize = p.box; var y_offset: usize = p.box; for (text) |c| { self.backend.putChar(c, layout_area.x + x + x_offset, layout_area.y + y + y_offset); x_offset += 1; } if (self.configuration.border_style != .border_style_none) { self.backend.drawBox(layout_area); } } pub fn padding(self: *UserInterface) Padding { return switch (self.configuration.border_style) { .border_style_none => { return Padding{ .box = 0, .remainder = 0 }; }, .border_style_separate => { return Padding{ .box = 1, .remainder = 2 }; }, .border_style_overlap => { return Padding{ .box = 1, .remainder = 1 }; }, }; } pub fn splitLeftAtChar(self: *UserInterface, layout_area: *LayoutArea, char_count: usize) LayoutArea { const p = self.padding(); var split = LayoutArea{ .x = layout_area.x, .y = layout_area.y, .w = char_count + p.box * 2, .h = layout_area.h, }; layout_area.x += char_count + p.remainder; layout_area.w -= char_count + p.remainder; return split; } pub fn splitRightAtChar(self: *UserInterface, layout_area: *LayoutArea, char_count: usize) LayoutArea { _ = self; var split = LayoutArea{ .x = layout_area.x + char_count, .y = layout_area.y, .w = char_count, .h = layout_area.h, }; layout_area.w -= char_count; return split; } pub fn splitTopAtChar(self: *UserInterface, layout_area: *LayoutArea, char_count: usize) LayoutArea { const p = self.padding(); var split = LayoutArea{ .x = layout_area.x, .y = layout_area.y, .w = layout_area.w, .h = char_count + p.box * 2, }; layout_area.y += char_count + p.remainder; layout_area.h -= char_count + p.remainder; return split; } pub fn splitBottomAtChar(self: *UserInterface, layout_area: *LayoutArea, char_count: usize) LayoutArea { _ = self; var split = LayoutArea{ .x = layout_area.x, .y = layout_area.y + char_count, .w = layout_area.w, .h = char_count, }; layout_area.h -= char_count; return split; } }; const Padding = struct { box: usize, remainder: usize, }; const LayoutArea = struct { x: usize, y: usize, w: usize, h: usize, }; pub const TermSize = struct { w: usize, h: usize, }; const BackendZbox = struct { buffer: zbox.Buffer = undefined, pub fn init(allocator: *std.mem.Allocator) !BackendZbox { try zbox.init(allocator); try zbox.handleSignalInput(); const term_size = try BackendZbox.termSize(); var self = BackendZbox{ .buffer = try zbox.Buffer.init(allocator, term_size.w, term_size.h), }; return self; } pub fn render(self: *BackendZbox) !void { try zbox.push(self.buffer); } pub fn clear(self: *BackendZbox) void { self.buffer.clear(); } pub fn termSize() !TermSize { const term_size = try zbox.size(); return TermSize{ .w = @intCast(usize, term_size.width), .h = @intCast(usize, term_size.height) }; } pub fn updateCell(cell: *zbox.Cell, new_char: u21) void { var orig_char = cell.char; // The @as is required to work around a zig bug (that will not be fixed in the // stage 1 compiler). See e.g. https://github.com/ziglang/zig/issues/5557. cell.char = switch (new_char) { box_0011 => @as(u21, switch (orig_char) { box_0101, box_0110, box_0111 => box_0111, box_1001, box_1010, box_1011 => box_1011, box_1100, box_1101, box_1110, box_1111 => box_1111, else => box_0011, }), box_0101 => @as(u21, switch (orig_char) { box_0011, box_0110, box_0111 => box_0111, box_1001, box_1100, box_1101 => box_1101, box_1010, box_1011, box_1110, box_1111 => box_1111, else => box_0101, }), box_0110 => @as(u21, switch (orig_char) { box_0011, box_0101, box_0111 => box_0111, box_1010, box_1100, box_1110 => box_1110, box_1001, box_1011, box_1101, box_1111 => box_1111, else => box_0110, }), box_1001 => @as(u21, switch (orig_char) { box_0011, box_1010, box_1011 => box_1011, box_0101, box_1100, box_1101 => box_1101, box_0110, box_0111, box_1110, box_1111 => box_1111, else => box_1001, }), box_1010 => @as(u21, switch (orig_char) { box_0011, box_1001, box_1011 => box_1011, box_0110, box_1100, box_1110 => box_1110, box_0101, box_0111, box_1101, box_1111 => box_1111, else => box_1010, }), box_1100 => @as(u21, switch (orig_char) { box_0101, box_1001, box_1101 => box_1101, box_0110, box_1010, box_1110 => box_1110, box_0111, box_1011, box_0011, box_1111 => box_1111, else => box_1100, }), else => new_char, }; } pub fn drawBox(self: *BackendZbox, layout_area: *LayoutArea) void { updateCell(self.buffer.cellRef(layout_area.y, layout_area.x), box_0110); updateCell(self.buffer.cellRef(layout_area.y + layout_area.h - 1, layout_area.x), box_1100); updateCell(self.buffer.cellRef(layout_area.y, layout_area.x + layout_area.w - 1), box_0011); updateCell(self.buffer.cellRef(layout_area.y + layout_area.h - 1, layout_area.x + layout_area.w - 1), box_1001); var y: u32 = 1; while (y < (layout_area.h - 1)) : (y += 1) { updateCell(self.buffer.cellRef(layout_area.y + y, layout_area.x), box_1010); updateCell(self.buffer.cellRef(layout_area.y + y, layout_area.x + layout_area.w - 1), box_1010); } var x: u32 = 1; while (x < (layout_area.w - 1)) : (x += 1) { updateCell(self.buffer.cellRef(layout_area.y, layout_area.x + x), box_0101); updateCell(self.buffer.cellRef(layout_area.y + layout_area.h - 1, layout_area.x + x), box_0101); } } pub fn putChar(self: *BackendZbox, char: u8, x: usize, y: usize) void { self.buffer.cellRef(y, x).char = char; } };
src/immediata.zig
const std = @import("std"); pub const FIXSTR_SIZE: u8 = 0x1f; pub const FIXARRAY_SIZE: u8 = 0x0f; pub const FIXMAP_SIZE: u8 = 0x0f; pub fn from_u8(u: u8) Format { return Format.from_u8(u); } pub const Format = union(enum) { positive_fix_int: u8, fix_map: u8, fix_array: u8, fix_str: u8, nil, never_used, bool_false, bool_true, bin8, bin16, bin32, ext8, ext16, ext32, float32, float64, uint8, uint16, uint32, uint64, int8, int16, int32, int64, fix_ext1, fix_ext2, fix_ext4, fix_ext8, fix_ext16, str8, str16, str32, array16, array32, map16, map32, negative_fix_int: i8, pub fn from_u8(f: u8) Format { if (f >= 0x00 and f <= 0x7f) { return .{ .positive_fix_int = f }; } else if (f >= 0x80 and f <= 0x8f) { return .{ .fix_map = f & FIXMAP_SIZE }; } else if (f >= 0x90 and f <= 0x9f) { return .{ .fix_array = f & FIXARRAY_SIZE }; } else if (f >= 0xa0 and f <= 0xbf) { return .{ .fix_str = f & FIXSTR_SIZE }; } else if (f >= 0xe0 and f <= 0xff) { return .{ .negative_fix_int = @bitCast(i8, f) }; } return switch (f) { 0xc0 => .nil, 0xc1 => .never_used, 0xc2 => .bool_false, 0xc3 => .bool_true, 0xc4 => .bin8, 0xc5 => .bin16, 0xc6 => .bin32, 0xc7 => .ext8, 0xc8 => .ext16, 0xc9 => .ext32, 0xca => .float32, 0xcb => .float64, 0xcc => .uint8, 0xcd => .uint16, 0xce => .uint32, 0xcf => .uint64, 0xd0 => .int8, 0xd1 => .int16, 0xd2 => .int32, 0xd3 => .int64, 0xd4 => .fix_ext1, 0xd5 => .fix_ext2, 0xd6 => .fix_ext4, 0xd7 => .fix_ext8, 0xd8 => .fix_ext16, 0xd9 => .str8, 0xda => .str16, 0xdb => .str32, 0xdc => .array16, 0xdd => .array32, 0xde => .map16, 0xdf => .map32, else => unreachable, }; } pub fn toUint8(f: Format) u8 { return switch (f) { .positive_fix_int => |u| u, .fix_map => |u| 0x80 | (u & FIXMAP_SIZE), .fix_array => |u| 0x90 | (u & FIXARRAY_SIZE), .fix_str => |u| 0xa0 | (u & FIXSTR_SIZE), .nil => 0xc0, .never_used => 0xc1, .bool_false => 0xc2, .bool_true => 0xc3, .bin8 => 0xc4, .bin16 => 0xc5, .bin32 => 0xc6, .ext8 => 0xc7, .ext16 => 0xc8, .ext32 => 0xc9, .float32 => 0xca, .float64 => 0xcb, .uint8 => 0xcc, .uint16 => 0xcd, .uint32 => 0xce, .uint64 => 0xcf, .int8 => 0xd0, .int16 => 0xd1, .int32 => 0xd2, .int64 => 0xd3, .fix_ext1 => 0xd4, .fix_ext2 => 0xd5, .fix_ext4 => 0xd6, .fix_ext8 => 0xd7, .fix_ext16 => 0xd8, .str8 => 0xd9, .str16 => 0xda, .str32 => 0xdb, .array16 => 0xdc, .array32 => 0xdd, .map16 => 0xde, .map32 => 0xdf, .negative_fix_int => |u| @intCast(u8, u), }; } };
src/format.zig
const semver = @import("main.zig"); const t = @import("./util/index.zig"); const std = @import("std"); const mem = std.mem; const warn = std.debug.warn; const testCase = struct { v: []const u8, valid: bool, }; const test_cases = [_]testCase{ testCase{ .v = "bad", .valid = false }, testCase{ .v = "v1-alpha.beta.gamma", .valid = false }, testCase{ .v = "v1-pre", .valid = false }, testCase{ .v = "v1+meta", .valid = false }, testCase{ .v = "v1-pre+meta", .valid = false }, testCase{ .v = "v1.2-pre", .valid = false }, testCase{ .v = "v1.2+meta", .valid = false }, testCase{ .v = "v1.2-pre+meta", .valid = false }, testCase{ .v = "v1.0.0-alpha", .valid = true }, testCase{ .v = "v1.0.0-alpha.1", .valid = true }, testCase{ .v = "v1.0.0-alpha.beta", .valid = true }, testCase{ .v = "v1.0.0-beta", .valid = true }, testCase{ .v = "v1.0.0-beta.2", .valid = true }, testCase{ .v = "v1.0.0-beta.11", .valid = true }, testCase{ .v = "v1.0.0-rc.1", .valid = true }, testCase{ .v = "v1", .valid = true }, testCase{ .v = "v1.0", .valid = true }, testCase{ .v = "v1.0.0", .valid = true }, testCase{ .v = "v1.2", .valid = true }, testCase{ .v = "v1.2.0", .valid = true }, testCase{ .v = "v1.2.3-456", .valid = true }, testCase{ .v = "v1.2.3-456.789", .valid = true }, testCase{ .v = "v1.2.3-456-789", .valid = true }, testCase{ .v = "v1.2.3-456a", .valid = true }, testCase{ .v = "v1.2.3-pre", .valid = true }, testCase{ .v = "v1.2.3-pre+meta", .valid = true }, testCase{ .v = "v1.2.3-pre.1", .valid = true }, testCase{ .v = "v1.2.3-zzz", .valid = true }, testCase{ .v = "v1.2.3", .valid = true }, testCase{ .v = "v1.2.3+meta", .valid = true }, }; test "is valid" { for (test_cases) |ts| { const ok = semver.isValid(ts.v); if (ok != ts.valid) { try t.terrorf("version: {} expected {} got {}", .{ts.v, ts.valid, ok}); } } } const compareTest = struct { x: []const u8, y: []const u8, cmp: semver.Comparison, }; const compare_tests = [_]compareTest{ compareTest{ .x = "v1.0.0-alpha", .y = "v1.0.0-alpha", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.0.0-alpha.1", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-alpha.1", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.0.0-alpha.beta", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-alpha.beta", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-alpha.beta", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.0.0-beta", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-beta", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-beta", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-beta", .y = "v1.0.0-beta", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.0.0-beta.2", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-beta.2", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-beta.2", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-beta.2", .y = "v1.0.0-beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-beta.2", .y = "v1.0.0-beta.2", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.0.0-beta.11", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-beta.11", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-beta.11", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-beta.11", .y = "v1.0.0-beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-beta.11", .y = "v1.0.0-beta.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-beta.11", .y = "v1.0.0-beta.11", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.0.0-rc.1", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-rc.1", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-rc.1", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-rc.1", .y = "v1.0.0-beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-rc.1", .y = "v1.0.0-beta.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-rc.1", .y = "v1.0.0-beta.11", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0-rc.1", .y = "v1.0.0-rc.1", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1", .y = "v1.0.0-beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1", .y = "v1.0.0-beta.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1", .y = "v1.0.0-beta.11", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1", .y = "v1.0.0-rc.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1", .y = "v1", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1", .y = "v1.0", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1", .y = "v1.0.0", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.0", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0", .y = "v1.0.0-beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0", .y = "v1.0.0-beta.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0", .y = "v1.0.0-beta.11", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0", .y = "v1.0.0-rc.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0", .y = "v1", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.0", .y = "v1.0", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.0", .y = "v1.0.0", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.0.0", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0", .y = "v1.0.0-beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0", .y = "v1.0.0-beta.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0", .y = "v1.0.0-beta.11", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0", .y = "v1.0.0-rc.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.0.0", .y = "v1", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.0.0", .y = "v1.0", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.0.0", .y = "v1.0.0", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2", .y = "v1.0.0-beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2", .y = "v1.0.0-beta.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2", .y = "v1.0.0-beta.11", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2", .y = "v1.0.0-rc.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2", .y = "v1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2", .y = "v1.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2", .y = "v1.0.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2", .y = "v1.2", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2", .y = "v1.2.0", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.0", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.0", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.0", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.0", .y = "v1.0.0-beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.0", .y = "v1.0.0-beta.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.0", .y = "v1.0.0-beta.11", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.0", .y = "v1.0.0-rc.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.0", .y = "v1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.0", .y = "v1.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.0", .y = "v1.0.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.0", .y = "v1.2", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.0", .y = "v1.2.0", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.3-456", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456", .y = "v1.0.0-beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456", .y = "v1.0.0-beta.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456", .y = "v1.0.0-beta.11", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456", .y = "v1.0.0-rc.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456", .y = "v1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456", .y = "v1.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456", .y = "v1.0.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456", .y = "v1.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456", .y = "v1.2.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456", .y = "v1.2.3-456", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.3-456.789", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456.789", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456.789", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456.789", .y = "v1.0.0-beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456.789", .y = "v1.0.0-beta.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456.789", .y = "v1.0.0-beta.11", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456.789", .y = "v1.0.0-rc.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456.789", .y = "v1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456.789", .y = "v1.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456.789", .y = "v1.0.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456.789", .y = "v1.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456.789", .y = "v1.2.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456.789", .y = "v1.2.3-456", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456.789", .y = "v1.2.3-456.789", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.3-456-789", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456-789", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456-789", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456-789", .y = "v1.0.0-beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456-789", .y = "v1.0.0-beta.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456-789", .y = "v1.0.0-beta.11", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456-789", .y = "v1.0.0-rc.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456-789", .y = "v1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456-789", .y = "v1.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456-789", .y = "v1.0.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456-789", .y = "v1.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456-789", .y = "v1.2.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456-789", .y = "v1.2.3-456", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456-789", .y = "v1.2.3-456.789", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456-789", .y = "v1.2.3-456-789", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.3-456a", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456a", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456a", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456a", .y = "v1.0.0-beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456a", .y = "v1.0.0-beta.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456a", .y = "v1.0.0-beta.11", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456a", .y = "v1.0.0-rc.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456a", .y = "v1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456a", .y = "v1.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456a", .y = "v1.0.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456a", .y = "v1.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456a", .y = "v1.2.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456a", .y = "v1.2.3-456", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456a", .y = "v1.2.3-456.789", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456a", .y = "v1.2.3-456-789", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-456a", .y = "v1.2.3-456a", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.3-pre", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre", .y = "v1.0.0-beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre", .y = "v1.0.0-beta.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre", .y = "v1.0.0-beta.11", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre", .y = "v1.0.0-rc.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre", .y = "v1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre", .y = "v1.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre", .y = "v1.0.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre", .y = "v1.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre", .y = "v1.2.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre", .y = "v1.2.3-456", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre", .y = "v1.2.3-456.789", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre", .y = "v1.2.3-456-789", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre", .y = "v1.2.3-456a", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre", .y = "v1.2.3-pre", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.3-pre", .y = "v1.2.3-pre+meta", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.3-pre+meta", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre+meta", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre+meta", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre+meta", .y = "v1.0.0-beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre+meta", .y = "v1.0.0-beta.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre+meta", .y = "v1.0.0-beta.11", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre+meta", .y = "v1.0.0-rc.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre+meta", .y = "v1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre+meta", .y = "v1.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre+meta", .y = "v1.0.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre+meta", .y = "v1.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre+meta", .y = "v1.2.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre+meta", .y = "v1.2.3-456", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre+meta", .y = "v1.2.3-456.789", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre+meta", .y = "v1.2.3-456-789", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre+meta", .y = "v1.2.3-456a", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre+meta", .y = "v1.2.3-pre", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.3-pre+meta", .y = "v1.2.3-pre+meta", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.3-pre.1", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre.1", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre.1", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre.1", .y = "v1.0.0-beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre.1", .y = "v1.0.0-beta.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre.1", .y = "v1.0.0-beta.11", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre.1", .y = "v1.0.0-rc.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre.1", .y = "v1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre.1", .y = "v1.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre.1", .y = "v1.0.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre.1", .y = "v1.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre.1", .y = "v1.2.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre.1", .y = "v1.2.3-456", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre.1", .y = "v1.2.3-456.789", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre.1", .y = "v1.2.3-456-789", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre.1", .y = "v1.2.3-456a", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre.1", .y = "v1.2.3-pre", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre.1", .y = "v1.2.3-pre+meta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-pre.1", .y = "v1.2.3-pre.1", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.3-zzz", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-zzz", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-zzz", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-zzz", .y = "v1.0.0-beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-zzz", .y = "v1.0.0-beta.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-zzz", .y = "v1.0.0-beta.11", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-zzz", .y = "v1.0.0-rc.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-zzz", .y = "v1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-zzz", .y = "v1.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-zzz", .y = "v1.0.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-zzz", .y = "v1.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-zzz", .y = "v1.2.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-zzz", .y = "v1.2.3-456", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-zzz", .y = "v1.2.3-456.789", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-zzz", .y = "v1.2.3-456-789", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-zzz", .y = "v1.2.3-456a", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-zzz", .y = "v1.2.3-pre", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-zzz", .y = "v1.2.3-pre+meta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-zzz", .y = "v1.2.3-pre.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3-zzz", .y = "v1.2.3-zzz", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.3", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1.0.0-beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1.0.0-beta.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1.0.0-beta.11", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1.0.0-rc.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1.0.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1.2.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1.2.3-456", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1.2.3-456.789", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1.2.3-456-789", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1.2.3-456a", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1.2.3-pre", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1.2.3-pre+meta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1.2.3-pre.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1.2.3-zzz", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3", .y = "v1.2.3", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.3", .y = "v1.2.3+meta", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.3", .y = "v1.2.3+meta-pre", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.3+meta", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1.0.0-beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1.0.0-beta.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1.0.0-beta.11", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1.0.0-rc.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1.0.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1.2.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1.2.3-456", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1.2.3-456.789", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1.2.3-456-789", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1.2.3-456a", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1.2.3-pre", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1.2.3-pre+meta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1.2.3-pre.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1.2.3-zzz", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta", .y = "v1.2.3", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.3+meta", .y = "v1.2.3+meta", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.3+meta", .y = "v1.2.3+meta-pre", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.0.0-alpha", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.0.0-alpha.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.0.0-alpha.beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.0.0-beta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.0.0-beta.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.0.0-beta.11", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.0.0-rc.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.0.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.2", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.2.0", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.2.3-456", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.2.3-456.789", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.2.3-456-789", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.2.3-456a", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.2.3-pre", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.2.3-pre+meta", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.2.3-pre.1", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.2.3-zzz", .cmp = semver.Comparison.GreaterThan }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.2.3", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.2.3+meta", .cmp = semver.Comparison.Equal }, compareTest{ .x = "v1.2.3+meta-pre", .y = "v1.2.3+meta-pre", .cmp = semver.Comparison.Equal }, }; test "compare" { for (compare_tests) |ts, i| { const cmp = try semver.compare(ts.x, ts.y); if (ts.cmp != cmp) { try t.terrorf("{} [{} ,{}]expected {} got {}", .{i, ts.x, ts.y, ts.cmp, cmp}); } } } const printTest = struct { src: []const u8, expect: []const u8, }; const print_tests = [_]printTest{ printTest{ .src = "v1.0.0-alpha", .expect = "v1.0.0-alpha" }, printTest{ .src = "v1.0.0-alpha.1", .expect = "v1.0.0-alpha.1" }, printTest{ .src = "v1.0.0-alpha.beta", .expect = "v1.0.0-alpha.beta" }, printTest{ .src = "v1.0.0-beta", .expect = "v1.0.0-beta" }, printTest{ .src = "v1.0.0-beta.2", .expect = "v1.0.0-beta.2" }, printTest{ .src = "v1.0.0-beta.11", .expect = "v1.0.0-beta.11" }, printTest{ .src = "v1.0.0-rc.1", .expect = "v1.0.0-rc.1" }, printTest{ .src = "v1", .expect = "v1.0.0" }, printTest{ .src = "v1.0", .expect = "v1.0.0" }, printTest{ .src = "v1.0.0", .expect = "v1.0.0" }, printTest{ .src = "v1.2", .expect = "v1.2.0" }, printTest{ .src = "v1.2.0", .expect = "v1.2.0" }, printTest{ .src = "v1.2.3-456", .expect = "v1.2.3-456" }, printTest{ .src = "v1.2.3-456.789", .expect = "v1.2.3-456.789" }, printTest{ .src = "v1.2.3-456-789", .expect = "v1.2.3-456-789" }, printTest{ .src = "v1.2.3-456a", .expect = "v1.2.3-456a" }, printTest{ .src = "v1.2.3-pre", .expect = "v1.2.3-pre" }, printTest{ .src = "v1.2.3-pre+meta", .expect = "v1.2.3-pre+meta" }, printTest{ .src = "v1.2.3-pre.1", .expect = "v1.2.3-pre.1" }, printTest{ .src = "v1.2.3-zzz", .expect = "v1.2.3-zzz" }, printTest{ .src = "v1.2.3", .expect = "v1.2.3" }, printTest{ .src = "v1.2.3+meta", .expect = "v1.2.3+meta" }, }; test "print" { var buf = try std.Buffer.init(std.testing.allocator, ""); defer buf.deinit(); for (print_tests) |ts| { const v = try semver.parse(ts.src); try v.printBuffer(&buf); if (!mem.eql(u8, buf.toSlice(), ts.expect)) { try t.terrorf("expected {} got {} {}", .{ts.expect, buf.toSlice(), v}); } buf.shrink(0); } } test "parse without v prefix" { _ = try semver.parse("1.2.3"); _ = try semver.parse("1.2.3-pre"); _ = try semver.parse("1.2.3-pre+meta"); _ = try semver.parse("1.2"); _ = try semver.parse("1"); }
src/main_test.zig
const tone = @import("tone.zig"); const tune = @import("tune.zig"); const note = @import("note.zig"); const music = @import("music.zig"); const c5 = note.getFreq("C 5".*); const c4 = note.getFreq("C 4".*); const c3 = note.getFreq("C 3".*); const d3 = note.getFreq("D 3".*); const e3 = note.getFreq("E 3".*); const f3 = note.getFreq("F 3".*); const f4 = note.getFreq("F 4".*); const e4 = note.getFreq("E 4".*); const g4 = note.getFreq("G 4".*); const g3 = note.getFreq("G 3".*); const a3 = note.getFreq("A 3".*); const d4 = note.getFreq("D 4".*); const a4 = note.getFreq("A 4".*); const e5 = note.getFreq("E 5".*); const b4 = note.getFreq("B 4".*); const b3 = note.getFreq("B 3".*); const kick = note.getFreq("B 2".*); var melodyTone = tone.Tone{ .sfreq = c5, .efreq = c5, .channel = 2 }; var harmonyTone = tone.Tone{ .sfreq = c5, .efreq = c5, .channel = 1 }; var drumTone = tone.Tone{ .sfreq = c5, .efreq = c5, .channel = 3, .release = 10, .volume = 5, .mode = 3, .attack = 1 }; var melodyNotes = [_]note.Note{ note.Note{ .sfreq = c3, .efreq = c3, .length = 150 }, note.Note{ .sfreq = d3, .efreq = d3, .length = 150 }, note.Note{ .sfreq = e3, .efreq = e3, .length = 150 }, note.Note{ .sfreq = f3, .efreq = f3, .length = 150 }, note.Note{ .sfreq = c3, .efreq = c3, .length = 150 }, note.Note{ .sfreq = c4, .efreq = c4, .length = 150, .on = false }, note.Note{ .sfreq = c3, .efreq = c3, .length = 15 }, // Marker bar 1 note.Note{ .sfreq = e3, .efreq = e3, .length = 15 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 15 }, note.Note{ .sfreq = c4, .efreq = c4, .length = 15 }, note.Note{ .sfreq = e4, .efreq = e4, .length = 15 }, note.Note{ .sfreq = d4, .efreq = d4, .length = 15 }, note.Note{ .sfreq = c4, .efreq = c4, .length = 15 }, note.Note{ .sfreq = b3, .efreq = b3, .length = 15 }, note.Note{ .sfreq = c4, .efreq = c4, .length = 15 }, note.Note{ .sfreq = b3, .efreq = b3, .length = 15 }, note.Note{ .sfreq = d3, .efreq = d3, .length = 15 }, // Marker bar 2 note.Note{ .sfreq = f3, .efreq = f3, .length = 15 }, note.Note{ .sfreq = a3, .efreq = a3, .length = 15 }, note.Note{ .sfreq = d4, .efreq = d4, .length = 15 }, note.Note{ .sfreq = f4, .efreq = f4, .length = 15 }, note.Note{ .sfreq = e4, .efreq = e4, .length = 15 }, note.Note{ .sfreq = d4, .efreq = d4, .length = 15 }, note.Note{ .sfreq = c4, .efreq = c4, .length = 15 }, note.Note{ .sfreq = b3, .efreq = b3, .length = 15 }, note.Note{ .sfreq = a3, .efreq = a3, .length = 15 }, note.Note{ .sfreq = e3, .efreq = e3, .length = 15 }, // Marker bar 3 note.Note{ .sfreq = g3, .efreq = g3, .length = 15 }, note.Note{ .sfreq = b3, .efreq = b3, .length = 15 }, note.Note{ .sfreq = c4, .efreq = c4, .length = 15 }, note.Note{ .sfreq = e4, .efreq = e4, .length = 15 }, note.Note{ .sfreq = d4, .efreq = d4, .length = 15 }, note.Note{ .sfreq = c4, .efreq = c4, .length = 15 }, note.Note{ .sfreq = b3, .efreq = b3, .length = 15 }, note.Note{ .sfreq = c4, .efreq = c4, .length = 15 }, note.Note{ .sfreq = b3, .efreq = b3, .length = 15 }, note.Note{ .sfreq = f3, .efreq = f3, .length = 15 }, // Marker bar 4 note.Note{ .sfreq = a3, .efreq = a3, .length = 15 }, note.Note{ .sfreq = c4, .efreq = c4, .length = 15 }, note.Note{ .sfreq = d4, .efreq = d4, .length = 15 }, note.Note{ .sfreq = f4, .efreq = f4, .length = 15 }, note.Note{ .sfreq = e4, .efreq = e4, .length = 15 }, note.Note{ .sfreq = d4, .efreq = d4, .length = 15 }, note.Note{ .sfreq = c4, .efreq = c4, .length = 15 }, note.Note{ .sfreq = d4, .efreq = d4, .length = 15 }, note.Note{ .sfreq = c4, .efreq = c4, .length = 15 }, }; var harmonyNotes = [_]note.Note{ note.Note{ .sfreq = c5, .efreq = c5, .length = 60 }, note.Note{ .sfreq = g4, .efreq = g4, .length = 90 }, note.Note{ .sfreq = d4, .efreq = d4, .length = 60 }, note.Note{ .sfreq = a4, .efreq = a4, .length = 90 }, note.Note{ .sfreq = e5, .efreq = e5, .length = 60 }, note.Note{ .sfreq = b4, .efreq = b4, .length = 90 }, note.Note{ .sfreq = f4, .efreq = f4, .length = 60 }, note.Note{ .sfreq = c5, .efreq = c5, .length = 90 }, note.Note{ .sfreq = c4, .efreq = c4, .length = 150 }, note.Note{ .sfreq = c4, .efreq = c4, .length = 150, .on = false }, note.Note{ .sfreq = c5, .efreq = c5, .length = 60 }, // Marker loop 1 note.Note{ .sfreq = g4, .efreq = g4, .length = 90 }, note.Note{ .sfreq = d4, .efreq = d4, .length = 60 }, note.Note{ .sfreq = a4, .efreq = a4, .length = 90 }, note.Note{ .sfreq = e5, .efreq = e5, .length = 60 }, note.Note{ .sfreq = b4, .efreq = b4, .length = 90 }, note.Note{ .sfreq = f4, .efreq = f4, .length = 60 }, note.Note{ .sfreq = c5, .efreq = c5, .length = 90 }, note.Note{ .sfreq = c5, .efreq = c5, .length = 30, .on = false }, note.Note{ .sfreq = c5, .efreq = c5, .length = 60 }, // Marker loop 2 note.Note{ .sfreq = g4, .efreq = g4, .length = 90 }, note.Note{ .sfreq = d4, .efreq = d4, .length = 60 }, note.Note{ .sfreq = a4, .efreq = a4, .length = 90 }, note.Note{ .sfreq = e5, .efreq = e5, .length = 60 }, note.Note{ .sfreq = b4, .efreq = b4, .length = 90 }, note.Note{ .sfreq = f4, .efreq = f4, .length = 60 }, note.Note{ .sfreq = c5, .efreq = c5, .length = 90 }, note.Note{ .sfreq = c5, .efreq = c5, .length = 30, .on = false }, note.Note{ .sfreq = c5, .efreq = c5, .length = 60 }, // Marker loop 3 note.Note{ .sfreq = g4, .efreq = g4, .length = 90 }, note.Note{ .sfreq = d4, .efreq = d4, .length = 60 }, note.Note{ .sfreq = a4, .efreq = a4, .length = 90 }, note.Note{ .sfreq = e5, .efreq = e5, .length = 60 }, note.Note{ .sfreq = b4, .efreq = b4, .length = 90 }, note.Note{ .sfreq = f4, .efreq = f4, .length = 60 }, note.Note{ .sfreq = c5, .efreq = c5, .length = 90 }, note.Note{ .sfreq = c5, .efreq = c5, .length = 30, .on = false }, note.Note{ .sfreq = c5, .efreq = c5, .length = 60 }, // Marker loop 4 note.Note{ .sfreq = g4, .efreq = g4, .length = 90 }, note.Note{ .sfreq = d4, .efreq = d4, .length = 60 }, note.Note{ .sfreq = a4, .efreq = a4, .length = 90 }, note.Note{ .sfreq = e5, .efreq = e5, .length = 60 }, note.Note{ .sfreq = b4, .efreq = b4, .length = 90 }, note.Note{ .sfreq = f4, .efreq = f4, .length = 60 }, note.Note{ .sfreq = c5, .efreq = c5, .length = 90 }, note.Note{ .sfreq = c5, .efreq = c5, .length = 30, .on = false }, note.Note{ .sfreq = c5, .efreq = c5, .length = 60 }, // Marker loop 5 note.Note{ .sfreq = g4, .efreq = g4, .length = 90 }, note.Note{ .sfreq = d4, .efreq = d4, .length = 60 }, note.Note{ .sfreq = a4, .efreq = a4, .length = 90 }, note.Note{ .sfreq = f4, .efreq = f4, .length = 60 }, note.Note{ .sfreq = c5, .efreq = c5, .length = 90 }, note.Note{ .sfreq = c5, .efreq = c5, .length = 30, .on = false }, }; var drumNotes = [_]note.Note{ note.Note{ .sfreq = g3, .efreq = g3, .length = 60 }, note.Note{ .sfreq = c5, .efreq = 440, .length = 90 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 60 }, note.Note{ .sfreq = c5, .efreq = 440, .length = 90 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 60 }, note.Note{ .sfreq = c5, .efreq = 440, .length = 90 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 60 }, note.Note{ .sfreq = c5, .efreq = 440, .length = 90 }, note.Note{ .sfreq = c5, .efreq = 440, .length = 150 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 30 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 15 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 15 }, note.Note{ .sfreq = kick, .efreq = kick, .length = 30 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 30 }, note.Note{ .sfreq = kick, .efreq = kick, .length = 30 }, note.Note{ .sfreq = c5, .efreq = 440, .length = 30 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 15 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 15 }, note.Note{ .sfreq = kick, .efreq = kick, .length = 30 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 30 }, note.Note{ .sfreq = kick, .efreq = kick, .length = 30 }, note.Note{ .sfreq = kick, .efreq = kick, .length = 30 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 15 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 15 }, note.Note{ .sfreq = kick, .efreq = kick, .length = 30 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 30 }, note.Note{ .sfreq = kick, .efreq = kick, .length = 30 }, note.Note{ .sfreq = kick, .efreq = kick, .length = 30 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 15 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 15 }, note.Note{ .sfreq = kick, .efreq = kick, .length = 30 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 30 }, note.Note{ .sfreq = kick, .efreq = kick, .length = 30 }, note.Note{ .sfreq = kick, .efreq = kick, .length = 30 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 15 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 15 }, note.Note{ .sfreq = kick, .efreq = kick, .length = 30 }, note.Note{ .sfreq = g3, .efreq = g3, .length = 30 }, note.Note{ .sfreq = kick, .efreq = kick, .length = 30 }, }; var melody = tune.Tune{ .notes = &melodyNotes, .numNotes = melodyNotes.len, .tone = &melodyTone, .introEndNote = 6 }; var harmony = tune.Tune{ .notes = &harmonyNotes, .numNotes = harmonyNotes.len, .tone = &harmonyTone, .introEndNote = 10 }; var drums = tune.Tune{ .notes = &drumNotes, .numNotes = drumNotes.len, .tone = &drumTone, .introEndNote = 15 }; pub const parliamentMusic = music.Music{ .part1 = &melody, .part2 = &harmony, .part3 = &drums };
src/music/parliament-music.zig
const std = @import("std"); const neg = @import("negXi2.zig"); const testing = std.testing; const print = std.debug.print; fn test__negsi2(a: i32, expected: i32) !void { var result = neg.__negsi2(a); try testing.expectEqual(expected, result); } test "negsi2" { // TODO ensuring that math.minInt(i32); returns error try test__negsi2(-3, 3); try test__negsi2(-2, 2); try test__negsi2(-1, 1); try test__negsi2(0, 0); // special case for 2s complement try test__negsi2(1, -1); try test__negsi2(2, -2); try test__negsi2(3, -3); // max_usable == MAX(i32) == -MIN(i32) == 2147483647 == 7fffffff // divTrunc: max_usable / i, i=1,2,3,5,100 // 7fffffff / i try test__negsi2(-715827882, 715827882); try test__negsi2(715827882, -715827882); try test__negsi2(-429496729, 429496729); try test__negsi2(429496729, -429496729); try test__negsi2(-214748364, 214748364); try test__negsi2(214748364, -214748364); // shifting: max_usable >> i, i=0..bitsize-4 // 7fffffff >> i // 7fffffff >> i + 1 // 7fffffff >> i + 3 // 7fffffff >> i + 7 try test__negsi2(-2147483647, 2147483647); try test__negsi2(2147483647, -2147483647); try test__negsi2(-2147483646, 2147483646); try test__negsi2(2147483646, -2147483646); try test__negsi2(-2147483644, 2147483644); try test__negsi2(2147483644, -2147483644); try test__negsi2(-2147483640, 2147483640); try test__negsi2(2147483640, -2147483640); try test__negsi2(-1073741823, 1073741823); try test__negsi2(1073741823, -1073741823); try test__negsi2(-1073741822, 1073741822); try test__negsi2(1073741822, -1073741822); try test__negsi2(-1073741820, 1073741820); try test__negsi2(1073741820, -1073741820); try test__negsi2(-1073741816, 1073741816); try test__negsi2(1073741816, -1073741816); try test__negsi2(-536870911, 536870911); try test__negsi2(536870911, -536870911); try test__negsi2(-536870910, 536870910); try test__negsi2(536870910, -536870910); try test__negsi2(-536870908, 536870908); try test__negsi2(536870908, -536870908); try test__negsi2(-536870904, 536870904); try test__negsi2(536870904, -536870904); try test__negsi2(-268435455, 268435455); try test__negsi2(268435455, -268435455); try test__negsi2(-268435454, 268435454); try test__negsi2(268435454, -268435454); try test__negsi2(-268435452, 268435452); try test__negsi2(268435452, -268435452); try test__negsi2(-268435448, 268435448); try test__negsi2(268435448, -268435448); try test__negsi2(-134217727, 134217727); try test__negsi2(134217727, -134217727); try test__negsi2(-134217726, 134217726); try test__negsi2(134217726, -134217726); try test__negsi2(-134217724, 134217724); try test__negsi2(134217724, -134217724); try test__negsi2(-134217720, 134217720); try test__negsi2(134217720, -134217720); try test__negsi2(-67108863, 67108863); try test__negsi2(67108863, -67108863); try test__negsi2(-67108862, 67108862); try test__negsi2(67108862, -67108862); try test__negsi2(-67108860, 67108860); try test__negsi2(67108860, -67108860); try test__negsi2(-67108856, 67108856); try test__negsi2(67108856, -67108856); try test__negsi2(-33554431, 33554431); try test__negsi2(33554431, -33554431); try test__negsi2(-33554430, 33554430); try test__negsi2(33554430, -33554430); try test__negsi2(-33554428, 33554428); try test__negsi2(33554428, -33554428); try test__negsi2(-33554424, 33554424); try test__negsi2(33554424, -33554424); try test__negsi2(-16777215, 16777215); try test__negsi2(16777215, -16777215); try test__negsi2(-16777214, 16777214); try test__negsi2(16777214, -16777214); try test__negsi2(-16777212, 16777212); try test__negsi2(16777212, -16777212); try test__negsi2(-16777208, 16777208); try test__negsi2(16777208, -16777208); try test__negsi2(-8388607, 8388607); try test__negsi2(8388607, -8388607); try test__negsi2(-8388606, 8388606); try test__negsi2(8388606, -8388606); try test__negsi2(-8388604, 8388604); try test__negsi2(8388604, -8388604); try test__negsi2(-8388600, 8388600); try test__negsi2(8388600, -8388600); try test__negsi2(-4194303, 4194303); try test__negsi2(4194303, -4194303); try test__negsi2(-4194302, 4194302); try test__negsi2(4194302, -4194302); try test__negsi2(-4194300, 4194300); try test__negsi2(4194300, -4194300); try test__negsi2(-4194296, 4194296); try test__negsi2(4194296, -4194296); try test__negsi2(-2097151, 2097151); try test__negsi2(2097151, -2097151); try test__negsi2(-2097150, 2097150); try test__negsi2(2097150, -2097150); try test__negsi2(-2097148, 2097148); try test__negsi2(2097148, -2097148); try test__negsi2(-2097144, 2097144); try test__negsi2(2097144, -2097144); try test__negsi2(-1048575, 1048575); try test__negsi2(1048575, -1048575); try test__negsi2(-1048574, 1048574); try test__negsi2(1048574, -1048574); try test__negsi2(-1048572, 1048572); try test__negsi2(1048572, -1048572); try test__negsi2(-1048568, 1048568); try test__negsi2(1048568, -1048568); try test__negsi2(-524287, 524287); try test__negsi2(524287, -524287); try test__negsi2(-524286, 524286); try test__negsi2(524286, -524286); try test__negsi2(-524284, 524284); try test__negsi2(524284, -524284); try test__negsi2(-524280, 524280); try test__negsi2(524280, -524280); try test__negsi2(-262143, 262143); try test__negsi2(262143, -262143); try test__negsi2(-262142, 262142); try test__negsi2(262142, -262142); try test__negsi2(-262140, 262140); try test__negsi2(262140, -262140); try test__negsi2(-262136, 262136); try test__negsi2(262136, -262136); try test__negsi2(-131071, 131071); try test__negsi2(131071, -131071); try test__negsi2(-131070, 131070); try test__negsi2(131070, -131070); try test__negsi2(-131068, 131068); try test__negsi2(131068, -131068); try test__negsi2(-131064, 131064); try test__negsi2(131064, -131064); try test__negsi2(-65535, 65535); try test__negsi2(65535, -65535); try test__negsi2(-65534, 65534); try test__negsi2(65534, -65534); try test__negsi2(-65532, 65532); try test__negsi2(65532, -65532); try test__negsi2(-65528, 65528); try test__negsi2(65528, -65528); try test__negsi2(-32767, 32767); try test__negsi2(32767, -32767); try test__negsi2(-32766, 32766); try test__negsi2(32766, -32766); try test__negsi2(-32764, 32764); try test__negsi2(32764, -32764); try test__negsi2(-32760, 32760); try test__negsi2(32760, -32760); try test__negsi2(-16383, 16383); try test__negsi2(16383, -16383); try test__negsi2(-16382, 16382); try test__negsi2(16382, -16382); try test__negsi2(-16380, 16380); try test__negsi2(16380, -16380); try test__negsi2(-16376, 16376); try test__negsi2(16376, -16376); try test__negsi2(-8191, 8191); try test__negsi2(8191, -8191); try test__negsi2(-8190, 8190); try test__negsi2(8190, -8190); try test__negsi2(-8188, 8188); try test__negsi2(8188, -8188); try test__negsi2(-8184, 8184); try test__negsi2(8184, -8184); try test__negsi2(-4095, 4095); try test__negsi2(4095, -4095); try test__negsi2(-4094, 4094); try test__negsi2(4094, -4094); try test__negsi2(-4092, 4092); try test__negsi2(4092, -4092); try test__negsi2(-4088, 4088); try test__negsi2(4088, -4088); try test__negsi2(-2047, 2047); try test__negsi2(2047, -2047); try test__negsi2(-2046, 2046); try test__negsi2(2046, -2046); try test__negsi2(-2044, 2044); try test__negsi2(2044, -2044); try test__negsi2(-2040, 2040); try test__negsi2(2040, -2040); try test__negsi2(-1023, 1023); try test__negsi2(1023, -1023); try test__negsi2(-1022, 1022); try test__negsi2(1022, -1022); try test__negsi2(-1020, 1020); try test__negsi2(1020, -1020); try test__negsi2(-1016, 1016); try test__negsi2(1016, -1016); try test__negsi2(-511, 511); try test__negsi2(511, -511); try test__negsi2(-510, 510); try test__negsi2(510, -510); try test__negsi2(-508, 508); try test__negsi2(508, -508); try test__negsi2(-504, 504); try test__negsi2(504, -504); try test__negsi2(-255, 255); try test__negsi2(255, -255); try test__negsi2(-254, 254); try test__negsi2(254, -254); try test__negsi2(-252, 252); try test__negsi2(252, -252); try test__negsi2(-248, 248); try test__negsi2(248, -248); try test__negsi2(-127, 127); try test__negsi2(127, -127); try test__negsi2(-126, 126); try test__negsi2(126, -126); try test__negsi2(-124, 124); try test__negsi2(124, -124); try test__negsi2(-120, 120); try test__negsi2(120, -120); try test__negsi2(-63, 63); try test__negsi2(63, -63); try test__negsi2(-62, 62); try test__negsi2(62, -62); try test__negsi2(-60, 60); try test__negsi2(60, -60); try test__negsi2(-56, 56); try test__negsi2(56, -56); try test__negsi2(-31, 31); try test__negsi2(31, -31); try test__negsi2(-30, 30); try test__negsi2(30, -30); try test__negsi2(-28, 28); try test__negsi2(28, -28); try test__negsi2(-24, 24); try test__negsi2(24, -24); try test__negsi2(-15, 15); try test__negsi2(15, -15); try test__negsi2(-14, 14); try test__negsi2(14, -14); try test__negsi2(-12, 12); try test__negsi2(12, -12); try test__negsi2(-8, 8); try test__negsi2(8, -8); }
lib/std/special/compiler_rt/negsi2_test.zig
const std = @import("std"); const assert = std.debug.assert; pub const Oid = @import("oids.zig").Oid; pub const Value = std.json.Value; const rpc_version = "\"jsonrpc\":\"2.0\""; pub fn jsonToString( self: Value, comptime fmt: []const u8, context: var, comptime FmtError: type, output: fn (@typeOf(context), []const u8) FmtError!void, ) FmtError!void { switch (self) { Value.Null => { return std.fmt.format(context, FmtError, output, "null"); }, Value.Bool => |inner| { return std.fmt.format(context, FmtError, output, "{}", inner); }, Value.Integer => |inner| { return std.fmt.format(context, FmtError, output, "{}", inner); }, Value.Float => |inner| { return std.fmt.format(context, FmtError, output, "{.5}", inner); }, Value.String => |inner| { return std.fmt.format(context, FmtError, output, "\"{}\"", inner); }, Value.Array => |inner| { var not_first = false; try std.fmt.format(context, FmtError, output, "["); for (inner.toSliceConst()) |value| { if (not_first) { try std.fmt.format(context, FmtError, output, ","); } not_first = true; try jsonToString(value, fmt, context, FmtError, output); } return std.fmt.format(context, FmtError, output, "]"); }, Value.Object => |inner| { var not_first = false; try std.fmt.format(context, FmtError, output, "{{"); var it = inner.iterator(); while (it.next()) |entry| { if (not_first) { try std.fmt.format(context, FmtError, output, ","); } not_first = true; try std.fmt.format(context, FmtError, output, "\"{}\":", entry.key); try jsonToString(entry.value, fmt, context, FmtError, output); } return std.fmt.format(context, FmtError, output, "}}"); }, } } pub const Request = union(enum) { Call: CallObj, Notification: NotificationObj, pub const CallObj = struct { method: []const u8, params: ?Value, id: Oid, }; pub const NotificationObj = struct { method: []const u8, params: ?Value, }; pub fn call(method: []const u8, params: ?Value) Request { return Request { .Call = CallObj { .method = method, .params = params, .id = Oid.new(), } }; } pub fn notify(method: []const u8, params: ?Value) Request { return Request { .Notification = NotificationObj { .method = method, .params = params, } }; } pub fn format( self: Request, comptime fmt: []const u8, context: var, comptime FmtError: type, output: fn (@typeOf(context), []const u8) FmtError!void, ) FmtError!void { switch (self) { Request.Call => |c| { if (c.params) |p| { try std.fmt.format(context, FmtError, output, "{}{},\"method\":\"{}\",\"params\":", "{", rpc_version, c.method); try jsonToString(p, fmt, context, FmtError, output); try std.fmt.format(context, FmtError, output, ",\"id\":\"{}\"{}", c.id, "}"); } else { return std.fmt.format(context, FmtError, output, "{}{},\"method\":\"{}\",\"id\":\"{}\"{}", "{", rpc_version, c.method, c.id, "}" ); } }, Request.Notification => |n| { if (n.params) |p| { try std.fmt.format(context, FmtError, output, "{}{},\"method\":\"{}\",\"params\":", "{", rpc_version, n.method); try jsonToString(p, fmt, context, FmtError, output); try std.fmt.format(context, FmtError, output, "{}", "}"); } else { return std.fmt.format(context, FmtError, output, "{}{},\"method\":\"{}\"{}", "{", rpc_version, n.method, "}" ); } } } } }; pub const Response = union(enum) { Error: ErrorObj, Ok: OkObj, pub const ErrorObj = struct { code: ErrorCode, message: []const u8, data: ?Value, }; pub const OkObj = struct { result: Value, id: Oid, }; pub fn ok(result: Value, id: Oid) Response { return Response { .Ok = OkObj { .result = result, .id = id, } }; } pub fn err(code: ErrorCode, data: ?Value) Response { return Response { .Error = ErrorObj { .code = code, .message = code.getMsg(), .data = data, } }; } pub fn format( self: Response, comptime fmt: []const u8, context: var, comptime FmtError: type, output: fn (@typeOf(context), []const u8) FmtError!void, ) FmtError!void { switch (self) { Response.Ok => |o| { try std.fmt.format(context, FmtError, output, "{}{},\"result\":", "{", rpc_version); try jsonToString(o.result, fmt, context, FmtError, output); try std.fmt.format(context, FmtError, output, ",\"id\":\"{}\"{}", o.id, "}"); }, Response.Error => |e| { if (e.data) |d| { try std.fmt.format(context, FmtError, output, "{}{},\"error\":{}\"code\":{},\"message\":\"{}\",\"data\":", "{", rpc_version, "{", e.code.toInt(), e.message ); try jsonToString(d, fmt, context, FmtError, output); try std.fmt.format(context, FmtError, output, ",\"id\":null{}", "}"); } else { try std.fmt.format(context, FmtError, output, "{}{},\"error\":{}\"code\":{},\"message\":\"{}\"{},\"id\":null{}", "{", rpc_version, "{", e.code.toInt(), e.message, "}", "}" ); } } } } }; pub const ErrorCode = union(enum) { ParserError: void, InvalidRequest: void, MethodNotFound: void, InvalidParams: void, InternalError: void, ServerError: isize, Custom: CustomErr, pub const CustomErr = struct { err: anyerror, message: []const u8, }; fn toInt(self: ErrorCode) isize { return switch (self) { ErrorCode.ParserError => -32700, ErrorCode.InvalidRequest => -32600, ErrorCode.MethodNotFound => -32601, ErrorCode.InvalidParams => -32602, ErrorCode.InternalError => -32603, ErrorCode.ServerError => |c| c, ErrorCode.Custom => |c| @intCast(isize, @errorToInt(c.err)), }; } pub fn getMsg(self: ErrorCode) []const u8 { return switch (self) { ErrorCode.ParserError => "Parse error", ErrorCode.InvalidRequest => "Invalid Request", ErrorCode.MethodNotFound => "Method not found", ErrorCode.InvalidParams => "Invalid params", ErrorCode.InternalError => "Internal error", ErrorCode.ServerError => "Server error", ErrorCode.Custom => |c| c.message, }; } }; test "Request.Call" { var out_slice: [5000]u8 = undefined; var slice_stream = std.io.SliceOutStream.init(out_slice[0..]); var params = blk: { var slice = []Value{ Value { .Integer = 1 }, Value { .Integer = 2 } }; break :blk std.ArrayList(Value).fromOwnedSlice(std.debug.global_allocator, slice[0..]); }; try slice_stream.stream.print("{}", Request.call("example.call", Value { .Array = params })); assert(std.json.validate(slice_stream.getWritten())); } test "Request.Notification" { var out_slice = []u8{0} ** 500; var slice_stream = std.io.SliceOutStream.init(out_slice[0..]); var params = blk: { var slice = []Value{ Value { .Integer = 1 }, Value { .Integer = 2 } }; break :blk std.ArrayList(Value).fromOwnedSlice(std.debug.global_allocator, slice[0..]); }; try slice_stream.stream.print("{}", Request.notify("example.notification", Value { .Array = params })); assert(std.json.validate(slice_stream.getWritten())); } test "Response.Ok" { var out_slice = []u8{0} ** 500; var slice_stream = std.io.SliceOutStream.init(out_slice[0..]); try slice_stream.stream.print("{}", Response.ok(Value.Null,Oid.new())); assert(std.json.validate(slice_stream.getWritten())); } test "Response.Error" { var out_slice = []u8{0} ** 500; var slice_stream = std.io.SliceOutStream.init(out_slice[0..]); try slice_stream.stream.print("{}", Response.err(ErrorCode.InternalError, null)); assert(std.json.validate(slice_stream.getWritten())); }
src/index.zig
const std = @import("std"); const warn = std.debug.warn; const assert = std.debug.assert; const Matrix = @import("Matrix.zig").Matrix; pub fn Vector(comptime T: type, comptime S: u32) type { return struct { const Self = @This(); data: [S]T, pub fn x(self: Vector(T, S)) T { return self.data[0]; } pub fn y(self: Vector(T, S)) T { return self.data[1]; } pub fn z(self: Vector(T, S)) T { comptime { if (S < 3) { @compileError("No z component"); } } return self.data[2]; } pub fn w(self: Vector(T, S)) T { comptime { if (S < 4) { @compileError("No w component"); } } return self.data[3]; } pub fn setX(self: *Vector(T, S), x: T) void { self.data[0] = x; } pub fn setY(self: *Vector(T, S), y: T) void { self.data[1] = y; } pub fn setZ(self: *Vector(T, S), z: T) void { comptime { if (S < 2) { @compileError("No z component"); } } self.data[2] = z; } pub fn init(values: [S]T) Self { comptime { if (S < 2) { @compileError("Vectors must have at least 2 components"); } } var a: Self = undefined; var i: u32 = 0; while (i < S) { a.data[i] = values[i]; i += 1; } return a; } pub fn copy(self: Vector(T, S)) Vector(T, S) { var a: Vector(T, S) = undefined; std.mem.copy(T, a.data[0..], self.data[0..]); return a; } pub fn add(self: *Vector(T, S), v: Vector(T, S)) void { var i: u32 = 0; while (i < S) : (i += 1) { self.data[i] += v.data[i]; } } pub fn sub(self: *Vector(T, S), v: Vector(T, S)) void { var i: u32 = 0; while (i < S) : (i += 1) { self.data[i] -= v.data[i]; } } pub fn mul(self: *Vector(T, S), v: Vector(T, S)) void { var i: u32 = 0; while (i < S) : (i += 1) { self.data[i] *= v.data[i]; } } pub fn div(self: *Vector(T, S), v: Vector(T, S)) void { var i: u32 = 0; while (i < S) : (i += 1) { self.data[i] /= v.data[i]; } } pub fn lengthNoSqrt(self: Vector(T, S)) T { return self.dot(self); } pub fn length(self: Vector(T, S)) T { return std.math.sqrt(self.dot(self)); } pub fn normalise(self: *Vector(T, S)) void { const l = self.length(); var i: u32 = 0; while (i < S) : (i += 1) { self.data[i] /= l; } } pub fn normalised(self: *Vector(T, S)) Vector(T, S) { var v = self.copy(); v.normalise(); return v; } pub fn normalize(self: *Vector(T, S)) void { self.normalise(); } pub fn normalized(self: *Vector(T, S)) Vector(T, S) { return self.normalised(); } pub fn dot(self: Vector(T, S), v: Vector(T, S)) T { var i: u32 = 0; var sum: T = 0; while (i < S) : (i += 1) { sum += self.data[i] * v.data[i]; } return sum; } pub fn cross(self: Vector(T, S), v: Vector(T, S)) Vector(T, S) { comptime { if (S < 2) { @compileError("Cross product is for 3D vectors only"); } } var new: Vector(T, S) = undefined; var i: u32 = 0; while (i < S) : (i += 1) { new.data[i] = self.data[(i + 1) % S] * v.data[(i + 2) % S] - self.data[(i + 2) % S] * v.data[(i + 1) % S]; } return new; } pub fn mulMat(self: Vector(T, S), m: Matrix(T, S)) Vector(T, S) { var new: Vector(T, S) = undefined; var i: u32 = 0; while (i < S) : (i += 1) { var sum: T = 0; var j: u32 = 0; while (j < S) : (j += 1) { sum += m.data[j][i] * self.data[j]; } new.data[i] = sum; } return new; } }; } test "Copy" { var v1 = Vector(f32, 2).init([2]f32{ 3, 4 }); var v2 = v1.copy(); std.testing.expectEqual(v2.data[0], 3); std.testing.expectEqual(v2.data[1], 4); } test "Vector add/sub/mul/div" { var v1i: Vector(i16, 3) = Vector(i16, 3).init([3]i16{ 1, 2, 3 }); var v2i: Vector(i16, 3) = Vector(i16, 3).init([3]i16{ 4, 5, 6 }); v1i.add(v2i); std.testing.expectEqual(v1i.data[0], 5); std.testing.expectEqual(v1i.data[1], 7); std.testing.expectEqual(v1i.data[2], 9); var v1: Vector(f32, 3) = Vector(f32, 3).init([3]f32{ 4.0, 5.0, 6.0 }); var v2: Vector(f32, 3) = Vector(f32, 3).init([3]f32{ 1.0, 2.0, 3.0 }); v1.sub(v2); std.testing.expect(std.math.approxEq(f32, v1.data[0], 3.0, 0.00001)); std.testing.expect(std.math.approxEq(f32, v1.data[1], 3.0, 0.00001)); std.testing.expect(std.math.approxEq(f32, v1.data[2], 3.0, 0.00001)); var v3: Vector(f32, 5) = Vector(f32, 5).init([5]f32{ 4.0, 5.0, 6.0, 1.0, 2.0 }); var v4: Vector(f32, 5) = Vector(f32, 5).init([5]f32{ 1.0, 2.0, 3.0, 8.0, 0.5 }); v3.mul(v4); assert(v3.data[0] == 4.0); assert(v3.data[1] == 10.0); assert(v3.data[2] == 18.0); assert(v3.data[3] == 8.0); assert(v3.data[4] == 1.0); std.testing.expect(std.math.approxEq(f32, v3.data[0], 4.0, 0.00001)); std.testing.expect(std.math.approxEq(f32, v3.data[1], 10.0, 0.00001)); std.testing.expect(std.math.approxEq(f32, v3.data[2], 18.0, 0.00001)); std.testing.expect(std.math.approxEq(f32, v3.data[3], 8.0, 0.00001)); std.testing.expect(std.math.approxEq(f32, v3.data[4], 1.0, 0.00001)); var v5: Vector(f32, 2) = Vector(f32, 2).init([2]f32{ 4.0, 5.0 }); var v6: Vector(f32, 2) = Vector(f32, 2).init([2]f32{ 1.0, 2.0 }); v5.div(v6); std.testing.expect(std.math.approxEq(f32, v5.data[0], 4.0, 0.00001)); std.testing.expect(std.math.approxEq(f32, v5.data[1], 2.5, 0.00001)); } test "Length" { var v1: Vector(f64, 3) = Vector(f64, 3).init([3]f64{ 1.0, 0.0, 6.0 }); std.testing.expect(std.math.approxEq(f64, v1.lengthNoSqrt(), 37.0, 0.00001)); std.testing.expect(std.math.approxEq(f64, v1.length(), 6.0827625303, 0.00001)); } test "Dot Product" { var v1: Vector(f64, 3) = Vector(f64, 3).init([3]f64{ 1.0, 2.0, 3.0 }); var v2: Vector(f64, 3) = Vector(f64, 3).init([3]f64{ 4.0, 5.0, 6.0 }); std.testing.expect(std.math.approxEq(f64, v1.dot(v2), 32.0, 0.00001)); } test "Cross Product" { var v1: Vector(f64, 3) = Vector(f64, 3).init([3]f64{ 1.0, 2.0, 3.0 }); var v2: Vector(f64, 3) = Vector(f64, 3).init([3]f64{ 4.0, 5.0, 6.0 }); var v3: Vector(f64, 3) = v1.cross(v2); std.testing.expect(std.math.approxEq(f64, v3.data[0], -3.0, 0.00001)); std.testing.expect(std.math.approxEq(f64, v3.data[1], 6.0, 0.00001)); std.testing.expect(std.math.approxEq(f64, v3.data[2], -3.0, 0.00001)); }
src/Mathematics/Vector.zig
const os = @import("root").os; const platform = os.platform; const ports = @import("ports.zig"); var inited = [1]bool{false} ** 4; pub fn init() void { port(1).try_init(); port(2).try_init(); port(3).try_init(); port(4).try_init(); } pub fn port(comptime port_num: usize) type { const io_base: u16 = switch(port_num) { 1 => 0x3f8, 2 => 0x2f8, 3 => 0x3e8, 4 => 0x2e8, else => unreachable, }; return struct { pub fn try_init() void { if(inited[port_num - 1]) return; // First let's try to detect if the serial port is present { ports.outb(io_base + 7, 0x00); if(ports.inb(io_base + 7) != 0x00) return; ports.outb(io_base + 7, 0xff); if(ports.inb(io_base + 7) != 0xff) return; } ports.outb(io_base + 3, 0x80); ports.outb(io_base + 0, 0x01); ports.outb(io_base + 1, 0x00); ports.outb(io_base + 3, 0x03); ports.outb(io_base + 2, 0xC7); ports.outb(io_base + 4, 0x0B); if(ports.inb(io_base + 6) & 0xb0 != 0xb0) return; // Don't enable any serial ports on x86 for now //inited[port_num - 1] = true; os.log("Using x86 serial port #{}.\n", .{port_num}); } pub fn read_ready() bool { if(!inited[port_num - 1]) return false; return ports.inb(io_base + 5) & 0x20 != 0; } pub fn read() u8 { if(!inited[port_num - 1]) @panic("Uninitialized serial read!"); while(!read_ready()) { platform.spin_hint(); } return ports.inb(io_base); } pub fn try_read() ?u8 { if(read_ready()) return read(); return null; } pub fn write_ready() bool { if(!inited[port_num - 1]) return false; return ports.inb(io_base + 5) & 0x01 != 0; } pub fn write(val: u8) void { if(!inited[port_num - 1]) return; if(val == '\n') write('\r'); while(!write_ready()) { platform.spin_hint(); } ports.outb(io_base, val); } }; }
src/platform/x86_64/serial.zig
const std = @import("std"); const ig = @import("imgui"); const glfw = @import("glfw"); // Private items const PlayRoom = @import("playRoom.zig"); const editor = @import("editor.zig"); const Renderer = @import("renderer.zig"); const SlingSettings = struct { initialScene: ?[]const u8 = null, rememberWindowSettings: bool = true, wasMaximizedLast: bool = false, windowPos: math.Vec2 = .{ .x = 200, .y = 200 }, windowSize: math.Vec2 = .{ .x = 1280, .y = 720 }, hideConsoleInRooms: bool = false, debugView: bool = false, }; const imFontRanges = [_]c_ushort{ 0xF004, 0xF4AD }; pub const Theme = struct { pub var primary = util.hexToColor(0xFDFFFCFF); pub var background = util.hexToColor(0x011627FF); pub var highlight = util.hexToColor(0x3C91E6FF); pub var secondary = util.hexToColor(0xDA627DFF); pub var debugInfo = util.hexToColor(0xA663CCFF); pub var debugSuccess = util.hexToColor(0x09E85EFF); pub var debugError = util.hexToColor(0xE84855FF); pub var debugWarning = util.hexToColor(0xF26419FF); }; // Public namespaces and forwards pub const zt = @import("zt"); pub const input = @import("input.zig"); pub const math = zt.math; pub const serializer = @import("serializer.zig"); pub const asset = @import("asset.zig"); pub const util = @import("util.zig"); pub const register = @import("register.zig"); pub const fmod = @import("fmod.zig"); pub const audio = @import("audio.zig"); pub const physics = @import("physics.zig"); pub const handles = @import("handle.zig"); pub const debug = @import("debug.zig"); /// If you are editing the dictionary AND setting a user font for the editor, /// set the font THEN edit the dictionary. pub const dictionary = @import("dictionary.zig"); pub const icon = @import("icon.zig"); // Public types and forwards pub const Camera = @import("camera.zig"); pub const Depth = Renderer.Depth; pub const Object = @import("object.zig"); pub const Scene = @import("scene.zig"); /// A shader, this is used in slingworks to change how things are drawn. pub const Shader = zt.gl.Shader; /// The default vertex that slingworks uses to render everything. pub const Vertex = zt.game.Renderer.Vertex; /// A nine patch slice for rendering, store in it the sub rect of the patch, /// and the amount in pixels from each side, and you can use this to draw /// nine patch textures. pub const Patch = Renderer.Patch; pub const alloc = std.heap.c_allocator; pub var timeScale: f32 = 1.0; pub var time: f32 = 0.0; pub var dt: f32 = 0.0; pub var unscaledDt: f32 = 0.0; pub var settings: SlingSettings = .{}; pub var inEditor: bool = false; pub var render: Renderer = undefined; /// You can set this directly, null is no scene. Make sure you clean up the current scene if one exists. pub var scene: ?*Scene = null; /// You shouldn't set this directly, as rooms have setup/teardown that is managed by sling. Prefer to use /// enterRoomString("room") and leaveRoom() pub var room: ?usize = null; pub var preferredSerializationConfig: serializer.Configuration = serializer.Configuration.init(alloc); /// You can set this yourself if desired, this changes the serialization format of everything sling uses. pub var preferredLexicon: serializer.Lexicon = serializer.json.JsonLexicon; var ctx: *zt.App(void).Context = undefined; var staticInits = std.ArrayList(fn () void).init(alloc); pub fn run() void { parseArgs(); deserializeSling(); initialize(); loop(); serializeSling(); ctx.deinit(); } fn parseArgs() void { // Parse args for editor flag. const args = std.process.argsAlloc(alloc) catch unreachable; for (args) |argument| { if (std.mem.eql(u8, std.mem.spanZ(argument), "editor")) { inEditor = true; } } std.process.argsFree(alloc, args); // Set the cwd path to the exe folder. If something needs to work based on calling from another directory, // I recommend using another way to reach those resources. if (zt.known_folders.getPath(alloc, .executable_dir) catch unreachable) |exePath| { defer alloc.free(exePath); std.process.changeCurDir(exePath) catch { std.debug.print("Failed to chdir to local executable folder.\n", .{}); }; } } fn initialize() void { // Audio first so we dont get graphical bugs mid startup. audio.init(); // If we're maximizing, it needs to be through glfw pre-init. if (settings.rememberWindowSettings and settings.wasMaximizedLast) { zt.App(void).preInit(); glfw.glfwWindowHint(glfw.GLFW_MAXIMIZED, glfw.GLFW_TRUE); } // Start the loop from ZT. ctx = zt.App(void).begin(std.heap.c_allocator); ctx.settings.energySaving = false; if (settings.rememberWindowSettings and !settings.wasMaximizedLast) { ctx.setWindowSize(@floatToInt(c_int, settings.windowSize.x), @floatToInt(c_int, settings.windowSize.y)); glfw.glfwSetWindowPos(ctx.window, @floatToInt(c_int, settings.windowPos.x), @floatToInt(c_int, settings.windowPos.y)); } var io = ig.igGetIO(); io.*.ConfigFlags |= ig.ImGuiConfigFlags_DockingEnable; render = Renderer.init(); for (staticInits.items) |ifn| { ifn(); } register.room(PlayRoom.roomMethod, dictionary.roomMenuPlay, PlayRoom.init, PlayRoom.deinit); if (!inEditor and settings.initialScene != null) { var bytes = std.fs.cwd().readFileAlloc(alloc, settings.initialScene.?, 80_000_000) catch unreachable; defer alloc.free(bytes); scene = Scene.initFromBytes(bytes); } } fn loop() void { while (ctx.open) { dt = ctx.time.dt * timeScale; unscaledDt = ctx.time.dt; time += ctx.time.dt; ctx.beginFrame(); input.pump(); if (inEditor) { _ = zt.custom_components.ztViewPort(); editor.editorUI(); } if (room) |roomIdx| { register.RegisteredRooms.items[roomIdx].method(); } else if (scene) |currentScene| { currentScene.update(); } render.flush(); ctx.endFrame(); audio.update(); } } fn serializeSling() void { // Serialize settings. if (settings.rememberWindowSettings) { var w: c_int = 0; var h: c_int = 0; var x: c_int = 0; var y: c_int = 0; glfw.glfwGetWindowSize(ctx.window, &w, &h); glfw.glfwGetWindowPos(ctx.window, &x, &y); if (glfw.glfwGetWindowAttrib(ctx.window, glfw.GLFW_MAXIMIZED) == 1) { settings.wasMaximizedLast = true; } else { settings.wasMaximizedLast = false; settings.windowPos = .{ .x = @intToFloat(f32, x), .y = @intToFloat(f32, y) }; settings.windowSize = .{ .x = @intToFloat(f32, w), .y = @intToFloat(f32, h) }; } } var tree = serializer.Tree.initArena(alloc); tree.root = tree.toNode(settings); defer tree.deinit(); var settingsBytes = preferredLexicon.convert(alloc, tree); defer alloc.free(settingsBytes); std.fs.cwd().writeFile("settings.json", settingsBytes) catch { std.debug.panic("Failed to write sling settings to disk.", .{}); }; } fn deserializeSling() void { // 5mb max var settingsFile = std.fs.cwd().readFileAlloc(alloc, "settings.json", 5_000_000) catch { std.debug.print("Failed to find sling settings file.\n", .{}); return; }; defer alloc.free(settingsFile); var tree = preferredLexicon.parse(alloc, settingsFile); defer tree.deinit(); tree.root.into(&settings, alloc); } /// Use this to get the build data for a type. Calling this implicitly /// registers a type as an entity. pub fn configure(comptime T: type) *Object.GenBuildData(T) { const base = Object.GenBuildData(T); return base.register(); } /// Use this to automatically register a type into sling if it contains a /// `slingIntegration` function of type `fn() void` pub fn integrate(comptime T: type) void { if (@hasDecl(T, "slingIntegration")) { switch (@typeInfo(@TypeOf(@field(T, "slingIntegration")))) { .Fn => |fnInfo| { if (fnInfo.args.len == 0 and (fnInfo.return_type == null or fnInfo.return_type.? == void)) { T.slingIntegration(); } else { @compileError("'slingIntegration' on type " ++ @typeName(T) ++ " failed, it should be a function with no args and no return type."); } }, else => { @compileError("'slingIntegration' on type " ++ @typeName(T) ++ " failed, it should be a function with no args and no return type."); }, } } else { @compileError("There is no slingIntegration on type " ++ @typeName(T)); } } pub fn addStaticInit(func: fn () void) void { staticInits.append(func) catch { std.debug.panic("Failed to append static initializer", .{}); }; } pub fn setWindowTitle(title: []const u8) void { ctx.setWindowTitle(title); } pub fn setWindowIcon(path: []const u8) void { ctx.setWindowIcon(path); } pub fn setBackgroundColor(color: math.Vec4) void { const gl = @import("gl"); gl.glClearColor(color.x, color.y, color.z, color.w); } /// Simply @embedFile your ttf and pass into first param. /// This should be done once at init. If you are editing the dictionary, /// do so after this, as this will overwrite iconify the default labels. pub fn setEditorFontBytes(bytes: []const u8, size: f32) void { var io = ig.igGetIO(); var cfg = ig.ImFontConfig_ImFontConfig(); cfg.*.OversampleH = 3; cfg.*.OversampleV = 2; // User font var defaultRange = ig.ImFontAtlas_GetGlyphRangesDefault(io.*.Fonts); var copied: []u8 = alloc.dupeZ(u8, bytes) catch unreachable; defer alloc.free(copied); var userFnt = ig.ImFontAtlas_AddFontFromMemoryTTF(io.*.Fonts, copied.ptr, @intCast(c_int, copied.len), size, cfg, defaultRange); // Icon font var iconCopied: []u8 = alloc.dupeZ(u8, @embedFile("deps/fontawesome.otf")) catch unreachable; defer alloc.free(iconCopied); cfg.*.MergeMode = true; _ = ig.ImFontAtlas_AddFontFromMemoryTTF(io.*.Fonts, iconCopied.ptr, @intCast(c_int, iconCopied.len), size - 2, cfg, &imFontRanges); // Finish _ = ig.ImFontAtlas_Build(io.*.Fonts); io.*.FontDefault = userFnt; ctx.rebuildFont(); dictionary.iconify(); } pub fn enterRoom(index: usize) void { if (room != null) { leaveRoom(); } var target = register.RegisteredRooms.items[index]; if (target.initMethod) |ifn| { ifn(); } room = index; } pub fn enterRoomString(id: []const u8) void { for (register.RegisteredRooms.items) |r, i| { if (std.mem.eql(u8, id, r.name)) { enterRoom(i); return; } } } pub fn leaveRoom() void { if (register.RegisteredRooms.items[room.?].deinitMethod) |dfn| { dfn(); } room = null; } const console = @import("editor/console.zig"); pub fn log(message: []const u8) void { console.submit(message, null, icon.bell); } pub fn logFmt(comptime fmt: []const u8, params: anytype) void { console.submitFmt(fmt, params, null, icon.bell); } pub fn logErr(message: []const u8) void { console.submit(message, debug.DebugType.err, icon.circledCross); } pub fn logErrFmt(comptime fmt: []const u8, params: anytype) void { console.submitFmt(fmt, params, debug.DebugType.err, icon.circledCross); } pub fn logWarn(message: []const u8) void { console.submit(message, debug.DebugType.warning, icon.circledQuestionmark); } pub fn logWarnFmt(comptime fmt: []const u8, params: anytype) void { console.submitFmt(fmt, params, debug.DebugType.warning, icon.circledQuestionmark); }
src/sling.zig
// Because SPIR-V requires re-compilation anyway, and so hot swapping will not work // anyway, we simply generate all the code in flushModule. This keeps // things considerably simpler. const SpirV = @This(); const std = @import("std"); const Allocator = std.mem.Allocator; const ArenaAllocator = std.heap.ArenaAllocator; const assert = std.debug.assert; const log = std.log.scoped(.link); const Module = @import("../Module.zig"); const Compilation = @import("../Compilation.zig"); const link = @import("../link.zig"); const codegen = @import("../codegen/spirv.zig"); const trace = @import("../tracy.zig").trace; const build_options = @import("build_options"); const Air = @import("../Air.zig"); const Liveness = @import("../Liveness.zig"); const Value = @import("../value.zig").Value; const SpvModule = @import("../codegen/spirv/Module.zig"); const spec = @import("../codegen/spirv/spec.zig"); const IdResult = spec.IdResult; // TODO: Should this struct be used at all rather than just a hashmap of aux data for every decl? pub const FnData = struct { // We're going to fill these in flushModule, and we're going to fill them unconditionally, // so just set it to undefined. id: IdResult = undefined, }; base: link.File, /// This linker backend does not try to incrementally link output SPIR-V code. /// Instead, it tracks all declarations in this table, and iterates over it /// in the flush function. decl_table: std.AutoArrayHashMapUnmanaged(*Module.Decl, DeclGenContext) = .{}, const DeclGenContext = struct { air: Air, air_value_arena: ArenaAllocator.State, liveness: Liveness, fn deinit(self: *DeclGenContext, gpa: Allocator) void { self.air.deinit(gpa); self.liveness.deinit(gpa); self.air_value_arena.promote(gpa).deinit(); self.* = undefined; } }; pub fn createEmpty(gpa: Allocator, options: link.Options) !*SpirV { const spirv = try gpa.create(SpirV); spirv.* = .{ .base = .{ .tag = .spirv, .options = options, .file = null, .allocator = gpa, }, }; // TODO: Figure out where to put all of these switch (options.target.cpu.arch) { .spirv32, .spirv64 => {}, else => return error.TODOArchNotSupported, } switch (options.target.os.tag) { .opencl, .glsl450, .vulkan => {}, else => return error.TODOOsNotSupported, } if (options.target.abi != .none) { return error.TODOAbiNotSupported; } return spirv; } pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Options) !*SpirV { assert(options.object_format == .spirv); if (options.use_llvm) return error.LLVM_BackendIsTODO_ForSpirV; // TODO: LLVM Doesn't support SpirV at all. if (options.use_lld) return error.LLD_LinkingIsTODO_ForSpirV; // TODO: LLD Doesn't support SpirV at all. const spirv = try createEmpty(allocator, options); errdefer spirv.base.destroy(); // TODO: read the file and keep valid parts instead of truncating const file = try options.emit.?.directory.handle.createFile(sub_path, .{ .truncate = true, .read = true }); spirv.base.file = file; return spirv; } pub fn deinit(self: *SpirV) void { self.decl_table.deinit(self.base.allocator); } pub fn updateFunc(self: *SpirV, module: *Module, func: *Module.Fn, air: Air, liveness: Liveness) !void { if (build_options.skip_non_native) { @panic("Attempted to compile for architecture that was disabled by build configuration"); } _ = module; // Keep track of all decls so we can iterate over them on flush(). const result = try self.decl_table.getOrPut(self.base.allocator, func.owner_decl); if (result.found_existing) { result.value_ptr.deinit(self.base.allocator); } var arena = ArenaAllocator.init(self.base.allocator); errdefer arena.deinit(); var new_air = try cloneAir(air, self.base.allocator, arena.allocator()); errdefer new_air.deinit(self.base.allocator); var new_liveness = try cloneLiveness(liveness, self.base.allocator); errdefer new_liveness.deinit(self.base.allocator); result.value_ptr.* = .{ .air = new_air, .air_value_arena = arena.state, .liveness = new_liveness, }; } pub fn updateDecl(self: *SpirV, module: *Module, decl: *Module.Decl) !void { if (build_options.skip_non_native) { @panic("Attempted to compile for architecture that was disabled by build configuration"); } _ = module; // Keep track of all decls so we can iterate over them on flush(). _ = try self.decl_table.getOrPut(self.base.allocator, decl); } pub fn updateDeclExports( self: *SpirV, module: *Module, decl: *const Module.Decl, exports: []const *Module.Export, ) !void { _ = self; _ = module; _ = decl; _ = exports; } pub fn freeDecl(self: *SpirV, decl: *Module.Decl) void { const index = self.decl_table.getIndex(decl).?; if (decl.val.tag() == .function) { self.decl_table.values()[index].deinit(self.base.allocator); } self.decl_table.swapRemoveAt(index); } pub fn flush(self: *SpirV, comp: *Compilation) !void { if (build_options.have_llvm and self.base.options.use_lld) { return error.LLD_LinkingIsTODO_ForSpirV; // TODO: LLD Doesn't support SpirV at all. } else { return self.flushModule(comp); } } pub fn flushModule(self: *SpirV, comp: *Compilation) !void { if (build_options.skip_non_native) { @panic("Attempted to compile for architecture that was disabled by build configuration"); } const tracy = trace(@src()); defer tracy.end(); const module = self.base.options.module.?; const target = comp.getTarget(); var arena = std.heap.ArenaAllocator.init(self.base.allocator); defer arena.deinit(); var spv = SpvModule.init(self.base.allocator, arena.allocator()); defer spv.deinit(); // Allocate an ID for every declaration before generating code, // so that we can access them before processing them. // TODO: We're allocating an ID unconditionally now, are there // declarations which don't generate a result? // TODO: fn_link is used here, but thats probably not the right field. It will work anyway though. for (self.decl_table.keys()) |decl| { if (decl.has_tv) { decl.fn_link.spirv.id = spv.allocId(); } } // Now, actually generate the code for all declarations. var decl_gen = codegen.DeclGen.init(module, &spv); defer decl_gen.deinit(); var it = self.decl_table.iterator(); while (it.next()) |entry| { const decl = entry.key_ptr.*; if (!decl.has_tv) continue; const air = entry.value_ptr.air; const liveness = entry.value_ptr.liveness; // Note, if `decl` is not a function, air/liveness may be undefined. if (try decl_gen.gen(decl, air, liveness)) |msg| { try module.failed_decls.put(module.gpa, decl, msg); return; // TODO: Attempt to generate more decls? } } try writeCapabilities(&spv, target); try writeMemoryModel(&spv, target); try spv.flush(self.base.file.?); } fn writeCapabilities(spv: *SpvModule, target: std.Target) !void { // TODO: Integrate with a hypothetical feature system const cap: spec.Capability = switch (target.os.tag) { .opencl => .Kernel, .glsl450 => .Shader, .vulkan => .VulkanMemoryModel, else => unreachable, // TODO }; try spv.sections.capabilities.emit(spv.gpa, .OpCapability, .{ .capability = cap, }); } fn writeMemoryModel(spv: *SpvModule, target: std.Target) !void { const addressing_model = switch (target.os.tag) { .opencl => switch (target.cpu.arch) { .spirv32 => spec.AddressingModel.Physical32, .spirv64 => spec.AddressingModel.Physical64, else => unreachable, // TODO }, .glsl450, .vulkan => spec.AddressingModel.Logical, else => unreachable, // TODO }; const memory_model: spec.MemoryModel = switch (target.os.tag) { .opencl => .OpenCL, .glsl450 => .GLSL450, .vulkan => .Vulkan, else => unreachable, }; // TODO: Put this in a proper section. try spv.sections.capabilities.emit(spv.gpa, .OpMemoryModel, .{ .addressing_model = addressing_model, .memory_model = memory_model, }); } fn cloneLiveness(l: Liveness, gpa: Allocator) !Liveness { const tomb_bits = try gpa.dupe(usize, l.tomb_bits); errdefer gpa.free(tomb_bits); const extra = try gpa.dupe(u32, l.extra); errdefer gpa.free(extra); return Liveness{ .tomb_bits = tomb_bits, .extra = extra, .special = try l.special.clone(gpa), }; } fn cloneAir(air: Air, gpa: Allocator, value_arena: Allocator) !Air { const values = try gpa.alloc(Value, air.values.len); errdefer gpa.free(values); for (values) |*value, i| { value.* = try air.values[i].copy(value_arena); } var instructions = try air.instructions.toMultiArrayList().clone(gpa); errdefer instructions.deinit(gpa); return Air{ .instructions = instructions.slice(), .extra = try gpa.dupe(u32, air.extra), .values = values, }; }
src/link/SpirV.zig
const std = @import("std"); const util = @import("util"); const input = @embedFile("18.txt"); const Token = union(enum) { group: []const Token, literal: u64, add: void, mul: void, fn eval1(self: Token) u64 { switch (self) { .group => |g| { std.debug.assert(g.len % 2 == 1); var accum = g[0].eval1(); var expr: []const Token = g[1..]; while (expr.len > 0) : (expr = expr[2..]) { switch (expr[0]) { .add => accum += expr[1].eval1(), .mul => accum *= expr[1].eval1(), else => unreachable, } } return accum; }, .literal => |n| return n, else => unreachable, } } fn eval2(self: Token) u64 { switch (self) { .group => |g| { std.debug.assert(g.len % 2 == 1); var accum = g[0].eval2(); var expr: []const Token = g[1..]; while (expr.len > 0) { switch (expr[0]) { .add => { accum += expr[1].eval2(); expr = expr[2..]; }, .mul => { var i: usize = 2; while (expr[i..].len >= 2) { switch (expr[i]) { .add => i += 2, .mul => break, else => unreachable, } } accum *= (Token{ .group = expr[1..i] }).eval2(); expr = expr[i..]; }, else => unreachable, } } return accum; }, .literal => |n| return n, else => unreachable, } } }; const tokens: []const Token = comptime blk: { @setEvalBranchQuota(input.len * 10); var tokens_: []const Token = &[_]Token{}; for (util.lines(input)) |line| { var expr = line; var parse_int: ?u64 = null; var group_stack: []const []const Token = &[_][]const Token{}; var current_group: []const Token = &[_]Token{}; while (true) { if (parse_int) |*int| { if (expr.len == 0 or expr[0] < '0' or expr[0] > '9') { current_group = current_group ++ [_]Token{.{ .literal = int.* }}; parse_int = null; } else { int.* *= 10; int.* += c - '0'; expr = expr[1..]; } } else if (expr.len > 0) { switch (expr[0]) { ' ' => {}, '+' => current_group = current_group ++ [_]Token{.add}, '*' => current_group = current_group ++ [_]Token{.mul}, '(' => { group_stack = group_stack ++ [_][]const Token{current_group}; current_group = &[_]Token{}; }, ')' => { const token = [_]Token{.{ .group = current_group }}; current_group = group_stack[group_stack.len - 1] ++ token; group_stack = group_stack[0..(group_stack.len - 1)]; }, '0'...'9' => parse_int = expr[0] - '0', else => unreachable, } expr = expr[1..]; } else break; } tokens_ = tokens_ ++ [_]Token{.{ .group = current_group }}; } break :blk tokens_; }; pub fn main(n: util.Utils) !void { var part_1: u64 = 0; var part_2: u64 = 0; for (tokens) |token| { part_1 += token.eval1(); part_2 += token.eval2(); } try n.out.print("{}\n{}\n", .{ part_1, part_2 }); }
2020/18.zig
const std = @import("std"); const builtin = @import("builtin"); const fs = std.fs; const io = std.io; const mem = std.mem; const testing = std.testing; const logger = std.log.scoped(.tests); const trace = @import("tracy.zig").trace; const Allocator = std.mem.Allocator; const Archive = @import("archive/Archive.zig"); const main = @import("main.zig"); const llvm_ar_archive_name = "llvm-ar-archive.a"; const zig_ar_archive_name = "zig-ar-archive.a"; const no_files = [_][]const u8{}; const no_symbols = [_][][]const u8{}; const no_dir = "test/data/none"; // Testing TODOs: // - Create symbol comparison tests (generate source files procedurally) // - Add testing matrices for testing different combinations of arguments & modifiers // - Create end-to-end tests that check stdout of parsing functionality (not just archive generation) // Including variatns of modifiers // - Create end-to-end tests that check extracted files are the same // - Create "stress" tests that go beyond the basic tests & auto-generate a massive amount of // archive input that can be tested against. // - Test the failure cases (and see how we handle them) // - Add parsing tests using archives created by native archivers on appropriate platforms // - Fuzz test // - Test weird combinations and try to match llvm-ar output // - Test multiple os/format combinations (i.e. bsd style archives) // - Test ranlib functionality // - Test bad inputs/ // - Test performance // - Don't redo work between tests (compiling same files, running llvm ar multiple times). // Allows us to invoke zar as a program, just to really confirm it works // end-to-end. const invoke_zar_as_child_process = false; test "Test Archive Text Basic" { const test1_dir = "test/data/test1"; const test1_names = [_][]const u8{ "input1.txt", "input2.txt" }; const test1_symbols = no_symbols; var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); try doStandardTests(arena.allocator(), test1_dir, &test1_names, &test1_symbols); } test "Test Archive Text With Long Filenames" { // Due to the fixed-size limits for filenames in the standard ar format, // this tests that the different ar-type specific extensions for dealing // with that properly work. const test2_dir = "test/data/test2"; const test2_names = [_][]const u8{ "input1.txt", "input2.txt", "input3_that_is_also_a_much_longer_file_name.txt", "input4_that_is_also_a_much_longer_file_name.txt" }; const test2_symbols = no_symbols; var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); try doStandardTests(arena.allocator(), test2_dir, &test2_names, &test2_symbols); } test "Test Archive With Symbols Basic" { const test4_names = [_][]const u8{"input1.o"}; const test4_symbols = [_][]const []const u8{ &[_][]const u8{ "input1_symbol1", "input1_symbol2" }, }; var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); try doStandardTests(arena.allocator(), no_dir, &test4_names, &test4_symbols); } test "Test Archive With Long Names And Symbols" { const test5_names = [_][]const u8{ "input1.o", "input2.o", "input3_that_is_also_a_much_longer_file_name.o" }; const test5_symbols = [_][]const []const u8{ &[_][]const u8{ "input1_symbol1", "input1_symbol2" }, &[_][]const u8{ "input2_symbol1", "input2_symbol2_that_is_also_longer_symbol", "input2_symbol3" }, &[_][]const u8{ "input3_that_is_also_a_much_longer_file_name_symbol1", "input3_symbol2_that_is_also_longer_symbol", "input3_symbol3_that_is_also_longer_symbol" }, }; var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); try doStandardTests(arena.allocator(), no_dir, &test5_names, &test5_symbols); } test "Test Archive Stress Test" { // Generate 55 different files with an arbitrary number of symbols const test6_filecount = 55; const test6_symcount = 15; var test6_names: [test6_filecount][]u8 = undefined; var test6_symbols: [test6_filecount][][]u8 = undefined; var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); try initialiseTestData(arena.allocator(), &test6_names, &test6_symbols, test6_symcount); try doStandardTests(arena.allocator(), no_dir, &test6_names, &test6_symbols); } test "Test Archive Sorted" { // Confirm that our archives default files & their symbols in the correct way // for each target. const test_sort_names = [_][]const u8{ "dddd.o", "eeee.o", "ccccc.o", "aaaaaaaa.o", "aa.o", "cccc.o", "aaaa.o", "bbbb.o", "cc.o", "bb.o", "zz.o" }; const test_sort = [_][]const []const u8{ &[_][]const u8{ "ddd", "aaa" }, &[_][]const u8{ "cccc", "ddd", "aaaa" }, &[_][]const u8{ "z", "aa", "a" }, &[_][]const u8{ "agsg", "ssss", "aaaa" }, &[_][]const u8{ "_1_2_3", "__1", "_00000" }, &[_][]const u8{ "AA", "aa", "BB" }, &[_][]const u8{ "aa", "AA", "BB" }, &[_][]const u8{ "BB", "AA", "aa" }, &[_][]const u8{ "_123", "_22", "_12" }, &[_][]const u8{ "bB", "aB", "cB" }, &[_][]const u8{ "_11", "_12", "_13" }, }; // TODO: remove redundancy maybe by excluding parsing component of this test? var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); try doStandardTests(arena.allocator(), no_dir, &test_sort_names, &test_sort); } fn initialiseTestData(allocator: Allocator, file_names: [][]const u8, symbol_names: [][][]const u8, symbol_count: u32) !void { for (file_names) |_, index| { file_names[index] = try std.fmt.allocPrint(allocator, "index_{}.o", .{index}); } for (symbol_names) |_, file_index| { symbol_names[file_index] = try allocator.alloc([]u8, symbol_count); for (symbol_names[file_index]) |_, symbol_index| { symbol_names[file_index][symbol_index] = try std.fmt.allocPrint(allocator, "symbol_{}_file_{}", .{ symbol_index, file_index }); } } return; } const targets = result: { const os_fields = std.meta.fields(OperatingSystem); const arch_fields = std.meta.fields(Architecture); comptime var aggregator: [os_fields.len * arch_fields.len]Target = undefined; comptime var target_index = 0; inline for (os_fields) |os_field| { inline for (arch_fields) |arch_field| { aggregator[target_index] = .{ .architecture = @intToEnum(Architecture, arch_field.value), .operating_system = @intToEnum(OperatingSystem, os_field.value), }; target_index += 1; } } break :result aggregator; }; const Target = struct { architecture: Architecture, operating_system: OperatingSystem, fn targetToArgument(comptime target: Target) []const u8 { return @tagName(target.architecture) ++ "-" ++ @tagName(target.operating_system); } }; const OperatingSystem = enum { linux, macos, freebsd, // windows, fn toDefaultLlvmFormat(operating_system: OperatingSystem) LlvmFormat { return switch (operating_system) { .linux => .gnu, .macos => .darwin, .freebsd => .gnu, }; } }; const Architecture = enum { aarch64, x86_64, }; const llvm_formats = result: { const fields = std.meta.fields(LlvmFormat); comptime var aggregator: [fields.len]LlvmFormat = undefined; inline for (fields) |field, field_index| { aggregator[field_index] = @intToEnum(LlvmFormat, field.value); } break :result aggregator; }; const LlvmFormat = enum { gnu, bsd, darwin, implicit, fn llvmFormatToArgument(comptime format: LlvmFormat) []const u8 { switch (format) { .gnu => return "--format=gnu", .bsd => return "--format=bsd", .darwin => return "--format=darwin", .implicit => return "", } } }; const TestDirInfo = struct { tmp_dir: std.testing.TmpDir, cwd: []const u8, pub fn getInfo() !TestDirInfo { var result: TestDirInfo = .{ .tmp_dir = std.testing.tmpDir(.{}), .cwd = undefined, }; result.cwd = try std.fs.path.join(std.testing.allocator, &[_][]const u8{ "zig-cache", "tmp", &result.tmp_dir.sub_path, }); return result; } pub fn cleanup(self: *TestDirInfo) void { self.tmp_dir.cleanup(); std.testing.allocator.free(self.cwd); } }; pub fn doStandardTests(framework_allocator: Allocator, comptime test_dir_path: []const u8, file_names: []const []const u8, symbol_names: []const []const []const u8) !void { const tracy = trace(@src()); defer tracy.end(); const operation = "rc"; inline for (targets) |target| { var test_dir_info = try TestDirInfo.getInfo(); // if a test is going to fail anyway, this is a useful way to debug it for now.. var cancel_cleanup = false; defer if (!cancel_cleanup) test_dir_info.cleanup(); errdefer { cancel_cleanup = true; } // Create an archive with llvm ar & zar and confirm that the outputs match // byte-for-byte. try copyAssetsToTestDirectory(test_dir_path, file_names, test_dir_info); const llvm_format = comptime target.operating_system.toDefaultLlvmFormat(); try generateCompiledFilesWithSymbols(framework_allocator, target, file_names, symbol_names, test_dir_info); { try doLlvmArchiveOperation(.implicit, operation, file_names, test_dir_info); try testParsingOfLlvmGeneratedArchive(framework_allocator, target, .implicit, file_names, symbol_names, test_dir_info); try testArchiveCreation(target, .implicit, file_names, test_dir_info); try testSymbolStrippingAndRanlib(test_dir_info); try test_dir_info.tmp_dir.dir.deleteFile(zig_ar_archive_name); try test_dir_info.tmp_dir.dir.deleteFile(llvm_ar_archive_name); } { try doLlvmArchiveOperation(llvm_format, operation, file_names, test_dir_info); try testParsingOfLlvmGeneratedArchive(framework_allocator, target, llvm_format, file_names, symbol_names, test_dir_info); try testArchiveCreation(target, llvm_format, file_names, test_dir_info); try testSymbolStrippingAndRanlib(test_dir_info); try test_dir_info.tmp_dir.dir.deleteFile(zig_ar_archive_name); try test_dir_info.tmp_dir.dir.deleteFile(llvm_ar_archive_name); } } } fn testSymbolStrippingAndRanlib(test_dir_info: TestDirInfo) !void { const tracy = trace(@src()); defer tracy.end(); { errdefer { logger.err("Failed symbol stripping", .{}); } const operation = "rS"; try doZarArchiveOperation(.implicit, operation, &no_files, test_dir_info); try doLlvmArchiveOperation(.implicit, operation, &no_files, test_dir_info); try compareGeneratedArchives(test_dir_info); } { errdefer { logger.err("Failed acting as ranlib", .{}); } const operation = "s"; try doZarArchiveOperation(.implicit, operation, &no_files, test_dir_info); try doLlvmArchiveOperation(.implicit, operation, &no_files, test_dir_info); try compareGeneratedArchives(test_dir_info); } } fn testArchiveCreation(comptime target: Target, comptime format: LlvmFormat, file_names: []const []const u8, test_dir_info: TestDirInfo) !void { const tracy = trace(@src()); defer tracy.end(); errdefer { logger.err("Failed creation {s} on format {}", .{ target.targetToArgument(), format }); } const operation = "rc"; try doZarArchiveOperation(format, operation, file_names, test_dir_info); try compareGeneratedArchives(test_dir_info); } fn testParsingOfLlvmGeneratedArchive(framework_allocator: Allocator, comptime target: Target, comptime format: LlvmFormat, file_names: []const []const u8, symbol_names: []const []const []const u8, test_dir_info: TestDirInfo) !void { errdefer { logger.err("Failed parsing {s} on format {}", .{ target.targetToArgument(), format }); } try testArchiveParsing(framework_allocator, target, test_dir_info, file_names, symbol_names); } fn compareGeneratedArchives(test_dir_info: TestDirInfo) !void { const tracy = trace(@src()); defer tracy.end(); const allocator = std.testing.allocator; const llvm_ar_file_handle = try test_dir_info.tmp_dir.dir.openFile(llvm_ar_archive_name, .{ .mode = .read_only }); defer llvm_ar_file_handle.close(); const zig_ar_file_handle = try test_dir_info.tmp_dir.dir.openFile(zig_ar_archive_name, .{ .mode = .read_only }); defer zig_ar_file_handle.close(); const llvm_ar_stat = try llvm_ar_file_handle.stat(); const zig_ar_stat = try zig_ar_file_handle.stat(); try testing.expect(llvm_ar_stat.size == zig_ar_stat.size); const llvm_ar_buffer = try allocator.alloc(u8, llvm_ar_stat.size); const zig_ar_buffer = try allocator.alloc(u8, zig_ar_stat.size); defer allocator.free(llvm_ar_buffer); defer allocator.free(zig_ar_buffer); { const llvm_ar_read = try llvm_ar_file_handle.preadAll(llvm_ar_buffer, 0); try testing.expect(llvm_ar_read == llvm_ar_stat.size); } { const zig_ar_read = try zig_ar_file_handle.preadAll(zig_ar_buffer, 0); try testing.expect(zig_ar_read == zig_ar_stat.size); } for (llvm_ar_buffer) |llvm_ar_byte, index| { const zig_ar_byte = zig_ar_buffer[index]; try testing.expect(llvm_ar_byte == zig_ar_byte); } } fn testArchiveParsing(framework_allocator: Allocator, comptime target: Target, test_dir_info: TestDirInfo, file_names: []const []const u8, symbol_names: []const []const []const u8) !void { const tracy = trace(@src()); defer tracy.end(); const test_dir = test_dir_info.tmp_dir.dir; const archive_file = try test_dir.openFile(llvm_ar_archive_name, .{ .mode = .read_only }); defer archive_file.close(); var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); var testing_allocator = arena.allocator(); var archive = try Archive.create(test_dir, archive_file, llvm_ar_archive_name, Archive.ArchiveType.ambiguous, .{}, false); try archive.parse(testing_allocator); var memory_buffer = try framework_allocator.alloc(u8, 1024 * 1024); defer framework_allocator.free(memory_buffer); for (file_names) |file_name, index| { try testing.expect(mem.eql(u8, archive.files.items[index].name, file_name)); const file = try test_dir.openFile(file_name, .{}); defer file.close(); const reader = file.reader(); var current_start_pos: u64 = 0; while (true) { const num_read = try reader.read(memory_buffer); if (num_read == 0) { break; } try testing.expect(mem.eql(u8, memory_buffer[0..num_read], archive.files.items[index].contents.bytes[current_start_pos .. current_start_pos + num_read])); current_start_pos = current_start_pos + num_read; } } if (target.operating_system == .macos) { // TODO: darwin files are sorted by default, we need to make sure our // test can account for this! return; } var current_index = @as(u32, 0); for (symbol_names) |symbol_names_in_file, file_index| { for (symbol_names_in_file) |symbol_name| { const parsed_symbol = archive.symbols.items[current_index]; var parsed_symbol_name = parsed_symbol.name; // darwin targets will prepend symbol names with underscores if (target.operating_system == .macos) { try testing.expect(parsed_symbol_name[0] == '_'); parsed_symbol_name = parsed_symbol_name[1..parsed_symbol_name.len]; } try testing.expect(mem.eql(u8, parsed_symbol_name, symbol_name)); try testing.expect(mem.eql(u8, archive.files.items[parsed_symbol.file_index].name, file_names[file_index])); current_index = current_index + 1; } } } fn copyAssetsToTestDirectory(comptime test_src_dir_path: []const u8, file_names: []const []const u8, test_dir_info: TestDirInfo) !void { const tracy = trace(@src()); defer tracy.end(); var test_src_dir = fs.cwd().openDir(test_src_dir_path, .{}) catch |err| switch (err) { error.FileNotFound => return, else => return err, }; defer test_src_dir.close(); for (file_names) |test_file| { std.fs.Dir.copyFile(test_src_dir, test_file, test_dir_info.tmp_dir.dir, test_file, .{}) catch |err| switch (err) { error.FileNotFound => continue, else => return err, }; } } fn doZarArchiveOperation(comptime format: LlvmFormat, comptime operation: []const u8, file_names: []const []const u8, test_dir_info: TestDirInfo) !void { const tracy = trace(@src()); defer tracy.end(); const allocator = std.testing.allocator; var argv = std.ArrayList([]const u8).init(allocator); defer argv.deinit(); try argv.append("../../../zig-out/bin/zar"); try argv.append(format.llvmFormatToArgument()); try argv.append(operation); try argv.append(zig_ar_archive_name); try argv.appendSlice(file_names); if (invoke_zar_as_child_process) { const result = try std.ChildProcess.exec(.{ .allocator = allocator, .argv = argv.items, .cwd = test_dir_info.cwd, }); defer { allocator.free(result.stdout); allocator.free(result.stderr); } } else { // TODO: don't deinit testing allocator here so that we can confirm // the archiver does everything by the books? var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); try main.archiveMain(test_dir_info.tmp_dir.dir, arena.allocator(), argv.items); } } fn doLlvmArchiveOperation(comptime format: LlvmFormat, comptime operation: []const u8, file_names: []const []const u8, test_dir_info: TestDirInfo) !void { const tracy = trace(@src()); defer tracy.end(); const allocator = std.testing.allocator; var argv = std.ArrayList([]const u8).init(allocator); defer argv.deinit(); try argv.append("zig"); try argv.append("ar"); try argv.append(format.llvmFormatToArgument()); try argv.append(operation); try argv.append(llvm_ar_archive_name); try argv.appendSlice(file_names); const result = try std.ChildProcess.exec(.{ .allocator = allocator, .argv = argv.items, .cwd = test_dir_info.cwd, }); defer { allocator.free(result.stdout); allocator.free(result.stderr); } } fn generateCompiledFilesWithSymbols(framework_allocator: Allocator, comptime target: Target, file_names: []const []const u8, symbol_names: []const []const []const u8, test_dir_info: TestDirInfo) !void { const tracy = trace(@src()); defer tracy.end(); const worker_count = std.math.max(1, std.Thread.getCpuCount() catch 1); const child_processes = try framework_allocator.alloc(*std.ChildProcess, worker_count); var argv = std.ArrayList([]const u8).init(framework_allocator); defer argv.deinit(); try argv.append("zig"); try argv.append("cc"); try argv.append("-c"); try argv.append("-o"); const file_name_arg = argv.items.len; try argv.append(""); const source_name_arg = argv.items.len; try argv.append(""); try argv.append("-target"); // TODO: Test other target triples with appropriate corresponding archive format! try argv.append(target.targetToArgument()); for (symbol_names) |file_symbols, index| { const process_index = @mod(index, child_processes.len); if (index >= child_processes.len) { // TODO: read results etc. _ = try child_processes[process_index].wait(); child_processes[process_index].deinit(); } const file_name = file_names[index]; const source_file_name = try std.fmt.allocPrint(framework_allocator, "{s}.c", .{file_name}); defer framework_allocator.free(source_file_name); { const source_file = try test_dir_info.tmp_dir.dir.createFile(source_file_name, .{}); defer source_file.close(); const writer = source_file.writer(); for (file_symbols) |symbol| { try writer.print("extern int {s}(int a) {{ return a; }}\n", .{symbol}); } } argv.items[file_name_arg] = file_name; argv.items[source_name_arg] = source_file_name; child_processes[process_index] = try std.ChildProcess.init(argv.items, framework_allocator); child_processes[process_index].cwd = test_dir_info.cwd; try child_processes[process_index].spawn(); } { var process_index: u32 = 0; while (process_index < symbol_names.len and process_index < child_processes.len) { // TODO: read results etc. _ = try child_processes[process_index].wait(); child_processes[process_index].deinit(); process_index += 1; } } }
src/test.zig
const std = @import("std"); const Sink = @import("sink.zig").Sink; const Delegate = @import("delegate.zig").Delegate; pub fn Signal(comptime Event: type) type { return struct { const Self = @This(); calls: std.ArrayList(Delegate(Event)), allocator: ?*std.mem.Allocator = null, pub fn init(allocator: *std.mem.Allocator) Self { // we purposely do not store the allocator locally in this case so we know not to destroy ourself in deint! return Self{ .calls = std.ArrayList(Delegate(Event)).init(allocator), }; } /// heap allocates a Signal pub fn create(allocator: *std.mem.Allocator) *Self { var signal = allocator.create(Self) catch unreachable; signal.calls = std.ArrayList(Delegate(Event)).init(allocator); signal.allocator = allocator; return signal; } pub fn deinit(self: *Self) void { self.calls.deinit(); // optionally destroy ourself as well if we came from an allocator if (self.allocator) |allocator| allocator.destroy(self); } pub fn size(self: Self) usize { return self.calls.items.len; } pub fn empty(self: Self) bool { return self.size == 0; } /// Disconnects all the listeners from a signal pub fn clear(self: *Self) void { self.calls.items.len = 0; } pub fn publish(self: Self, arg: Event) void { for (self.calls.items) |call| { call.trigger(arg); } } /// Constructs a sink that is allowed to modify a given signal pub fn sink(self: *Self) Sink(Event) { return Sink(Event).init(self); } }; } fn tester(param: u32) void { std.testing.expectEqual(@as(u32, 666), param) catch unreachable; } const Thing = struct { field: f32 = 0, pub fn tester(_: *Thing, param: u32) void { std.testing.expectEqual(@as(u32, 666), param) catch unreachable; } }; test "Signal/Sink" { var signal = Signal(u32).init(std.testing.allocator); defer signal.deinit(); var sink = signal.sink(); sink.connect(tester); try std.testing.expectEqual(@as(usize, 1), signal.size()); // bound listener var thing = Thing{}; sink.connectBound(&thing, "tester"); signal.publish(666); sink.disconnect(tester); signal.publish(666); try std.testing.expectEqual(@as(usize, 1), signal.size()); sink.disconnectBound(&thing); try std.testing.expectEqual(@as(usize, 0), signal.size()); } test "Sink Before null" { var signal = Signal(u32).init(std.testing.allocator); defer signal.deinit(); var sink = signal.sink(); sink.connect(tester); try std.testing.expectEqual(@as(usize, 1), signal.size()); var thing = Thing{}; sink.before(null).connectBound(&thing, "tester"); try std.testing.expectEqual(@as(usize, 2), signal.size()); }
src/signals/signal.zig
const std = @import("std"); const sdl = @cImport({ @cInclude("SDL.h"); }); const utils = @import("utils.zig"); const Bus = @import("Bus.zig"); const Self = @This(); const Height = 160; const Width = 240; const LCDCAddr = 0x04000000; const GreenSwapAddr = 0x04000002; const LCDSAddr = 0x04000004; const VCounterAddr = 0x04000006; const Bg0ControlAddr = 0x04000008; const Bg1ControlAddr = 0x0400000A; const Bg2ControlAddr = 0x0400000C; const Bg3ControlAddr = 0x0400000E; const BgScrollAddr = 0x04000010; const BGControl = packed struct { bg_priority: u2, char_base_block: u2, _: u2, mosaic: bool, color_palette: enum(u1) { _16_16 = 0b0, _256_1 = 0b1, }, screen_base_block: u5, display_overflow: enum(u1) { transparent = 0b0, wraparound = 0b1, }, screen_size: enum(u2) { map_256_256 = 0x0, map_512_256 = 0x1, map_256_512 = 0x2, map_512_512 = 0x3, }, }; window: *sdl.SDL_Window, renderer: *sdl.SDL_Renderer, lcdc: *packed struct { display_window_obj: enum(u1) { off = 0b0, on = 0b1 }, display_window1: enum(u1) { off = 0b0, on = 0b1 }, display_window0: enum(u1) { off = 0b0, on = 0b1 }, display_obj: enum(u1) { off = 0b0, on = 0b1 }, display_bg3: enum(u1) { off = 0b0, on = 0b1 }, display_bg2: enum(u1) { off = 0b0, on = 0b1 }, display_bg1: enum(u1) { off = 0b0, on = 0b1 }, display_bg0: enum(u1) { off = 0b0, on = 0b1 }, forced_blank: enum(u1) { no = 0b0, yes = 0b1 }, // Allow access to VRAM, palette, OAM obj_char_mapping: enum(u1) { two_dimen = 0b0, three_dimen = 0b1 }, hblank_oam_access: enum(u1) { no = 0b0, yes = 0b1 }, display_frame: enum(u1) { front = 0b0, back = 0b1 }, // TODO: ?? cgb_mode: enum(u1) { gba = 0b0, cgb = 0b1 }, bg_mode: enum(u3) { bg0 = 0, bg1 = 1, bg2 = 2, bg3 = 3, bg4 = 4, bg5 = 5, _prohib0 = 6, _prohib1 = 7, }, }, green_swap: *packed struct { _: u15, swap: enum(u1) { normal = 0b0, swap = 0b1, }, }, lcds: *packed struct { vcounter_setting: u8, _: u2, vcounter_irq: bool, hblank_irq: bool, vblank_irq: bool, vcounter: bool, hblank: bool, vblank: bool, }, vcounter: *packed struct { ly: u8, _: u8, }, bg0_control: *BGControl, bg1_control: *BGControl, bg2_control: *BGControl, bg3_control: *BGControl, bg_scroll: *packed struct { bg0_x: u8, _: u8, bg0_y: u8, __: u8, bg1_x: u8, ___: u8, bg1_y: u8, ____: u8, bg2_x: u8, _____: u8, bg2_y: u8, ______: u8, bg3_x: u8, _______: u8, bg3_y: u8, ________: u8, }, pub fn init(bus: *Bus) Self { var window: ?*sdl.SDL_Window = undefined; var renderer: ?*sdl.SDL_Renderer = undefined; if (sdl.SDL_CreateWindowAndRenderer(Width, Height, 0, &window, &renderer) != 0) utils.sdlPanic(); return .{ .window = window.?, .renderer = renderer.?, .lcdc = @ptrCast(utils.Field(Self, .lcdc), bus.getAddr(LCDCAddr)), .green_swap = @ptrCast(utils.Field(Self, .green_swap), bus.getAddr(GreenSwapAddr)), .lcds = @ptrCast(utils.Field(Self, .lcds), bus.getAddr(LCDCAddr)), .vcounter = @ptrCast(utils.Field(Self, .vcounter), bus.getAddr(VCounterAddr)), .bg0_control = @ptrCast(*BGControl, bus.getAddr(Bg0ControlAddr)), .bg1_control = @ptrCast(*BGControl, bus.getAddr(Bg1ControlAddr)), .bg2_control = @ptrCast(*BGControl, bus.getAddr(Bg2ControlAddr)), .bg3_control = @ptrCast(*BGControl, bus.getAddr(Bg3ControlAddr)), .bg_scroll = @ptrCast(utils.Field(Self, .bg_scroll), bus.getAddr(BgScrollAddr)), }; } pub fn deinit(self: Self) void { _ = self; } test "static analysis" { std.testing.refAllDecls(@This()); }
src/Ppu.zig
const std = @import("std"); const root = @import("main.zig"); const math = std.math; const assert = std.debug.assert; const testing = std.testing; pub const vec3 = Vec3(f32); pub const vec3_f64 = Vec3(f64); pub const vec3_i32 = Vec3(i32); /// A 3 dimensional vector. pub fn Vec3(comptime T: type) type { if (@typeInfo(T) != .Float and @typeInfo(T) != .Int) { @compileError("Vec3 not implemented for " ++ @typeName(T)); } return packed struct { x: T, y: T, z: T, const Self = @This(); /// Constract vector from given 3 components. pub fn new(x: T, y: T, z: T) Self { return Self{ .x = x, .y = y, .z = z, }; } /// Return component from given index. pub fn at(self: *const Self, index: i32) T { assert(index <= 2); if (index == 0) { return self.x; } else if (index == 1) { return self.y; } else { return self.z; } } /// Set all components to the same given value. pub fn set(val: T) Self { return Self.new(val, val, val); } /// Shorthand for writing vec3.new(0, 0, 0). pub fn zero() Self { return Self.new(0., 0., 0.); } /// Shorthand for writing vec3.new(1, 1, 1). pub fn one() Self { return Self.new(1., 1., 1.); } /// Shorthand for writing vec3.new(0, 1, 0). pub fn up() Self { return Self.new(0., 1., 0.); } /// Shorthand for writing vec3.new(0, -1, 0). pub fn down() Self { return Self.new(0., -1., 0.); } /// Shorthand for writing vec3.new(1, 0, 0). pub fn right() Self { return Self.new(1., 0., 0.); } /// Shorthand for writing vec3.new(-1, 0, 0). pub fn left() Self { return Self.new(-1., 0., 0.); } /// Shorthand for writing vec3.new(0, 0, -1). pub fn back() Self { return Self.new(0., 0., -1); } /// Shorthand for writing vec3.new(0, 0, 1). pub fn forward() Self { return Self.new(0., 0., 1); } /// Cast a type to another type. Only for integers and floats. /// It's like builtins: @intCast, @floatCast, @intToFloat, @floatToInt pub fn cast(self: Self, dest: anytype) Vec3(dest) { const source_info = @typeInfo(T); const dest_info = @typeInfo(dest); if (source_info == .Float and dest_info == .Int) { const x = @floatToInt(dest, self.x); const y = @floatToInt(dest, self.y); const z = @floatToInt(dest, self.z); return Vec3(dest).new(x, y, z); } if (source_info == .Int and dest_info == .Float) { const x = @intToFloat(dest, self.x); const y = @intToFloat(dest, self.y); const z = @intToFloat(dest, self.z); return Vec3(dest).new(x, y, z); } return switch (dest_info) { .Float => { const x = @floatCast(dest, self.x); const y = @floatCast(dest, self.y); const z = @floatCast(dest, self.z); return Vec3(dest).new(x, y, z); }, .Int => { const x = @intCast(dest, self.x); const y = @intCast(dest, self.y); const z = @intCast(dest, self.z); return Vec3(dest).new(x, y, z); }, else => panic( "Error, given type should be integers or float.\n", .{}, ), }; } /// Construct new vector from slice. pub fn from_slice(slice: []const T) Self { return Self.new(slice[0], slice[1], slice[2]); } /// Transform vector to array. pub fn to_array(self: Self) [3]T { return .{ self.x, self.y, self.z }; } /// Return the angle in degrees between two vectors. pub fn get_angle(lhs: Self, rhs: Self) T { const dot_product = Self.dot(lhs.norm(), rhs.norm()); return root.to_degrees(math.acos(dot_product)); } /// Compute the length (magnitude) of given vector |a|. pub fn length(self: Self) T { return math.sqrt((self.x * self.x) + (self.y * self.y) + (self.z * self.z)); } /// Construct new normalized vector from a given vector. pub fn norm(self: Self) Self { var l = length(self); return Self.new(self.x / l, self.y / l, self.z / l); } pub fn is_eq(lhs: Self, rhs: Self) bool { return lhs.x == rhs.x and lhs.y == rhs.y and lhs.z == rhs.z; } /// Substraction between two given vector. pub fn sub(lhs: Self, rhs: Self) Self { return Self.new(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z); } /// Addition betwen two given vector. pub fn add(lhs: Self, rhs: Self) Self { return Self.new(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z); } /// Multiply each components by the given scalar. pub fn scale(v: Self, scalar: T) Self { return Self.new(v.x * scalar, v.y * scalar, v.z * scalar); } /// Compute the cross product from two vector. pub fn cross(lhs: Self, rhs: Self) Self { return Self.new( (lhs.y * rhs.z) - (lhs.z * rhs.y), (lhs.z * rhs.x) - (lhs.x * rhs.z), (lhs.x * rhs.y) - (lhs.y * rhs.x), ); } /// Return the dot product between two given vector. pub fn dot(lhs: Self, rhs: Self) T { return (lhs.x * rhs.x) + (lhs.y * rhs.y) + (lhs.z * rhs.z); } /// Lerp between two vectors. pub fn lerp(lhs: Self, rhs: Self, t: T) Self { const x = root.lerp(T, lhs.x, rhs.x, t); const y = root.lerp(T, lhs.y, rhs.y, t); const z = root.lerp(T, lhs.z, rhs.z, t); return Self.new(x, y, z); } /// Construct a new vector from the min components between two vectors. pub fn min(lhs: Self, rhs: Self) Self { return Self.new( math.min(lhs.x, rhs.x), math.min(lhs.y, rhs.y), math.min(lhs.z, rhs.z), ); } /// Construct a new vector from the max components between two vectors. pub fn max(lhs: Self, rhs: Self) Self { return Self.new( math.max(lhs.x, rhs.x), math.max(lhs.y, rhs.y), math.max(lhs.z, rhs.z), ); } // Construct a new vector whose components are the absolute value of the // input. pub fn abs(in: Self) Self { return Self.new(@fabs(in.x), @fabs(in.y), @fabs(in.z)); } // Construct a new vector whose components are the truncated value of // the input. pub fn trunc(in: Self) Self { return Self.new(@trunc(in.x), @trunc(in.y), @trunc(in.z)); } // Construct a new vector whose components are the ceil'd value of the // input. pub fn ceil(in: Self) Self { return Self.new(@ceil(in.x), @ceil(in.y), @ceil(in.z)); } // Construct a new vector whose components are the round'd value of the // input. pub fn round(in: Self) Self { return Self.new(@round(in.x), @round(in.y), @round(in.z)); } }; } test "zalgebra.Vec3.init" { var _vec_0 = vec3.new(1.5, 2.6, 3.7); testing.expectEqual(_vec_0.x, 1.5); testing.expectEqual(_vec_0.y, 2.6); testing.expectEqual(_vec_0.z, 3.7); } test "zalgebra.Vec3.set" { var _vec_0 = vec3.new(2.5, 2.5, 2.5); var _vec_1 = vec3.set(2.5); testing.expectEqual(vec3.is_eq(_vec_0, _vec_1), true); } test "zalgebra.Vec3.get_angle" { var _vec_0 = vec3.new(1., 0., 0.); var _vec_1 = vec3.up(); var _vec_2 = vec3.new(-1., 0., 0.); var _vec_3 = vec3.new(1., 1., 0.); testing.expectEqual(vec3.get_angle(_vec_0, _vec_1), 90.); testing.expectEqual(vec3.get_angle(_vec_0, _vec_2), 180.); testing.expectEqual(vec3.get_angle(_vec_0, _vec_3), 45.); } test "zalgebra.Vec3.to_array" { const _vec_0 = vec3.up().to_array(); const _vec_1 = [_]f32{ 0, 1, 0 }; testing.expectEqual(std.mem.eql(f32, &_vec_0, &_vec_1), true); } test "zalgebra.Vec3.is_eq" { var _vec_0 = vec3.new(1., 2., 3.); var _vec_1 = vec3.new(1., 2., 3.); var _vec_2 = vec3.new(1.5, 2., 3.); testing.expectEqual(vec3.is_eq(_vec_0, _vec_1), true); testing.expectEqual(vec3.is_eq(_vec_0, _vec_2), false); } test "zalgebra.Vec3.length" { var _vec_0 = vec3.new(1.5, 2.6, 3.7); testing.expectEqual(_vec_0.length(), 4.7644519); } test "zalgebra.Vec3.normalize" { var _vec_0 = vec3.new(1.5, 2.6, 3.7); testing.expectEqual(vec3.is_eq(_vec_0.norm(), vec3.new(0.314831584, 0.545708060, 0.776584625)), true); } test "zalgebra.Vec3.sub" { var _vec_0 = vec3.new(1., 2., 3.); var _vec_1 = vec3.new(2., 2., 3.); testing.expectEqual(vec3.is_eq(vec3.sub(_vec_0, _vec_1), vec3.new(-1., 0., 0.)), true); } test "zalgebra.Vec3.add" { var _vec_0 = vec3.new(1., 2., 3.); var _vec_1 = vec3.new(2., 2., 3.); testing.expectEqual(vec3.is_eq(vec3.add(_vec_0, _vec_1), vec3.new(3., 4., 6.)), true); } test "zalgebra.Vec3.scale" { var _vec_0 = vec3.new(1., 2., 3.); testing.expectEqual(vec3.is_eq(vec3.scale(_vec_0, 5.), vec3.new(5., 10., 15.)), true); } test "zalgebra.Vec3.cross" { var _vec_0 = vec3.new(1.5, 2.6, 3.7); var _vec_1 = vec3.new(2.5, 3.45, 1.0); var _vec_2 = vec3.new(1.5, 2.6, 3.7); var _cross_product_0 = vec3.cross(_vec_0, _vec_2); var _cross_product_1 = vec3.cross(_vec_0, _vec_1); testing.expectEqual(vec3.is_eq(_cross_product_0, vec3.new(0., 0., 0.)), true); testing.expectEqual(vec3.is_eq(_cross_product_1, vec3.new(-10.1650009, 7.75, -1.32499980)), true); } test "zalgebra.Vec3.dot" { var _vec_0 = vec3.new(1.5, 2.6, 3.7); var _vec_1 = vec3.new(2.5, 3.45, 1.0); testing.expectEqual(vec3.dot(_vec_0, _vec_1), 16.42); } test "zalgebra.Vec3.lerp" { var _vec_0 = vec3.new(-10.0, 0.0, -10.0); var _vec_1 = vec3.new(10.0, 10.0, 10.0); testing.expectEqual(vec3.is_eq(vec3.lerp(_vec_0, _vec_1, 0.5), vec3.new(0.0, 5.0, 0.0)), true); } test "zalgebra.Vec3.min" { var _vec_0 = vec3.new(10.0, -2.0, 0.0); var _vec_1 = vec3.new(-10.0, 5.0, 0.0); testing.expectEqual(vec3.is_eq(vec3.min(_vec_0, _vec_1), vec3.new(-10.0, -2.0, 0.0)), true); } test "zalgebra.Vec3.max" { var _vec_0 = vec3.new(10.0, -2.0, 0.0); var _vec_1 = vec3.new(-10.0, 5.0, 0.0); testing.expectEqual(vec3.is_eq(vec3.max(_vec_0, _vec_1), vec3.new(10.0, 5.0, 0.0)), true); } test "zalgebra.Vec3.at" { const t = vec3.new(10.0, -2.0, 0.0); testing.expectEqual(t.at(0), 10.0); testing.expectEqual(t.at(1), -2.0); testing.expectEqual(t.at(2), 0.0); } test "zalgebra.Vec3.from_slice" { const array = [3]f32{ 2, 1, 4 }; testing.expectEqual(vec3.is_eq(vec3.from_slice(&array), vec3.new(2, 1, 4)), true); } test "zalgebra.Vec3.cast" { const a = vec3_i32.new(3, 6, 2); const b = Vec3(usize).new(3, 6, 2); testing.expectEqual( Vec3(usize).is_eq(a.cast(usize), b), true, ); const c = vec3.new(3.5, 6.5, 2.0); const d = vec3_f64.new(3.5, 6.5, 2); testing.expectEqual( vec3_f64.is_eq(c.cast(f64), d), true, ); const e = vec3_i32.new(3, 6, 2); const f = vec3.new(3.0, 6.0, 2.0); testing.expectEqual( vec3.is_eq(e.cast(f32), f), true, ); const g = vec3.new(3.0, 6.0, 2.0); const h = vec3_i32.new(3, 6, 2); testing.expectEqual( vec3_i32.is_eq(g.cast(i32), h), true, ); }
src/vec3.zig
const std = @import("std"); const assert = std.debug.assert; const warn = std.debug.warn; const math = std.math; const Allocator = std.mem.Allocator; const geo = @import("modules/zig-geometry/index.zig"); const gl = @import("modules/zig-sdl2/src/index.zig"); const ColorU8 = @import("../src/color.zig").ColorU8; const DBG = false; pub const Texture = struct { const Self = @This(); pAllocator: *Allocator, pub width: usize, pub height: usize, pub pixels: ?[]ColorU8, pub pixels_owned: bool, pub fn init(pAllocator: *Allocator) Self { return Self{ .pAllocator = pAllocator, .width = 0, .height = 0, .pixels = null, .pixels_owned = false, }; } pub fn initPixels(pAllocator: *Allocator, width: usize, height: usize, color: ColorU8) anyerror!Self { var count: usize = width * height; var pixels = try pAllocator.alloc(ColorU8, count); var i: usize = 0; while (i < count) : (i += 1) { pixels[i] = color; } return Self{ .pAllocator = pAllocator, .width = width, .height = height, .pixels = pixels, .pixels_owned = true, }; } pub fn deinit(pSelf: *Self) void { if ((pSelf.pixels_owned) and (pSelf.pixels != null)) { pSelf.pAllocator.free(pSelf.pixels.?); } } pub fn loadFile(pSelf: *Self, filename: []const u8) anyerror!void { var cfilename = try std.cstr.addNullByte(pSelf.pAllocator, filename); defer pSelf.pAllocator.free(cfilename); var surface = gl.IMG_Load(cfilename.ptr) orelse return error.UnableToLoadImage; defer gl.SDL_FreeSurface(surface); pSelf.width = @intCast(usize, surface.w); pSelf.height = @intCast(usize, surface.h); var bpp: usize = @intCast(usize, surface.format.BytesPerPixel); switch (bpp) { 1, 2, 3, 4 => {}, else => return error.UnsupportedBytesPerPixel, } var pitch: usize = @intCast(usize, surface.pitch); var count: usize = pSelf.width * pSelf.height * bpp; var pPixels: []const u8 = if (surface.pixels) |p| @ptrCast([*]u8, p)[0..count] else return error.NoPixels; pSelf.pixels = try pSelf.pAllocator.alloc(ColorU8, count); pSelf.pixels_owned = true; var y: usize = 0; var line_offset: usize = 0; var dest_offset: usize = 0; while (y < pSelf.height) : (y += 1) { // Looping through the lines of pixels var pLine: []const u8 = pPixels[line_offset..]; var x: usize = 0; var src_offset: usize = 0; while (x < pSelf.width) : (x += 1) { // Loopting through the pixels on a line // Create a slice of this pixels bytes var pPixel: []const u8 = pLine[src_offset..(src_offset + bpp)]; src_offset += bpp; // Extract the bytes into a u32 var raw_pixel: u32 = switch (bpp) { 1 => @intCast(u32, pPixel[0]), 2 => @intCast(u32, pPixel[0]) << 0 | @intCast(u32, pPixel[1]) << 8, 3 => @intCast(u32, pPixel[0]) << 0 | @intCast(u32, pPixel[1]) << 8 | @intCast(u32, pPixel[2]) << 16, 4 => @intCast(u32, pPixel[0]) << 0 | @intCast(u32, pPixel[1]) << 8 | @intCast(u32, pPixel[2]) << 16 | @intCast(u32, pPixel[3]) << 24, else => unreachable, }; // Extract the components from the raw_pixel var a: u8 = undefined; var r: u8 = undefined; var g: u8 = undefined; var b: u8 = undefined; gl.SDL_GetRGBA(raw_pixel, surface.format, &r, &g, &b, &a); // Store in texture pixels slice pSelf.pixels.?[dest_offset] = ColorU8.init(a, r, g, b); dest_offset += 1; } line_offset += pitch; } } pub fn map(pSelf: *const Self, tu: f32, tv: f32, defaultColor: ColorU8) ColorU8 { if (pSelf.pixels) |pPixels| { var u = @floatToInt(usize, tu * @intToFloat(f32, pSelf.width)) % pSelf.width; var v = @floatToInt(usize, tv * @intToFloat(f32, pSelf.height)) % pSelf.height; var c = pPixels[(v * pSelf.width) + u]; if (DBG) warn("map: tu={.3} tv={.3} u={} v={} c={}... ", tu, tv, u, v, &c); return c; } else { return defaultColor; } } }; test "texture.empty" { var direct_allocator = std.heap.DirectAllocator.init(); var arena_allocator = std.heap.ArenaAllocator.init(&direct_allocator.allocator); defer arena_allocator.deinit(); var pAllocator = &arena_allocator.allocator; var texture = Texture.init(pAllocator); defer texture.deinit(); } test "texture.known.TODO" { // TODO: Add a test with known contents so we truly validate } test "texture.initPixels" { var direct_allocator = std.heap.DirectAllocator.init(); var arena_allocator = std.heap.ArenaAllocator.init(&direct_allocator.allocator); defer arena_allocator.deinit(); var pAllocator = &arena_allocator.allocator; // Create and Initialize text.pixels var texture = try Texture.initPixels(pAllocator, 1024, 512, ColorU8.Black); defer texture.deinit(); assert(texture.width == 1024); assert(texture.height == 512); assert(texture.pixels.?[0].r == ColorU8.Black.r); assert(texture.pixels.?[0].g == ColorU8.Black.g); assert(texture.pixels.?[0].b == ColorU8.Black.b); } test "texture.loadFile.bricks2" { var direct_allocator = std.heap.DirectAllocator.init(); var arena_allocator = std.heap.ArenaAllocator.init(&direct_allocator.allocator); defer arena_allocator.deinit(); var pAllocator = &arena_allocator.allocator; var texture = Texture.init(pAllocator); defer texture.deinit(); try texture.loadFile("src/modules/3d-test-resources/bricks2.jpg"); assert(texture.pixels != null); // We "know" the first pixel isn't 0 assert(texture.pixels.?[0].asU32Argb() != 0); }
src/texture.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const List = std.ArrayList; const Map = std.AutoHashMap; const StrMap = std.StringHashMap; const BitSet = std.DynamicBitSet; const Str = []const u8; const int = i64; const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../data/day24.txt"); const Emulator = struct { const div = [_]bool{ false, false, false, false, false, true, false, true, true, false, true, true, true, true, }; const add1 = [_]int{ 12, 11, 13, 11, 14, -10, 11, -9, -3, 13, -5, -10, -4, -5, }; const add2 = [_]int{ 4, 11, 5, 11, 14, 7, 11, 4, 6, 5, 9, 12, 14, 14, }; pub fn emulate(input: []const u8) bool { var z: int = 0; var i: usize = 0; while (i < 14) : (i += 1) { const w = input[i]; print("\ninput {}: {}\n", .{i, w}); const rz = @rem(z, 26); const x = rz + add1[i]; print("x = {} ({} + {})\n", .{x, rz, add1[i]}); if (div[i]) { z = @divTrunc(z, 26); print("pop\n", .{}); } if (x != w) { z *= 26; const new_val = add2[i] + w; z += new_val; print("push\n", .{}); } print("z =", .{}); var zz = z; while (zz != 0) { print(" {}", .{@mod(zz, 26)}); zz = @divTrunc(zz, 26); } print("\n", .{}); } return z == 0; } }; const PendingDigit = struct { index: u8, add2: i8, }; pub fn main() !void { var max_val: [14]u8 = undefined; var min_val: [14]u8 = undefined; var lines = tokenize(u8, data, "\r\n"); var input_idx: u8 = 0; var stack = std.BoundedArray(PendingDigit, 7).init(0) catch unreachable; while (lines.next()) |line| : (input_idx += 1) { assert(eql(u8, line, "inp w")); assert(eql(u8, lines.next().?, "mul x 0")); assert(eql(u8, lines.next().?, "add x z")); assert(eql(u8, lines.next().?, "mod x 26")); const pop_line = lines.next().?; const pop = pop_line.len == 8; if (pop) { assert(eql(u8, pop_line, "div z 26")); } else { assert(eql(u8, pop_line, "div z 1")); } const add1_line = lines.next().?; assert(eql(u8, add1_line[0..6], "add x ")); const add1 = try parseInt(i8, add1_line[6..], 10); assert(eql(u8, lines.next().?, "eql x w")); assert(eql(u8, lines.next().?, "eql x 0")); assert(eql(u8, lines.next().?, "mul y 0")); assert(eql(u8, lines.next().?, "add y 25")); assert(eql(u8, lines.next().?, "mul y x")); assert(eql(u8, lines.next().?, "add y 1")); assert(eql(u8, lines.next().?, "mul z y")); assert(eql(u8, lines.next().?, "mul y 0")); assert(eql(u8, lines.next().?, "add y w")); const add2_line = lines.next().?; assert(eql(u8, add2_line[0..6], "add y ")); const add2 = try parseInt(i8, add2_line[6..], 10); assert(eql(u8, lines.next().?, "mul y x")); assert(eql(u8, lines.next().?, "add z y")); if (!pop) { assert(add1 > 9); stack.appendAssumeCapacity(.{ .index = input_idx, .add2 = add2, }); } else { assert(add1 < 0); const pair = stack.pop(); // a + add2 + add1 == b // a - b == add1 + add2 const diff = add1 + pair.add2; assert(diff > -9 and diff < 9); if (diff > 0) { const diff_u8 = @intCast(u8, diff); max_val[pair.index] = '9' - diff_u8; max_val[input_idx] = '9'; min_val[pair.index] = '1'; min_val[input_idx] = '1' + diff_u8; } else { const diff_u8 = @intCast(u8, -diff); max_val[pair.index] = '9'; max_val[input_idx] = '9' - diff_u8; min_val[pair.index] = '1' + diff_u8; min_val[input_idx] = '1'; } } } print("part1={s}, part2={s}\n", .{&max_val, &min_val}); } // Useful stdlib functions const tokenize = std.mem.tokenize; const split = std.mem.split; const indexOf = std.mem.indexOfScalar; const indexOfAny = std.mem.indexOfAny; const indexOfStr = std.mem.indexOfPosLinear; const lastIndexOf = std.mem.lastIndexOfScalar; const lastIndexOfAny = std.mem.lastIndexOfAny; const lastIndexOfStr = std.mem.lastIndexOfLinear; const trim = std.mem.trim; const sliceMin = std.mem.min; const sliceMax = std.mem.max; const eql = std.mem.eql; const parseEnum = std.meta.stringToEnum; const parseInt = std.fmt.parseInt; const parseFloat = std.fmt.parseFloat; const min = std.math.min; const min3 = std.math.min3; const max = std.math.max; const max3 = std.math.max3; const print = std.debug.print; const assert = std.debug.assert; const sort = std.sort.sort; const asc = std.sort.asc; const desc = std.sort.desc;
src/day24.zig
const std = @import("std"); usingnamespace (@import("../machine.zig")); usingnamespace (@import("../util.zig")); const imm = Operand.immediate; const imm16 = Operand.immediate16; const imm32 = Operand.immediate32; const immSign = Operand.immediateSigned; const immSign16 = Operand.immediateSigned16; const immSign32 = Operand.immediateSigned32; test "jcc" { const m32 = Machine.init(.x86_32); const m64 = Machine.init(.x64); debugPrint(false); { testOp1(m32, .JCXZ, imm(0x11), "67 E3 11"); testOp1(m32, .JECXZ, imm(0x11), "E3 11"); testOp1(m32, .JRCXZ, imm(0x11), AsmError.InvalidOperand); testOp1(m64, .JCXZ, imm(0x11), AsmError.InvalidOperand); testOp1(m64, .JECXZ, imm(0x11), "67 E3 11"); testOp1(m64, .JRCXZ, imm(0x11), "E3 11"); } { testOp1(m32, .JA, imm(0x11), "77 11"); testOp1(m32, .JAE, imm(0x11), "73 11"); testOp1(m32, .JB, imm(0x11), "72 11"); testOp1(m32, .JBE, imm(0x11), "76 11"); testOp1(m32, .JC, imm(0x11), "72 11"); testOp1(m32, .JE, imm(0x11), "74 11"); testOp1(m32, .JG, imm(0x11), "7F 11"); testOp1(m32, .JGE, imm(0x11), "7D 11"); testOp1(m32, .JL, imm(0x11), "7C 11"); testOp1(m32, .JLE, imm(0x11), "7E 11"); testOp1(m32, .JNA, imm(0x11), "76 11"); testOp1(m32, .JNAE, imm(0x11), "72 11"); testOp1(m32, .JNB, imm(0x11), "73 11"); testOp1(m32, .JNBE, imm(0x11), "77 11"); testOp1(m32, .JNC, imm(0x11), "73 11"); testOp1(m32, .JNE, imm(0x11), "75 11"); testOp1(m32, .JNG, imm(0x11), "7E 11"); testOp1(m32, .JNGE, imm(0x11), "7C 11"); testOp1(m32, .JNL, imm(0x11), "7D 11"); testOp1(m32, .JNLE, imm(0x11), "7F 11"); testOp1(m32, .JNO, imm(0x11), "71 11"); testOp1(m32, .JNP, imm(0x11), "7B 11"); testOp1(m32, .JNS, imm(0x11), "79 11"); testOp1(m32, .JNZ, imm(0x11), "75 11"); testOp1(m32, .JO, imm(0x11), "70 11"); testOp1(m32, .JP, imm(0x11), "7A 11"); testOp1(m32, .JPE, imm(0x11), "7A 11"); testOp1(m32, .JPO, imm(0x11), "7B 11"); testOp1(m32, .JS, imm(0x11), "78 11"); testOp1(m32, .JZ, imm(0x11), "74 11"); testOp1(m64, .JA, imm(0x11), "77 11"); testOp1(m64, .JAE, imm(0x11), "73 11"); testOp1(m64, .JB, imm(0x11), "72 11"); testOp1(m64, .JBE, imm(0x11), "76 11"); testOp1(m64, .JC, imm(0x11), "72 11"); testOp1(m64, .JE, imm(0x11), "74 11"); testOp1(m64, .JG, imm(0x11), "7F 11"); testOp1(m64, .JGE, imm(0x11), "7D 11"); testOp1(m64, .JL, imm(0x11), "7C 11"); testOp1(m64, .JLE, imm(0x11), "7E 11"); testOp1(m64, .JNA, imm(0x11), "76 11"); testOp1(m64, .JNAE, imm(0x11), "72 11"); testOp1(m64, .JNB, imm(0x11), "73 11"); testOp1(m64, .JNBE, imm(0x11), "77 11"); testOp1(m64, .JNC, imm(0x11), "73 11"); testOp1(m64, .JNE, imm(0x11), "75 11"); testOp1(m64, .JNG, imm(0x11), "7E 11"); testOp1(m64, .JNGE, imm(0x11), "7C 11"); testOp1(m64, .JNL, imm(0x11), "7D 11"); testOp1(m64, .JNLE, imm(0x11), "7F 11"); testOp1(m64, .JNO, imm(0x11), "71 11"); testOp1(m64, .JNP, imm(0x11), "7B 11"); testOp1(m64, .JNS, imm(0x11), "79 11"); testOp1(m64, .JNZ, imm(0x11), "75 11"); testOp1(m64, .JO, imm(0x11), "70 11"); testOp1(m64, .JP, imm(0x11), "7A 11"); testOp1(m64, .JPE, imm(0x11), "7A 11"); testOp1(m64, .JPO, imm(0x11), "7B 11"); testOp1(m64, .JS, imm(0x11), "78 11"); testOp1(m64, .JZ, imm(0x11), "74 11"); } { testOp1(m32, .JA, immSign(-1), "77 ff"); testOp1(m32, .JAE, immSign(-1), "73 ff"); testOp1(m32, .JB, immSign(-1), "72 ff"); testOp1(m32, .JBE, immSign(-1), "76 ff"); testOp1(m32, .JC, immSign(-1), "72 ff"); testOp1(m32, .JE, immSign(-1), "74 ff"); testOp1(m32, .JG, immSign(-1), "7F ff"); testOp1(m32, .JGE, immSign(-1), "7D ff"); testOp1(m32, .JL, immSign(-1), "7C ff"); testOp1(m32, .JLE, immSign(-1), "7E ff"); testOp1(m32, .JNA, immSign(-1), "76 ff"); testOp1(m32, .JNAE, immSign(-1), "72 ff"); testOp1(m32, .JNB, immSign(-1), "73 ff"); testOp1(m32, .JNBE, immSign(-1), "77 ff"); testOp1(m32, .JNC, immSign(-1), "73 ff"); testOp1(m32, .JNE, immSign(-1), "75 ff"); testOp1(m32, .JNG, immSign(-1), "7E ff"); testOp1(m32, .JNGE, immSign(-1), "7C ff"); testOp1(m32, .JNL, immSign(-1), "7D ff"); testOp1(m32, .JNLE, immSign(-1), "7F ff"); testOp1(m32, .JNO, immSign(-1), "71 ff"); testOp1(m32, .JNP, immSign(-1), "7B ff"); testOp1(m32, .JNS, immSign(-1), "79 ff"); testOp1(m32, .JNZ, immSign(-1), "75 ff"); testOp1(m32, .JO, immSign(-1), "70 ff"); testOp1(m32, .JP, immSign(-1), "7A ff"); testOp1(m32, .JPE, immSign(-1), "7A ff"); testOp1(m32, .JPO, immSign(-1), "7B ff"); testOp1(m32, .JS, immSign(-1), "78 ff"); testOp1(m32, .JZ, immSign(-1), "74 ff"); testOp1(m64, .JA, immSign(-1), "77 ff"); testOp1(m64, .JAE, immSign(-1), "73 ff"); testOp1(m64, .JB, immSign(-1), "72 ff"); testOp1(m64, .JBE, immSign(-1), "76 ff"); testOp1(m64, .JC, immSign(-1), "72 ff"); testOp1(m64, .JE, immSign(-1), "74 ff"); testOp1(m64, .JG, immSign(-1), "7F ff"); testOp1(m64, .JGE, immSign(-1), "7D ff"); testOp1(m64, .JL, immSign(-1), "7C ff"); testOp1(m64, .JLE, immSign(-1), "7E ff"); testOp1(m64, .JNA, immSign(-1), "76 ff"); testOp1(m64, .JNAE, immSign(-1), "72 ff"); testOp1(m64, .JNB, immSign(-1), "73 ff"); testOp1(m64, .JNBE, immSign(-1), "77 ff"); testOp1(m64, .JNC, immSign(-1), "73 ff"); testOp1(m64, .JNE, immSign(-1), "75 ff"); testOp1(m64, .JNG, immSign(-1), "7E ff"); testOp1(m64, .JNGE, immSign(-1), "7C ff"); testOp1(m64, .JNL, immSign(-1), "7D ff"); testOp1(m64, .JNLE, immSign(-1), "7F ff"); testOp1(m64, .JNO, immSign(-1), "71 ff"); testOp1(m64, .JNP, immSign(-1), "7B ff"); testOp1(m64, .JNS, immSign(-1), "79 ff"); testOp1(m64, .JNZ, immSign(-1), "75 ff"); testOp1(m64, .JO, immSign(-1), "70 ff"); testOp1(m64, .JP, immSign(-1), "7A ff"); testOp1(m64, .JPE, immSign(-1), "7A ff"); testOp1(m64, .JPO, immSign(-1), "7B ff"); testOp1(m64, .JS, immSign(-1), "78 ff"); testOp1(m64, .JZ, immSign(-1), "74 ff"); } { testOp1(m32, .JA, imm(0x80), "66 0F 87 80 00"); testOp1(m32, .JAE, imm(0x80), "66 0F 83 80 00"); testOp1(m32, .JB, imm(0x80), "66 0F 82 80 00"); testOp1(m32, .JBE, imm(0x80), "66 0F 86 80 00"); testOp1(m32, .JC, imm(0x80), "66 0F 82 80 00"); testOp1(m32, .JE, imm(0x80), "66 0F 84 80 00"); testOp1(m32, .JG, imm(0x80), "66 0F 8F 80 00"); testOp1(m32, .JGE, imm(0x80), "66 0F 8D 80 00"); testOp1(m32, .JL, imm(0x80), "66 0F 8C 80 00"); testOp1(m32, .JLE, imm(0x80), "66 0F 8E 80 00"); testOp1(m32, .JNA, imm(0x80), "66 0F 86 80 00"); testOp1(m32, .JNAE, imm(0x80), "66 0F 82 80 00"); testOp1(m32, .JNB, imm(0x80), "66 0F 83 80 00"); testOp1(m32, .JNBE, imm(0x80), "66 0F 87 80 00"); testOp1(m32, .JNC, imm(0x80), "66 0F 83 80 00"); testOp1(m32, .JNE, imm(0x80), "66 0F 85 80 00"); testOp1(m32, .JNG, imm(0x80), "66 0F 8E 80 00"); testOp1(m32, .JNGE, imm(0x80), "66 0F 8C 80 00"); testOp1(m32, .JNL, imm(0x80), "66 0F 8D 80 00"); testOp1(m32, .JNLE, imm(0x80), "66 0F 8F 80 00"); testOp1(m32, .JNO, imm(0x80), "66 0F 81 80 00"); testOp1(m32, .JNP, imm(0x80), "66 0F 8B 80 00"); testOp1(m32, .JNS, imm(0x80), "66 0F 89 80 00"); testOp1(m32, .JNZ, imm(0x80), "66 0F 85 80 00"); testOp1(m32, .JO, imm(0x80), "66 0F 80 80 00"); testOp1(m32, .JP, imm(0x80), "66 0F 8A 80 00"); testOp1(m32, .JPE, imm(0x80), "66 0F 8A 80 00"); testOp1(m32, .JPO, imm(0x80), "66 0F 8B 80 00"); testOp1(m32, .JS, imm(0x80), "66 0F 88 80 00"); testOp1(m32, .JZ, imm(0x80), "66 0F 84 80 00"); testOp1(m64, .JA, imm(0x80), "0F 87 80 00 00 00"); testOp1(m64, .JAE, imm(0x80), "0F 83 80 00 00 00"); testOp1(m64, .JB, imm(0x80), "0F 82 80 00 00 00"); testOp1(m64, .JBE, imm(0x80), "0F 86 80 00 00 00"); testOp1(m64, .JC, imm(0x80), "0F 82 80 00 00 00"); testOp1(m64, .JE, imm(0x80), "0F 84 80 00 00 00"); testOp1(m64, .JG, imm(0x80), "0F 8F 80 00 00 00"); testOp1(m64, .JGE, imm(0x80), "0F 8D 80 00 00 00"); testOp1(m64, .JL, imm(0x80), "0F 8C 80 00 00 00"); testOp1(m64, .JLE, imm(0x80), "0F 8E 80 00 00 00"); testOp1(m64, .JNA, imm(0x80), "0F 86 80 00 00 00"); testOp1(m64, .JNAE, imm(0x80), "0F 82 80 00 00 00"); testOp1(m64, .JNB, imm(0x80), "0F 83 80 00 00 00"); testOp1(m64, .JNBE, imm(0x80), "0F 87 80 00 00 00"); testOp1(m64, .JNC, imm(0x80), "0F 83 80 00 00 00"); testOp1(m64, .JNE, imm(0x80), "0F 85 80 00 00 00"); testOp1(m64, .JNG, imm(0x80), "0F 8E 80 00 00 00"); testOp1(m64, .JNGE, imm(0x80), "0F 8C 80 00 00 00"); testOp1(m64, .JNL, imm(0x80), "0F 8D 80 00 00 00"); testOp1(m64, .JNLE, imm(0x80), "0F 8F 80 00 00 00"); testOp1(m64, .JNO, imm(0x80), "0F 81 80 00 00 00"); testOp1(m64, .JNP, imm(0x80), "0F 8B 80 00 00 00"); testOp1(m64, .JNS, imm(0x80), "0F 89 80 00 00 00"); testOp1(m64, .JNZ, imm(0x80), "0F 85 80 00 00 00"); testOp1(m64, .JO, imm(0x80), "0F 80 80 00 00 00"); testOp1(m64, .JP, imm(0x80), "0F 8A 80 00 00 00"); testOp1(m64, .JPE, imm(0x80), "0F 8A 80 00 00 00"); testOp1(m64, .JPO, imm(0x80), "0F 8B 80 00 00 00"); testOp1(m64, .JS, imm(0x80), "0F 88 80 00 00 00"); testOp1(m64, .JZ, imm(0x80), "0F 84 80 00 00 00"); } { testOp1(m32, .JA, imm16(0x80), "66 0F 87 80 00"); testOp1(m32, .JAE, imm16(0x80), "66 0F 83 80 00"); testOp1(m32, .JB, imm16(0x80), "66 0F 82 80 00"); testOp1(m32, .JBE, imm16(0x80), "66 0F 86 80 00"); testOp1(m32, .JC, imm16(0x80), "66 0F 82 80 00"); testOp1(m32, .JE, imm16(0x80), "66 0F 84 80 00"); testOp1(m32, .JG, imm16(0x80), "66 0F 8F 80 00"); testOp1(m32, .JGE, imm16(0x80), "66 0F 8D 80 00"); testOp1(m32, .JL, imm16(0x80), "66 0F 8C 80 00"); testOp1(m32, .JLE, imm16(0x80), "66 0F 8E 80 00"); testOp1(m32, .JNA, imm16(0x80), "66 0F 86 80 00"); testOp1(m32, .JNAE, imm16(0x80), "66 0F 82 80 00"); testOp1(m32, .JNB, imm16(0x80), "66 0F 83 80 00"); testOp1(m32, .JNBE, imm16(0x80), "66 0F 87 80 00"); testOp1(m32, .JNC, imm16(0x80), "66 0F 83 80 00"); testOp1(m32, .JNE, imm16(0x80), "66 0F 85 80 00"); testOp1(m32, .JNG, imm16(0x80), "66 0F 8E 80 00"); testOp1(m32, .JNGE, imm16(0x80), "66 0F 8C 80 00"); testOp1(m32, .JNL, imm16(0x80), "66 0F 8D 80 00"); testOp1(m32, .JNLE, imm16(0x80), "66 0F 8F 80 00"); testOp1(m32, .JNO, imm16(0x80), "66 0F 81 80 00"); testOp1(m32, .JNP, imm16(0x80), "66 0F 8B 80 00"); testOp1(m32, .JNS, imm16(0x80), "66 0F 89 80 00"); testOp1(m32, .JNZ, imm16(0x80), "66 0F 85 80 00"); testOp1(m32, .JO, imm16(0x80), "66 0F 80 80 00"); testOp1(m32, .JP, imm16(0x80), "66 0F 8A 80 00"); testOp1(m32, .JPE, imm16(0x80), "66 0F 8A 80 00"); testOp1(m32, .JPO, imm16(0x80), "66 0F 8B 80 00"); testOp1(m32, .JS, imm16(0x80), "66 0F 88 80 00"); testOp1(m32, .JZ, imm16(0x80), "66 0F 84 80 00"); testOp1(m64, .JA, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JAE, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JB, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JBE, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JC, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JE, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JG, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JGE, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JL, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JLE, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JNA, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JNAE, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JNB, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JNBE, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JNC, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JNE, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JNG, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JNGE, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JNL, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JNLE, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JNO, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JNP, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JNS, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JNZ, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JO, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JP, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JPE, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JPO, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JS, imm16(0x80), AsmError.InvalidOperand); testOp1(m64, .JZ, imm16(0x80), AsmError.InvalidOperand); } { testOp1(m32, .JA, immSign32(-1), "0F 87 ff ff ff ff"); testOp1(m32, .JAE, immSign32(-1), "0F 83 ff ff ff ff"); testOp1(m32, .JB, immSign32(-1), "0F 82 ff ff ff ff"); testOp1(m32, .JBE, immSign32(-1), "0F 86 ff ff ff ff"); testOp1(m32, .JC, immSign32(-1), "0F 82 ff ff ff ff"); testOp1(m32, .JE, immSign32(-1), "0F 84 ff ff ff ff"); testOp1(m32, .JG, immSign32(-1), "0F 8F ff ff ff ff"); testOp1(m32, .JGE, immSign32(-1), "0F 8D ff ff ff ff"); testOp1(m32, .JL, immSign32(-1), "0F 8C ff ff ff ff"); testOp1(m32, .JLE, immSign32(-1), "0F 8E ff ff ff ff"); testOp1(m32, .JNA, immSign32(-1), "0F 86 ff ff ff ff"); testOp1(m32, .JNAE, immSign32(-1), "0F 82 ff ff ff ff"); testOp1(m32, .JNB, immSign32(-1), "0F 83 ff ff ff ff"); testOp1(m32, .JNBE, immSign32(-1), "0F 87 ff ff ff ff"); testOp1(m32, .JNC, immSign32(-1), "0F 83 ff ff ff ff"); testOp1(m32, .JNE, immSign32(-1), "0F 85 ff ff ff ff"); testOp1(m32, .JNG, immSign32(-1), "0F 8E ff ff ff ff"); testOp1(m32, .JNGE, immSign32(-1), "0F 8C ff ff ff ff"); testOp1(m32, .JNL, immSign32(-1), "0F 8D ff ff ff ff"); testOp1(m32, .JNLE, immSign32(-1), "0F 8F ff ff ff ff"); testOp1(m32, .JNO, immSign32(-1), "0F 81 ff ff ff ff"); testOp1(m32, .JNP, immSign32(-1), "0F 8B ff ff ff ff"); testOp1(m32, .JNS, immSign32(-1), "0F 89 ff ff ff ff"); testOp1(m32, .JNZ, immSign32(-1), "0F 85 ff ff ff ff"); testOp1(m32, .JO, immSign32(-1), "0F 80 ff ff ff ff"); testOp1(m32, .JP, immSign32(-1), "0F 8A ff ff ff ff"); testOp1(m32, .JPE, immSign32(-1), "0F 8A ff ff ff ff"); testOp1(m32, .JPO, immSign32(-1), "0F 8B ff ff ff ff"); testOp1(m32, .JS, immSign32(-1), "0F 88 ff ff ff ff"); testOp1(m32, .JZ, immSign32(-1), "0F 84 ff ff ff ff"); testOp1(m64, .JA, immSign32(-1), "0F 87 ff ff ff ff"); testOp1(m64, .JAE, immSign32(-1), "0F 83 ff ff ff ff"); testOp1(m64, .JB, immSign32(-1), "0F 82 ff ff ff ff"); testOp1(m64, .JBE, immSign32(-1), "0F 86 ff ff ff ff"); testOp1(m64, .JC, immSign32(-1), "0F 82 ff ff ff ff"); testOp1(m64, .JE, immSign32(-1), "0F 84 ff ff ff ff"); testOp1(m64, .JG, immSign32(-1), "0F 8F ff ff ff ff"); testOp1(m64, .JGE, immSign32(-1), "0F 8D ff ff ff ff"); testOp1(m64, .JL, immSign32(-1), "0F 8C ff ff ff ff"); testOp1(m64, .JLE, immSign32(-1), "0F 8E ff ff ff ff"); testOp1(m64, .JNA, immSign32(-1), "0F 86 ff ff ff ff"); testOp1(m64, .JNAE, immSign32(-1), "0F 82 ff ff ff ff"); testOp1(m64, .JNB, immSign32(-1), "0F 83 ff ff ff ff"); testOp1(m64, .JNBE, immSign32(-1), "0F 87 ff ff ff ff"); testOp1(m64, .JNC, immSign32(-1), "0F 83 ff ff ff ff"); testOp1(m64, .JNE, immSign32(-1), "0F 85 ff ff ff ff"); testOp1(m64, .JNG, immSign32(-1), "0F 8E ff ff ff ff"); testOp1(m64, .JNGE, immSign32(-1), "0F 8C ff ff ff ff"); testOp1(m64, .JNL, immSign32(-1), "0F 8D ff ff ff ff"); testOp1(m64, .JNLE, immSign32(-1), "0F 8F ff ff ff ff"); testOp1(m64, .JNO, immSign32(-1), "0F 81 ff ff ff ff"); testOp1(m64, .JNP, immSign32(-1), "0F 8B ff ff ff ff"); testOp1(m64, .JNS, immSign32(-1), "0F 89 ff ff ff ff"); testOp1(m64, .JNZ, immSign32(-1), "0F 85 ff ff ff ff"); testOp1(m64, .JO, immSign32(-1), "0F 80 ff ff ff ff"); testOp1(m64, .JP, immSign32(-1), "0F 8A ff ff ff ff"); testOp1(m64, .JPE, immSign32(-1), "0F 8A ff ff ff ff"); testOp1(m64, .JPO, immSign32(-1), "0F 8B ff ff ff ff"); testOp1(m64, .JS, immSign32(-1), "0F 88 ff ff ff ff"); testOp1(m64, .JZ, immSign32(-1), "0F 84 ff ff ff ff"); } }
src/x86/tests/jcc.zig
const std = @import("std"); const builtin = @import("builtin"); const opt = @import("opt.zig"); const warn = std.debug.warn; const stdout = &std.io.getStdOut().outStream(); const Allocator = std.mem.Allocator; const fstaterror = std.os.FStatError; pub fn du(paths: std.ArrayList([]const u8), depth: u8, sz: SizeOptions) anyerror!u64 { const terminator = '\n'; const divisor: u32 = switch (sz) { .Bytes => 512, .Kilo => 1024, .Mega => 1048576, .Giga => 1073741824, }; // loop through paths and find size var i: usize = 0; var f: std.fs.File = undefined; var size: u64 = 0; var total_size: u64 = 0; if (paths.items.len > 0) { for (paths.items) |file_name| { if (std.fs.cwd().openDir(file_name, std.fs.Dir.OpenDirOptions{ .access_sub_paths = true, .iterate = true })) |dir| { var iter = dir.iterate(); var files = std.ArrayList([]const u8).init(std.heap.page_allocator); while (try iter.next()) |item| { var new_name = try concat_files(std.heap.page_allocator, file_name, item.name); try files.append(new_name); } //try stdout.print("calling du\n", .{}); size = try du(files, depth + 1, sz); try stdout.print("{}\t{}{c}", .{ size / divisor / 8, file_name, terminator }); total_size += size; var opened = dir; std.fs.Dir.close(&opened); } else |erro| { //try stdout.print("not folder: {}\n", .{file_name}); f = std.fs.cwd().openFile(file_name, .{ .read = true, .write = false, }) catch |err| { try stdout.print("Error opening file: {}! {}\n", .{ file_name, err }); return err; }; size = grab_allocated_memory(f) catch |err| { try stdout.print("Error statting file: {}!\n", .{file_name}); return err; }; f.close(); // assume 512 byte blocks unless environmental variable set if (depth == 0) try stdout.print("{}\t{}{c}", .{ size / divisor / 8, file_name, terminator }); total_size += size; } } } return total_size; } fn concat_files(allocator: *Allocator, a: []const u8, b: []const u8) ![]u8 { const result = try allocator.alloc(u8, a.len + b.len + 1); std.mem.copy(u8, result, a); std.mem.copy(u8, result[a.len..], "/"); std.mem.copy(u8, result[a.len + 1 ..], b); return result; } pub fn grab_allocated_memory(file: std.fs.File) !u64 { if (builtin.os.tag == .windows) { var io_status_block: windows.IO_STATUS_BLOCK = undefined; var info: windows.FILE_ALL_INFORMATION = undefined; const rc = windows.ntdll.NtQueryInformationFile(file.handle, &io_status_block, &info, @sizeOf(windows.FILE_ALL_INFORMATION), .FileAllInformation); switch (rc) { .SUCCESS => {}, .BUFFER_OVERFLOW => {}, .INVALID_PARAMETER => unreachable, .ACCESS_DENIED => return error.AccessDenied, else => return windows.unexpectedStatus(rc), } return @bitCast(u64, info.StandardInformation.AllocationSize); } const st = try std.os.fstat(file.handle); return @bitCast(u64, st.blocks * st.blksize); } const DuFlags = enum { Help, Version, Kilobyte, Megabyte, Gigabyte, }; var flags = [_]opt.Flag(DuFlags){ .{ .name = DuFlags.Help, .long = "help", }, .{ .name = DuFlags.Version, .long = "version", }, .{ .name = DuFlags.Kilobyte, .short = 'k', }, .{ .name = DuFlags.Megabyte, .short = 'm', }, .{ .name = DuFlags.Gigabyte, .short = 'g', }, }; const SizeOptions = enum { Bytes, Kilo, Mega, Giga, }; pub fn main(args: [][]u8) anyerror!u8 { var user_size: SizeOptions = SizeOptions.Bytes; var human_readable: bool = false; var it = opt.FlagIterator(DuFlags).init(flags[0..], args); while (it.next_flag() catch { return 1; }) |flag| { switch (flag.name) { DuFlags.Help => { warn("(help screen here)\n", .{}); return 1; }, DuFlags.Version => { warn("(version info here)\n", .{}); return 1; }, DuFlags.Kilobyte => { user_size = SizeOptions.Kilo; }, DuFlags.Megabyte => { user_size = SizeOptions.Mega; }, DuFlags.Gigabyte => { user_size = SizeOptions.Giga; }, } } var files = std.ArrayList([]const u8).init(std.heap.page_allocator); while (it.next_arg()) |file_name| { try files.append(file_name[0..]); } // run command var total = try du(files, 0, user_size); return 0; } test "total size of LICENSE" { var paths = std.ArrayList([]const u8).init(std.heap.page_allocator); try paths.append("LICENSE"); var ret = try du(paths, 0, SizeOptions.Bytes); // WILL BREAK IF WE CHANGE LICENSE std.debug.assert(ret == 8 * 512 * 8); }
src/du.zig
const std = @import("std"); const fmt = std.fmt; const mem = std.mem; const print = std.debug.print; const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const AutoHashMap = std.AutoHashMap; const U36_MAX = std.math.maxInt(u36); const Mask = struct { on: u36 = 0, off: u36 = 0, float: u36 = 0, allocator: *Allocator, fn init(allocator: *Allocator) Mask { return Mask { .allocator = allocator }; } fn update(self: *Mask, mask: *const [36]u8) void { var on: u36 = 0; var off: u36 = 0; var float: u36 = 0; var bit_mask: u36 = 1 << 35; for (mask) |digit| { if (digit == '1') { on |= bit_mask; } if (digit == '0') { off |= bit_mask; } if (digit == 'X') { float |= bit_mask; } bit_mask >>= 1; } self.on = on; self.off = off; self.float = float; } fn getAddresses(self: *const Mask, address: u36) ![]u36 { var list = ArrayList(u36).init(self.allocator); const base = (address & self.off) | self.on; try list.append(base); var bit_mask: u36 = 1 << 35; while (bit_mask != 0) { if (self.float & bit_mask != 0) { for (list.items) |found| { try list.append(found | bit_mask); } } bit_mask >>= 1; } return list.toOwnedSlice(); } }; const Memory = struct { mask: *const Mask, values: AutoHashMap(u64, u36), // rv: [U36_MAX]u36 = [_]u36{0} ** U36_MAX, fn init(allocator: *Allocator, mask: *const Mask) Memory { return Memory { .mask = mask, .values = AutoHashMap(u64, u36).init(allocator) }; } fn update(self: *Memory, address: u36, value: u36) !void { for (try self.mask.getAddresses(address)) |resolved| { try self.values.put(resolved, value); } } fn sum(self: *Memory) u64 { var total: u64 = 0; var iter = self.values.iterator(); while (iter.next()) |i| { total += i.value; } return total; } }; pub fn main() !void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const allocator = &arena.allocator; var mask = Mask.init(allocator); var memory = Memory.init(allocator, &mask); const stdin = std.io.getStdIn().inStream(); var buf: [256]u8 = undefined; while (try stdin.readUntilDelimiterOrEof(buf[0..], '\r')) |line| { // lol windows try stdin.skipUntilDelimiterOrEof('\n'); if (mem.eql(u8, line[0..4], "mask")) { const new_mask = line[7..43]; // 36 characters after "mask = " mask.update(new_mask); } else { const index_start = 4; // after "mem[" const index_end = index_start + mem.indexOfScalar(u8, line[index_start..], ']').?; const value_start = index_end + 4; // after "] = "; const index = try fmt.parseInt(u36, line[index_start..index_end], 10); const value = try fmt.parseInt(u36, line[value_start..], 10); try memory.update(index, value); } } const result = memory.sum(); print("{}\n", .{result}); }
14/part2.zig
const std = @import("std"); const args = @import("args"); const File = @import("File.zig"); const Loader = @import("Loader.zig"); const TopOptions = struct { help: bool = false, pub const shorthands = .{ .h = "help", }; }; const Command = union(enum) { run: RunOptions, build: BuildOptions, parse: ParseOptions, help: struct {}, }; const Positionals = [][:0]const u8; const errPrint = std.debug.print; fn top_usage(fatal: bool) noreturn { errPrint("{s}", .{ \\Usage: wala <command> [options] \\ \\Commands: \\ run Run built wasm with system runtime \\ build Convert Wala to WebAssembly \\ parse Read sweet expressions \\ help Print this usage information \\ \\Options: \\ -h, --help Print command-specific usage \\ \\Examples: \\ wala run samples/hello.wala \\ }); std.os.exit(@boolToInt(fatal)); } fn fatalErr(err: anytype) noreturn { errPrint("fatal: {}\n", .{err}); std.os.exit(1); } const top_alloc = std.heap.page_allocator; pub fn main() void { const argv = args.parseWithVerbForCurrentProcess(TopOptions, Command, top_alloc, .print) catch top_usage(true); defer argv.deinit(); const help = argv.options.help; const command = argv.verb orelse top_usage(!help); switch (command) { .run => |options| run(options, argv.positionals, help), .build => |options| build(options, argv.positionals, help), .parse => |options| parse(options, argv.positionals, help), .help => top_usage(false), } } const ParseOptions = struct { format: @import("Expr.zig").Format = .human, }; fn parse_usage(fatal: bool) noreturn { errPrint("{s}", .{ \\Usage: wala parse <file> [options] \\ \\Options: \\ --format Output format (compact, tree, human, sweet) \\ -h, --help Print this usage information \\ \\Examples: \\ wala parse samples/hello.wala \\ }); std.os.exit(@boolToInt(fatal)); } inline fn parse(options: ParseOptions, positionals: Positionals, help: bool) void { if (help) parse_usage(false); if (positionals.len != 1) { errPrint("Expect 1 argument got {}\n", .{positionals.len}); parse_usage(true); } var file = File.read(positionals[0], top_alloc) catch |err| fatalErr(err); defer file.deinit(); switch (file.text.tryRead()) { .ok => |exprs| { const writer = std.io.getStdOut().writer(); for (exprs.list()) |expr| { expr.print(options.format, writer) catch unreachable; writer.writeByte('\n') catch unreachable; } exprs.deinit(); }, .err => |err| fatalErr(err), } } inline fn aLoader() Loader { return .{ .allocator = top_alloc, .errAt = struct { fn do(arg: Loader.ErrArg) void { switch (arg) { .text => |a| { errPrint("{}\n", .{a.point}); if (a.data) |d| errPrint("{}\n", .{d}); }, .wasm => |a| errPrint("{s}@{}: {}\n", .{ a.file.realpath, a.at, a.kind }), } } }.do, }; } const BuildOptions = struct { format: enum { compact, human, binary } = .binary, }; fn build_usage(fatal: bool) noreturn { errPrint("{s}", .{ \\Usage: wala build <file> [options] \\ \\Options: \\ --format Output format (compact, human, binary) \\ -h, --help Print this usage information \\ \\Examples: \\ wala build samples/hello.wala \\ }); std.os.exit(@boolToInt(fatal)); } inline fn build(options: BuildOptions, positionals: Positionals, help: bool) void { if (help) build_usage(false); if (positionals.len != 1) { errPrint("Expect 1 argument got {}\n", .{positionals.len}); build_usage(true); } var loader = aLoader(); const module = loader.load(positionals[0]) catch |err| fatalErr(err); defer module.deinit(); const writer = std.io.getStdOut().writer(); switch (options.format) { .binary => Loader.writeWasm(module, writer) catch unreachable, .compact => Loader.writeText(module, writer, loader.allocator, .compact) catch unreachable, .human => Loader.writeText(module, writer, loader.allocator, .human) catch unreachable, } } const RunOptions = struct { runtime: []const u8 = "wasmtime", }; fn run_usage(fatal: bool) noreturn { errPrint("{s}", .{ \\Usage: wala run <file> [options] \\ \\Options: \\ --runtime Execution environment with arguments \\ -h, --help Print this usage information \\ \\Examples: \\ wala run samples/hello.wala \\ }); std.os.exit(@boolToInt(fatal)); } inline fn run(options: RunOptions, positionals: Positionals, help: bool) void { if (help) run_usage(false); if (positionals.len == 0) { errPrint("Expect at least 1 argument\n", .{}); run_usage(true); } var loader = aLoader(); const module = loader.load(positionals[0]) catch |err| fatalErr(err); defer module.deinit(); var tmpDir = std.testing.tmpDir(.{}); defer tmpDir.cleanup(); const wasmName = "run.wasm"; const wasmFile = tmpDir.dir.createFile(wasmName, .{}) catch unreachable; Loader.writeWasm(module, wasmFile.writer()) catch unreachable; wasmFile.close(); const argv = top_alloc.alloc([]const u8, positionals.len + 1) catch unreachable; defer top_alloc.free(argv); argv[0] = options.runtime; argv[1] = wasmName; std.mem.copy([]const u8, argv[2..], positionals[1..]); const runtime = std.ChildProcess.init(argv, top_alloc) catch unreachable; defer runtime.deinit(); runtime.cwd_dir = tmpDir.dir; _ = runtime.spawnAndWait() catch unreachable; } test { _ = @import("SweetParser.zig"); _ = @import("Wasm.zig"); }
src/main.zig
const std = @import("../std.zig"); const ws2_32 = std.os.windows.ws2_32; const windows = std.os.windows; pub extern "c" fn _errno() *c_int; pub extern "c" fn _msize(memblock: ?*anyopaque) usize; // TODO: copied the else case and removed the socket function (because its in ws2_32) // need to verify which of these is actually supported on windows pub extern "c" fn clock_getres(clk_id: c_int, tp: *timespec) c_int; pub extern "c" fn clock_gettime(clk_id: c_int, tp: *timespec) c_int; pub extern "c" fn fstat(fd: fd_t, buf: *Stat) c_int; pub extern "c" fn getrusage(who: c_int, usage: *rusage) c_int; pub extern "c" fn gettimeofday(noalias tv: ?*timeval, noalias tz: ?*timezone) c_int; pub extern "c" fn nanosleep(rqtp: *const timespec, rmtp: ?*timespec) c_int; pub extern "c" fn sched_yield() c_int; pub extern "c" fn sigaction(sig: c_int, noalias act: ?*const Sigaction, noalias oact: ?*Sigaction) c_int; pub extern "c" fn sigprocmask(how: c_int, noalias set: ?*const sigset_t, noalias oset: ?*sigset_t) c_int; pub extern "c" fn stat(noalias path: [*:0]const u8, noalias buf: *Stat) c_int; pub extern "c" fn sigfillset(set: ?*sigset_t) void; pub extern "c" fn alarm(seconds: c_uint) c_uint; pub extern "c" fn sigwait(set: ?*sigset_t, sig: ?*c_int) c_int; pub const fd_t = windows.HANDLE; pub const ino_t = windows.LARGE_INTEGER; pub const pid_t = windows.HANDLE; pub const mode_t = u0; pub const PATH_MAX = 260; pub const time_t = c_longlong; pub const timespec = extern struct { tv_sec: time_t, tv_nsec: c_long, }; pub const timeval = extern struct { tv_sec: c_long, tv_usec: c_long, }; pub const Stat = @compileError("TODO windows Stat definition"); pub const sig_atomic_t = c_int; pub const sigset_t = @compileError("TODO windows sigset_t definition"); pub const Sigaction = @compileError("TODO windows Sigaction definition"); pub const timezone = @compileError("TODO windows timezone definition"); pub const rusage = @compileError("TODO windows rusage definition"); /// maximum signal number + 1 pub const NSIG = 23; /// Signal types pub const SIG = struct { /// interrupt pub const INT = 2; /// illegal instruction - invalid function image pub const ILL = 4; /// floating point exception pub const FPE = 8; /// segment violation pub const SEGV = 11; /// Software termination signal from kill pub const TERM = 15; /// Ctrl-Break sequence pub const BREAK = 21; /// abnormal termination triggered by abort call pub const ABRT = 22; /// SIGABRT compatible with other platforms, same as SIGABRT pub const ABRT_COMPAT = 6; // Signal action codes /// default signal action pub const DFL = 0; /// ignore signal pub const IGN = 1; /// return current value pub const GET = 2; /// signal gets error pub const SGE = 3; /// acknowledge pub const ACK = 4; /// Signal error value (returned by signal call on error) pub const ERR = -1; }; pub const SEEK = struct { pub const SET = 0; pub const CUR = 1; pub const END = 2; }; pub const E = enum(u16) { /// No error occurred. SUCCESS = 0, PERM = 1, NOENT = 2, SRCH = 3, INTR = 4, IO = 5, NXIO = 6, @"2BIG" = 7, NOEXEC = 8, BADF = 9, CHILD = 10, AGAIN = 11, NOMEM = 12, ACCES = 13, FAULT = 14, BUSY = 16, EXIST = 17, XDEV = 18, NODEV = 19, NOTDIR = 20, ISDIR = 21, NFILE = 23, MFILE = 24, NOTTY = 25, FBIG = 27, NOSPC = 28, SPIPE = 29, ROFS = 30, MLINK = 31, PIPE = 32, DOM = 33, /// Also means `DEADLOCK`. DEADLK = 36, NAMETOOLONG = 38, NOLCK = 39, NOSYS = 40, NOTEMPTY = 41, INVAL = 22, RANGE = 34, ILSEQ = 42, // POSIX Supplement ADDRINUSE = 100, ADDRNOTAVAIL = 101, AFNOSUPPORT = 102, ALREADY = 103, BADMSG = 104, CANCELED = 105, CONNABORTED = 106, CONNREFUSED = 107, CONNRESET = 108, DESTADDRREQ = 109, HOSTUNREACH = 110, IDRM = 111, INPROGRESS = 112, ISCONN = 113, LOOP = 114, MSGSIZE = 115, NETDOWN = 116, NETRESET = 117, NETUNREACH = 118, NOBUFS = 119, NODATA = 120, NOLINK = 121, NOMSG = 122, NOPROTOOPT = 123, NOSR = 124, NOSTR = 125, NOTCONN = 126, NOTRECOVERABLE = 127, NOTSOCK = 128, NOTSUP = 129, OPNOTSUPP = 130, OTHER = 131, OVERFLOW = 132, OWNERDEAD = 133, PROTO = 134, PROTONOSUPPORT = 135, PROTOTYPE = 136, TIME = 137, TIMEDOUT = 138, TXTBSY = 139, WOULDBLOCK = 140, DQUOT = 10069, _, }; pub const STRUNCATE = 80; pub const F_OK = 0; /// Remove directory instead of unlinking file pub const AT = struct { pub const REMOVEDIR = 0x200; }; pub const in_port_t = u16; pub const sa_family_t = ws2_32.ADDRESS_FAMILY; pub const socklen_t = ws2_32.socklen_t; pub const sockaddr = ws2_32.sockaddr; pub const in6_addr = [16]u8; pub const in_addr = u32; pub const addrinfo = ws2_32.addrinfo; pub const AF = ws2_32.AF; pub const MSG = ws2_32.MSG; pub const SOCK = ws2_32.SOCK; pub const TCP = ws2_32.TCP; pub const IPPROTO = ws2_32.IPPROTO; pub const BTHPROTO_RFCOMM = ws2_32.BTHPROTO_RFCOMM; pub const nfds_t = c_ulong; pub const pollfd = ws2_32.pollfd; pub const POLL = ws2_32.POLL; pub const SOL = ws2_32.SOL; pub const SO = ws2_32.SO; pub const PVD_CONFIG = ws2_32.PVD_CONFIG; pub const O = struct { pub const RDONLY = 0o0; pub const WRONLY = 0o1; pub const RDWR = 0o2; pub const CREAT = 0o100; pub const EXCL = 0o200; pub const NOCTTY = 0o400; pub const TRUNC = 0o1000; pub const APPEND = 0o2000; pub const NONBLOCK = 0o4000; pub const DSYNC = 0o10000; pub const SYNC = 0o4010000; pub const RSYNC = 0o4010000; pub const DIRECTORY = 0o200000; pub const NOFOLLOW = 0o400000; pub const CLOEXEC = 0o2000000; pub const ASYNC = 0o20000; pub const DIRECT = 0o40000; pub const LARGEFILE = 0; pub const NOATIME = 0o1000000; pub const PATH = 0o10000000; pub const TMPFILE = 0o20200000; pub const NDELAY = NONBLOCK; }; pub const IFNAMESIZE = 30;
lib/std/c/windows.zig
pub const Registry = union(enum) { core: CoreRegistry, extension: ExtensionRegistry, }; pub const CoreRegistry = struct { copyright: [][]const u8, /// Hexadecimal representation of the magic number magic_number: []const u8, major_version: u32, minor_version: u32, revision: u32, instruction_printing_class: []InstructionPrintingClass, instructions: []Instruction, operand_kinds: []OperandKind, }; pub const ExtensionRegistry = struct { copyright: [][]const u8, version: u32, revision: u32, instructions: []Instruction, operand_kinds: []OperandKind = &[_]OperandKind{}, }; pub const InstructionPrintingClass = struct { tag: []const u8, heading: ?[]const u8 = null, }; pub const Instruction = struct { opname: []const u8, class: ?[]const u8 = null, // Note: Only available in the core registry. opcode: u32, operands: []Operand = &[_]Operand{}, capabilities: [][]const u8 = &[_][]const u8{}, extensions: [][]const u8 = &[_][]const u8{}, version: ?[]const u8 = null, lastVersion: ?[]const u8 = null, }; pub const Operand = struct { kind: []const u8, /// If this field is 'null', the operand is only expected once. quantifier: ?Quantifier = null, name: []const u8 = "", }; pub const Quantifier = enum { /// zero or once @"?", /// zero or more @"*", }; pub const OperandCategory = enum { BitEnum, ValueEnum, Id, Literal, Composite, }; pub const OperandKind = struct { category: OperandCategory, /// The name kind: []const u8, doc: ?[]const u8 = null, enumerants: ?[]Enumerant = null, bases: ?[]const []const u8 = null, }; pub const Enumerant = struct { enumerant: []const u8, value: union(enum) { bitflag: []const u8, // Hexadecimal representation of the value int: u31, }, capabilities: [][]const u8 = &[_][]const u8{}, /// Valid for .ValueEnum and .BitEnum extensions: [][]const u8 = &[_][]const u8{}, /// `quantifier` will always be `null`. parameters: []Operand = &[_]Operand{}, version: ?[]const u8 = null, lastVersion: ?[]const u8 = null, };
tools/spirv/grammar.zig
pub fn VecTable(comptime num_irqs: usize, comptime nameProvider: var) type { return extern struct { stack: ?extern fn () void, handlers: [num_irqs + 16]?extern fn () void, const Self = @This(); pub fn new() Self { @setEvalBranchQuota(10000); comptime { var self: Self = undefined; self.stack = null; var i = 1; while (i < num_irqs + 16) : (i += 1) { const name = nameProvider(i) orelse getDefaultName(i); self.handlers[i - 1] = unhandled(name); } return self; } } // FIXME: `sp` is actually a pointer to non-code data, but Zig won't let us // create a pointer to such entities (e.g., `extern var stack: u8`) in a constant // context. (Hence the use of a function pointer) pub fn setInitStackPtr(self: Self, sp: ?extern fn () void) Self { var this = self; this.stack = sp; return this; } pub fn setExcHandler(self: Self, exc_number: usize, handler: ?extern fn () void) Self { var this = self; this.handlers[exc_number - 1] = handler; return this; } /// Register a TZmCFI-optimized exception handler. /// /// When using TZmCFI's exception trampolines, the performance of /// exception handlers can be improved by using an alternate calling /// convention in which exception handlers return directly to the /// exception return trampoline. /// /// This method creates a wrapper method to use this calling convention, /// and passes it to `setExcHandler`. It automatically changes it back /// to the default calling convention if the build option `HAS_TZMCFI_SES` /// is disabled. pub fn setTcExcHandler(self: Self, exc_number: usize, comptime handler: extern fn () void) Self { return self.setExcHandler( exc_number, struct { fn _() callconv(.C) void { @setTcExcHandler(@import("build_options").HAS_TZMCFI_SES); @call(.{ .modifier = .always_inline }, handler, .{}); } }._, ); } }; } fn getDefaultName(comptime exc_number: usize) []const u8 { if (exc_number < 16) { return "???[" ++ intToStr(exc_number) ++ "]"; } else { return "IRQ[" ++ intToStr(exc_number - 16) ++ "]"; } } /// Create an "unhandled exception" handler. fn unhandled(comptime name: []const u8) extern fn () void { const ns = struct { fn handler() callconv(.C) void { @panic("unhandled exception: " ++ name); } }; return ns.handler; } fn intToStr(comptime i: var) []const u8 { comptime { if (i < 0) { @compileError("negative numbers are not supported (yet)"); } else if (i == 0) { return "0"; } else { var str: []const u8 = ""; var ii = i; while (ii > 0) { str = [1]u8{'0' + ii % 10} ++ str; ii /= 10; } return str; } } }
examples/common/vectable.zig
const std = @import("std"); const mem = std.mem; const Control = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 0, hi: u21 = 921599, pub fn init(allocator: *mem.Allocator) !Control { var instance = Control{ .allocator = allocator, .array = try allocator.alloc(bool, 921600), }; mem.set(bool, instance.array, false); var index: u21 = 0; index = 0; while (index <= 9) : (index += 1) { instance.array[index] = true; } index = 11; while (index <= 12) : (index += 1) { instance.array[index] = true; } index = 14; while (index <= 31) : (index += 1) { instance.array[index] = true; } index = 127; while (index <= 159) : (index += 1) { instance.array[index] = true; } instance.array[173] = true; instance.array[1564] = true; instance.array[6158] = true; instance.array[8203] = true; index = 8206; while (index <= 8207) : (index += 1) { instance.array[index] = true; } instance.array[8232] = true; instance.array[8233] = true; index = 8234; while (index <= 8238) : (index += 1) { instance.array[index] = true; } index = 8288; while (index <= 8292) : (index += 1) { instance.array[index] = true; } instance.array[8293] = true; index = 8294; while (index <= 8303) : (index += 1) { instance.array[index] = true; } instance.array[65279] = true; index = 65520; while (index <= 65528) : (index += 1) { instance.array[index] = true; } index = 65529; while (index <= 65531) : (index += 1) { instance.array[index] = true; } index = 78896; while (index <= 78904) : (index += 1) { instance.array[index] = true; } index = 113824; while (index <= 113827) : (index += 1) { instance.array[index] = true; } index = 119155; while (index <= 119162) : (index += 1) { instance.array[index] = true; } instance.array[917504] = true; instance.array[917505] = true; index = 917506; while (index <= 917535) : (index += 1) { instance.array[index] = true; } index = 917632; while (index <= 917759) : (index += 1) { instance.array[index] = true; } index = 918000; while (index <= 921599) : (index += 1) { instance.array[index] = true; } // Placeholder: 0. Struct name, 1. Code point kind return instance; } pub fn deinit(self: *Control) void { self.allocator.free(self.array); } // isControl checks if cp is of the kind Control. pub fn isControl(self: Control, 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/GraphemeBreakProperty/Control.zig
const std = @import("std"); const mem = std.mem; const OtherPunctuation = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 33, hi: u21 = 125279, pub fn init(allocator: *mem.Allocator) !OtherPunctuation { var instance = OtherPunctuation{ .allocator = allocator, .array = try allocator.alloc(bool, 125247), }; mem.set(bool, instance.array, false); var index: u21 = 0; index = 0; while (index <= 2) : (index += 1) { instance.array[index] = true; } index = 4; while (index <= 6) : (index += 1) { instance.array[index] = true; } instance.array[9] = true; instance.array[11] = true; index = 13; while (index <= 14) : (index += 1) { instance.array[index] = true; } index = 25; while (index <= 26) : (index += 1) { instance.array[index] = true; } index = 30; while (index <= 31) : (index += 1) { instance.array[index] = true; } instance.array[59] = true; instance.array[128] = true; instance.array[134] = true; index = 149; while (index <= 150) : (index += 1) { instance.array[index] = true; } instance.array[158] = true; instance.array[861] = true; instance.array[870] = true; index = 1337; while (index <= 1342) : (index += 1) { instance.array[index] = true; } instance.array[1384] = true; instance.array[1439] = true; instance.array[1442] = true; instance.array[1445] = true; index = 1490; while (index <= 1491) : (index += 1) { instance.array[index] = true; } index = 1512; while (index <= 1513) : (index += 1) { instance.array[index] = true; } index = 1515; while (index <= 1516) : (index += 1) { instance.array[index] = true; } instance.array[1530] = true; index = 1533; while (index <= 1534) : (index += 1) { instance.array[index] = true; } index = 1609; while (index <= 1612) : (index += 1) { instance.array[index] = true; } instance.array[1715] = true; index = 1759; while (index <= 1772) : (index += 1) { instance.array[index] = true; } index = 2006; while (index <= 2008) : (index += 1) { instance.array[index] = true; } index = 2063; while (index <= 2077) : (index += 1) { instance.array[index] = true; } instance.array[2109] = true; index = 2371; while (index <= 2372) : (index += 1) { instance.array[index] = true; } instance.array[2383] = true; instance.array[2524] = true; instance.array[2645] = true; instance.array[2767] = true; instance.array[3158] = true; instance.array[3171] = true; instance.array[3539] = true; instance.array[3630] = true; index = 3641; while (index <= 3642) : (index += 1) { instance.array[index] = true; } index = 3811; while (index <= 3825) : (index += 1) { instance.array[index] = true; } instance.array[3827] = true; instance.array[3940] = true; index = 4015; while (index <= 4019) : (index += 1) { instance.array[index] = true; } index = 4024; while (index <= 4025) : (index += 1) { instance.array[index] = true; } index = 4137; while (index <= 4142) : (index += 1) { instance.array[index] = true; } instance.array[4314] = true; index = 4927; while (index <= 4935) : (index += 1) { instance.array[index] = true; } instance.array[5709] = true; index = 5834; while (index <= 5836) : (index += 1) { instance.array[index] = true; } index = 5908; while (index <= 5909) : (index += 1) { instance.array[index] = true; } index = 6067; while (index <= 6069) : (index += 1) { instance.array[index] = true; } index = 6071; while (index <= 6073) : (index += 1) { instance.array[index] = true; } index = 6111; while (index <= 6116) : (index += 1) { instance.array[index] = true; } index = 6118; while (index <= 6121) : (index += 1) { instance.array[index] = true; } index = 6435; while (index <= 6436) : (index += 1) { instance.array[index] = true; } index = 6653; while (index <= 6654) : (index += 1) { instance.array[index] = true; } index = 6783; while (index <= 6789) : (index += 1) { instance.array[index] = true; } index = 6791; while (index <= 6796) : (index += 1) { instance.array[index] = true; } index = 6969; while (index <= 6975) : (index += 1) { instance.array[index] = true; } index = 7131; while (index <= 7134) : (index += 1) { instance.array[index] = true; } index = 7194; while (index <= 7198) : (index += 1) { instance.array[index] = true; } index = 7261; while (index <= 7262) : (index += 1) { instance.array[index] = true; } index = 7327; while (index <= 7334) : (index += 1) { instance.array[index] = true; } instance.array[7346] = true; index = 8181; while (index <= 8182) : (index += 1) { instance.array[index] = true; } index = 8191; while (index <= 8198) : (index += 1) { instance.array[index] = true; } index = 8207; while (index <= 8215) : (index += 1) { instance.array[index] = true; } index = 8218; while (index <= 8221) : (index += 1) { instance.array[index] = true; } index = 8224; while (index <= 8226) : (index += 1) { instance.array[index] = true; } index = 8230; while (index <= 8240) : (index += 1) { instance.array[index] = true; } instance.array[8242] = true; index = 8244; while (index <= 8253) : (index += 1) { instance.array[index] = true; } index = 11480; while (index <= 11483) : (index += 1) { instance.array[index] = true; } index = 11485; while (index <= 11486) : (index += 1) { instance.array[index] = true; } instance.array[11599] = true; index = 11743; while (index <= 11744) : (index += 1) { instance.array[index] = true; } index = 11749; while (index <= 11751) : (index += 1) { instance.array[index] = true; } instance.array[11754] = true; index = 11757; while (index <= 11765) : (index += 1) { instance.array[index] = true; } index = 11767; while (index <= 11768) : (index += 1) { instance.array[index] = true; } instance.array[11770] = true; index = 11773; while (index <= 11774) : (index += 1) { instance.array[index] = true; } index = 11785; while (index <= 11789) : (index += 1) { instance.array[index] = true; } index = 11791; while (index <= 11800) : (index += 1) { instance.array[index] = true; } index = 11803; while (index <= 11806) : (index += 1) { instance.array[index] = true; } instance.array[11808] = true; index = 11810; while (index <= 11822) : (index += 1) { instance.array[index] = true; } instance.array[11825] = true; index = 12256; while (index <= 12258) : (index += 1) { instance.array[index] = true; } instance.array[12316] = true; instance.array[12506] = true; index = 42205; while (index <= 42206) : (index += 1) { instance.array[index] = true; } index = 42476; while (index <= 42478) : (index += 1) { instance.array[index] = true; } instance.array[42578] = true; instance.array[42589] = true; index = 42705; while (index <= 42710) : (index += 1) { instance.array[index] = true; } index = 43091; while (index <= 43094) : (index += 1) { instance.array[index] = true; } index = 43181; while (index <= 43182) : (index += 1) { instance.array[index] = true; } index = 43223; while (index <= 43225) : (index += 1) { instance.array[index] = true; } instance.array[43227] = true; index = 43277; while (index <= 43278) : (index += 1) { instance.array[index] = true; } instance.array[43326] = true; index = 43424; while (index <= 43436) : (index += 1) { instance.array[index] = true; } index = 43453; while (index <= 43454) : (index += 1) { instance.array[index] = true; } index = 43579; while (index <= 43582) : (index += 1) { instance.array[index] = true; } index = 43709; while (index <= 43710) : (index += 1) { instance.array[index] = true; } index = 43727; while (index <= 43728) : (index += 1) { instance.array[index] = true; } instance.array[43978] = true; index = 65007; while (index <= 65013) : (index += 1) { instance.array[index] = true; } instance.array[65016] = true; instance.array[65039] = true; index = 65060; while (index <= 65061) : (index += 1) { instance.array[index] = true; } index = 65064; while (index <= 65067) : (index += 1) { instance.array[index] = true; } index = 65071; while (index <= 65073) : (index += 1) { instance.array[index] = true; } index = 65075; while (index <= 65078) : (index += 1) { instance.array[index] = true; } index = 65086; while (index <= 65088) : (index += 1) { instance.array[index] = true; } instance.array[65095] = true; index = 65097; while (index <= 65098) : (index += 1) { instance.array[index] = true; } index = 65248; while (index <= 65250) : (index += 1) { instance.array[index] = true; } index = 65252; while (index <= 65254) : (index += 1) { instance.array[index] = true; } instance.array[65257] = true; instance.array[65259] = true; index = 65261; while (index <= 65262) : (index += 1) { instance.array[index] = true; } index = 65273; while (index <= 65274) : (index += 1) { instance.array[index] = true; } index = 65278; while (index <= 65279) : (index += 1) { instance.array[index] = true; } instance.array[65307] = true; instance.array[65344] = true; index = 65347; while (index <= 65348) : (index += 1) { instance.array[index] = true; } index = 65759; while (index <= 65761) : (index += 1) { instance.array[index] = true; } instance.array[66430] = true; instance.array[66479] = true; instance.array[66894] = true; instance.array[67638] = true; instance.array[67838] = true; instance.array[67870] = true; index = 68143; while (index <= 68151) : (index += 1) { instance.array[index] = true; } instance.array[68190] = true; index = 68303; while (index <= 68309) : (index += 1) { instance.array[index] = true; } index = 68376; while (index <= 68382) : (index += 1) { instance.array[index] = true; } index = 68472; while (index <= 68475) : (index += 1) { instance.array[index] = true; } index = 69428; while (index <= 69432) : (index += 1) { instance.array[index] = true; } index = 69670; while (index <= 69676) : (index += 1) { instance.array[index] = true; } index = 69786; while (index <= 69787) : (index += 1) { instance.array[index] = true; } index = 69789; while (index <= 69792) : (index += 1) { instance.array[index] = true; } index = 69919; while (index <= 69922) : (index += 1) { instance.array[index] = true; } index = 69971; while (index <= 69972) : (index += 1) { instance.array[index] = true; } index = 70052; while (index <= 70055) : (index += 1) { instance.array[index] = true; } instance.array[70060] = true; instance.array[70074] = true; index = 70076; while (index <= 70078) : (index += 1) { instance.array[index] = true; } index = 70167; while (index <= 70172) : (index += 1) { instance.array[index] = true; } instance.array[70280] = true; index = 70698; while (index <= 70702) : (index += 1) { instance.array[index] = true; } index = 70713; while (index <= 70714) : (index += 1) { instance.array[index] = true; } instance.array[70716] = true; instance.array[70821] = true; index = 71072; while (index <= 71094) : (index += 1) { instance.array[index] = true; } index = 71200; while (index <= 71202) : (index += 1) { instance.array[index] = true; } index = 71231; while (index <= 71243) : (index += 1) { instance.array[index] = true; } index = 71451; while (index <= 71453) : (index += 1) { instance.array[index] = true; } instance.array[71706] = true; index = 71971; while (index <= 71973) : (index += 1) { instance.array[index] = true; } instance.array[72129] = true; index = 72222; while (index <= 72229) : (index += 1) { instance.array[index] = true; } index = 72313; while (index <= 72315) : (index += 1) { instance.array[index] = true; } index = 72317; while (index <= 72321) : (index += 1) { instance.array[index] = true; } index = 72736; while (index <= 72740) : (index += 1) { instance.array[index] = true; } index = 72783; while (index <= 72784) : (index += 1) { instance.array[index] = true; } index = 73430; while (index <= 73431) : (index += 1) { instance.array[index] = true; } instance.array[73694] = true; index = 74831; while (index <= 74835) : (index += 1) { instance.array[index] = true; } index = 92749; while (index <= 92750) : (index += 1) { instance.array[index] = true; } instance.array[92884] = true; index = 92950; while (index <= 92954) : (index += 1) { instance.array[index] = true; } instance.array[92963] = true; index = 93814; while (index <= 93817) : (index += 1) { instance.array[index] = true; } instance.array[94145] = true; instance.array[113790] = true; index = 121446; while (index <= 121450) : (index += 1) { instance.array[index] = true; } index = 125245; while (index <= 125246) : (index += 1) { instance.array[index] = true; } // Placeholder: 0. Struct name, 1. Code point kind return instance; } pub fn deinit(self: *OtherPunctuation) void { self.allocator.free(self.array); } // isOtherPunctuation checks if cp is of the kind Other_Punctuation. pub fn isOtherPunctuation(self: OtherPunctuation, 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/DerivedGeneralCategory/OtherPunctuation.zig
const c = @import("src/c.zig"); const std = @import("std"); const builtin = std.builtin; const debug = std.debug; const math = std.math; const mem = std.mem; const meta = std.meta; const nk = @This(); pub const atlas = @import("src/atlas.zig"); pub const bar = @import("src/bar.zig"); pub const button = @import("src/button.zig"); pub const checkbox = @import("src/checkbox.zig"); pub const check = @import("src/check.zig"); pub const color = @import("src/color.zig"); pub const group = @import("src/group.zig"); pub const input = @import("src/input.zig"); pub const layout = @import("src/layout.zig"); pub const list = @import("src/list.zig"); pub const option = @import("src/option.zig"); pub const radio = @import("src/radio.zig"); pub const selectable = @import("src/selectable.zig"); pub const select = @import("src/select.zig"); pub const slide = @import("src/slide.zig"); pub const slider = @import("src/slider.zig"); pub const testing = @import("src/testing.zig"); pub const text = @import("src/text.zig"); pub const tree = @import("src/tree.zig"); pub const widget = @import("src/widget.zig"); pub const window = @import("src/window.zig"); pub const utf_size = c.NK_UTF_SIZE; pub const property = struct { pub fn int(ctx: *nk.Context, name: []const u8, min: c_int, val: *c_int, max: c_int, step: c_int, inc_per_pixel: f32) void { return c.nk_property_int(ctx, nk.slice(name), min, val, max, step, inc_per_pixel); } pub fn float(ctx: *nk.Context, name: []const u8, min: f32, val: *f32, max: f32, step: f32, inc_per_pixel: f32) void { return c.nk_property_float(ctx, nk.slice(name), min, val, max, step, inc_per_pixel); } pub fn double(ctx: *nk.Context, name: []const u8, min: f64, val: *f64, max: f64, step: f64, inc_per_pixel: f32) void { return c.nk_property_double(ctx, nk.slice(name), min, val, max, step, inc_per_pixel); } pub fn i(ctx: *nk.Context, name: []const u8, min: c_int, val: c_int, max: c_int, step: c_int, inc_per_pixel: f32) c_int { return c.nk_propertyi(ctx, nk.slice(name), min, val, max, step, inc_per_pixel); } pub fn f(ctx: *nk.Context, name: []const u8, min: f32, val: f32, max: f32, step: f32, inc_per_pixel: f32) f32 { return c.nk_propertyf(ctx, nk.slice(name), min, val, max, step, inc_per_pixel); } pub fn d(ctx: *nk.Context, name: []const u8, min: f64, val: f64, max: f64, step: f64, inc_per_pixel: f32) f64 { return c.nk_propertyd(ctx, nk.slice(name), min, val, max, step, inc_per_pixel); } test { std.testing.refAllDecls(@This()); } }; pub const edit = struct { pub const Text = c.nk_text_edit; pub fn string(ctx: *nk.Context, flags: nk.Flags, buf: *[]u8, max: usize, filter: nk.Filter) nk.Flags { var c_len = @intCast(c_int, buf.len); defer buf.len = @intCast(usize, c_len); return c.nk_edit_string(ctx, flags, buf.ptr, &c_len, @intCast(c_int, max), filter); } pub fn stringZ(ctx: *nk.Context, flags: nk.Flags, buf: [*:0]u8, max: usize, filter: nk.Filter) nk.Flags { return c.nk_edit_string_zero_terminated(ctx, flags, buf, @intCast(c_int, max), filter); } pub fn buffer(ctx: *nk.Context, flags: nk.Flags, t: *Text, filter: nk.Filter) nk.Flags { return c.nk_edit_buffer(ctx, flags, t, filter); } pub fn focus(ctx: *nk.Context, flags: nk.Flags) void { return c.nk_edit_focus(ctx, flags); } pub fn unfocus(ctx: *nk.Context) void { return c.nk_edit_unfocus(ctx); } test { std.testing.refAllDecls(@This()); } }; pub const chart = struct { pub fn begin(ctx: *nk.Context, a: nk.ChartType, num: usize, min: f32, max: f32) bool { return c.nk_chart_begin(ctx, a, @intCast(c_int, num), min, max) != 0; } pub fn beginColored(ctx: *nk.Context, y: nk.ChartType, a: nk.Color, active: nk.Color, num: usize, min: f32, max: f32) bool { return c.nk_chart_begin_colored(ctx, y, a, active, @intCast(c_int, num), min, max) != 0; } pub fn addSlot(ctx: *nk.Context, a: nk.ChartType, count: usize, min_value: f32, max_value: f32) void { return c.nk_chart_add_slot(ctx, a, @intCast(c_int, count), min_value, max_value); } pub fn addSlotColored(ctx: *nk.Context, y: nk.ChartType, a: nk.Color, active: nk.Color, count: usize, min_value: f32, max_value: f32) void { return c.nk_chart_add_slot_colored(ctx, y, a, active, @intCast(c_int, count), min_value, max_value); } pub fn push(ctx: *nk.Context, value: f32) nk.Flags { return c.nk_chart_push(ctx, value); } pub fn pushSlot(ctx: *nk.Context, value: f32, slot: usize) nk.Flags { return c.nk_chart_push_slot(ctx, value, @intCast(c_int, slot)); } pub fn end(ctx: *nk.Context) void { return c.nk_chart_end(ctx); } pub fn plot(ctx: *nk.Context, a: nk.ChartType, values: []const f32, offset: c_int) void { return c.nk_plot(ctx, a, values.ptr, @intCast(c_int, values.len), offset); } pub fn plotFunction(ctx: *nk.Context, y: nk.ChartType, userdata: anytype, getter: fn (@TypeOf(userdata), usize) f32, count: usize, offset: usize) void { const T = @TypeOf(userdata); const Wrapped = struct { userdata: T, getter: fn (T, usize) f32, fn valueGetter(user: ?*c_void, index: c_int) callconv(.C) f32 { const casted = @ptrCast(*const @This(), @alignCast(@alignOf(@This()), user)); return casted.getter(casted.userdata, @intCast(usize, index)); } }; var wrapped = Wrapped{ .userdata = userdata, .getter = getter }; return c.nk_plot_function( ctx, y, @ptrCast(*c_void, &wrapped), Wrapped.valueGetter, @intCast(c_int, count), @intCast(c_int, offset), ); } test { std.testing.refAllDecls(@This()); } test "chart" { var ctx = &try nk.testing.init(); defer nk.free(ctx); if (nk.window.begin(ctx, opaque {}, nk.rect(10, 10, 10, 10), .{})) |win| { nk.layout.rowDynamic(ctx, 0.0, 1); nk.chart.plotFunction(ctx, .NK_CHART_LINES, {}, struct { fn func(_: void, i: usize) f32 { return @intToFloat(f32, i); } }.func, 10, 0); } nk.window.end(ctx); } }; pub const popup = struct { pub fn begin(ctx: *nk.Context, _type: nk.PopupType, str: []const u8, flags: nk.Flags, bounds: nk.Rect) bool { return c.nk_popup_begin(ctx, _type, nk.slice(str), flags, bounds) != 0; } pub fn close(ctx: *nk.Context) void { return c.nk_popup_close(ctx); } pub fn end(ctx: *nk.Context) void { return c.nk_popup_end(ctx); } pub fn getScroll(ctx: *nk.Context) nk.ScrollOffset { var x_offset: c.nk_uint = undefined; var y_offset: c.nk_uint = undefined; c.nk_popup_get_scroll(ctx, &x_offset, &y_offset); return .{ .x = x_offset, .y = y_offset, }; } pub fn setScroll(ctx: *nk.Context, offset: nk.ScrollOffset) void { c.nk_popup_set_scroll( ctx, @intCast(c.nk_uint, offset.x), @intCast(c.nk_uint, offset.y), ); } test { std.testing.refAllDecls(@This()); } }; pub const combo = struct { pub fn items( ctx: *nk.Context, strings: []const nk.Slice, selected: usize, item_height: c_int, size: nk.Vec2, ) usize { return @intCast(usize, c.nk_combo( ctx, discardConst(strings.ptr), @intCast(c_int, strings.len), @intCast(c_int, selected), item_height, size, )); } pub fn separator( ctx: *nk.Context, items_separated_by_separator: []const u8, seb: c_int, selected: usize, count: c_int, item_height: c_int, size: nk.Vec2, ) usize { return @intCast(usize, c.nk_combo_separator( ctx, nk.slice(items_separated_by_separator), seb, @intCast(c_int, selected), count, item_height, size, )); } pub fn string( ctx: *nk.Context, items_separated_by_zeros: []const u8, selected: usize, count: c_int, item_height: c_int, size: nk.Vec2, ) usize { return @intCast(usize, c.nk_combo_string( ctx, nk.slice(items_separated_by_zeros), @intCast(c_int, selected), count, item_height, size, )); } pub fn callback( ctx: *nk.Context, userdata: anytype, getter: fn (@TypeOf(userdata), usize) []const u8, selected: usize, count: usize, item_height: usize, size: nk.Vec2, ) usize { const T = @TypeOf(userdata); const Wrapped = struct { userdata: T, getter: fn (T, usize) []const u8, fn valueGetter(user: ?*c_void, index: c_int, out: [*c]nk.Slice) callconv(.C) void { const casted = @ptrCast(*const @This(), @alignCast(@alignOf(@This()), user)); out.* = nk.slice(casted.getter(casted.userdata, @intCast(usize, index))); } }; var wrapped = Wrapped{ .userdata = userdata, .getter = getter }; return @intCast(usize, c.nk_combo_callback( ctx, Wrapped.valueGetter, @ptrCast(*c_void, &wrapped), @intCast(c_int, selected), @intCast(c_int, count), @intCast(c_int, item_height), size, )); } pub fn beginLabel(ctx: *nk.Context, selected: []const u8, size: nk.Vec2) bool { return c.nk_combo_begin_label(ctx, nk.slice(selected), size) != 0; } pub fn beginColor(ctx: *nk.Context, q: nk.Color, size: nk.Vec2) bool { return c.nk_combo_begin_color(ctx, q, size) != 0; } pub fn beginSymbol(ctx: *nk.Context, a: nk.SymbolType, size: nk.Vec2) bool { return c.nk_combo_begin_symbol(ctx, a, size) != 0; } pub fn beginSymbolLabel( ctx: *nk.Context, selected: []const u8, a: nk.SymbolType, size: nk.Vec2, ) bool { return c.nk_combo_begin_symbol_label(ctx, nk.slice(selected), a, size) != 0; } pub fn beginImage(ctx: *nk.Context, img: nk.Image, size: nk.Vec2) bool { return c.nk_combo_begin_image(ctx, img, size) != 0; } pub fn beginImageLabel(ctx: *nk.Context, selected: []const u8, a: nk.Image, size: nk.Vec2) bool { return c.nk_combo_begin_image_label(ctx, nk.slice(selected), a, size) != 0; } pub fn itemLabel(ctx: *nk.Context, a: []const u8, alignment: nk.Flags) bool { return c.nk_combo_item_label(ctx, nk.slice(a), alignment) != 0; } pub fn itemImageLabel(ctx: *nk.Context, y: nk.Image, a: []const u8, alignment: nk.Flags) bool { return c.nk_combo_item_image_label(ctx, y, nk.slice(a), alignment) != 0; } pub fn itemSymbolLabel( ctx: *nk.Context, y: nk.SymbolType, a: []const u8, alignment: nk.Flags, ) bool { return c.nk_combo_item_symbol_label(ctx, y, nk.slice(a), alignment) != 0; } pub fn close(ctx: *nk.Context) void { return c.nk_combo_close(ctx); } pub fn end(ctx: *nk.Context) void { return c.nk_combo_end(ctx); } test { std.testing.refAllDecls(@This()); } test "chart" { var ctx = &try nk.testing.init(); defer nk.free(ctx); if (nk.window.begin(ctx, opaque {}, nk.rect(10, 10, 10, 10), .{})) |win| { nk.layout.rowDynamic(ctx, 0.0, 1); _ = nk.combo.callback(ctx, {}, struct { fn func(_: void, i: usize) []const u8 { return switch (i) { 0 => "1", 1 => "2", else => unreachable, }; } }.func, 0, 2, 10, vec2(10, 10)); } nk.window.end(ctx); } }; pub const contextual = struct { pub fn begin(ctx: *nk.Context, y: nk.Flags, a: nk.Vec2, trigger_bounds: nk.Rect) bool { return c.nk_contextual_begin(ctx, y, a, trigger_bounds) != 0; } pub fn itemLabel(ctx: *nk.Context, a: []const u8, alignment: nk.Flags) bool { return c.nk_contextual_item_label(ctx, nk.slice(a), alignment) != 0; } pub fn itemImageLabel(ctx: *nk.Context, y: nk.Image, a: []const u8, alignment: nk.Flags) bool { return c.nk_contextual_item_image_label(ctx, y, nk.slice(a), alignment) != 0; } pub fn itemSymbolLabel(ctx: *nk.Context, y: nk.SymbolType, a: []const u8, alignment: nk.Flags) bool { return c.nk_contextual_item_symbol_label(ctx, y, nk.slice(a), alignment) != 0; } pub fn close(ctx: *nk.Context) void { return c.nk_contextual_close(ctx); } pub fn end(ctx: *nk.Context) void { return c.nk_contextual_end(ctx); } test { std.testing.refAllDecls(@This()); } }; pub const tooltip = struct { pub fn text(ctx: *nk.Context, t: []const u8) void { return c.nk_tooltip(ctx, nk.slice(t)); } pub fn begin(ctx: *nk.Context, width: f32) bool { return c.nk_tooltip_begin(ctx, width) != 0; } pub fn end(ctx: *nk.Context) void { return c.nk_tooltip_end(ctx); } test { std.testing.refAllDecls(@This()); } }; pub const menubar = struct { pub fn begin(ctx: *nk.Context) void { return c.nk_menubar_begin(ctx); } pub fn end(ctx: *nk.Context) void { return c.nk_menubar_end(ctx); } test { std.testing.refAllDecls(@This()); } }; pub const menu = struct { pub fn beginLabel(ctx: *nk.Context, a: []const u8, alignment: nk.Flags, size: nk.Vec2) bool { return c.nk_menu_begin_label(ctx, nk.slice(a), alignment, size) != 0; } pub fn beginImage(ctx: *nk.Context, y: []const u8, a: nk.Image, size: nk.Vec2) bool { return c.nk_menu_begin_image(ctx, nk.slice(y), a, size) != 0; } pub fn beginImageLabel( ctx: *nk.Context, y: []const u8, alignment: nk.Flags, a: nk.Image, size: nk.Vec2, ) bool { return c.nk_menu_begin_image_label(ctx, nk.slice(y), alignment, a, size) != 0; } pub fn beginSymbol(ctx: *nk.Context, y: []const u8, a: nk.SymbolType, size: nk.Vec2) bool { return c.nk_menu_begin_symbol(ctx, nk.slice(y), a, size) != 0; } pub fn beginSymbolLabel( ctx: *nk.Context, y: []const u8, alignment: nk.Flags, a: nk.SymbolType, size: nk.Vec2, ) bool { return c.nk_menu_begin_symbol_label(ctx, nk.slice(y), alignment, a, size) != 0; } pub fn itemLabel(ctx: *nk.Context, a: []const u8, alignment: nk.Flags) bool { return c.nk_menu_item_label(ctx, nk.slice(a), alignment) != 0; } pub fn itemImageLabel(ctx: *nk.Context, y: nk.Image, a: []const u8, alignment: nk.Flags) bool { return c.nk_menu_item_image_label(ctx, y, nk.slice(a), alignment) != 0; } pub fn itemSymbolLabel(ctx: *nk.Context, y: nk.SymbolType, a: []const u8, alignment: nk.Flags) bool { return c.nk_menu_item_symbol_label(ctx, y, nk.slice(a), alignment) != 0; } pub fn close(ctx: *nk.Context) void { return c.nk_menu_close(ctx); } pub fn end(ctx: *nk.Context) void { return c.nk_menu_end(ctx); } test { std.testing.refAllDecls(@This()); } }; pub const style = struct { pub fn default(ctx: *nk.Context) void { return c.nk_style_default(ctx); } pub fn fromTable(ctx: *nk.Context, table: *const [c.NK_COLOR_COUNT]nk.Color) void { return c.nk_style_from_table(ctx, table); } pub fn loadCursor(ctx: *nk.Context, cursor: nk.StyleCursor, cur: nk.Cursor) void { return c.nk_style_load_cursor(ctx, cursor, &cur); } pub fn loadAllCursors(ctx: *nk.Context, cursors: *const [c.NK_CURSOR_COUNT]nk.Cursor) void { return c.nk_style_load_all_cursors(ctx, discardConst(cursors)); } pub fn getColorByName(s: nk.StyleColors) [:0]const u8 { const name = getColorByNameZ(s); return mem.spanZ(name); } pub fn getColorByNameZ(s: nk.StyleColors) [*:0]const u8 { return @ptrCast([*:0]const u8, c.nk_style_get_color_by_name(s)); } pub fn setFont(ctx: *nk.Context, font: *const nk.UserFont) void { return c.nk_style_set_font(ctx, font); } pub fn setCursor(ctx: *nk.Context, u: nk.StyleCursor) bool { return c.nk_style_set_cursor(ctx, u) != 0; } pub fn showCursor(ctx: *nk.Context) void { return c.nk_style_show_cursor(ctx); } pub fn hideCursor(ctx: *nk.Context) void { return c.nk_style_hide_cursor(ctx); } pub fn pushFont(ctx: *nk.Context, font: *const nk.UserFont) bool { return c.nk_style_push_font(ctx, font) != 0; } pub fn popFont(ctx: *nk.Context) bool { return c.nk_style_pop_font(ctx) != 0; } test { std.testing.refAllDecls(@This()); } }; pub const textedit = struct { pub fn init(a: *mem.Allocator, size: usize) nk.TextEdit { var res: nk.TextEdit = undefined; c.nk_textedit_init( &res, &nk.allocator(a), @intCast(c.nk_size, size), ); return res; } pub fn initFixed(memory: []u8) nk.TextEdit { var res: nk.TextEdit = undefined; c.nk_textedit_init_fixed( &res, @ptrCast(*c_void, memory.ptr), @intCast(c.nk_size, memory.len), ); return res; } pub fn free(e: *nk.TextEdit) void { return c.nk_textedit_free(e); } pub fn text(e: *nk.TextEdit, t: []const u8) void { return c.nk_textedit_text(e, nk.slice(t)); } pub fn delete(e: *nk.TextEdit, where: usize, len: usize) void { return c.nk_textedit_delete(e, @intCast(c_int, where), @intCast(c_int, len)); } pub fn deleteSelection(e: *nk.TextEdit) void { return c.nk_textedit_delete_selection(e); } pub fn selectAll(e: *nk.TextEdit) void { return c.nk_textedit_select_all(e); } pub fn cut(e: *nk.TextEdit) bool { return c.nk_textedit_cut(e) != 0; } pub fn paste(e: *nk.TextEdit, t: []const u8) bool { return c.nk_textedit_paste(e, nk.slice(t)) != 0; } pub fn undo(e: *nk.TextEdit) void { return c.nk_textedit_undo(e); } pub fn redo(e: *nk.TextEdit) void { return c.nk_textedit_redo(e); } test { std.testing.refAllDecls(@This()); } }; pub const stroke = struct { pub fn line(b: *nk.CommandBuffer, x0: f32, y0: f32, x1: f32, y1: f32, line_thickness: f32, col: nk.Color) void { return c.nk_stroke_line(b, x0, y0, x1, y1, line_thickness, col); } pub fn curve( b: *nk.CommandBuffer, ax: f32, ay: f32, ctrl0x: f32, ctrl0y: f32, ctrl1x: f32, ctrl1y: f32, bx: f32, by: f32, line_thickness: f32, col: nk.Color, ) void { return c.nk_stroke_curve( b, ax, ay, ctrl0x, ctrl0y, ctrl1x, ctrl1y, bx, by, line_thickness, col, ); } pub fn rect(b: *nk.CommandBuffer, r: nk.Rect, rounding: f32, line_thickness: f32, col: nk.Color) void { return c.nk_stroke_rect(b, r, rounding, line_thickness, col); } pub fn circle(b: *nk.CommandBuffer, r: nk.Rect, line_thickness: f32, col: nk.Color) void { return c.nk_stroke_circle(b, r, line_thickness, col); } pub fn arc(b: *nk.CommandBuffer, cx: f32, cy: f32, radius: f32, a_min: f32, a_max: f32, line_thickness: f32, col: nk.Color) void { return c.nk_stroke_arc(b, cx, cy, radius, a_min, a_max, line_thickness, col); } pub fn triangle(b: *nk.CommandBuffer, h: f32, o: f32, q: f32, d: f32, y: f32, a: f32, line_thichness: f32, u: nk.Color) void { return c.nk_stroke_triangle(b, h, o, q, d, y, a, line_thichness, u); } pub fn polyline(b: *nk.CommandBuffer, points: [][2]f32, line_thickness: f32, col: nk.Color) void { return c.nk_stroke_polyline( b, @ptrCast([*]f32, points.ptr), @intCast(c_int, points.len), line_thickness, col, ); } pub fn polygon(b: *nk.CommandBuffer, points: [][2]f32, line_thickness: f32, col: nk.Color) void { return c.nk_stroke_polygon( b, @ptrCast([*]f32, points.ptr), @intCast(c_int, points.len), line_thickness, col, ); } test { std.testing.refAllDecls(@This()); } }; pub const rest = struct { test { std.testing.refAllDecls(@This()); } pub fn nkRgb(r: c_int, g: c_int, b: c_int) nk.Color { return c.nk_rgb(r, g, b); } pub fn nkRgbIv(rgb: [*c]const c_int) nk.Color { return c.nk_rgb_iv(rgb); } pub fn nkRgbBv(rgb: [*c]const u8) nk.Color { return c.nk_rgb_bv(rgb); } pub fn nkRgbF(r: f32, g: f32, b: f32) nk.Color { return c.nk_rgb_f(r, g, b); } pub fn nkRgbFv(rgb: [*c]const f32) nk.Color { return c.nk_rgb_fv(rgb); } pub fn nkRgbCf(y: nk.Colorf) nk.Color { return c.nk_rgb_cf(y); } pub fn nkRgbHex(rgb: []const u8) nk.Color { return c.nk_rgb_hex(nk.slice(rgb)); } pub fn nkRgba(r: c_int, g: c_int, b: c_int, a: c_int) nk.Color { return c.nk_rgba(r, g, b, a); } pub fn nkRgbaU32(i: c_uint) nk.Color { return c.nk_rgba_u32(i); } pub fn nkRgbaIv(rgba: [*c]const c_int) nk.Color { return c.nk_rgba_iv(rgba); } pub fn nkRgbaBv(rgba: [*c]const u8) nk.Color { return c.nk_rgba_bv(rgba); } pub fn nkRgbaF(r: f32, g: f32, b: f32, a: f32) nk.Color { return c.nk_rgba_f(r, g, b, a); } pub fn nkRgbaFv(rgba: [*c]const f32) nk.Color { return c.nk_rgba_fv(rgba); } pub fn nkRgbaCf(y: nk.Colorf) nk.Color { return c.nk_rgba_cf(y); } pub fn nkRgbaHex(rgb: []const u8) nk.Color { return c.nk_rgba_hex(nk.slice(rgb)); } pub fn nkHsvaColorf(h: f32, s: f32, v: f32, a: f32) nk.Colorf { return c.nk_hsva_colorf(h, s, v, a); } pub fn nkHsvaColorfv(y: [*c]f32) nk.Colorf { return c.nk_hsva_colorfv(y); } pub fn nkColorfHsvaF(out_h: [*c]f32, out_s: [*c]f32, out_v: [*c]f32, out_a: [*c]f32, in: nk.Colorf) void { return c.nk_colorf_hsva_f(out_h, out_s, out_v, out_a, in); } pub fn nkColorfHsvaFv(hsva: [*c]f32, in: nk.Colorf) void { return c.nk_colorf_hsva_fv(hsva, in); } pub fn nkHsv(h: c_int, s: c_int, v: c_int) nk.Color { return c.nk_hsv(h, s, v); } pub fn nkHsvIv(hsv: [*c]const c_int) nk.Color { return c.nk_hsv_iv(hsv); } pub fn nkHsvBv(hsv: [*c]const u8) nk.Color { return c.nk_hsv_bv(hsv); } pub fn nkHsvF(h: f32, s: f32, v: f32) nk.Color { return c.nk_hsv_f(h, s, v); } pub fn nkHsvFv(hsv: [*c]const f32) nk.Color { return c.nk_hsv_fv(hsv); } pub fn nkHsva(h: c_int, s: c_int, v: c_int, a: c_int) nk.Color { return c.nk_hsva(h, s, v, a); } pub fn nkHsvaIv(hsva: [*c]const c_int) nk.Color { return c.nk_hsva_iv(hsva); } pub fn nkHsvaBv(hsva: [*c]const u8) nk.Color { return c.nk_hsva_bv(hsva); } pub fn nkHsvaF(h: f32, s: f32, v: f32, a: f32) nk.Color { return c.nk_hsva_f(h, s, v, a); } pub fn nkHsvaFv(hsva: [*c]const f32) nk.Color { return c.nk_hsva_fv(hsva); } pub fn nkColorF(r: [*c]f32, g: [*c]f32, b: [*c]f32, a: [*c]f32, u: nk.Color) void { return c.nk_color_f(r, g, b, a, u); } pub fn nkColorFv(rgba_out: [*c]f32, u: nk.Color) void { return c.nk_color_fv(rgba_out, u); } pub fn nkColorCf(y: nk.Color) nk.Colorf { return c.nk_color_cf(y); } pub fn nkColorD(r: [*c]f64, g: [*c]f64, b: [*c]f64, a: [*c]f64, u: nk.Color) void { return c.nk_color_d(r, g, b, a, u); } pub fn nkColorDv(rgba_out: [*c]f64, u: nk.Color) void { return c.nk_color_dv(rgba_out, u); } pub fn nkColorU32(y: nk.Color) c.nk_uint { return c.nk_color_u32(y); } pub fn nkColorHexRgba(output: [*c]u8, u: nk.Color) void { return c.nk_color_hex_rgba(output, u); } pub fn nkColorHexRgb(output: [*c]u8, u: nk.Color) void { return c.nk_color_hex_rgb(output, u); } pub fn nkColorHsvI(out_h: [*c]c_int, out_s: [*c]c_int, out_v: [*c]c_int, u: nk.Color) void { return c.nk_color_hsv_i(out_h, out_s, out_v, u); } pub fn nkColorHsvB(out_h: [*c]u8, out_s: [*c]u8, out_v: [*c]u8, u: nk.Color) void { return c.nk_color_hsv_b(out_h, out_s, out_v, u); } pub fn nkColorHsvIv(hsv_out: [*c]c_int, u: nk.Color) void { return c.nk_color_hsv_iv(hsv_out, u); } pub fn nkColorHsvBv(hsv_out: [*c]u8, u: nk.Color) void { return c.nk_color_hsv_bv(hsv_out, u); } pub fn nkColorHsvF(out_h: [*c]f32, out_s: [*c]f32, out_v: [*c]f32, u: nk.Color) void { return c.nk_color_hsv_f(out_h, out_s, out_v, u); } pub fn nkColorHsvFv(hsv_out: [*c]f32, u: nk.Color) void { return c.nk_color_hsv_fv(hsv_out, u); } pub fn nkColorHsvaI(h: [*c]c_int, s: [*c]c_int, v: [*c]c_int, a: [*c]c_int, u: nk.Color) void { return c.nk_color_hsva_i(h, s, v, a, u); } pub fn nkColorHsvaB(h: [*c]u8, s: [*c]u8, v: [*c]u8, a: [*c]u8, u: nk.Color) void { return c.nk_color_hsva_b(h, s, v, a, u); } pub fn nkColorHsvaIv(hsva_out: [*c]c_int, u: nk.Color) void { return c.nk_color_hsva_iv(hsva_out, u); } pub fn nkColorHsvaBv(hsva_out: [*c]u8, u: nk.Color) void { return c.nk_color_hsva_bv(hsva_out, u); } pub fn nkColorHsvaF(out_h: [*c]f32, out_s: [*c]f32, out_v: [*c]f32, out_a: [*c]f32, u: nk.Color) void { return c.nk_color_hsva_f(out_h, out_s, out_v, out_a, u); } pub fn nkColorHsvaFv(hsva_out: [*c]f32, u: nk.Color) void { return c.nk_color_hsva_fv(hsva_out, u); } pub fn nkHandlePtr(ptr: ?*c_void) nk.Handle { return c.nk_handle_ptr(ptr); } pub fn nkHandleId(h: c_int) nk.Handle { return c.nk_handle_id(h); } pub fn nkImageHandle(h: nk.Handle) nk.Image { return c.nk_image_handle(h); } pub fn nkImagePtr(ptr: ?*c_void) nk.Image { return c.nk_image_ptr(ptr); } pub fn nkImageId(id: c_int) nk.Image { return c.nk_image_id(id); } pub fn nkImageIsSubimage(img: [*c]const nk.Image) bool { return c.nk_image_is_subimage(img) != 0; } pub fn nkSubimagePtr(ptr: ?*c_void, w: c_ushort, h: c_ushort, sub_region: nk.Rect) nk.Image { return c.nk_subimage_ptr(ptr, w, h, sub_region); } pub fn nkSubimageId(id: c_int, w: c_ushort, h: c_ushort, sub_region: nk.Rect) nk.Image { return c.nk_subimage_id(id, w, h, sub_region); } pub fn nkSubimageHandle(h: nk.Handle, w: c_ushort, q: c_ushort, sub_region: nk.Rect) nk.Image { return c.nk_subimage_handle(h, w, q, sub_region); } pub fn nkMurmurHash(key: []const u8, seed: nk.Hash) nk.Hash { return c.nk_murmur_hash(nk.slice(key), seed); } pub fn nkTriangleFromDirection(result: [*c]nk.Vec2, r: nk.Rect, pad_x: f32, pad_y: f32, u: nk.Heading) void { return c.nk_triangle_from_direction(result, r, pad_x, pad_y, u); } pub fn nkVec2(x: f32, y: f32) nk.Vec2 { return c.nk_vec2(x, y); } pub fn nkVec2i(x: c_int, y: c_int) nk.Vec2 { return c.nk_vec2i(x, y); } pub fn nkVec2v(xy: [*c]const f32) nk.Vec2 { return c.nk_vec2v(xy); } pub fn nkVec2iv(xy: [*c]const c_int) nk.Vec2 { return c.nk_vec2iv(xy); } pub fn nkGetNullRect() nk.Rect { return c.nk_get_null_rect(); } pub fn nkRect(x: f32, y: f32, w: f32, h: f32) nk.Rect { return c.nk_rect(x, y, w, h); } pub fn nkRecti(x: c_int, y: c_int, w: c_int, h: c_int) nk.Rect { return c.nk_recti(x, y, w, h); } pub fn nkRecta(pos: nk.Vec2, size: nk.Vec2) nk.Rect { return c.nk_recta(pos, size); } pub fn nkRectv(xywh: [*c]const f32) nk.Rect { return c.nk_rectv(xywh); } pub fn nkRectiv(xywh: [*c]const c_int) nk.Rect { return c.nk_rectiv(xywh); } pub fn nkRectPos(r: nk.Rect) nk.Vec2 { return c.nk_rect_pos(r); } pub fn nkRectSize(r: nk.Rect) nk.Vec2 { return c.nk_rect_size(r); } pub fn nkFontDefaultGlyphRanges() [*c]const nk.Rune { return c.nk_font_default_glyph_ranges(); } pub fn nkFontChineseGlyphRanges() [*c]const nk.Rune { return c.nk_font_chinese_glyph_ranges(); } pub fn nkFontCyrillicGlyphRanges() [*c]const nk.Rune { return c.nk_font_cyrillic_glyph_ranges(); } pub fn nkFontKoreanGlyphRanges() [*c]const nk.Rune { return c.nk_font_korean_glyph_ranges(); } pub fn nkBufferInit(b: [*c]nk.Buffer, a: [*c]const nk.Allocator, size: usize) void { return c.nk_buffer_init(b, a, size); } pub fn nkBufferInitFixed(b: [*c]nk.Buffer, memory: ?*c_void, size: usize) void { return c.nk_buffer_init_fixed(b, memory, size); } pub fn nkBufferInfo(m: [*c]nk.MemoryStatus, b: [*c]nk.Buffer) void { return c.nk_buffer_info(m, b); } pub fn nkBufferPush(b: [*c]nk.Buffer, t: nk.BufferAllocatorType, memory: ?*const c_void, size: usize, @"align": usize) void { return c.nk_buffer_push(b, t, memory, size, @"align"); } pub fn nkBufferMark(b: [*c]nk.Buffer, t: nk.BufferAllocatorType) void { return c.nk_buffer_mark(b, t); } pub fn nkBufferReset(b: [*c]nk.Buffer, t: nk.BufferAllocatorType) void { return c.nk_buffer_reset(b, t); } pub fn nkBufferClear(b: [*c]nk.Buffer) void { return c.nk_buffer_clear(b); } pub fn nkBufferFree(b: [*c]nk.Buffer) void { return c.nk_buffer_free(b); } pub fn nkBufferMemory(b: [*c]nk.Buffer) ?*c_void { return c.nk_buffer_memory(b); } pub fn nkBufferMemoryConst(b: [*c]const nk.Buffer) ?*const c_void { return c.nk_buffer_memory_const(b); } pub fn nkBufferTotal(b: [*c]nk.Buffer) usize { return c.nk_buffer_total(b); } pub fn nkStrInit(s: [*c]nk.String, a: [*c]const nk.Allocator, size: usize) void { return c.nk_str_init(s, a, size); } pub fn nkStrInitFixed(s: [*c]nk.String, memory: ?*c_void, size: usize) void { return c.nk_str_init_fixed(s, memory, size); } pub fn nkStrClear(s: [*c]nk.String) void { return c.nk_str_clear(s); } pub fn nkStrFree(s: [*c]nk.String) void { return c.nk_str_free(s); } pub fn nkStrAppendStrChar(s: [*c]nk.String, t: []const u8) c_int { return c.nk_str_append_str_char(s, nk.slice(t)); } pub fn nkStrAppendStrRunes(s: [*c]nk.String, runes: [*c]const nk.Rune, len: usize) c_int { return c.nk_str_append_str_runes(s, runes, len); } pub fn nkStrInsertAtChar(s: [*c]nk.String, pos: c_int, t: []const u8) c_int { return c.nk_str_insert_at_char(s, pos, nk.slice(t)); } pub fn nkStrInsertAtRune(s: [*c]nk.String, pos: c_int, t: []const u8) c_int { return c.nk_str_insert_at_rune(s, pos, nk.slice(t)); } pub fn nkStrInsertTextRunes(s: [*c]nk.String, pos: c_int, a: [*c]const nk.Rune, u: c_int) c_int { return c.nk_str_insert_text_runes(s, pos, a, u); } pub fn nkStrInsertStrRunes(s: [*c]nk.String, pos: c_int, a: [*c]const nk.Rune) c_int { return c.nk_str_insert_str_runes(s, pos, a); } pub fn nkStrRemoveChars(s: [*c]nk.String, len: c_int) void { return c.nk_str_remove_chars(s, len); } pub fn nkStrRemoveRunes(s: [*c]nk.String, len: c_int) void { return c.nk_str_remove_runes(s, len); } pub fn nkStrDeleteChars(s: [*c]nk.String, pos: c_int, len: c_int) void { return c.nk_str_delete_chars(s, pos, len); } pub fn nkStrDeleteRunes(s: [*c]nk.String, pos: c_int, len: c_int) void { return c.nk_str_delete_runes(s, pos, len); } pub fn nkStrAtChar(s: [*c]nk.String, pos: c_int) [*c]u8 { return c.nk_str_at_char(s, pos); } pub fn nkStrAtRune(s: [*c]nk.String, pos: c_int, unicode: [*c]nk.Rune, len: [*c]c_int) [*c]u8 { return c.nk_str_at_rune(s, pos, unicode, len); } pub fn nkStrRuneAt(s: [*c]const nk.String, pos: c_int) nk.Rune { return c.nk_str_rune_at(s, pos); } pub fn nkStrAtCharConst(s: [*c]const nk.String, pos: c_int) [*c]const u8 { return c.nk_str_at_char_const(s, pos); } pub fn nkStrAtConst(s: [*c]const nk.String, pos: c_int, unicode: [*c]nk.Rune) []const u8 { const res = c.nk_str_at_const(s, pos, unicode); return res.ptr[0..res.len]; } pub fn nkStrGet(s: [*c]nk.String) [*c]u8 { return c.nk_str_get(s); } pub fn nkStrGetConst(s: [*c]const nk.String) []const u8 { const res = c.nk_str_get_const(s); return res.ptr[0..res.len]; } pub fn nkStrLen(s: [*c]nk.String) c_int { return c.nk_str_len(s); } pub fn nkFilterDefault(t: [*c]const nk.TextEdit, unicode: nk.Rune) bool { return c.nk_filter_default(t, unicode) != 0; } pub fn nkFilterAscii(t: [*c]const nk.TextEdit, unicode: nk.Rune) bool { return c.nk_filter_ascii(t, unicode) != 0; } pub fn nkFilterFloat(t: [*c]const nk.TextEdit, unicode: nk.Rune) bool { return c.nk_filter_float(t, unicode) != 0; } pub fn nkFilterDecimal(t: [*c]const nk.TextEdit, unicode: nk.Rune) bool { return c.nk_filter_decimal(t, unicode) != 0; } pub fn nkFilterHex(t: [*c]const nk.TextEdit, unicode: nk.Rune) bool { return c.nk_filter_hex(t, unicode) != 0; } pub fn nkFilterOct(t: [*c]const nk.TextEdit, unicode: nk.Rune) bool { return c.nk_filter_oct(t, unicode) != 0; } pub fn nkFilterBinary(t: [*c]const nk.TextEdit, unicode: nk.Rune) bool { return c.nk_filter_binary(t, unicode) != 0; } pub fn nkFillRect(b: [*c]nk.CommandBuffer, r: nk.Rect, rounding: f32, u: nk.Color) void { return c.nk_fill_rect(b, r, rounding, u); } pub fn nkFillRectMultiColor(b: [*c]nk.CommandBuffer, r: nk.Rect, left: nk.Color, top: nk.Color, right: nk.Color, bottom: nk.Color) void { return c.nk_fill_rect_multi_color(b, r, left, top, right, bottom); } pub fn nkFillCircle(b: [*c]nk.CommandBuffer, r: nk.Rect, a: nk.Color) void { return c.nk_fill_circle(b, r, a); } pub fn nkFillArc(b: [*c]nk.CommandBuffer, cx: f32, cy: f32, radius: f32, a_min: f32, a_max: f32, u: nk.Color) void { return c.nk_fill_arc(b, cx, cy, radius, a_min, a_max, u); } pub fn nkFillTriangle(b: [*c]nk.CommandBuffer, x0: f32, y0: f32, x1: f32, y1: f32, x2: f32, y2: f32, u: nk.Color) void { return c.nk_fill_triangle(b, x0, y0, x1, y1, x2, y2, u); } pub fn nkFillPolygon(b: [*c]nk.CommandBuffer, a: [*c]f32, point_count: c_int, u: nk.Color) void { return c.nk_fill_polygon(b, a, point_count, u); } pub fn nkDrawImage(b: [*c]nk.CommandBuffer, r: nk.Rect, y: [*c]const nk.Image, a: nk.Color) void { return c.nk_draw_image(b, r, y, a); } pub fn nkDrawText(b: [*c]nk.CommandBuffer, r: nk.Rect, t: []const u8, d: [*c]const nk.UserFont, y: nk.Color, q: nk.Color) void { return c.nk_draw_text(b, r, nk.slice(t), d, y, q); } pub fn nkPushScissor(b: [*c]nk.CommandBuffer, r: nk.Rect) void { return c.nk_push_scissor(b, r); } pub fn nkPushCustom(b: [*c]nk.CommandBuffer, r: nk.Rect, a: nk.CustomCallback, usr: nk.Handle) void { return c.nk_push_custom(b, r, a, usr); } pub fn nkInputHasMouseClick(in: *const nk.Input, bots: nk.Buttons) bool { return c.nk_input_has_mouse_click(in, bots) != 0; } pub fn nkInputHasMouseClickInRect(in: *const nk.Input, bots: nk.Buttons, r: nk.Rect) bool { return c.nk_input_has_mouse_click_in_rect(in, bots, r) != 0; } pub fn nkInputHasMouseClickDownInRect(in: *const nk.Input, bots: nk.Buttons, r: nk.Rect, down: bool) bool { return c.nk_input_has_mouse_click_down_in_rect(in, bots, r, @boolToInt(down)) != 0; } pub fn nkInputIsMouseClickInRect(in: *const nk.Input, bots: nk.Buttons, r: nk.Rect) bool { return c.nk_input_is_mouse_click_in_rect(in, bots, r) != 0; } pub fn nkInputIsMouseClickDownInRect(in: *const nk.Input, id: nk.Buttons, b: nk.Rect, down: bool) bool { return c.nk_input_is_mouse_click_down_in_rect(in, id, b, @boolToInt(down)) != 0; } pub fn nkInputAnyMouseClickInRect(in: *const nk.Input, r: nk.Rect) bool { return c.nk_input_any_mouse_click_in_rect(in, r) != 0; } pub fn nkInputIsMousePrevHoveringRect(in: *const nk.Input, r: nk.Rect) bool { return c.nk_input_is_mouse_prev_hovering_rect(in, r) != 0; } pub fn nkInputIsMouseHoveringRect(in: *const nk.Input, r: nk.Rect) bool { return c.nk_input_is_mouse_hovering_rect(in, r) != 0; } pub fn nkInputMouseClicked(in: *const nk.Input, bots: nk.Buttons, r: nk.Rect) bool { return c.nk_input_mouse_clicked(in, bots, r) != 0; } pub fn nkInputIsMouseDown(in: *const nk.Input, bots: nk.Buttons) bool { return c.nk_input_is_mouse_down(in, bots) != 0; } pub fn nkInputIsMousePressed(in: *const nk.Input, bots: nk.Buttons) bool { return c.nk_input_is_mouse_pressed(in, bots) != 0; } pub fn nkInputIsMouseReleased(in: *const nk.Input, bots: nk.Buttons) bool { return c.nk_input_is_mouse_released(in, bots) != 0; } pub fn nkInputIsKeyPressed(in: *const nk.Input, keys: nk.Keys) bool { return c.nk_input_is_key_pressed(in, keys) != 0; } pub fn nkInputIsKeyReleased(in: *const nk.Input, keys: nk.Keys) bool { return c.nk_input_is_key_released(in, keys) != 0; } pub fn nkInputIsKeyDown(in: *const nk.Input, keys: nk.Keys) bool { return c.nk_input_is_key_down(in, keys) != 0; } pub fn nkStyleItemImage(img: nk.Image) nk.StyleItem { return c.nk_style_item_image(img); } pub fn nkStyleItemColor(y: nk.Color) nk.StyleItem { return c.nk_style_item_color(y); } pub fn nkStyleItemHide() nk.StyleItem { return c.nk_style_item_hide(); } }; pub const Allocator = c.struct_nk_allocator; pub const BufferAllocatorType = c.enum_nk_buffer_allocation_type; pub const Buffer = c.struct_nk_buffer; pub const Buttons = c.nk_buttons; pub const ChartType = c.enum_nk_chart_type; pub const CollapseStates = c.nk_collapse_states; pub const Color = c.struct_nk_color; pub const Colorf = c.struct_nk_colorf; pub const CommandBuffer = c.struct_nk_command_buffer; pub const Context = c.struct_nk_context; pub const Cursor = c.struct_nk_cursor; pub const CustomCallback = c.nk_command_custom_callback; pub const Filter = c.nk_plugin_filter; pub const Flags = c.nk_flags; pub const FontAtlas = c.struct_nk_font_atlas; pub const Handle = c.nk_handle; pub const Hash = c.nk_hash; pub const Heading = c.enum_nk_heading; pub const Image = c.struct_nk_image; pub const Input = c.struct_nk_input; pub const Keys = c.nk_keys; pub const MemoryStatus = c.struct_nk_memory_status; pub const PopupType = c.enum_nk_popup_type; pub const Rect = c.struct_nk_rect; pub const Rune = c.nk_rune; pub const Scroll = c.struct_nk_scroll; pub const Slice = c.struct_nk_slice; pub const String = c.struct_nk_str; pub const StyleButton = c.struct_nk_style_button; pub const StyleColors = c.enum_nk_style_colors; pub const StyleCursor = c.enum_nk_style_cursor; pub const StyleItem = c.struct_nk_style_item; pub const SymbolType = c.nk_symbol_type; pub const TextEdit = c.struct_nk_text_edit; pub const UserFont = c.struct_nk_user_font; pub const Vec2 = c.struct_nk_vec2; pub const Window = c.struct_nk_window; pub const Command = union(enum) { scissor: *const c.struct_nk_command_scissor, line: *const c.struct_nk_command_line, curve: *const c.struct_nk_command_curve, rect: *const c.struct_nk_command_rect, rect_filled: *const c.struct_nk_command_rect_filled, rect_multi_color: *const c.struct_nk_command_rect_multi_color, circle: *const c.struct_nk_command_circle, circle_filled: *const c.struct_nk_command_circle_filled, arc: *const c.struct_nk_command_arc, arc_filled: *const c.struct_nk_command_arc_filled, triangle: *const c.struct_nk_command_triangle, triangle_filled: *const c.struct_nk_command_triangle_filled, polygon: *const c.struct_nk_command_polygon, polygon_filled: *const c.struct_nk_command_polygon_filled, polyline: *const c.struct_nk_command_polyline, text: *const c.struct_nk_command_text, image: *const c.struct_nk_command_image, custom: *const c.struct_nk_command, pub fn fromNuklear(cmd: *const c.struct_nk_command) Command { switch (cmd.type) { .NK_COMMAND_SCISSOR => return .{ .scissor = @ptrCast(*const c.struct_nk_command_scissor, cmd) }, .NK_COMMAND_LINE => return .{ .line = @ptrCast(*const c.struct_nk_command_line, cmd) }, .NK_COMMAND_CURVE => return .{ .curve = @ptrCast(*const c.struct_nk_command_curve, cmd) }, .NK_COMMAND_RECT => return .{ .rect = @ptrCast(*const c.struct_nk_command_rect, cmd) }, .NK_COMMAND_RECT_FILLED => return .{ .rect_filled = @ptrCast(*const c.struct_nk_command_rect_filled, cmd) }, .NK_COMMAND_RECT_MULTI_COLOR => return .{ .rect_multi_color = @ptrCast(*const c.struct_nk_command_rect_multi_color, cmd) }, .NK_COMMAND_CIRCLE => return .{ .circle = @ptrCast(*const c.struct_nk_command_circle, cmd) }, .NK_COMMAND_CIRCLE_FILLED => return .{ .circle_filled = @ptrCast(*const c.struct_nk_command_circle_filled, cmd) }, .NK_COMMAND_ARC => return .{ .arc = @ptrCast(*const c.struct_nk_command_arc, cmd) }, .NK_COMMAND_ARC_FILLED => return .{ .arc_filled = @ptrCast(*const c.struct_nk_command_arc_filled, cmd) }, .NK_COMMAND_TRIANGLE => return .{ .triangle = @ptrCast(*const c.struct_nk_command_triangle, cmd) }, .NK_COMMAND_TRIANGLE_FILLED => return .{ .triangle_filled = @ptrCast(*const c.struct_nk_command_triangle_filled, cmd) }, .NK_COMMAND_POLYGON => return .{ .polygon = @ptrCast(*const c.struct_nk_command_polygon, cmd) }, .NK_COMMAND_POLYGON_FILLED => return .{ .polygon_filled = @ptrCast(*const c.struct_nk_command_polygon_filled, cmd) }, .NK_COMMAND_POLYLINE => return .{ .polyline = @ptrCast(*const c.struct_nk_command_polyline, cmd) }, .NK_COMMAND_TEXT => return .{ .text = @ptrCast(*const c.struct_nk_command_text, cmd) }, .NK_COMMAND_IMAGE => return .{ .image = @ptrCast(*const c.struct_nk_command_image, cmd) }, .NK_COMMAND_CUSTOM => return .{ .custom = cmd }, .NK_COMMAND_NOP => unreachable, _ => unreachable, } } }; pub const PanelFlags = struct { title: ?[]const u8 = null, border: bool = false, moveable: bool = false, scalable: bool = false, closable: bool = false, minimizable: bool = false, scrollbar: bool = true, scroll_auto_hide: bool = false, background: bool = false, input: bool = true, pub fn toNuklear(flags: PanelFlags) nk.Flags { return @intCast(nk.Flags, (if (flags.title) |_| c.NK_WINDOW_TITLE else 0) | (if (flags.border) c.NK_WINDOW_BORDER else 0) | (if (flags.moveable) c.NK_WINDOW_MOVABLE else 0) | (if (flags.scalable) c.NK_WINDOW_SCALABLE else 0) | (if (flags.closable) c.NK_WINDOW_CLOSABLE else 0) | (if (flags.minimizable) c.NK_WINDOW_MINIMIZABLE else 0) | (if (!flags.scrollbar) c.NK_WINDOW_NO_SCROLLBAR else 0) | (if (flags.scroll_auto_hide) c.NK_WINDOW_SCROLL_AUTO_HIDE else 0) | (if (flags.background) c.NK_WINDOW_BACKGROUND else 0) | (if (!flags.input) c.NK_WINDOW_NO_INPUT else 0)); } }; pub const ScrollOffset = struct { x: usize, y: usize, }; pub fn init(alloc: *mem.Allocator, font: *const UserFont) Context { var res: Context = undefined; const status = c.nk_init(&res, &allocator(alloc), font); // init only returns `0` if we pass `null` as the allocator. debug.assert(status != 0); return res; } pub fn initFixed(buf: []u8, font: *const UserFont) Context { var res: Context = undefined; const status = c.nk_init_fixed(&res, buf.ptr, buf.len, font); // init only returns `0` if we pass `null` as the buffer. debug.assert(status != 0); return res; } // pub fn initCustom(cmds: *Buffer, pool: *Buffer, font: Font) Context {} pub fn clear(ctx: *Context) void { c.nk_clear(ctx); } pub fn free(ctx: *Context) void { c.nk_free(ctx); } pub fn iterator(ctx: *Context) Iterator { return .{ .ctx = ctx }; } pub const Iterator = struct { ctx: *Context, prev: ?*const c.struct_nk_command = null, pub fn next(it: *Iterator) ?Command { const res = if (it.prev) |p| c.nk__next(it.ctx, p) else c.nk__begin(it.ctx) orelse return null; defer it.prev = res; if (res == null) { return null; } return Command.fromNuklear(res); } }; pub fn slice(s: []const u8) Slice { return .{ .ptr = s.ptr, .len = s.len, ._pad = undefined, }; } pub fn rect(x: f32, y: f32, w: f32, h: f32) Rect { return .{ .x = x, .y = y, .w = w, .h = h, ._pad = undefined }; } pub fn vec2(x: f32, y: f32) Vec2 { return .{ .x = x, .y = y, ._pad = undefined, ._pad2 = undefined }; } pub fn typeId(comptime T: type) usize { // We generate a completly unique id by declaring a global variable `id`, and storing // the address if `id` in itself. const Id = struct { var addr: u8 = undefined; }; return @ptrToInt(&Id.addr); } pub fn allocator(alloc: *mem.Allocator) Allocator { return .{ .userdata = .{ .ptr = @ptrCast(*c_void, alloc) }, .alloc = heap.alloc, .free = heap.free, }; } fn DiscardConst(comptime Ptr: type) type { var info = @typeInfo(Ptr); info.Pointer.is_const = false; return @Type(info); } fn discardConst(ptr: anytype) DiscardConst(@TypeOf(ptr)) { const Res = DiscardConst(@TypeOf(ptr)); return @intToPtr(Res, @ptrToInt(ptr)); } const heap = struct { // Nuklears allocator interface does not send back and forth the size of the allocation. // This is a problem, as zigs interface really wants you to pass back the size when // reallocating and freeing. To solve this, we store the size in a header block that is // stored in the memory before the pointer we return to nuklear. const header_align = @alignOf(Header); const header_size = @sizeOf(Header); const Header = struct { size: usize, }; fn alloc(handle: Handle, m_old: ?*c_void, n: c.nk_size) callconv(.C) ?*c_void { const old = if (@ptrCast(?[*]u8, m_old)) |old| blk: { const old_with_header = old - header_size; const header = alignPtrCast([*]Header, old_with_header)[0]; break :blk old_with_header[0 .. header_size + header.size]; } else &[_]u8{}; if (n == 0) { free(handle, m_old); return null; } const al = alignPtrCast(*mem.Allocator, handle.ptr); const res = al.reallocAdvanced(old, header_align, n + header_size, .exact) catch return null; // Store the size of the allocation in the extra memory we allocated, and return // a pointer after the header. @ptrCast([*]Header, res.ptr)[0] = .{ .size = n }; return @ptrCast(*c_void, res[header_size..].ptr); } fn free(handle: Handle, m_old: ?*c_void) callconv(.C) void { const old = @ptrCast(?[*]u8, m_old) orelse return; const old_with_header = old - header_size; const header = alignPtrCast([*]Header, old_with_header)[0]; const al = alignPtrCast(*mem.Allocator, handle.ptr); al.free(old_with_header[0 .. header_size + header.size]); } fn alignPtrCast(comptime Ptr: type, ptr: anytype) Ptr { return @ptrCast(Ptr, @alignCast(@typeInfo(Ptr).Pointer.alignment, ptr)); } }; test { std.testing.refAllDecls(@This()); } test "initFixed" { var font: UserFont = undefined; var buf: [1024]u8 = undefined; var ctx = &initFixed(&buf, &font); defer free(ctx); } // test "Context.initCustom" { // var ctx = Context.initCustom(&buf, null); // defer ctx.free(); // } //
nuklear.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const log = std.log.scoped(.vr); const config = @import("config.zig"); pub const Replica = @import("vr/replica.zig").Replica; pub const Clock = @import("vr/clock.zig").Clock; pub const DeterministicTime = @import("vr/clock.zig").DeterministicTime; pub const SystemTime = @import("vr/clock.zig").SystemTime; pub const Journal = @import("vr/journal.zig").Journal; // TODO Command for client to fetch its latest request number from the cluster. /// Viewstamped Replication protocol commands: pub const Command = packed enum(u8) { reserved, ping, pong, request, prepare, prepare_ok, reply, commit, start_view_change, do_view_change, start_view, request_start_view, request_headers, request_prepare, headers, nack_prepare, }; /// This type exists to avoid making the Header type dependant on the state /// machine used, which would cause awkward circular type dependencies. pub const Operation = enum(u8) { /// The value 0 is required to be .reserved regardless of the state machine in order to /// avoid interpretation of a suprious 0 byte as a valid operation. reserved = 0, /// The value 1 is required to be .init and is used for initialization of the cluster. init = 1, /// All other values are treated the same by the VR protocol and are free for the state /// machine to use as it sees fit. _, pub fn to_state_machine_op(op: Operation, comptime StateMachine: type) StateMachine.Operation { check_state_machine_op_type(StateMachine.Operation); return @intToEnum(StateMachine.Operation, @enumToInt(op)); } pub fn from_state_machine_op(comptime StateMachine: type, op: StateMachine.Operation) Operation { return @intToEnum(Operation, @enumToInt(op)); } fn check_state_machine_op_type(comptime Op: type) void { if (!@hasField(Op, "reserved") or std.meta.fieldInfo(Op, .reserved).value != 0) { @compileError("StateMachine.Operation must have a 'reserved' field with value 0!"); } if (!@hasField(Op, "init") or std.meta.fieldInfo(Op, .init).value != 1) { @compileError("StateMachine.Operation must have an 'init' field with value 1!"); } } }; /// Network message and journal entry header: /// We reuse the same header for both so that prepare messages from the leader can simply be /// journalled as is by the followers without requiring any further modification. pub const Header = packed struct { comptime { assert(@sizeOf(Header) == 128); } /// A checksum covering only the rest of this header (but including checksum_body): /// This enables the header to be trusted without having to recv() or read() associated body. /// This checksum is enough to uniquely identify a network message or journal entry. checksum: u128 = 0, /// A checksum covering only associated body. checksum_body: u128 = 0, /// The checksum of the message to which this message refers, or a unique recovery nonce: /// We use this nonce in various ways, for example: /// * A prepare sets nonce to the checksum of the prior prepare to create a hash chain. /// * A prepare_ok sets nonce to the checksum of the prepare it wants to ack. /// * A commit sets nonce to the checksum of the latest committed op. /// This adds an additional cryptographic safety control beyond VR's op and commit numbers. nonce: u128 = 0, /// Each client records its own client id and a current request number. A client is allowed to /// have just one outstanding request at a time. client: u128 = 0, /// The cluster id binds intention into the header, so that a client or replica can indicate /// which cluster it thinks it's speaking to, instead of accidentally talking to the wrong /// cluster (for example, staging vs production). cluster: u128, /// Every message sent from one replica to another contains the sending replica's current view: view: u64 = 0, /// The op number: op: u64 = 0, /// The commit number: commit: u64 = 0, /// The journal offset to which this message relates: /// This enables direct access to a prepare, without requiring previous variable-length entries. /// While we use fixed-size data structures, a batch will contain a variable amount of them. offset: u64 = 0, /// The size of this message header and any associated body: /// This must be 0 for an empty header with command == .reserved. size: u32 = @sizeOf(Header), /// The cluster reconfiguration epoch number (for future use): epoch: u32 = 0, /// Each request is given a number by the client and later requests must have larger numbers /// than earlier ones. The request number is used by the replicas to avoid running requests more /// than once; it is also used by the client to discard duplicate responses to its requests. request: u32 = 0, /// The index of the replica in the cluster configuration array that originated this message: /// This only identifies the ultimate author because messages may be forwarded amongst replicas. replica: u16 = 0, /// The VR protocol command for this message: command: Command, /// The state machine operation to apply: operation: Operation = .reserved, pub fn calculate_checksum(self: *const Header) u128 { const checksum_size = @sizeOf(@TypeOf(self.checksum)); assert(checksum_size == 16); var target: [32]u8 = undefined; std.crypto.hash.Blake3.hash(std.mem.asBytes(self)[checksum_size..], target[0..], .{}); return @bitCast(u128, target[0..checksum_size].*); } pub fn calculate_checksum_body(self: *const Header, body: []const u8) u128 { assert(self.size == @sizeOf(Header) + body.len); const checksum_size = @sizeOf(@TypeOf(self.checksum_body)); assert(checksum_size == 16); var target: [32]u8 = undefined; std.crypto.hash.Blake3.hash(body[0..], target[0..], .{}); return @bitCast(u128, target[0..checksum_size].*); } /// This must be called only after set_checksum_body() so that checksum_body is also covered: pub fn set_checksum(self: *Header) void { self.checksum = self.calculate_checksum(); } pub fn set_checksum_body(self: *Header, body: []const u8) void { self.checksum_body = self.calculate_checksum_body(body); } pub fn valid_checksum(self: *const Header) bool { return self.checksum == self.calculate_checksum(); } pub fn valid_checksum_body(self: *const Header, body: []const u8) bool { return self.checksum_body == self.calculate_checksum_body(body); } /// Returns null if all fields are set correctly according to the command, or else a warning. /// This does not verify that checksum is valid, and expects that this has already been done. pub fn invalid(self: *const Header) ?[]const u8 { if (self.size < @sizeOf(Header)) return "size < @sizeOf(Header)"; if (self.epoch != 0) return "epoch != 0"; return switch (self.command) { .reserved => self.invalid_reserved(), .request => self.invalid_request(), .prepare => self.invalid_prepare(), .prepare_ok => self.invalid_prepare_ok(), else => return null, // TODO Add validators for all commands. }; } fn invalid_reserved(self: *const Header) ?[]const u8 { assert(self.command == .reserved); if (self.nonce != 0) return "nonce != 0"; if (self.client != 0) return "client != 0"; if (self.cluster != 0) return "cluster != 0"; if (self.view != 0) return "view != 0"; if (self.op != 0) return "op != 0"; if (self.commit != 0) return "commit != 0"; if (self.offset != 0) return "offset != 0"; if (self.request != 0) return "request != 0"; if (self.replica != 0) return "replica != 0"; if (self.operation != .reserved) return "operation != .reserved"; return null; } fn invalid_request(self: *const Header) ?[]const u8 { assert(self.command == .request); if (self.nonce != 0) return "nonce != 0"; if (self.client == 0) return "client == 0"; if (self.cluster == 0) return "cluster == 0"; if (self.view != 0) return "view != 0"; if (self.op != 0) return "op != 0"; if (self.commit != 0) return "commit != 0"; if (self.offset != 0) return "offset != 0"; if (self.request == 0) return "request == 0"; if (self.replica != 0) return "replica != 0"; if (self.operation == .reserved) return "operation == .reserved"; return null; } fn invalid_prepare(self: *const Header) ?[]const u8 { assert(self.command == .prepare); switch (self.operation) { .reserved => return "operation == .reserved", .init => { if (self.nonce != 0) return "init: nonce != 0"; if (self.client != 0) return "init: client != 0"; if (self.cluster == 0) return "init: cluster == 0"; if (self.view != 0) return "init: view != 0"; if (self.op != 0) return "init: op != 0"; if (self.commit != 0) return "init: commit != 0"; if (self.offset != 0) return "init: offset != 0"; if (self.size != @sizeOf(Header)) return "init: size != @sizeOf(Header)"; if (self.request != 0) return "init: request != 0"; if (self.replica != 0) return "init: replica != 0"; }, else => { if (self.client == 0) return "client == 0"; if (self.cluster == 0) return "cluster == 0"; if (self.op == 0) return "op == 0"; if (self.op <= self.commit) return "op <= commit"; if (self.request == 0) return "request == 0"; }, } return null; } fn invalid_prepare_ok(self: *const Header) ?[]const u8 { assert(self.command == .prepare_ok); if (self.size != @sizeOf(Header)) return "size != @sizeOf(Header)"; if (self.cluster == 0) return "cluster == 0"; switch (self.operation) { .reserved => return "operation == .reserved", .init => { if (self.nonce != 0) return "init: nonce != 0"; if (self.client != 0) return "init: client != 0"; if (self.view != 0) return "init: view != 0"; if (self.op != 0) return "init: op != 0"; if (self.commit != 0) return "init: commit != 0"; if (self.offset != 0) return "init: offset != 0"; if (self.request != 0) return "init: request != 0"; if (self.replica != 0) return "init: replica != 0"; }, else => { if (self.client == 0) return "client == 0"; if (self.op == 0) return "op == 0"; if (self.op <= self.commit) return "op <= commit"; if (self.request == 0) return "request == 0"; }, } return null; } /// Returns whether the immediate sender is a replica or client (if this can be determined). /// Some commands such as .request or .prepare may be forwarded on to other replicas so that /// Header.replica or Header.client only identifies the ultimate origin, not the latest peer. pub fn peer_type(self: *const Header) enum { unknown, replica, client } { switch (self.command) { .reserved => unreachable, // These messages cannot identify the peer as they may have been forwarded: .request, .prepare => return .unknown, // These messages identify the peer as either a replica or a client: .ping, .pong => { if (self.client > 0) { assert(self.replica == 0); return .client; } else { return .replica; } }, // All other messages identify the peer as a replica: else => return .replica, } } pub fn reserved() Header { var header = Header{ .command = .reserved, .cluster = 0 }; header.set_checksum_body(&[0]u8{}); header.set_checksum(); assert(header.invalid() == null); return header; } }; const Client = struct {}; // TODO Client table should warn if the client's request number has wrapped past 32 bits. // This is easy to detect. // If a client has done a few billion requests, we don't expect to see request 0 come through. const ClientTable = struct {}; pub const Timeout = struct { name: []const u8, /// TODO: get rid of this field as this is used by Client as well replica: u16, after: u64, ticks: u64 = 0, ticking: bool = false, /// It's important to check that when fired() is acted on that the timeout is stopped/started, /// otherwise further ticks around the event loop may trigger a thundering herd of messages. pub fn fired(self: *Timeout) bool { if (self.ticking and self.ticks >= self.after) { log.debug("{}: {s} fired", .{ self.replica, self.name }); if (self.ticks > self.after) { log.emerg("{}: {s} is firing every tick", .{ self.replica, self.name }); @panic("timeout was not reset correctly"); } return true; } else { return false; } } pub fn reset(self: *Timeout) void { assert(self.ticking); self.ticks = 0; log.debug("{}: {s} reset", .{ self.replica, self.name }); } pub fn start(self: *Timeout) void { self.ticks = 0; self.ticking = true; log.debug("{}: {s} started", .{ self.replica, self.name }); } pub fn stop(self: *Timeout) void { self.ticks = 0; self.ticking = false; log.debug("{}: {s} stopped", .{ self.replica, self.name }); } pub fn tick(self: *Timeout) void { if (self.ticking) self.ticks += 1; } }; /// Returns An array containing the remote or local addresses of each of the 2f + 1 replicas: /// Unlike the VRR paper, we do not sort the array but leave the order explicitly to the user. /// There are several advantages to this: /// * The operator may deploy a cluster with proximity in mind since replication follows order. /// * A replica's IP address may be changed without reconfiguration. /// This does require that the user specify the same order to all replicas. /// The caller owns the memory of the returned slice of addresses. /// TODO Unit tests. /// TODO Integrate into `src/cli.zig`. pub fn parse_configuration(allocator: *std.mem.Allocator, raw: []const u8) ![]std.net.Address { var addresses = try allocator.alloc(std.net.Address, config.replicas_max); errdefer allocator.free(addresses); var index: usize = 0; var comma_iterator = std.mem.split(raw, ","); while (comma_iterator.next()) |raw_address| : (index += 1) { if (raw_address.len == 0) return error.AddressHasTrailingComma; if (index == config.replicas_max) return error.AddressLimitExceeded; var colon_iterator = std.mem.split(raw_address, ":"); // The split iterator will always return non-null once, even if the delimiter is not found: const raw_ipv4 = colon_iterator.next().?; if (colon_iterator.next()) |raw_port| { if (colon_iterator.next() != null) return error.AddressHasMoreThanOneColon; const port = std.fmt.parseUnsigned(u16, raw_port, 10) catch |err| switch (err) { error.Overflow => return error.PortOverflow, error.InvalidCharacter => return error.PortInvalid, }; addresses[index] = std.net.Address.parseIp4(raw_ipv4, port) catch { return error.AddressInvalid; }; } else { // There was no colon in the address so there are now two cases: // 1. an IPv4 address with the default port, or // 2. a port with the default IPv4 address. // Let's try parsing as a port first: if (std.fmt.parseUnsigned(u16, raw_address, 10)) |port| { addresses[index] = std.net.Address.parseIp4(config.address, port) catch unreachable; } else |err| switch (err) { error.Overflow => return error.PortOverflow, error.InvalidCharacter => { // Something was not a digit, let's try parsing as an IPv4 instead: addresses[index] = std.net.Address.parseIp4(raw_address, config.port) catch { return error.AddressInvalid; }; }, } } } return addresses[0..index]; }
src/vr.zig
const std = @import("std"); const Answer = struct { @"0": u32, @"1": u32 }; const Point = struct { x: usize, y: usize }; const Neighbors = struct { items: [8]Point, len: usize }; const PathMap = std.StringHashMap(std.ArrayList([]const u8)); fn isSmall(name: []const u8) bool { return std.ascii.isLower(name[0]); } fn addPath(paths: *PathMap, from: []const u8, to: []const u8, arena: *std.heap.ArenaAllocator) !void { if (paths.getPtr(from)) |tos| { try tos.append(to); } else { var tos = std.ArrayList([]const u8).init(&arena.allocator); try tos.append(to); try paths.put(from, tos); } } fn countPaths(paths: PathMap, from: []const u8, to: []const u8, visited: *std.StringHashMap(u32), allow_revisits: bool) error{OutOfMemory}!u32 { if (std.mem.eql(u8, from, to)) { return 1; } else { var max_visited_count: u32 = 0; var it = visited.valueIterator(); while (it.next()) |visited_count| { max_visited_count = @maximum(visited_count.*, max_visited_count); } var num_paths: u32 = 0; for (paths.get(from).?.items) |to_next| { const valid_next = !isSmall(to_next) or if (allow_revisits) (visited.get(to_next).? == 0 or (max_visited_count < 2 and !std.mem.eql(u8, "start", to_next))) else (visited.get(to_next).? == 0); if (valid_next) { if (isSmall(to_next)) { visited.getPtr(to_next).?.* += 1; } num_paths += try countPaths(paths, to_next, to, visited, allow_revisits); if (isSmall(to_next)) { visited.getPtr(to_next).?.* -= 1; } } } return num_paths; } } fn run(filename: []const u8) !Answer { const file = try std.fs.cwd().openFile(filename, .{ .read = true }); defer file.close(); var reader = std.io.bufferedReader(file.reader()).reader(); var buffer: [4096]u8 = undefined; var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); var arena = std.heap.ArenaAllocator.init(&gpa.allocator); defer arena.deinit(); var node_names = std.StringHashMap(void).init(&arena.allocator); var paths = std.StringHashMap(std.ArrayList([]const u8)).init(&arena.allocator); while (try reader.readUntilDelimiterOrEof(&buffer, '\n')) |line| { var tokens = std.mem.tokenize(u8, line, "-"); const from = tokens.next().?; try node_names.put(try arena.allocator.dupe(u8, from), undefined); const to = tokens.next().?; try node_names.put(try arena.allocator.dupe(u8, to), undefined); try addPath(&paths, node_names.getKey(from).?, node_names.getKey(to).?, &arena); try addPath(&paths, node_names.getKey(to).?, node_names.getKey(from).?, &arena); } var visited = std.StringHashMap(u32).init(&arena.allocator); var it = node_names.keyIterator(); while (it.next()) |key| { if (std.mem.eql(u8, key.*, "start")) { try visited.put(key.*, 1); } else { try visited.put(key.*, 0); } } const num_paths1 = try countPaths(paths, node_names.getKey("start").?, node_names.getKey("end").?, &visited, false); const num_paths2 = try countPaths(paths, node_names.getKey("start").?, node_names.getKey("end").?, &visited, true); return Answer{ .@"0" = num_paths1, .@"1" = num_paths2 }; } pub fn main() !void { const answer = try run("inputs/" ++ @typeName(@This()) ++ ".txt"); std.debug.print("{d}\n", .{answer.@"0"}); std.debug.print("{d}\n", .{answer.@"1"}); } test { const answer = try run("test-inputs/" ++ @typeName(@This()) ++ ".txt"); try std.testing.expectEqual(@as(u32, 10), answer.@"0"); try std.testing.expectEqual(@as(u32, 36), answer.@"1"); }
src/day12.zig
const std = @import("std"); const testing = std.testing; const main = @import("main.zig"); const wcwidth = main.wcwidth; const wcswidth = main.wcswidth; const sliceWidth = main.sliceWidth; test "null character" { try testing.expectEqual(@as(isize, 0), wcwidth(0)); } test "simple ascii characters" { try testing.expectEqual(@as(isize, 1), wcwidth('a')); try testing.expectEqual(@as(isize, 1), wcwidth('1')); try testing.expectEqual(@as(isize, 1), wcwidth('-')); } test "hello jp" { const phrase = "コンニチハ, セカイ!"; const expect_length_each = [_]isize{ 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 1 }; const expect_length_phrase = comptime blk: { var sum: isize = 0; for (expect_length_each) |x| sum += x; break :blk sum; }; // Check individual widths var utf8 = (try std.unicode.Utf8View.init(phrase)).iterator(); var i: usize = 0; while (utf8.nextCodepoint()) |codepoint| : (i += 1) { try testing.expectEqual(expect_length_each[i], wcwidth(codepoint)); } // Check phrase width try testing.expectEqual(expect_length_phrase, try sliceWidth(phrase)); } test "csi width -1" { const phrase = "\x1B[0m"; const expect_length_each = [_]isize{ -1, 1, 1, 1 }; const expect_length_phrase: isize = -1; // Check individual widths var utf8 = (try std.unicode.Utf8View.init(phrase)).iterator(); var i: usize = 0; while (utf8.nextCodepoint()) |codepoint| : (i += 1) { try testing.expectEqual(expect_length_each[i], wcwidth(codepoint)); } // Check phrase width try testing.expectEqual(expect_length_phrase, try sliceWidth(phrase)); } test "combining total 4" { const phrase = "--\u{05BF}--"; const expect_length_each = [_]isize{ 1, 1, 0, 1, 1 }; const expect_length_phrase: isize = 4; // Check individual widths var utf8 = (try std.unicode.Utf8View.init(phrase)).iterator(); var i: usize = 0; while (utf8.nextCodepoint()) |codepoint| : (i += 1) { try testing.expectEqual(expect_length_each[i], wcwidth(codepoint)); } // Check phrase width try testing.expectEqual(expect_length_phrase, try sliceWidth(phrase)); } test "combining cafe" { const phrase = "cafe\u{0301}"; const expect_length_each = [_]isize{ 1, 1, 1, 1, 0 }; const expect_length_phrase: isize = 4; // Check individual widths var utf8 = (try std.unicode.Utf8View.init(phrase)).iterator(); var i: usize = 0; while (utf8.nextCodepoint()) |codepoint| : (i += 1) { try testing.expectEqual(expect_length_each[i], wcwidth(codepoint)); } // Check phrase width try testing.expectEqual(expect_length_phrase, try sliceWidth(phrase)); } test "combining enclosing" { const phrase = "\u{0401}\u{0488}"; const expect_length_each = [_]isize{ 1, 0 }; const expect_length_phrase: isize = 1; // Check individual widths var utf8 = (try std.unicode.Utf8View.init(phrase)).iterator(); var i: usize = 0; while (utf8.nextCodepoint()) |codepoint| : (i += 1) { try testing.expectEqual(expect_length_each[i], wcwidth(codepoint)); } // Check phrase width try testing.expectEqual(expect_length_phrase, try sliceWidth(phrase)); } test "combining spacing" { const phrase = "\u{1B13}\u{1B28}\u{1B2E}\u{1B44}"; const expect_length_each = [_]isize{ 1, 1, 1, 1 }; const expect_length_phrase: isize = 4; // Check individual widths var utf8 = (try std.unicode.Utf8View.init(phrase)).iterator(); var i: usize = 0; while (utf8.nextCodepoint()) |codepoint| : (i += 1) { try testing.expectEqual(expect_length_each[i], wcwidth(codepoint)); } // Check phrase width try testing.expectEqual(expect_length_phrase, try sliceWidth(phrase)); }
src/test.zig
const boot = @import("bootboot.zig"); const FrameBuffer = @import("framebuffer.zig").FrameBuffer; const Position = @import("framebuffer.zig").Position; const Color = @import("framebuffer.zig").Color; const FrameBufferType = @import("framebuffer.zig").FrameBufferType; const PSFont = @import("psfont.zig").PSFont; const DefaultFont = @import("psfont.zig").DefaultFont; const Renderer = @import("renderer.zig").Renderer; const Direction = @import("renderer.zig").Direction; const fmt = @import("std").fmt; const portio = @import("arch/x86_64/portio.zig"); const ArchFunctions = @import("arch/arch.zig").ArchFunctions; export fn _start() void { var bootId = boot.bootboot.bspId; ArchFunctions.suspendMultiCores(); ArchFunctions.init(); ArchFunctions.uartWrite("Starting ][os...\n"); var frameBuffer = FrameBuffer{ .address = boot.bootboot.frameBuffer.address, .size = boot.bootboot.frameBuffer.size, .width = boot.bootboot.frameBuffer.width, .height = boot.bootboot.frameBuffer.height, .scanLine = boot.bootboot.frameBuffer.scanLine, .colorEncoding = @intToEnum(FrameBufferType, boot.bootboot.fbType), }; kmain(&boot.bootboot, frameBuffer); ArchFunctions.halt(); } fn kmain(bootHeader: *boot.Bootboot, frameBuffer: FrameBuffer) void { var render = Renderer{ .framebuffer = frameBuffer }; const green = frameBuffer.getColor(0, 0x8f, 0xb5, 0x3c); const red = frameBuffer.getColor(0, 0xe8, 0x55, 0x00); const violet = frameBuffer.getColor(0, 0x65, 0x2b, 0x91); const topLeft: Position = .{ .x = 100, .y = 50 }; const width = 100; const height = 100; bootScreen(&render); render.drawRectangle(topLeft, width, height, red); render.drawRectangle(topLeft.offsetX(2 * width), width, height, green); render.drawRectangle(topLeft.offsetX(4 * width), width, height, violet); render.fillRectangle(topLeft.offsetY(100).offsetX(width), width, height, red); render.fillRectangle(topLeft.offsetY(100).offsetX(3 * width), width, height, green); render.fillRectangle(topLeft.offsetY(100).offsetX(5 * width), width, height, violet); puts(&render, DefaultFont, "][ nobloat/os -> https://github.com/nobloat/os", violet); var buff = [_]u8{0} ** (200); _ = fmt.bufPrint(buff[0..], "Cores: {}, BSP-ID: {}, TimeZone: (GMT {}), Init-Ramdisk Size: {} ", .{ bootHeader.numcores, bootHeader.bspId, bootHeader.timezone, bootHeader.initrdSize }) catch unreachable; puts(&render, DefaultFont, buff[0..], green); } fn bootScreen(render: *Renderer) void { const background = render.framebuffer.getColor(0, 0xf7, 0xf8, 0xf9); render.fillRectangle(.{ .x = 0, .y = 0 }, render.framebuffer.width, render.framebuffer.height, background); } fn puts(render: *Renderer, font: PSFont, string: []const u8, color: Color) void { var x: u32 = 100; var y: u32 = 100; var target = render.getTarget(.{ .x = 10, .y = 10 }, font.header.width, font.header.height); for (string) |c| { if (c == 0) { break; } font.Render(&target, c, color); target.topLeft.x += 10; } }
kernel/main.zig
const std = @import("std"); const mem = std.mem; pub fn Reader(comptime Socket: type, comptime buffer_size: usize) type { return struct { const Self = @This(); socket: *Socket, buf: [buffer_size]u8 = undefined, pos: usize = 0, pub inline fn init(socket: *Socket) Self { return Self{ .socket = socket }; } pub inline fn reset(self: *Self) void { self.pos = 0; } pub inline fn readUntil(self: *Self, delimiter: []const u8) ![]const u8 { while (true) { if (self.pos >= buffer_size) return error.BufferOverflow; const num_bytes = try self.socket.read(self.buf[self.pos..]); if (num_bytes == 0) return error.EndOfStream; self.pos += num_bytes; if (mem.indexOf(u8, self.buf[0..self.pos], delimiter)) |i| { return self.buf[0 .. i + 1]; } } } pub inline fn readLine(self: *Self) ![]const u8 { return self.readUntil("\n"); } pub inline fn peek(self: *Self, amount: usize) !void { if (self.pos >= amount) return; while (self.pos < amount) { const num_bytes = try self.socket.read(self.buf[self.pos..]); if (num_bytes == 0) return error.EndOfStream; self.pos += num_bytes; } } pub inline fn shift(self: *Self, amount: usize) void { mem.copy(u8, self.buf[0 .. self.pos - amount], self.buf[amount..self.pos]); self.pos -= amount; } }; } pub fn Writer(comptime Socket: type, comptime buffer_size: usize) type { return struct { const Self = @This(); socket: *Socket, buf: [buffer_size]u8 = undefined, pos: usize = 0, pub inline fn init(socket: *Socket) Self { return Self{ .socket = socket }; } pub inline fn write(self: *Self, buf: []const u8) !void { mem.copy(u8, try self.peek(buf.len), buf); } pub inline fn peek(self: *Self, size: usize) ![]u8 { if (size > buffer_size) return error.RequestedSizeToolarge; if (self.pos + size > buffer_size) try self.shift(buffer_size - size); defer self.pos += size; return self.buf[self.pos..][0..size]; } pub inline fn flush(self: *Self) !void { return self.shift(null); } pub inline fn shift(self: *Self, amount: ?usize) !void { const required_leftover_space = amount orelse 0; while (self.pos > required_leftover_space) { const num_bytes = try self.socket.write(self.buf[0..self.pos]); if (num_bytes == 0) return error.EndOfStream; self.pos -= num_bytes; } } }; }
io.zig
pub const CTL_E_ILLEGALFUNCTIONCALL = @as(i32, -2146828283); pub const CONNECT_E_FIRST = @as(i32, -2147220992); pub const SELFREG_E_FIRST = @as(i32, -2147220992); pub const PERPROP_E_FIRST = @as(i32, -2147220992); pub const OLECMDERR_E_FIRST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147221248)); pub const OLECMDERR_E_DISABLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147221247)); pub const OLECMDERR_E_NOHELP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147221246)); pub const OLECMDERR_E_CANCELED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147221245)); pub const OLECMDERR_E_UNKNOWNGROUP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147221244)); pub const CONNECT_E_NOCONNECTION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220992)); pub const CONNECT_E_ADVISELIMIT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220991)); pub const CONNECT_E_CANNOTCONNECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220990)); pub const CONNECT_E_OVERRIDDEN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220989)); pub const SELFREG_E_TYPELIB = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220992)); pub const SELFREG_E_CLASS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220991)); pub const PERPROP_E_NOPAGEAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220992)); pub const CLSID_CFontPropPage = Guid.initString("0be35200-8f91-11ce-9de3-00aa004bb851"); pub const CLSID_CColorPropPage = Guid.initString("0be35201-8f91-11ce-9de3-00aa004bb851"); pub const CLSID_CPicturePropPage = Guid.initString("0be35202-8f91-11ce-9de3-00aa004bb851"); pub const CLSID_PersistPropset = Guid.initString("fb8f0821-0164-101b-84ed-08002b2ec713"); pub const CLSID_ConvertVBX = Guid.initString("fb8f0822-0164-101b-84ed-08002b2ec713"); pub const CLSID_StdFont = Guid.initString("0be35203-8f91-11ce-9de3-00aa004bb851"); pub const CLSID_StdPicture = Guid.initString("0be35204-8f91-11ce-9de3-00aa004bb851"); pub const GUID_HIMETRIC = Guid.initString("66504300-be0f-101a-8bbb-00aa00300cab"); pub const GUID_COLOR = Guid.initString("66504301-be0f-101a-8bbb-00aa00300cab"); pub const GUID_XPOSPIXEL = Guid.initString("66504302-be0f-101a-8bbb-00aa00300cab"); pub const GUID_YPOSPIXEL = Guid.initString("66504303-be0f-101a-8bbb-00aa00300cab"); pub const GUID_XSIZEPIXEL = Guid.initString("66504304-be0f-101a-8bbb-00aa00300cab"); pub const GUID_YSIZEPIXEL = Guid.initString("66504305-be0f-101a-8bbb-00aa00300cab"); pub const GUID_XPOS = Guid.initString("66504306-be0f-101a-8bbb-00aa00300cab"); pub const GUID_YPOS = Guid.initString("66504307-be0f-101a-8bbb-00aa00300cab"); pub const GUID_XSIZE = Guid.initString("66504308-be0f-101a-8bbb-00aa00300cab"); pub const GUID_YSIZE = Guid.initString("66504309-be0f-101a-8bbb-00aa00300cab"); pub const GUID_TRISTATE = Guid.initString("6650430a-be0f-101a-8bbb-00aa00300cab"); pub const GUID_OPTIONVALUEEXCLUSIVE = Guid.initString("6650430b-be0f-101a-8bbb-00aa00300cab"); pub const GUID_CHECKVALUEEXCLUSIVE = Guid.initString("6650430c-be0f-101a-8bbb-00aa00300cab"); pub const GUID_FONTNAME = Guid.initString("6650430d-be0f-101a-8bbb-00aa00300cab"); pub const GUID_FONTSIZE = Guid.initString("6650430e-be0f-101a-8bbb-00aa00300cab"); pub const GUID_FONTBOLD = Guid.initString("6650430f-be0f-101a-8bbb-00aa00300cab"); pub const GUID_FONTITALIC = Guid.initString("66504310-be0f-101a-8bbb-00aa00300cab"); pub const GUID_FONTUNDERSCORE = Guid.initString("66504311-be0f-101a-8bbb-00aa00300cab"); pub const GUID_FONTSTRIKETHROUGH = Guid.initString("66504312-be0f-101a-8bbb-00aa00300cab"); pub const GUID_HANDLE = Guid.initString("66504313-be0f-101a-8bbb-00aa00300cab"); pub const PICTYPE_UNINITIALIZED = @as(i32, -1); pub const PICTYPE_NONE = @as(u32, 0); pub const PICTYPE_BITMAP = @as(u32, 1); pub const PICTYPE_METAFILE = @as(u32, 2); pub const PICTYPE_ICON = @as(u32, 3); pub const PICTYPE_ENHMETAFILE = @as(u32, 4); pub const CONNECT_E_LAST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220977)); pub const CONNECT_S_FIRST = @import("../zig.zig").typedConst(HRESULT, @as(i32, 262656)); pub const CONNECT_S_LAST = @import("../zig.zig").typedConst(HRESULT, @as(i32, 262671)); pub const SELFREG_E_LAST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220977)); pub const SELFREG_S_FIRST = @import("../zig.zig").typedConst(HRESULT, @as(i32, 262656)); pub const SELFREG_S_LAST = @import("../zig.zig").typedConst(HRESULT, @as(i32, 262671)); pub const PERPROP_E_LAST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220977)); pub const PERPROP_S_FIRST = @import("../zig.zig").typedConst(HRESULT, @as(i32, 262656)); pub const PERPROP_S_LAST = @import("../zig.zig").typedConst(HRESULT, @as(i32, 262671)); pub const OLEIVERB_PROPERTIES = @as(i32, -7); pub const VT_STREAMED_PROPSET = @as(u32, 73); pub const VT_STORED_PROPSET = @as(u32, 74); pub const VT_BLOB_PROPSET = @as(u32, 75); pub const VT_VERBOSE_ENUM = @as(u32, 76); pub const OCM__BASE = @as(u32, 8192); pub const LP_DEFAULT = @as(u32, 0); pub const LP_MONOCHROME = @as(u32, 1); pub const LP_VGACOLOR = @as(u32, 2); pub const LP_COLOR = @as(u32, 4); pub const DISPID_AUTOSIZE = @as(i32, -500); pub const DISPID_BACKCOLOR = @as(i32, -501); pub const DISPID_BACKSTYLE = @as(i32, -502); pub const DISPID_BORDERCOLOR = @as(i32, -503); pub const DISPID_BORDERSTYLE = @as(i32, -504); pub const DISPID_BORDERWIDTH = @as(i32, -505); pub const DISPID_DRAWMODE = @as(i32, -507); pub const DISPID_DRAWSTYLE = @as(i32, -508); pub const DISPID_DRAWWIDTH = @as(i32, -509); pub const DISPID_FILLCOLOR = @as(i32, -510); pub const DISPID_FILLSTYLE = @as(i32, -511); pub const DISPID_FONT = @as(i32, -512); pub const DISPID_FORECOLOR = @as(i32, -513); pub const DISPID_ENABLED = @as(i32, -514); pub const DISPID_HWND = @as(i32, -515); pub const DISPID_TABSTOP = @as(i32, -516); pub const DISPID_TEXT = @as(i32, -517); pub const DISPID_CAPTION = @as(i32, -518); pub const DISPID_BORDERVISIBLE = @as(i32, -519); pub const DISPID_APPEARANCE = @as(i32, -520); pub const DISPID_MOUSEPOINTER = @as(i32, -521); pub const DISPID_MOUSEICON = @as(i32, -522); pub const DISPID_PICTURE = @as(i32, -523); pub const DISPID_VALID = @as(i32, -524); pub const DISPID_READYSTATE = @as(i32, -525); pub const DISPID_LISTINDEX = @as(i32, -526); pub const DISPID_SELECTED = @as(i32, -527); pub const DISPID_LIST = @as(i32, -528); pub const DISPID_COLUMN = @as(i32, -529); pub const DISPID_LISTCOUNT = @as(i32, -531); pub const DISPID_MULTISELECT = @as(i32, -532); pub const DISPID_MAXLENGTH = @as(i32, -533); pub const DISPID_PASSWORDCHAR = @as(i32, -534); pub const DISPID_SCROLLBARS = @as(i32, -535); pub const DISPID_WORDWRAP = @as(i32, -536); pub const DISPID_MULTILINE = @as(i32, -537); pub const DISPID_NUMBEROFROWS = @as(i32, -538); pub const DISPID_NUMBEROFCOLUMNS = @as(i32, -539); pub const DISPID_DISPLAYSTYLE = @as(i32, -540); pub const DISPID_GROUPNAME = @as(i32, -541); pub const DISPID_IMEMODE = @as(i32, -542); pub const DISPID_ACCELERATOR = @as(i32, -543); pub const DISPID_ENTERKEYBEHAVIOR = @as(i32, -544); pub const DISPID_TABKEYBEHAVIOR = @as(i32, -545); pub const DISPID_SELTEXT = @as(i32, -546); pub const DISPID_SELSTART = @as(i32, -547); pub const DISPID_SELLENGTH = @as(i32, -548); pub const DISPID_REFRESH = @as(i32, -550); pub const DISPID_DOCLICK = @as(i32, -551); pub const DISPID_ABOUTBOX = @as(i32, -552); pub const DISPID_ADDITEM = @as(i32, -553); pub const DISPID_CLEAR = @as(i32, -554); pub const DISPID_REMOVEITEM = @as(i32, -555); pub const DISPID_CLICK = @as(i32, -600); pub const DISPID_DBLCLICK = @as(i32, -601); pub const DISPID_KEYDOWN = @as(i32, -602); pub const DISPID_KEYPRESS = @as(i32, -603); pub const DISPID_KEYUP = @as(i32, -604); pub const DISPID_MOUSEDOWN = @as(i32, -605); pub const DISPID_MOUSEMOVE = @as(i32, -606); pub const DISPID_MOUSEUP = @as(i32, -607); pub const DISPID_ERROREVENT = @as(i32, -608); pub const DISPID_READYSTATECHANGE = @as(i32, -609); pub const DISPID_CLICK_VALUE = @as(i32, -610); pub const DISPID_RIGHTTOLEFT = @as(i32, -611); pub const DISPID_TOPTOBOTTOM = @as(i32, -612); pub const DISPID_AMBIENT_BACKCOLOR = @as(i32, -701); pub const DISPID_AMBIENT_DISPLAYNAME = @as(i32, -702); pub const DISPID_AMBIENT_FONT = @as(i32, -703); pub const DISPID_AMBIENT_FORECOLOR = @as(i32, -704); pub const DISPID_AMBIENT_LOCALEID = @as(i32, -705); pub const DISPID_AMBIENT_MESSAGEREFLECT = @as(i32, -706); pub const DISPID_AMBIENT_SCALEUNITS = @as(i32, -707); pub const DISPID_AMBIENT_TEXTALIGN = @as(i32, -708); pub const DISPID_AMBIENT_USERMODE = @as(i32, -709); pub const DISPID_AMBIENT_UIDEAD = @as(i32, -710); pub const DISPID_AMBIENT_SHOWGRABHANDLES = @as(i32, -711); pub const DISPID_AMBIENT_SHOWHATCHING = @as(i32, -712); pub const DISPID_AMBIENT_DISPLAYASDEFAULT = @as(i32, -713); pub const DISPID_AMBIENT_SUPPORTSMNEMONICS = @as(i32, -714); pub const DISPID_AMBIENT_AUTOCLIP = @as(i32, -715); pub const DISPID_AMBIENT_APPEARANCE = @as(i32, -716); pub const DISPID_AMBIENT_CODEPAGE = @as(i32, -725); pub const DISPID_AMBIENT_PALETTE = @as(i32, -726); pub const DISPID_AMBIENT_CHARSET = @as(i32, -727); pub const DISPID_AMBIENT_TRANSFERPRIORITY = @as(i32, -728); pub const DISPID_AMBIENT_RIGHTTOLEFT = @as(i32, -732); pub const DISPID_AMBIENT_TOPTOBOTTOM = @as(i32, -733); pub const DISPID_Name = @as(i32, -800); pub const DISPID_Delete = @as(i32, -801); pub const DISPID_Object = @as(i32, -802); pub const DISPID_Parent = @as(i32, -803); pub const DISPID_FONT_NAME = @as(u32, 0); pub const DISPID_FONT_SIZE = @as(u32, 2); pub const DISPID_FONT_BOLD = @as(u32, 3); pub const DISPID_FONT_ITALIC = @as(u32, 4); pub const DISPID_FONT_UNDER = @as(u32, 5); pub const DISPID_FONT_STRIKE = @as(u32, 6); pub const DISPID_FONT_WEIGHT = @as(u32, 7); pub const DISPID_FONT_CHARSET = @as(u32, 8); pub const DISPID_FONT_CHANGED = @as(u32, 9); pub const DISPID_PICT_HANDLE = @as(u32, 0); pub const DISPID_PICT_HPAL = @as(u32, 2); pub const DISPID_PICT_TYPE = @as(u32, 3); pub const DISPID_PICT_WIDTH = @as(u32, 4); pub const DISPID_PICT_HEIGHT = @as(u32, 5); pub const DISPID_PICT_RENDER = @as(u32, 6); pub const GC_WCH_SIBLING = @as(i32, 1); pub const TIFLAGS_EXTENDDISPATCHONLY = @as(u32, 1); pub const OLECMD_TASKDLGID_ONBEFOREUNLOAD = @as(u32, 1); pub const OLECMDARGINDEX_SHOWPAGEACTIONMENU_HWND = @as(u32, 0); pub const OLECMDARGINDEX_SHOWPAGEACTIONMENU_X = @as(u32, 1); pub const OLECMDARGINDEX_SHOWPAGEACTIONMENU_Y = @as(u32, 2); pub const OLECMDARGINDEX_ACTIVEXINSTALL_PUBLISHER = @as(u32, 0); pub const OLECMDARGINDEX_ACTIVEXINSTALL_DISPLAYNAME = @as(u32, 1); pub const OLECMDARGINDEX_ACTIVEXINSTALL_CLSID = @as(u32, 2); pub const OLECMDARGINDEX_ACTIVEXINSTALL_INSTALLSCOPE = @as(u32, 3); pub const OLECMDARGINDEX_ACTIVEXINSTALL_SOURCEURL = @as(u32, 4); pub const INSTALL_SCOPE_INVALID = @as(u32, 0); pub const INSTALL_SCOPE_MACHINE = @as(u32, 1); pub const INSTALL_SCOPE_USER = @as(u32, 2); pub const MK_ALT = @as(u32, 32); pub const DROPEFFECT_NONE = @as(u32, 0); pub const DROPEFFECT_COPY = @as(u32, 1); pub const DROPEFFECT_MOVE = @as(u32, 2); pub const DROPEFFECT_LINK = @as(u32, 4); pub const DROPEFFECT_SCROLL = @as(u32, 2147483648); pub const DD_DEFSCROLLINSET = @as(u32, 11); pub const DD_DEFSCROLLDELAY = @as(u32, 50); pub const DD_DEFSCROLLINTERVAL = @as(u32, 50); pub const DD_DEFDRAGDELAY = @as(u32, 200); pub const DD_DEFDRAGMINDIST = @as(u32, 2); pub const OT_LINK = @as(i32, 1); pub const OT_EMBEDDED = @as(i32, 2); pub const OT_STATIC = @as(i32, 3); pub const OLEVERB_PRIMARY = @as(u32, 0); pub const OF_SET = @as(u32, 1); pub const OF_GET = @as(u32, 2); pub const OF_HANDLER = @as(u32, 4); pub const WIN32 = @as(u32, 100); pub const OLEIVERB_PRIMARY = @as(i32, 0); pub const OLEIVERB_SHOW = @as(i32, -1); pub const OLEIVERB_OPEN = @as(i32, -2); pub const OLEIVERB_HIDE = @as(i32, -3); pub const OLEIVERB_UIACTIVATE = @as(i32, -4); pub const OLEIVERB_INPLACEACTIVATE = @as(i32, -5); pub const OLEIVERB_DISCARDUNDOSTATE = @as(i32, -6); pub const EMBDHLP_INPROC_HANDLER = @as(i32, 0); pub const EMBDHLP_INPROC_SERVER = @as(i32, 1); pub const EMBDHLP_CREATENOW = @as(i32, 0); pub const EMBDHLP_DELAYCREATE = @as(i32, 65536); pub const OLECREATE_LEAVERUNNING = @as(u32, 1); pub const IDC_OLEUIHELP = @as(u32, 99); pub const IDC_IO_CREATENEW = @as(u32, 2100); pub const IDC_IO_CREATEFROMFILE = @as(u32, 2101); pub const IDC_IO_LINKFILE = @as(u32, 2102); pub const IDC_IO_OBJECTTYPELIST = @as(u32, 2103); pub const IDC_IO_DISPLAYASICON = @as(u32, 2104); pub const IDC_IO_CHANGEICON = @as(u32, 2105); pub const IDC_IO_FILE = @as(u32, 2106); pub const IDC_IO_FILEDISPLAY = @as(u32, 2107); pub const IDC_IO_RESULTIMAGE = @as(u32, 2108); pub const IDC_IO_RESULTTEXT = @as(u32, 2109); pub const IDC_IO_ICONDISPLAY = @as(u32, 2110); pub const IDC_IO_OBJECTTYPETEXT = @as(u32, 2111); pub const IDC_IO_FILETEXT = @as(u32, 2112); pub const IDC_IO_FILETYPE = @as(u32, 2113); pub const IDC_IO_INSERTCONTROL = @as(u32, 2114); pub const IDC_IO_ADDCONTROL = @as(u32, 2115); pub const IDC_IO_CONTROLTYPELIST = @as(u32, 2116); pub const IDC_PS_PASTE = @as(u32, 500); pub const IDC_PS_PASTELINK = @as(u32, 501); pub const IDC_PS_SOURCETEXT = @as(u32, 502); pub const IDC_PS_PASTELIST = @as(u32, 503); pub const IDC_PS_PASTELINKLIST = @as(u32, 504); pub const IDC_PS_DISPLAYLIST = @as(u32, 505); pub const IDC_PS_DISPLAYASICON = @as(u32, 506); pub const IDC_PS_ICONDISPLAY = @as(u32, 507); pub const IDC_PS_CHANGEICON = @as(u32, 508); pub const IDC_PS_RESULTIMAGE = @as(u32, 509); pub const IDC_PS_RESULTTEXT = @as(u32, 510); pub const IDC_CI_GROUP = @as(u32, 120); pub const IDC_CI_CURRENT = @as(u32, 121); pub const IDC_CI_CURRENTICON = @as(u32, 122); pub const IDC_CI_DEFAULT = @as(u32, 123); pub const IDC_CI_DEFAULTICON = @as(u32, 124); pub const IDC_CI_FROMFILE = @as(u32, 125); pub const IDC_CI_FROMFILEEDIT = @as(u32, 126); pub const IDC_CI_ICONLIST = @as(u32, 127); pub const IDC_CI_LABEL = @as(u32, 128); pub const IDC_CI_LABELEDIT = @as(u32, 129); pub const IDC_CI_BROWSE = @as(u32, 130); pub const IDC_CI_ICONDISPLAY = @as(u32, 131); pub const IDC_CV_OBJECTTYPE = @as(u32, 150); pub const IDC_CV_DISPLAYASICON = @as(u32, 152); pub const IDC_CV_CHANGEICON = @as(u32, 153); pub const IDC_CV_ACTIVATELIST = @as(u32, 154); pub const IDC_CV_CONVERTTO = @as(u32, 155); pub const IDC_CV_ACTIVATEAS = @as(u32, 156); pub const IDC_CV_RESULTTEXT = @as(u32, 157); pub const IDC_CV_CONVERTLIST = @as(u32, 158); pub const IDC_CV_ICONDISPLAY = @as(u32, 165); pub const IDC_EL_CHANGESOURCE = @as(u32, 201); pub const IDC_EL_AUTOMATIC = @as(u32, 202); pub const IDC_EL_CANCELLINK = @as(u32, 209); pub const IDC_EL_UPDATENOW = @as(u32, 210); pub const IDC_EL_OPENSOURCE = @as(u32, 211); pub const IDC_EL_MANUAL = @as(u32, 212); pub const IDC_EL_LINKSOURCE = @as(u32, 216); pub const IDC_EL_LINKTYPE = @as(u32, 217); pub const IDC_EL_LINKSLISTBOX = @as(u32, 206); pub const IDC_EL_COL1 = @as(u32, 220); pub const IDC_EL_COL2 = @as(u32, 221); pub const IDC_EL_COL3 = @as(u32, 222); pub const IDC_BZ_RETRY = @as(u32, 600); pub const IDC_BZ_ICON = @as(u32, 601); pub const IDC_BZ_MESSAGE1 = @as(u32, 602); pub const IDC_BZ_SWITCHTO = @as(u32, 604); pub const IDC_UL_METER = @as(u32, 1029); pub const IDC_UL_STOP = @as(u32, 1030); pub const IDC_UL_PERCENT = @as(u32, 1031); pub const IDC_UL_PROGRESS = @as(u32, 1032); pub const IDC_PU_LINKS = @as(u32, 900); pub const IDC_PU_TEXT = @as(u32, 901); pub const IDC_PU_CONVERT = @as(u32, 902); pub const IDC_PU_ICON = @as(u32, 908); pub const IDC_GP_OBJECTNAME = @as(u32, 1009); pub const IDC_GP_OBJECTTYPE = @as(u32, 1010); pub const IDC_GP_OBJECTSIZE = @as(u32, 1011); pub const IDC_GP_CONVERT = @as(u32, 1013); pub const IDC_GP_OBJECTICON = @as(u32, 1014); pub const IDC_GP_OBJECTLOCATION = @as(u32, 1022); pub const IDC_VP_PERCENT = @as(u32, 1000); pub const IDC_VP_CHANGEICON = @as(u32, 1001); pub const IDC_VP_EDITABLE = @as(u32, 1002); pub const IDC_VP_ASICON = @as(u32, 1003); pub const IDC_VP_RELATIVE = @as(u32, 1005); pub const IDC_VP_SPIN = @as(u32, 1006); pub const IDC_VP_SCALETXT = @as(u32, 1034); pub const IDC_VP_ICONDISPLAY = @as(u32, 1021); pub const IDC_VP_RESULTIMAGE = @as(u32, 1033); pub const IDC_LP_OPENSOURCE = @as(u32, 1006); pub const IDC_LP_UPDATENOW = @as(u32, 1007); pub const IDC_LP_BREAKLINK = @as(u32, 1008); pub const IDC_LP_LINKSOURCE = @as(u32, 1012); pub const IDC_LP_CHANGESOURCE = @as(u32, 1015); pub const IDC_LP_AUTOMATIC = @as(u32, 1016); pub const IDC_LP_MANUAL = @as(u32, 1017); pub const IDC_LP_DATE = @as(u32, 1018); pub const IDC_LP_TIME = @as(u32, 1019); pub const IDD_INSERTOBJECT = @as(u32, 1000); pub const IDD_CHANGEICON = @as(u32, 1001); pub const IDD_CONVERT = @as(u32, 1002); pub const IDD_PASTESPECIAL = @as(u32, 1003); pub const IDD_EDITLINKS = @as(u32, 1004); pub const IDD_BUSY = @as(u32, 1006); pub const IDD_UPDATELINKS = @as(u32, 1007); pub const IDD_CHANGESOURCE = @as(u32, 1009); pub const IDD_INSERTFILEBROWSE = @as(u32, 1010); pub const IDD_CHANGEICONBROWSE = @as(u32, 1011); pub const IDD_CONVERTONLY = @as(u32, 1012); pub const IDD_CHANGESOURCE4 = @as(u32, 1013); pub const IDD_GNRLPROPS = @as(u32, 1100); pub const IDD_VIEWPROPS = @as(u32, 1101); pub const IDD_LINKPROPS = @as(u32, 1102); pub const IDD_CONVERT4 = @as(u32, 1103); pub const IDD_CONVERTONLY4 = @as(u32, 1104); pub const IDD_EDITLINKS4 = @as(u32, 1105); pub const IDD_GNRLPROPS4 = @as(u32, 1106); pub const IDD_LINKPROPS4 = @as(u32, 1107); pub const IDD_PASTESPECIAL4 = @as(u32, 1108); pub const IDD_CANNOTUPDATELINK = @as(u32, 1008); pub const IDD_LINKSOURCEUNAVAILABLE = @as(u32, 1020); pub const IDD_SERVERNOTFOUND = @as(u32, 1023); pub const IDD_OUTOFMEMORY = @as(u32, 1024); pub const IDD_SERVERNOTREGW = @as(u32, 1021); pub const IDD_LINKTYPECHANGEDW = @as(u32, 1022); pub const IDD_SERVERNOTREGA = @as(u32, 1025); pub const IDD_LINKTYPECHANGEDA = @as(u32, 1026); pub const ID_BROWSE_CHANGEICON = @as(u32, 1); pub const ID_BROWSE_INSERTFILE = @as(u32, 2); pub const ID_BROWSE_ADDCONTROL = @as(u32, 3); pub const ID_BROWSE_CHANGESOURCE = @as(u32, 4); pub const OLEUI_FALSE = @as(u32, 0); pub const OLEUI_SUCCESS = @as(u32, 1); pub const OLEUI_OK = @as(u32, 1); pub const OLEUI_CANCEL = @as(u32, 2); pub const OLEUI_ERR_STANDARDMIN = @as(u32, 100); pub const OLEUI_ERR_OLEMEMALLOC = @as(u32, 100); pub const OLEUI_ERR_STRUCTURENULL = @as(u32, 101); pub const OLEUI_ERR_STRUCTUREINVALID = @as(u32, 102); pub const OLEUI_ERR_CBSTRUCTINCORRECT = @as(u32, 103); pub const OLEUI_ERR_HWNDOWNERINVALID = @as(u32, 104); pub const OLEUI_ERR_LPSZCAPTIONINVALID = @as(u32, 105); pub const OLEUI_ERR_LPFNHOOKINVALID = @as(u32, 106); pub const OLEUI_ERR_HINSTANCEINVALID = @as(u32, 107); pub const OLEUI_ERR_LPSZTEMPLATEINVALID = @as(u32, 108); pub const OLEUI_ERR_HRESOURCEINVALID = @as(u32, 109); pub const OLEUI_ERR_FINDTEMPLATEFAILURE = @as(u32, 110); pub const OLEUI_ERR_LOADTEMPLATEFAILURE = @as(u32, 111); pub const OLEUI_ERR_DIALOGFAILURE = @as(u32, 112); pub const OLEUI_ERR_LOCALMEMALLOC = @as(u32, 113); pub const OLEUI_ERR_GLOBALMEMALLOC = @as(u32, 114); pub const OLEUI_ERR_LOADSTRING = @as(u32, 115); pub const OLEUI_ERR_STANDARDMAX = @as(u32, 116); pub const IOF_SHOWHELP = @as(i32, 1); pub const IOF_SELECTCREATENEW = @as(i32, 2); pub const IOF_SELECTCREATEFROMFILE = @as(i32, 4); pub const IOF_CHECKLINK = @as(i32, 8); pub const IOF_CHECKDISPLAYASICON = @as(i32, 16); pub const IOF_CREATENEWOBJECT = @as(i32, 32); pub const IOF_CREATEFILEOBJECT = @as(i32, 64); pub const IOF_CREATELINKOBJECT = @as(i32, 128); pub const IOF_DISABLELINK = @as(i32, 256); pub const IOF_VERIFYSERVERSEXIST = @as(i32, 512); pub const IOF_DISABLEDISPLAYASICON = @as(i32, 1024); pub const IOF_HIDECHANGEICON = @as(i32, 2048); pub const IOF_SHOWINSERTCONTROL = @as(i32, 4096); pub const IOF_SELECTCREATECONTROL = @as(i32, 8192); pub const OLEUI_IOERR_LPSZFILEINVALID = @as(u32, 116); pub const OLEUI_IOERR_LPSZLABELINVALID = @as(u32, 117); pub const OLEUI_IOERR_HICONINVALID = @as(u32, 118); pub const OLEUI_IOERR_LPFORMATETCINVALID = @as(u32, 119); pub const OLEUI_IOERR_PPVOBJINVALID = @as(u32, 120); pub const OLEUI_IOERR_LPIOLECLIENTSITEINVALID = @as(u32, 121); pub const OLEUI_IOERR_LPISTORAGEINVALID = @as(u32, 122); pub const OLEUI_IOERR_SCODEHASERROR = @as(u32, 123); pub const OLEUI_IOERR_LPCLSIDEXCLUDEINVALID = @as(u32, 124); pub const OLEUI_IOERR_CCHFILEINVALID = @as(u32, 125); pub const PS_MAXLINKTYPES = @as(u32, 8); pub const PSF_SHOWHELP = @as(i32, 1); pub const PSF_SELECTPASTE = @as(i32, 2); pub const PSF_SELECTPASTELINK = @as(i32, 4); pub const PSF_CHECKDISPLAYASICON = @as(i32, 8); pub const PSF_DISABLEDISPLAYASICON = @as(i32, 16); pub const PSF_HIDECHANGEICON = @as(i32, 32); pub const PSF_STAYONCLIPBOARDCHANGE = @as(i32, 64); pub const PSF_NOREFRESHDATAOBJECT = @as(i32, 128); pub const OLEUI_IOERR_SRCDATAOBJECTINVALID = @as(u32, 116); pub const OLEUI_IOERR_ARRPASTEENTRIESINVALID = @as(u32, 117); pub const OLEUI_IOERR_ARRLINKTYPESINVALID = @as(u32, 118); pub const OLEUI_PSERR_CLIPBOARDCHANGED = @as(u32, 119); pub const OLEUI_PSERR_GETCLIPBOARDFAILED = @as(u32, 120); pub const OLEUI_ELERR_LINKCNTRNULL = @as(u32, 116); pub const OLEUI_ELERR_LINKCNTRINVALID = @as(u32, 117); pub const ELF_SHOWHELP = @as(i32, 1); pub const ELF_DISABLEUPDATENOW = @as(i32, 2); pub const ELF_DISABLEOPENSOURCE = @as(i32, 4); pub const ELF_DISABLECHANGESOURCE = @as(i32, 8); pub const ELF_DISABLECANCELLINK = @as(i32, 16); pub const CIF_SHOWHELP = @as(i32, 1); pub const CIF_SELECTCURRENT = @as(i32, 2); pub const CIF_SELECTDEFAULT = @as(i32, 4); pub const CIF_SELECTFROMFILE = @as(i32, 8); pub const CIF_USEICONEXE = @as(i32, 16); pub const OLEUI_CIERR_MUSTHAVECLSID = @as(u32, 116); pub const OLEUI_CIERR_MUSTHAVECURRENTMETAFILE = @as(u32, 117); pub const OLEUI_CIERR_SZICONEXEINVALID = @as(u32, 118); pub const CF_SHOWHELPBUTTON = @as(i32, 1); pub const CF_SETCONVERTDEFAULT = @as(i32, 2); pub const CF_SETACTIVATEDEFAULT = @as(i32, 4); pub const CF_SELECTCONVERTTO = @as(i32, 8); pub const CF_SELECTACTIVATEAS = @as(i32, 16); pub const CF_DISABLEDISPLAYASICON = @as(i32, 32); pub const CF_DISABLEACTIVATEAS = @as(i32, 64); pub const CF_HIDECHANGEICON = @as(i32, 128); pub const CF_CONVERTONLY = @as(i32, 256); pub const OLEUI_CTERR_CLASSIDINVALID = @as(u32, 117); pub const OLEUI_CTERR_DVASPECTINVALID = @as(u32, 118); pub const OLEUI_CTERR_CBFORMATINVALID = @as(u32, 119); pub const OLEUI_CTERR_HMETAPICTINVALID = @as(u32, 120); pub const OLEUI_CTERR_STRINGINVALID = @as(u32, 121); pub const BZ_DISABLECANCELBUTTON = @as(i32, 1); pub const BZ_DISABLESWITCHTOBUTTON = @as(i32, 2); pub const BZ_DISABLERETRYBUTTON = @as(i32, 4); pub const BZ_NOTRESPONDINGDIALOG = @as(i32, 8); pub const OLEUI_BZERR_HTASKINVALID = @as(u32, 116); pub const OLEUI_BZ_SWITCHTOSELECTED = @as(u32, 117); pub const OLEUI_BZ_RETRYSELECTED = @as(u32, 118); pub const OLEUI_BZ_CALLUNBLOCKED = @as(u32, 119); pub const CSF_SHOWHELP = @as(i32, 1); pub const CSF_VALIDSOURCE = @as(i32, 2); pub const CSF_ONLYGETSOURCE = @as(i32, 4); pub const CSF_EXPLORER = @as(i32, 8); pub const OLEUI_CSERR_LINKCNTRNULL = @as(u32, 116); pub const OLEUI_CSERR_LINKCNTRINVALID = @as(u32, 117); pub const OLEUI_CSERR_FROMNOTNULL = @as(u32, 118); pub const OLEUI_CSERR_TONOTNULL = @as(u32, 119); pub const OLEUI_CSERR_SOURCENULL = @as(u32, 120); pub const OLEUI_CSERR_SOURCEINVALID = @as(u32, 121); pub const OLEUI_CSERR_SOURCEPARSERROR = @as(u32, 122); pub const OLEUI_CSERR_SOURCEPARSEERROR = @as(u32, 122); pub const VPF_SELECTRELATIVE = @as(i32, 1); pub const VPF_DISABLERELATIVE = @as(i32, 2); pub const VPF_DISABLESCALE = @as(i32, 4); pub const OPF_OBJECTISLINK = @as(i32, 1); pub const OPF_NOFILLDEFAULT = @as(i32, 2); pub const OPF_SHOWHELP = @as(i32, 4); pub const OPF_DISABLECONVERT = @as(i32, 8); pub const OLEUI_OPERR_SUBPROPNULL = @as(u32, 116); pub const OLEUI_OPERR_SUBPROPINVALID = @as(u32, 117); pub const OLEUI_OPERR_PROPSHEETNULL = @as(u32, 118); pub const OLEUI_OPERR_PROPSHEETINVALID = @as(u32, 119); pub const OLEUI_OPERR_SUPPROP = @as(u32, 120); pub const OLEUI_OPERR_PROPSINVALID = @as(u32, 121); pub const OLEUI_OPERR_PAGESINCORRECT = @as(u32, 122); pub const OLEUI_OPERR_INVALIDPAGES = @as(u32, 123); pub const OLEUI_OPERR_NOTSUPPORTED = @as(u32, 124); pub const OLEUI_OPERR_DLGPROCNOTNULL = @as(u32, 125); pub const OLEUI_OPERR_LPARAMNOTZERO = @as(u32, 126); pub const OLEUI_GPERR_STRINGINVALID = @as(u32, 127); pub const OLEUI_GPERR_CLASSIDINVALID = @as(u32, 128); pub const OLEUI_GPERR_LPCLSIDEXCLUDEINVALID = @as(u32, 129); pub const OLEUI_GPERR_CBFORMATINVALID = @as(u32, 130); pub const OLEUI_VPERR_METAPICTINVALID = @as(u32, 131); pub const OLEUI_VPERR_DVASPECTINVALID = @as(u32, 132); pub const OLEUI_LPERR_LINKCNTRNULL = @as(u32, 133); pub const OLEUI_LPERR_LINKCNTRINVALID = @as(u32, 134); pub const OLEUI_OPERR_PROPERTYSHEET = @as(u32, 135); pub const OLEUI_OPERR_OBJINFOINVALID = @as(u32, 136); pub const OLEUI_OPERR_LINKINFOINVALID = @as(u32, 137); pub const OLEUI_QUERY_GETCLASSID = @as(u32, 65280); pub const OLEUI_QUERY_LINKBROKEN = @as(u32, 65281); pub const MKSYS_URLMONIKER = @as(u32, 6); pub const URL_MK_LEGACY = @as(u32, 0); pub const URL_MK_UNIFORM = @as(u32, 1); pub const URL_MK_NO_CANONICALIZE = @as(u32, 2); pub const FIEF_FLAG_FORCE_JITUI = @as(u32, 1); pub const FIEF_FLAG_PEEK = @as(u32, 2); pub const FIEF_FLAG_SKIP_INSTALLED_VERSION_CHECK = @as(u32, 4); pub const FIEF_FLAG_RESERVED_0 = @as(u32, 8); pub const FMFD_DEFAULT = @as(u32, 0); pub const FMFD_URLASFILENAME = @as(u32, 1); pub const FMFD_ENABLEMIMESNIFFING = @as(u32, 2); pub const FMFD_IGNOREMIMETEXTPLAIN = @as(u32, 4); pub const FMFD_SERVERMIME = @as(u32, 8); pub const FMFD_RESPECTTEXTPLAIN = @as(u32, 16); pub const FMFD_RETURNUPDATEDIMGMIMES = @as(u32, 32); pub const FMFD_RESERVED_1 = @as(u32, 64); pub const UAS_EXACTLEGACY = @as(u32, 4096); pub const URLMON_OPTION_USERAGENT = @as(u32, 268435457); pub const URLMON_OPTION_USERAGENT_REFRESH = @as(u32, 268435458); pub const URLMON_OPTION_URL_ENCODING = @as(u32, 268435460); pub const URLMON_OPTION_USE_BINDSTRINGCREDS = @as(u32, 268435464); pub const URLMON_OPTION_USE_BROWSERAPPSDOCUMENTS = @as(u32, 268435472); pub const CF_NULL = @as(u32, 0); pub const MK_S_ASYNCHRONOUS = @import("../zig.zig").typedConst(HRESULT, @as(i32, 262632)); pub const E_PENDING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147483638)); pub const INET_E_INVALID_URL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697214)); pub const INET_E_NO_SESSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697213)); pub const INET_E_CANNOT_CONNECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697212)); pub const INET_E_RESOURCE_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697211)); pub const INET_E_OBJECT_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697210)); pub const INET_E_DATA_NOT_AVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697209)); pub const INET_E_DOWNLOAD_FAILURE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697208)); pub const INET_E_AUTHENTICATION_REQUIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697207)); pub const INET_E_NO_VALID_MEDIA = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697206)); pub const INET_E_CONNECTION_TIMEOUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697205)); pub const INET_E_INVALID_REQUEST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697204)); pub const INET_E_UNKNOWN_PROTOCOL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697203)); pub const INET_E_SECURITY_PROBLEM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697202)); pub const INET_E_CANNOT_LOAD_DATA = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697201)); pub const INET_E_CANNOT_INSTANTIATE_OBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697200)); pub const INET_E_INVALID_CERTIFICATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697191)); pub const INET_E_REDIRECT_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697196)); pub const INET_E_REDIRECT_TO_DIR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697195)); pub const INET_E_CANNOT_LOCK_REQUEST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697194)); pub const INET_E_USE_EXTEND_BINDING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697193)); pub const INET_E_TERMINATED_BIND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697192)); pub const INET_E_RESERVED_1 = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697190)); pub const INET_E_BLOCKED_REDIRECT_XSECURITYID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697189)); pub const INET_E_DOMINJECTIONVALIDATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697188)); pub const INET_E_VTAB_SWITCH_FORCE_ENGINE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697187)); pub const INET_E_HSTS_CERTIFICATE_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697186)); pub const INET_E_RESERVED_2 = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697185)); pub const INET_E_RESERVED_3 = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697184)); pub const INET_E_RESERVED_4 = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697183)); pub const INET_E_RESERVED_5 = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697182)); pub const INET_E_ERROR_FIRST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697214)); pub const INET_E_CODE_DOWNLOAD_DECLINED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146696960)); pub const INET_E_RESULT_DISPATCHED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146696704)); pub const INET_E_CANNOT_REPLACE_SFP_FILE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146696448)); pub const INET_E_CODE_INSTALL_SUPPRESSED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146696192)); pub const INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146695936)); pub const INET_E_DOWNLOAD_BLOCKED_BY_INPRIVATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146695935)); pub const INET_E_CODE_INSTALL_BLOCKED_IMMERSIVE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146695934)); pub const INET_E_FORBIDFRAMING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146695933)); pub const INET_E_CODE_INSTALL_BLOCKED_ARM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146695932)); pub const INET_E_BLOCKED_PLUGGABLE_PROTOCOL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146695931)); pub const INET_E_BLOCKED_ENHANCEDPROTECTEDMODE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146695930)); pub const INET_E_CODE_INSTALL_BLOCKED_BITNESS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146695929)); pub const INET_E_DOWNLOAD_BLOCKED_BY_CSP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146695928)); pub const Uri_DISPLAY_NO_FRAGMENT = @as(u32, 1); pub const Uri_PUNYCODE_IDN_HOST = @as(u32, 2); pub const Uri_DISPLAY_IDN_HOST = @as(u32, 4); pub const Uri_DISPLAY_NO_PUNYCODE = @as(u32, 8); pub const Uri_ENCODING_USER_INFO_AND_PATH_IS_PERCENT_ENCODED_UTF8 = @as(u32, 1); pub const Uri_ENCODING_USER_INFO_AND_PATH_IS_CP = @as(u32, 2); pub const Uri_ENCODING_HOST_IS_IDN = @as(u32, 4); pub const Uri_ENCODING_HOST_IS_PERCENT_ENCODED_UTF8 = @as(u32, 8); pub const Uri_ENCODING_HOST_IS_PERCENT_ENCODED_CP = @as(u32, 16); pub const Uri_ENCODING_QUERY_AND_FRAGMENT_IS_PERCENT_ENCODED_UTF8 = @as(u32, 32); pub const Uri_ENCODING_QUERY_AND_FRAGMENT_IS_CP = @as(u32, 64); pub const UriBuilder_USE_ORIGINAL_FLAGS = @as(u32, 1); pub const WININETINFO_OPTION_LOCK_HANDLE = @as(u32, 65534); pub const URLOSTRM_USECACHEDCOPY_ONLY = @as(u32, 1); pub const URLOSTRM_USECACHEDCOPY = @as(u32, 2); pub const URLOSTRM_GETNEWESTVERSION = @as(u32, 3); pub const SET_FEATURE_ON_THREAD = @as(u32, 1); pub const SET_FEATURE_ON_PROCESS = @as(u32, 2); pub const SET_FEATURE_IN_REGISTRY = @as(u32, 4); pub const SET_FEATURE_ON_THREAD_LOCALMACHINE = @as(u32, 8); pub const SET_FEATURE_ON_THREAD_INTRANET = @as(u32, 16); pub const SET_FEATURE_ON_THREAD_TRUSTED = @as(u32, 32); pub const SET_FEATURE_ON_THREAD_INTERNET = @as(u32, 64); pub const SET_FEATURE_ON_THREAD_RESTRICTED = @as(u32, 128); pub const GET_FEATURE_FROM_THREAD = @as(u32, 1); pub const GET_FEATURE_FROM_PROCESS = @as(u32, 2); pub const GET_FEATURE_FROM_REGISTRY = @as(u32, 4); pub const GET_FEATURE_FROM_THREAD_LOCALMACHINE = @as(u32, 8); pub const GET_FEATURE_FROM_THREAD_INTRANET = @as(u32, 16); pub const GET_FEATURE_FROM_THREAD_TRUSTED = @as(u32, 32); pub const GET_FEATURE_FROM_THREAD_INTERNET = @as(u32, 64); pub const GET_FEATURE_FROM_THREAD_RESTRICTED = @as(u32, 128); pub const INET_E_USE_DEFAULT_PROTOCOLHANDLER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697199)); pub const INET_E_USE_DEFAULT_SETTING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697198)); pub const INET_E_QUERYOPTION_UNKNOWN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697197)); pub const INET_E_REDIRECTING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146697196)); pub const PROTOCOLFLAG_NO_PICS_CHECK = @as(u32, 1); pub const MUTZ_NOSAVEDFILECHECK = @as(u32, 1); pub const MUTZ_ISFILE = @as(u32, 2); pub const MUTZ_ACCEPT_WILDCARD_SCHEME = @as(u32, 128); pub const MUTZ_ENFORCERESTRICTED = @as(u32, 256); pub const MUTZ_RESERVED = @as(u32, 512); pub const MUTZ_REQUIRESAVEDFILECHECK = @as(u32, 1024); pub const MUTZ_DONT_UNESCAPE = @as(u32, 2048); pub const MUTZ_DONT_USE_CACHE = @as(u32, 4096); pub const MUTZ_FORCE_INTRANET_FLAGS = @as(u32, 8192); pub const MUTZ_IGNORE_ZONE_MAPPINGS = @as(u32, 16384); pub const MAX_SIZE_SECURITY_ID = @as(u32, 512); pub const URLACTION_MIN = @as(u32, 4096); pub const URLACTION_DOWNLOAD_MIN = @as(u32, 4096); pub const URLACTION_DOWNLOAD_SIGNED_ACTIVEX = @as(u32, 4097); pub const URLACTION_DOWNLOAD_UNSIGNED_ACTIVEX = @as(u32, 4100); pub const URLACTION_DOWNLOAD_CURR_MAX = @as(u32, 4100); pub const URLACTION_DOWNLOAD_MAX = @as(u32, 4607); pub const URLACTION_ACTIVEX_MIN = @as(u32, 4608); pub const URLACTION_ACTIVEX_RUN = @as(u32, 4608); pub const URLPOLICY_ACTIVEX_CHECK_LIST = @as(u32, 65536); pub const URLACTION_ACTIVEX_OVERRIDE_OBJECT_SAFETY = @as(u32, 4609); pub const URLACTION_ACTIVEX_OVERRIDE_DATA_SAFETY = @as(u32, 4610); pub const URLACTION_ACTIVEX_OVERRIDE_SCRIPT_SAFETY = @as(u32, 4611); pub const URLACTION_SCRIPT_OVERRIDE_SAFETY = @as(u32, 5121); pub const URLACTION_ACTIVEX_CONFIRM_NOOBJECTSAFETY = @as(u32, 4612); pub const URLACTION_ACTIVEX_TREATASUNTRUSTED = @as(u32, 4613); pub const URLACTION_ACTIVEX_NO_WEBOC_SCRIPT = @as(u32, 4614); pub const URLACTION_ACTIVEX_OVERRIDE_REPURPOSEDETECTION = @as(u32, 4615); pub const URLACTION_ACTIVEX_OVERRIDE_OPTIN = @as(u32, 4616); pub const URLACTION_ACTIVEX_SCRIPTLET_RUN = @as(u32, 4617); pub const URLACTION_ACTIVEX_DYNSRC_VIDEO_AND_ANIMATION = @as(u32, 4618); pub const URLACTION_ACTIVEX_OVERRIDE_DOMAINLIST = @as(u32, 4619); pub const URLACTION_ACTIVEX_ALLOW_TDC = @as(u32, 4620); pub const URLACTION_ACTIVEX_CURR_MAX = @as(u32, 4620); pub const URLACTION_ACTIVEX_MAX = @as(u32, 5119); pub const URLACTION_SCRIPT_MIN = @as(u32, 5120); pub const URLACTION_SCRIPT_RUN = @as(u32, 5120); pub const URLACTION_SCRIPT_JAVA_USE = @as(u32, 5122); pub const URLACTION_SCRIPT_SAFE_ACTIVEX = @as(u32, 5125); pub const URLACTION_CROSS_DOMAIN_DATA = @as(u32, 5126); pub const URLACTION_SCRIPT_PASTE = @as(u32, 5127); pub const URLACTION_ALLOW_XDOMAIN_SUBFRAME_RESIZE = @as(u32, 5128); pub const URLACTION_SCRIPT_XSSFILTER = @as(u32, 5129); pub const URLACTION_SCRIPT_NAVIGATE = @as(u32, 5130); pub const URLACTION_PLUGGABLE_PROTOCOL_XHR = @as(u32, 5131); pub const URLACTION_ALLOW_VBSCRIPT_IE = @as(u32, 5132); pub const URLACTION_SCRIPT_CURR_MAX = @as(u32, 5132); pub const URLACTION_SCRIPT_MAX = @as(u32, 5631); pub const URLACTION_HTML_MIN = @as(u32, 5632); pub const URLACTION_HTML_SUBMIT_FORMS = @as(u32, 5633); pub const URLACTION_HTML_SUBMIT_FORMS_FROM = @as(u32, 5634); pub const URLACTION_HTML_SUBMIT_FORMS_TO = @as(u32, 5635); pub const URLACTION_HTML_FONT_DOWNLOAD = @as(u32, 5636); pub const URLACTION_HTML_JAVA_RUN = @as(u32, 5637); pub const URLACTION_HTML_USERDATA_SAVE = @as(u32, 5638); pub const URLACTION_HTML_SUBFRAME_NAVIGATE = @as(u32, 5639); pub const URLACTION_HTML_META_REFRESH = @as(u32, 5640); pub const URLACTION_HTML_MIXED_CONTENT = @as(u32, 5641); pub const URLACTION_HTML_INCLUDE_FILE_PATH = @as(u32, 5642); pub const URLACTION_HTML_ALLOW_INJECTED_DYNAMIC_HTML = @as(u32, 5643); pub const URLACTION_HTML_REQUIRE_UTF8_DOCUMENT_CODEPAGE = @as(u32, 5644); pub const URLACTION_HTML_ALLOW_CROSS_DOMAIN_CANVAS = @as(u32, 5645); pub const URLACTION_HTML_ALLOW_WINDOW_CLOSE = @as(u32, 5646); pub const URLACTION_HTML_ALLOW_CROSS_DOMAIN_WEBWORKER = @as(u32, 5647); pub const URLACTION_HTML_ALLOW_CROSS_DOMAIN_TEXTTRACK = @as(u32, 5648); pub const URLACTION_HTML_ALLOW_INDEXEDDB = @as(u32, 5649); pub const URLACTION_HTML_MAX = @as(u32, 6143); pub const URLACTION_SHELL_MIN = @as(u32, 6144); pub const URLACTION_SHELL_INSTALL_DTITEMS = @as(u32, 6144); pub const URLACTION_SHELL_MOVE_OR_COPY = @as(u32, 6146); pub const URLACTION_SHELL_FILE_DOWNLOAD = @as(u32, 6147); pub const URLACTION_SHELL_VERB = @as(u32, 6148); pub const URLACTION_SHELL_WEBVIEW_VERB = @as(u32, 6149); pub const URLACTION_SHELL_SHELLEXECUTE = @as(u32, 6150); pub const URLACTION_SHELL_EXECUTE_HIGHRISK = @as(u32, 6150); pub const URLACTION_SHELL_EXECUTE_MODRISK = @as(u32, 6151); pub const URLACTION_SHELL_EXECUTE_LOWRISK = @as(u32, 6152); pub const URLACTION_SHELL_POPUPMGR = @as(u32, 6153); pub const URLACTION_SHELL_RTF_OBJECTS_LOAD = @as(u32, 6154); pub const URLACTION_SHELL_ENHANCED_DRAGDROP_SECURITY = @as(u32, 6155); pub const URLACTION_SHELL_EXTENSIONSECURITY = @as(u32, 6156); pub const URLACTION_SHELL_SECURE_DRAGSOURCE = @as(u32, 6157); pub const URLACTION_SHELL_REMOTEQUERY = @as(u32, 6158); pub const URLACTION_SHELL_PREVIEW = @as(u32, 6159); pub const URLACTION_SHELL_SHARE = @as(u32, 6160); pub const URLACTION_SHELL_ALLOW_CROSS_SITE_SHARE = @as(u32, 6161); pub const URLACTION_SHELL_TOCTOU_RISK = @as(u32, 6162); pub const URLACTION_SHELL_CURR_MAX = @as(u32, 6162); pub const URLACTION_SHELL_MAX = @as(u32, 6655); pub const URLACTION_NETWORK_MIN = @as(u32, 6656); pub const URLACTION_CREDENTIALS_USE = @as(u32, 6656); pub const URLPOLICY_CREDENTIALS_SILENT_LOGON_OK = @as(u32, 0); pub const URLPOLICY_CREDENTIALS_MUST_PROMPT_USER = @as(u32, 65536); pub const URLPOLICY_CREDENTIALS_CONDITIONAL_PROMPT = @as(u32, 131072); pub const URLPOLICY_CREDENTIALS_ANONYMOUS_ONLY = @as(u32, 196608); pub const URLACTION_AUTHENTICATE_CLIENT = @as(u32, 6657); pub const URLPOLICY_AUTHENTICATE_CLEARTEXT_OK = @as(u32, 0); pub const URLPOLICY_AUTHENTICATE_CHALLENGE_RESPONSE = @as(u32, 65536); pub const URLPOLICY_AUTHENTICATE_MUTUAL_ONLY = @as(u32, 196608); pub const URLACTION_COOKIES = @as(u32, 6658); pub const URLACTION_COOKIES_SESSION = @as(u32, 6659); pub const URLACTION_CLIENT_CERT_PROMPT = @as(u32, 6660); pub const URLACTION_COOKIES_THIRD_PARTY = @as(u32, 6661); pub const URLACTION_COOKIES_SESSION_THIRD_PARTY = @as(u32, 6662); pub const URLACTION_COOKIES_ENABLED = @as(u32, 6672); pub const URLACTION_NETWORK_CURR_MAX = @as(u32, 6672); pub const URLACTION_NETWORK_MAX = @as(u32, 7167); pub const URLACTION_JAVA_MIN = @as(u32, 7168); pub const URLACTION_JAVA_PERMISSIONS = @as(u32, 7168); pub const URLPOLICY_JAVA_PROHIBIT = @as(u32, 0); pub const URLPOLICY_JAVA_HIGH = @as(u32, 65536); pub const URLPOLICY_JAVA_MEDIUM = @as(u32, 131072); pub const URLPOLICY_JAVA_LOW = @as(u32, 196608); pub const URLPOLICY_JAVA_CUSTOM = @as(u32, 8388608); pub const URLACTION_JAVA_CURR_MAX = @as(u32, 7168); pub const URLACTION_JAVA_MAX = @as(u32, 7423); pub const URLACTION_INFODELIVERY_MIN = @as(u32, 7424); pub const URLACTION_INFODELIVERY_NO_ADDING_CHANNELS = @as(u32, 7424); pub const URLACTION_INFODELIVERY_NO_EDITING_CHANNELS = @as(u32, 7425); pub const URLACTION_INFODELIVERY_NO_REMOVING_CHANNELS = @as(u32, 7426); pub const URLACTION_INFODELIVERY_NO_ADDING_SUBSCRIPTIONS = @as(u32, 7427); pub const URLACTION_INFODELIVERY_NO_EDITING_SUBSCRIPTIONS = @as(u32, 7428); pub const URLACTION_INFODELIVERY_NO_REMOVING_SUBSCRIPTIONS = @as(u32, 7429); pub const URLACTION_INFODELIVERY_NO_CHANNEL_LOGGING = @as(u32, 7430); pub const URLACTION_INFODELIVERY_CURR_MAX = @as(u32, 7430); pub const URLACTION_INFODELIVERY_MAX = @as(u32, 7679); pub const URLACTION_CHANNEL_SOFTDIST_MIN = @as(u32, 7680); pub const URLACTION_CHANNEL_SOFTDIST_PERMISSIONS = @as(u32, 7685); pub const URLPOLICY_CHANNEL_SOFTDIST_PROHIBIT = @as(u32, 65536); pub const URLPOLICY_CHANNEL_SOFTDIST_PRECACHE = @as(u32, 131072); pub const URLPOLICY_CHANNEL_SOFTDIST_AUTOINSTALL = @as(u32, 196608); pub const URLACTION_CHANNEL_SOFTDIST_MAX = @as(u32, 7935); pub const URLACTION_DOTNET_USERCONTROLS = @as(u32, 8197); pub const URLACTION_BEHAVIOR_MIN = @as(u32, 8192); pub const URLACTION_BEHAVIOR_RUN = @as(u32, 8192); pub const URLPOLICY_BEHAVIOR_CHECK_LIST = @as(u32, 65536); pub const URLACTION_FEATURE_MIN = @as(u32, 8448); pub const URLACTION_FEATURE_MIME_SNIFFING = @as(u32, 8448); pub const URLACTION_FEATURE_ZONE_ELEVATION = @as(u32, 8449); pub const URLACTION_FEATURE_WINDOW_RESTRICTIONS = @as(u32, 8450); pub const URLACTION_FEATURE_SCRIPT_STATUS_BAR = @as(u32, 8451); pub const URLACTION_FEATURE_FORCE_ADDR_AND_STATUS = @as(u32, 8452); pub const URLACTION_FEATURE_BLOCK_INPUT_PROMPTS = @as(u32, 8453); pub const URLACTION_FEATURE_DATA_BINDING = @as(u32, 8454); pub const URLACTION_FEATURE_CROSSDOMAIN_FOCUS_CHANGE = @as(u32, 8455); pub const URLACTION_AUTOMATIC_DOWNLOAD_UI_MIN = @as(u32, 8704); pub const URLACTION_AUTOMATIC_DOWNLOAD_UI = @as(u32, 8704); pub const URLACTION_AUTOMATIC_ACTIVEX_UI = @as(u32, 8705); pub const URLACTION_ALLOW_RESTRICTEDPROTOCOLS = @as(u32, 8960); pub const URLACTION_ALLOW_APEVALUATION = @as(u32, 8961); pub const URLACTION_ALLOW_XHR_EVALUATION = @as(u32, 8962); pub const URLACTION_WINDOWS_BROWSER_APPLICATIONS = @as(u32, 9216); pub const URLACTION_XPS_DOCUMENTS = @as(u32, 9217); pub const URLACTION_LOOSE_XAML = @as(u32, 9218); pub const URLACTION_LOWRIGHTS = @as(u32, 9472); pub const URLACTION_WINFX_SETUP = @as(u32, 9728); pub const URLACTION_INPRIVATE_BLOCKING = @as(u32, 9984); pub const URLACTION_ALLOW_AUDIO_VIDEO = @as(u32, 9985); pub const URLACTION_ALLOW_ACTIVEX_FILTERING = @as(u32, 9986); pub const URLACTION_ALLOW_STRUCTURED_STORAGE_SNIFFING = @as(u32, 9987); pub const URLACTION_ALLOW_AUDIO_VIDEO_PLUGINS = @as(u32, 9988); pub const URLACTION_ALLOW_ZONE_ELEVATION_VIA_OPT_OUT = @as(u32, 9989); pub const URLACTION_ALLOW_ZONE_ELEVATION_OPT_OUT_ADDITION = @as(u32, 9990); pub const URLACTION_ALLOW_CROSSDOMAIN_DROP_WITHIN_WINDOW = @as(u32, 9992); pub const URLACTION_ALLOW_CROSSDOMAIN_DROP_ACROSS_WINDOWS = @as(u32, 9993); pub const URLACTION_ALLOW_CROSSDOMAIN_APPCACHE_MANIFEST = @as(u32, 9994); pub const URLACTION_ALLOW_RENDER_LEGACY_DXTFILTERS = @as(u32, 9995); pub const URLACTION_ALLOW_ANTIMALWARE_SCANNING_OF_ACTIVEX = @as(u32, 9996); pub const URLACTION_ALLOW_CSS_EXPRESSIONS = @as(u32, 9997); pub const URLPOLICY_ALLOW = @as(u32, 0); pub const URLPOLICY_QUERY = @as(u32, 1); pub const URLPOLICY_DISALLOW = @as(u32, 3); pub const URLPOLICY_NOTIFY_ON_ALLOW = @as(u32, 16); pub const URLPOLICY_NOTIFY_ON_DISALLOW = @as(u32, 32); pub const URLPOLICY_LOG_ON_ALLOW = @as(u32, 64); pub const URLPOLICY_LOG_ON_DISALLOW = @as(u32, 128); pub const URLPOLICY_MASK_PERMISSIONS = @as(u32, 15); pub const URLPOLICY_DONTCHECKDLGBOX = @as(u32, 256); pub const URLZONE_ESC_FLAG = @as(u32, 256); pub const SECURITY_IE_STATE_GREEN = @as(u32, 0); pub const SECURITY_IE_STATE_RED = @as(u32, 1); pub const SOFTDIST_FLAG_USAGE_EMAIL = @as(u32, 1); pub const SOFTDIST_FLAG_USAGE_PRECACHE = @as(u32, 2); pub const SOFTDIST_FLAG_USAGE_AUTOINSTALL = @as(u32, 4); pub const SOFTDIST_FLAG_DELETE_SUBSCRIPTION = @as(u32, 8); pub const SOFTDIST_ADSTATE_NONE = @as(u32, 0); pub const SOFTDIST_ADSTATE_AVAILABLE = @as(u32, 1); pub const SOFTDIST_ADSTATE_DOWNLOADED = @as(u32, 2); pub const SOFTDIST_ADSTATE_INSTALLED = @as(u32, 3); pub const CONFIRMSAFETYACTION_LOADOBJECT = @as(u32, 1); pub const COM_RIGHTS_EXECUTE = @as(u32, 1); pub const COM_RIGHTS_EXECUTE_LOCAL = @as(u32, 2); pub const COM_RIGHTS_EXECUTE_REMOTE = @as(u32, 4); pub const COM_RIGHTS_ACTIVATE_LOCAL = @as(u32, 8); pub const COM_RIGHTS_ACTIVATE_REMOTE = @as(u32, 16); pub const COM_RIGHTS_RESERVED1 = @as(u32, 32); pub const COM_RIGHTS_RESERVED2 = @as(u32, 64); pub const CWMO_MAX_HANDLES = @as(u32, 56); pub const ROTREGFLAGS_ALLOWANYCLIENT = @as(u32, 1); pub const APPIDREGFLAGS_ACTIVATE_IUSERVER_INDESKTOP = @as(u32, 1); pub const APPIDREGFLAGS_SECURE_SERVER_PROCESS_SD_AND_BIND = @as(u32, 2); pub const APPIDREGFLAGS_ISSUE_ACTIVATION_RPC_AT_IDENTIFY = @as(u32, 4); pub const APPIDREGFLAGS_IUSERVER_UNMODIFIED_LOGON_TOKEN = @as(u32, 8); pub const APPIDREGFLAGS_IUSERVER_SELF_SID_IN_LAUNCH_PERMISSION = @as(u32, 16); pub const APPIDREGFLAGS_IUSERVER_ACTIVATE_IN_CLIENT_SESSION_ONLY = @as(u32, 32); pub const APPIDREGFLAGS_RESERVED1 = @as(u32, 64); pub const APPIDREGFLAGS_RESERVED2 = @as(u32, 128); pub const APPIDREGFLAGS_RESERVED3 = @as(u32, 256); pub const APPIDREGFLAGS_RESERVED4 = @as(u32, 512); pub const APPIDREGFLAGS_RESERVED5 = @as(u32, 1024); pub const APPIDREGFLAGS_AAA_NO_IMPLICIT_ACTIVATE_AS_IU = @as(u32, 2048); pub const APPIDREGFLAGS_RESERVED7 = @as(u32, 4096); pub const APPIDREGFLAGS_RESERVED8 = @as(u32, 8192); pub const APPIDREGFLAGS_RESERVED9 = @as(u32, 16384); pub const DCOMSCM_ACTIVATION_USE_ALL_AUTHNSERVICES = @as(u32, 1); pub const DCOMSCM_ACTIVATION_DISALLOW_UNSECURE_CALL = @as(u32, 2); pub const DCOMSCM_RESOLVE_USE_ALL_AUTHNSERVICES = @as(u32, 4); pub const DCOMSCM_RESOLVE_DISALLOW_UNSECURE_CALL = @as(u32, 8); pub const DCOMSCM_PING_USE_MID_AUTHNSERVICE = @as(u32, 16); pub const DCOMSCM_PING_DISALLOW_UNSECURE_CALL = @as(u32, 32); pub const MAXLSN = @as(u64, 9223372036854775807); pub const DMUS_ERRBASE = @as(u32, 4096); //-------------------------------------------------------------------------------- // Section: Types (480) //-------------------------------------------------------------------------------- pub const UPDFCACHE_FLAGS = enum(u32) { ALL = 2147483647, ALLBUTNODATACACHE = 2147483646, NORMALCACHE = 8, IFBLANK = 16, ONLYIFBLANK = 2147483648, NODATACACHE = 1, ONSAVECACHE = 2, ONSTOPCACHE = 4, IFBLANKORONSAVECACHE = 18, _, pub fn initFlags(o: struct { ALL: u1 = 0, ALLBUTNODATACACHE: u1 = 0, NORMALCACHE: u1 = 0, IFBLANK: u1 = 0, ONLYIFBLANK: u1 = 0, NODATACACHE: u1 = 0, ONSAVECACHE: u1 = 0, ONSTOPCACHE: u1 = 0, IFBLANKORONSAVECACHE: u1 = 0, }) UPDFCACHE_FLAGS { return @intToEnum(UPDFCACHE_FLAGS, (if (o.ALL == 1) @enumToInt(UPDFCACHE_FLAGS.ALL) else 0) | (if (o.ALLBUTNODATACACHE == 1) @enumToInt(UPDFCACHE_FLAGS.ALLBUTNODATACACHE) else 0) | (if (o.NORMALCACHE == 1) @enumToInt(UPDFCACHE_FLAGS.NORMALCACHE) else 0) | (if (o.IFBLANK == 1) @enumToInt(UPDFCACHE_FLAGS.IFBLANK) else 0) | (if (o.ONLYIFBLANK == 1) @enumToInt(UPDFCACHE_FLAGS.ONLYIFBLANK) else 0) | (if (o.NODATACACHE == 1) @enumToInt(UPDFCACHE_FLAGS.NODATACACHE) else 0) | (if (o.ONSAVECACHE == 1) @enumToInt(UPDFCACHE_FLAGS.ONSAVECACHE) else 0) | (if (o.ONSTOPCACHE == 1) @enumToInt(UPDFCACHE_FLAGS.ONSTOPCACHE) else 0) | (if (o.IFBLANKORONSAVECACHE == 1) @enumToInt(UPDFCACHE_FLAGS.IFBLANKORONSAVECACHE) else 0) ); } }; pub const UPDFCACHE_ALL = UPDFCACHE_FLAGS.ALL; pub const UPDFCACHE_ALLBUTNODATACACHE = UPDFCACHE_FLAGS.ALLBUTNODATACACHE; pub const UPDFCACHE_NORMALCACHE = UPDFCACHE_FLAGS.NORMALCACHE; pub const UPDFCACHE_IFBLANK = UPDFCACHE_FLAGS.IFBLANK; pub const UPDFCACHE_ONLYIFBLANK = UPDFCACHE_FLAGS.ONLYIFBLANK; pub const UPDFCACHE_NODATACACHE = UPDFCACHE_FLAGS.NODATACACHE; pub const UPDFCACHE_ONSAVECACHE = UPDFCACHE_FLAGS.ONSAVECACHE; pub const UPDFCACHE_ONSTOPCACHE = UPDFCACHE_FLAGS.ONSTOPCACHE; pub const UPDFCACHE_IFBLANKORONSAVECACHE = UPDFCACHE_FLAGS.IFBLANKORONSAVECACHE; pub const URI_CREATE_FLAGS = enum(u32) { ALLOW_RELATIVE = 1, ALLOW_IMPLICIT_WILDCARD_SCHEME = 2, ALLOW_IMPLICIT_FILE_SCHEME = 4, NOFRAG = 8, NO_CANONICALIZE = 16, CANONICALIZE = 256, FILE_USE_DOS_PATH = 32, DECODE_EXTRA_INFO = 64, NO_DECODE_EXTRA_INFO = 128, CRACK_UNKNOWN_SCHEMES = 512, NO_CRACK_UNKNOWN_SCHEMES = 1024, PRE_PROCESS_HTML_URI = 2048, NO_PRE_PROCESS_HTML_URI = 4096, IE_SETTINGS = 8192, NO_IE_SETTINGS = 16384, NO_ENCODE_FORBIDDEN_CHARACTERS = 32768, NORMALIZE_INTL_CHARACTERS = 65536, CANONICALIZE_ABSOLUTE = 131072, _, pub fn initFlags(o: struct { ALLOW_RELATIVE: u1 = 0, ALLOW_IMPLICIT_WILDCARD_SCHEME: u1 = 0, ALLOW_IMPLICIT_FILE_SCHEME: u1 = 0, NOFRAG: u1 = 0, NO_CANONICALIZE: u1 = 0, CANONICALIZE: u1 = 0, FILE_USE_DOS_PATH: u1 = 0, DECODE_EXTRA_INFO: u1 = 0, NO_DECODE_EXTRA_INFO: u1 = 0, CRACK_UNKNOWN_SCHEMES: u1 = 0, NO_CRACK_UNKNOWN_SCHEMES: u1 = 0, PRE_PROCESS_HTML_URI: u1 = 0, NO_PRE_PROCESS_HTML_URI: u1 = 0, IE_SETTINGS: u1 = 0, NO_IE_SETTINGS: u1 = 0, NO_ENCODE_FORBIDDEN_CHARACTERS: u1 = 0, NORMALIZE_INTL_CHARACTERS: u1 = 0, CANONICALIZE_ABSOLUTE: u1 = 0, }) URI_CREATE_FLAGS { return @intToEnum(URI_CREATE_FLAGS, (if (o.ALLOW_RELATIVE == 1) @enumToInt(URI_CREATE_FLAGS.ALLOW_RELATIVE) else 0) | (if (o.ALLOW_IMPLICIT_WILDCARD_SCHEME == 1) @enumToInt(URI_CREATE_FLAGS.ALLOW_IMPLICIT_WILDCARD_SCHEME) else 0) | (if (o.ALLOW_IMPLICIT_FILE_SCHEME == 1) @enumToInt(URI_CREATE_FLAGS.ALLOW_IMPLICIT_FILE_SCHEME) else 0) | (if (o.NOFRAG == 1) @enumToInt(URI_CREATE_FLAGS.NOFRAG) else 0) | (if (o.NO_CANONICALIZE == 1) @enumToInt(URI_CREATE_FLAGS.NO_CANONICALIZE) else 0) | (if (o.CANONICALIZE == 1) @enumToInt(URI_CREATE_FLAGS.CANONICALIZE) else 0) | (if (o.FILE_USE_DOS_PATH == 1) @enumToInt(URI_CREATE_FLAGS.FILE_USE_DOS_PATH) else 0) | (if (o.DECODE_EXTRA_INFO == 1) @enumToInt(URI_CREATE_FLAGS.DECODE_EXTRA_INFO) else 0) | (if (o.NO_DECODE_EXTRA_INFO == 1) @enumToInt(URI_CREATE_FLAGS.NO_DECODE_EXTRA_INFO) else 0) | (if (o.CRACK_UNKNOWN_SCHEMES == 1) @enumToInt(URI_CREATE_FLAGS.CRACK_UNKNOWN_SCHEMES) else 0) | (if (o.NO_CRACK_UNKNOWN_SCHEMES == 1) @enumToInt(URI_CREATE_FLAGS.NO_CRACK_UNKNOWN_SCHEMES) else 0) | (if (o.PRE_PROCESS_HTML_URI == 1) @enumToInt(URI_CREATE_FLAGS.PRE_PROCESS_HTML_URI) else 0) | (if (o.NO_PRE_PROCESS_HTML_URI == 1) @enumToInt(URI_CREATE_FLAGS.NO_PRE_PROCESS_HTML_URI) else 0) | (if (o.IE_SETTINGS == 1) @enumToInt(URI_CREATE_FLAGS.IE_SETTINGS) else 0) | (if (o.NO_IE_SETTINGS == 1) @enumToInt(URI_CREATE_FLAGS.NO_IE_SETTINGS) else 0) | (if (o.NO_ENCODE_FORBIDDEN_CHARACTERS == 1) @enumToInt(URI_CREATE_FLAGS.NO_ENCODE_FORBIDDEN_CHARACTERS) else 0) | (if (o.NORMALIZE_INTL_CHARACTERS == 1) @enumToInt(URI_CREATE_FLAGS.NORMALIZE_INTL_CHARACTERS) else 0) | (if (o.CANONICALIZE_ABSOLUTE == 1) @enumToInt(URI_CREATE_FLAGS.CANONICALIZE_ABSOLUTE) else 0) ); } }; pub const Uri_CREATE_ALLOW_RELATIVE = URI_CREATE_FLAGS.ALLOW_RELATIVE; pub const Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME = URI_CREATE_FLAGS.ALLOW_IMPLICIT_WILDCARD_SCHEME; pub const Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME = URI_CREATE_FLAGS.ALLOW_IMPLICIT_FILE_SCHEME; pub const Uri_CREATE_NOFRAG = URI_CREATE_FLAGS.NOFRAG; pub const Uri_CREATE_NO_CANONICALIZE = URI_CREATE_FLAGS.NO_CANONICALIZE; pub const Uri_CREATE_CANONICALIZE = URI_CREATE_FLAGS.CANONICALIZE; pub const Uri_CREATE_FILE_USE_DOS_PATH = URI_CREATE_FLAGS.FILE_USE_DOS_PATH; pub const Uri_CREATE_DECODE_EXTRA_INFO = URI_CREATE_FLAGS.DECODE_EXTRA_INFO; pub const Uri_CREATE_NO_DECODE_EXTRA_INFO = URI_CREATE_FLAGS.NO_DECODE_EXTRA_INFO; pub const Uri_CREATE_CRACK_UNKNOWN_SCHEMES = URI_CREATE_FLAGS.CRACK_UNKNOWN_SCHEMES; pub const Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES = URI_CREATE_FLAGS.NO_CRACK_UNKNOWN_SCHEMES; pub const Uri_CREATE_PRE_PROCESS_HTML_URI = URI_CREATE_FLAGS.PRE_PROCESS_HTML_URI; pub const Uri_CREATE_NO_PRE_PROCESS_HTML_URI = URI_CREATE_FLAGS.NO_PRE_PROCESS_HTML_URI; pub const Uri_CREATE_IE_SETTINGS = URI_CREATE_FLAGS.IE_SETTINGS; pub const Uri_CREATE_NO_IE_SETTINGS = URI_CREATE_FLAGS.NO_IE_SETTINGS; pub const Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS = URI_CREATE_FLAGS.NO_ENCODE_FORBIDDEN_CHARACTERS; pub const Uri_CREATE_NORMALIZE_INTL_CHARACTERS = URI_CREATE_FLAGS.NORMALIZE_INTL_CHARACTERS; pub const Uri_CREATE_CANONICALIZE_ABSOLUTE = URI_CREATE_FLAGS.CANONICALIZE_ABSOLUTE; pub const RPC_C_AUTHN_LEVEL = enum(u32) { DEFAULT = 0, NONE = 1, CONNECT = 2, CALL = 3, PKT = 4, PKT_INTEGRITY = 5, PKT_PRIVACY = 6, }; pub const RPC_C_AUTHN_LEVEL_DEFAULT = RPC_C_AUTHN_LEVEL.DEFAULT; pub const RPC_C_AUTHN_LEVEL_NONE = RPC_C_AUTHN_LEVEL.NONE; pub const RPC_C_AUTHN_LEVEL_CONNECT = RPC_C_AUTHN_LEVEL.CONNECT; pub const RPC_C_AUTHN_LEVEL_CALL = RPC_C_AUTHN_LEVEL.CALL; pub const RPC_C_AUTHN_LEVEL_PKT = RPC_C_AUTHN_LEVEL.PKT; pub const RPC_C_AUTHN_LEVEL_PKT_INTEGRITY = RPC_C_AUTHN_LEVEL.PKT_INTEGRITY; pub const RPC_C_AUTHN_LEVEL_PKT_PRIVACY = RPC_C_AUTHN_LEVEL.PKT_PRIVACY; pub const RPC_C_IMP_LEVEL = enum(u32) { DEFAULT = 0, ANONYMOUS = 1, IDENTIFY = 2, IMPERSONATE = 3, DELEGATE = 4, }; pub const RPC_C_IMP_LEVEL_DEFAULT = RPC_C_IMP_LEVEL.DEFAULT; pub const RPC_C_IMP_LEVEL_ANONYMOUS = RPC_C_IMP_LEVEL.ANONYMOUS; pub const RPC_C_IMP_LEVEL_IDENTIFY = RPC_C_IMP_LEVEL.IDENTIFY; pub const RPC_C_IMP_LEVEL_IMPERSONATE = RPC_C_IMP_LEVEL.IMPERSONATE; pub const RPC_C_IMP_LEVEL_DELEGATE = RPC_C_IMP_LEVEL.DELEGATE; pub const ENUM_CONTROLS_WHICH_FLAGS = enum(u32) { W_WCH_SIBLING = 1, _WCH_CONTAINER = 2, _WCH_CONTAINED = 3, _WCH_ALL = 4, _WCH_FREVERSEDIR = 134217728, _WCH_FONLYAFTER = 268435456, _WCH_FONLYBEFORE = 536870912, _WCH_FSELECTED = 1073741824, }; pub const GCW_WCH_SIBLING = ENUM_CONTROLS_WHICH_FLAGS.W_WCH_SIBLING; pub const GC_WCH_CONTAINER = ENUM_CONTROLS_WHICH_FLAGS._WCH_CONTAINER; pub const GC_WCH_CONTAINED = ENUM_CONTROLS_WHICH_FLAGS._WCH_CONTAINED; pub const GC_WCH_ALL = ENUM_CONTROLS_WHICH_FLAGS._WCH_ALL; pub const GC_WCH_FREVERSEDIR = ENUM_CONTROLS_WHICH_FLAGS._WCH_FREVERSEDIR; pub const GC_WCH_FONLYAFTER = ENUM_CONTROLS_WHICH_FLAGS._WCH_FONLYAFTER; pub const GC_WCH_FONLYBEFORE = ENUM_CONTROLS_WHICH_FLAGS._WCH_FONLYBEFORE; pub const GC_WCH_FSELECTED = ENUM_CONTROLS_WHICH_FLAGS._WCH_FSELECTED; pub const MULTICLASSINFO_FLAGS = enum(u32) { TYPEINFO = 1, NUMRESERVEDDISPIDS = 2, IIDPRIMARY = 4, IIDSOURCE = 8, }; pub const MULTICLASSINFO_GETTYPEINFO = MULTICLASSINFO_FLAGS.TYPEINFO; pub const MULTICLASSINFO_GETNUMRESERVEDDISPIDS = MULTICLASSINFO_FLAGS.NUMRESERVEDDISPIDS; pub const MULTICLASSINFO_GETIIDPRIMARY = MULTICLASSINFO_FLAGS.IIDPRIMARY; pub const MULTICLASSINFO_GETIIDSOURCE = MULTICLASSINFO_FLAGS.IIDSOURCE; pub const IEnumContextProps = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const IContext = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const CO_MTA_USAGE_COOKIE = isize; pub const CO_DEVICE_CATALOG_COOKIE = isize; pub const DVASPECT = enum(i32) { CONTENT = 1, THUMBNAIL = 2, ICON = 4, DOCPRINT = 8, }; pub const DVASPECT_CONTENT = DVASPECT.CONTENT; pub const DVASPECT_THUMBNAIL = DVASPECT.THUMBNAIL; pub const DVASPECT_ICON = DVASPECT.ICON; pub const DVASPECT_DOCPRINT = DVASPECT.DOCPRINT; pub const CSPLATFORM = extern struct { dwPlatformId: u32, dwVersionHi: u32, dwVersionLo: u32, dwProcessorArch: u32, }; pub const QUERYCONTEXT = extern struct { dwContext: u32, Platform: CSPLATFORM, Locale: u32, dwVersionHi: u32, dwVersionLo: u32, }; pub const TYSPEC = enum(i32) { CLSID = 0, FILEEXT = 1, MIMETYPE = 2, FILENAME = 3, PROGID = 4, PACKAGENAME = 5, OBJECTID = 6, }; pub const TYSPEC_CLSID = TYSPEC.CLSID; pub const TYSPEC_FILEEXT = TYSPEC.FILEEXT; pub const TYSPEC_MIMETYPE = TYSPEC.MIMETYPE; pub const TYSPEC_FILENAME = TYSPEC.FILENAME; pub const TYSPEC_PROGID = TYSPEC.PROGID; pub const TYSPEC_PACKAGENAME = TYSPEC.PACKAGENAME; pub const TYSPEC_OBJECTID = TYSPEC.OBJECTID; pub const REGCLS = enum(i32) { SINGLEUSE = 0, MULTIPLEUSE = 1, MULTI_SEPARATE = 2, SUSPENDED = 4, SURROGATE = 8, AGILE = 16, }; pub const REGCLS_SINGLEUSE = REGCLS.SINGLEUSE; pub const REGCLS_MULTIPLEUSE = REGCLS.MULTIPLEUSE; pub const REGCLS_MULTI_SEPARATE = REGCLS.MULTI_SEPARATE; pub const REGCLS_SUSPENDED = REGCLS.SUSPENDED; pub const REGCLS_SURROGATE = REGCLS.SURROGATE; pub const REGCLS_AGILE = REGCLS.AGILE; pub const COINITBASE = enum(i32) { D = 0, }; pub const COINITBASE_MULTITHREADED = COINITBASE.D; pub const COAUTHIDENTITY = extern struct { User: ?*u16, UserLength: u32, Domain: ?*u16, DomainLength: u32, Password: <PASSWORD>, PasswordLength: u32, Flags: u32, }; pub const COAUTHINFO = extern struct { dwAuthnSvc: u32, dwAuthzSvc: u32, pwszServerPrincName: ?PWSTR, dwAuthnLevel: u32, dwImpersonationLevel: u32, pAuthIdentityData: ?*COAUTHIDENTITY, dwCapabilities: u32, }; pub const MEMCTX = enum(i32) { TASK = 1, SHARED = 2, MACSYSTEM = 3, UNKNOWN = -1, SAME = -2, }; pub const MEMCTX_TASK = MEMCTX.TASK; pub const MEMCTX_SHARED = MEMCTX.SHARED; pub const MEMCTX_MACSYSTEM = MEMCTX.MACSYSTEM; pub const MEMCTX_UNKNOWN = MEMCTX.UNKNOWN; pub const MEMCTX_SAME = MEMCTX.SAME; pub const CLSCTX = enum(u32) { INPROC_SERVER = 1, INPROC_HANDLER = 2, LOCAL_SERVER = 4, INPROC_SERVER16 = 8, REMOTE_SERVER = 16, INPROC_HANDLER16 = 32, RESERVED1 = 64, RESERVED2 = 128, RESERVED3 = 256, RESERVED4 = 512, NO_CODE_DOWNLOAD = 1024, RESERVED5 = 2048, NO_CUSTOM_MARSHAL = 4096, ENABLE_CODE_DOWNLOAD = 8192, NO_FAILURE_LOG = 16384, DISABLE_AAA = 32768, ENABLE_AAA = 65536, FROM_DEFAULT_CONTEXT = 131072, ACTIVATE_X86_SERVER = 262144, // ACTIVATE_32_BIT_SERVER = 262144, this enum value conflicts with ACTIVATE_X86_SERVER ACTIVATE_64_BIT_SERVER = 524288, ENABLE_CLOAKING = 1048576, APPCONTAINER = 4194304, ACTIVATE_AAA_AS_IU = 8388608, RESERVED6 = 16777216, ACTIVATE_ARM32_SERVER = 33554432, PS_DLL = 2147483648, ALL = 23, SERVER = 21, _, pub fn initFlags(o: struct { INPROC_SERVER: u1 = 0, INPROC_HANDLER: u1 = 0, LOCAL_SERVER: u1 = 0, INPROC_SERVER16: u1 = 0, REMOTE_SERVER: u1 = 0, INPROC_HANDLER16: u1 = 0, RESERVED1: u1 = 0, RESERVED2: u1 = 0, RESERVED3: u1 = 0, RESERVED4: u1 = 0, NO_CODE_DOWNLOAD: u1 = 0, RESERVED5: u1 = 0, NO_CUSTOM_MARSHAL: u1 = 0, ENABLE_CODE_DOWNLOAD: u1 = 0, NO_FAILURE_LOG: u1 = 0, DISABLE_AAA: u1 = 0, ENABLE_AAA: u1 = 0, FROM_DEFAULT_CONTEXT: u1 = 0, ACTIVATE_X86_SERVER: u1 = 0, ACTIVATE_64_BIT_SERVER: u1 = 0, ENABLE_CLOAKING: u1 = 0, APPCONTAINER: u1 = 0, ACTIVATE_AAA_AS_IU: u1 = 0, RESERVED6: u1 = 0, ACTIVATE_ARM32_SERVER: u1 = 0, PS_DLL: u1 = 0, ALL: u1 = 0, SERVER: u1 = 0, }) CLSCTX { return @intToEnum(CLSCTX, (if (o.INPROC_SERVER == 1) @enumToInt(CLSCTX.INPROC_SERVER) else 0) | (if (o.INPROC_HANDLER == 1) @enumToInt(CLSCTX.INPROC_HANDLER) else 0) | (if (o.LOCAL_SERVER == 1) @enumToInt(CLSCTX.LOCAL_SERVER) else 0) | (if (o.INPROC_SERVER16 == 1) @enumToInt(CLSCTX.INPROC_SERVER16) else 0) | (if (o.REMOTE_SERVER == 1) @enumToInt(CLSCTX.REMOTE_SERVER) else 0) | (if (o.INPROC_HANDLER16 == 1) @enumToInt(CLSCTX.INPROC_HANDLER16) else 0) | (if (o.RESERVED1 == 1) @enumToInt(CLSCTX.RESERVED1) else 0) | (if (o.RESERVED2 == 1) @enumToInt(CLSCTX.RESERVED2) else 0) | (if (o.RESERVED3 == 1) @enumToInt(CLSCTX.RESERVED3) else 0) | (if (o.RESERVED4 == 1) @enumToInt(CLSCTX.RESERVED4) else 0) | (if (o.NO_CODE_DOWNLOAD == 1) @enumToInt(CLSCTX.NO_CODE_DOWNLOAD) else 0) | (if (o.RESERVED5 == 1) @enumToInt(CLSCTX.RESERVED5) else 0) | (if (o.NO_CUSTOM_MARSHAL == 1) @enumToInt(CLSCTX.NO_CUSTOM_MARSHAL) else 0) | (if (o.ENABLE_CODE_DOWNLOAD == 1) @enumToInt(CLSCTX.ENABLE_CODE_DOWNLOAD) else 0) | (if (o.NO_FAILURE_LOG == 1) @enumToInt(CLSCTX.NO_FAILURE_LOG) else 0) | (if (o.DISABLE_AAA == 1) @enumToInt(CLSCTX.DISABLE_AAA) else 0) | (if (o.ENABLE_AAA == 1) @enumToInt(CLSCTX.ENABLE_AAA) else 0) | (if (o.FROM_DEFAULT_CONTEXT == 1) @enumToInt(CLSCTX.FROM_DEFAULT_CONTEXT) else 0) | (if (o.ACTIVATE_X86_SERVER == 1) @enumToInt(CLSCTX.ACTIVATE_X86_SERVER) else 0) | (if (o.ACTIVATE_64_BIT_SERVER == 1) @enumToInt(CLSCTX.ACTIVATE_64_BIT_SERVER) else 0) | (if (o.ENABLE_CLOAKING == 1) @enumToInt(CLSCTX.ENABLE_CLOAKING) else 0) | (if (o.APPCONTAINER == 1) @enumToInt(CLSCTX.APPCONTAINER) else 0) | (if (o.ACTIVATE_AAA_AS_IU == 1) @enumToInt(CLSCTX.ACTIVATE_AAA_AS_IU) else 0) | (if (o.RESERVED6 == 1) @enumToInt(CLSCTX.RESERVED6) else 0) | (if (o.ACTIVATE_ARM32_SERVER == 1) @enumToInt(CLSCTX.ACTIVATE_ARM32_SERVER) else 0) | (if (o.PS_DLL == 1) @enumToInt(CLSCTX.PS_DLL) else 0) | (if (o.ALL == 1) @enumToInt(CLSCTX.ALL) else 0) | (if (o.SERVER == 1) @enumToInt(CLSCTX.SERVER) else 0) ); } }; pub const CLSCTX_INPROC_SERVER = CLSCTX.INPROC_SERVER; pub const CLSCTX_INPROC_HANDLER = CLSCTX.INPROC_HANDLER; pub const CLSCTX_LOCAL_SERVER = CLSCTX.LOCAL_SERVER; pub const CLSCTX_INPROC_SERVER16 = CLSCTX.INPROC_SERVER16; pub const CLSCTX_REMOTE_SERVER = CLSCTX.REMOTE_SERVER; pub const CLSCTX_INPROC_HANDLER16 = CLSCTX.INPROC_HANDLER16; pub const CLSCTX_RESERVED1 = CLSCTX.RESERVED1; pub const CLSCTX_RESERVED2 = CLSCTX.RESERVED2; pub const CLSCTX_RESERVED3 = CLSCTX.RESERVED3; pub const CLSCTX_RESERVED4 = CLSCTX.RESERVED4; pub const CLSCTX_NO_CODE_DOWNLOAD = CLSCTX.NO_CODE_DOWNLOAD; pub const CLSCTX_RESERVED5 = CLSCTX.RESERVED5; pub const CLSCTX_NO_CUSTOM_MARSHAL = CLSCTX.NO_CUSTOM_MARSHAL; pub const CLSCTX_ENABLE_CODE_DOWNLOAD = CLSCTX.ENABLE_CODE_DOWNLOAD; pub const CLSCTX_NO_FAILURE_LOG = CLSCTX.NO_FAILURE_LOG; pub const CLSCTX_DISABLE_AAA = CLSCTX.DISABLE_AAA; pub const CLSCTX_ENABLE_AAA = CLSCTX.ENABLE_AAA; pub const CLSCTX_FROM_DEFAULT_CONTEXT = CLSCTX.FROM_DEFAULT_CONTEXT; pub const CLSCTX_ACTIVATE_X86_SERVER = CLSCTX.ACTIVATE_X86_SERVER; pub const CLSCTX_ACTIVATE_32_BIT_SERVER = CLSCTX.ACTIVATE_X86_SERVER; pub const CLSCTX_ACTIVATE_64_BIT_SERVER = CLSCTX.ACTIVATE_64_BIT_SERVER; pub const CLSCTX_ENABLE_CLOAKING = CLSCTX.ENABLE_CLOAKING; pub const CLSCTX_APPCONTAINER = CLSCTX.APPCONTAINER; pub const CLSCTX_ACTIVATE_AAA_AS_IU = CLSCTX.ACTIVATE_AAA_AS_IU; pub const CLSCTX_RESERVED6 = CLSCTX.RESERVED6; pub const CLSCTX_ACTIVATE_ARM32_SERVER = CLSCTX.ACTIVATE_ARM32_SERVER; pub const CLSCTX_PS_DLL = CLSCTX.PS_DLL; pub const CLSCTX_ALL = CLSCTX.ALL; pub const CLSCTX_SERVER = CLSCTX.SERVER; pub const MSHLFLAGS = enum(i32) { NORMAL = 0, TABLESTRONG = 1, TABLEWEAK = 2, NOPING = 4, RESERVED1 = 8, RESERVED2 = 16, RESERVED3 = 32, RESERVED4 = 64, }; pub const MSHLFLAGS_NORMAL = MSHLFLAGS.NORMAL; pub const MSHLFLAGS_TABLESTRONG = MSHLFLAGS.TABLESTRONG; pub const MSHLFLAGS_TABLEWEAK = MSHLFLAGS.TABLEWEAK; pub const MSHLFLAGS_NOPING = MSHLFLAGS.NOPING; pub const MSHLFLAGS_RESERVED1 = MSHLFLAGS.RESERVED1; pub const MSHLFLAGS_RESERVED2 = MSHLFLAGS.RESERVED2; pub const MSHLFLAGS_RESERVED3 = MSHLFLAGS.RESERVED3; pub const MSHLFLAGS_RESERVED4 = MSHLFLAGS.RESERVED4; pub const MSHCTX = enum(i32) { LOCAL = 0, NOSHAREDMEM = 1, DIFFERENTMACHINE = 2, INPROC = 3, CROSSCTX = 4, RESERVED1 = 5, }; pub const MSHCTX_LOCAL = MSHCTX.LOCAL; pub const MSHCTX_NOSHAREDMEM = MSHCTX.NOSHAREDMEM; pub const MSHCTX_DIFFERENTMACHINE = MSHCTX.DIFFERENTMACHINE; pub const MSHCTX_INPROC = MSHCTX.INPROC; pub const MSHCTX_CROSSCTX = MSHCTX.CROSSCTX; pub const MSHCTX_RESERVED1 = MSHCTX.RESERVED1; pub const BYTE_BLOB = extern struct { clSize: u32, abData: [1]u8, }; pub const WORD_BLOB = extern struct { clSize: u32, asData: [1]u16, }; pub const DWORD_BLOB = extern struct { clSize: u32, alData: [1]u32, }; pub const FLAGGED_BYTE_BLOB = extern struct { fFlags: u32, clSize: u32, abData: [1]u8, }; pub const FLAGGED_WORD_BLOB = extern struct { fFlags: u32, clSize: u32, asData: [1]u16, }; pub const BYTE_SIZEDARR = extern struct { clSize: u32, pData: ?*u8, }; pub const SHORT_SIZEDARR = extern struct { clSize: u32, pData: ?*u16, }; pub const LONG_SIZEDARR = extern struct { clSize: u32, pData: ?*u32, }; pub const HYPER_SIZEDARR = extern struct { clSize: u32, pData: ?*i64, }; pub const BLOB = extern struct { cbSize: u32, pBlobData: ?*u8, }; const IID_IUnknown_Value = @import("../zig.zig").Guid.initString("00000000-0000-0000-c000-000000000046"); pub const IID_IUnknown = &IID_IUnknown_Value; pub const IUnknown = extern struct { pub const VTable = extern struct { QueryInterface: fn( self: *const IUnknown, riid: ?*const Guid, ppvObject: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddRef: fn( self: *const IUnknown, ) callconv(@import("std").os.windows.WINAPI) u32, Release: fn( self: *const IUnknown, ) callconv(@import("std").os.windows.WINAPI) u32, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUnknown_QueryInterface(self: *const T, riid: ?*const Guid, ppvObject: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IUnknown.VTable, self.vtable).QueryInterface(@ptrCast(*const IUnknown, self), riid, ppvObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUnknown_AddRef(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const IUnknown.VTable, self.vtable).AddRef(@ptrCast(*const IUnknown, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUnknown_Release(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const IUnknown.VTable, self.vtable).Release(@ptrCast(*const IUnknown, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_AsyncIUnknown_Value = @import("../zig.zig").Guid.initString("000e0000-0000-0000-c000-000000000046"); pub const IID_AsyncIUnknown = &IID_AsyncIUnknown_Value; pub const AsyncIUnknown = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Begin_QueryInterface: fn( self: *const AsyncIUnknown, riid: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_QueryInterface: fn( self: *const AsyncIUnknown, ppvObject: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_AddRef: fn( self: *const AsyncIUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_AddRef: fn( self: *const AsyncIUnknown, ) callconv(@import("std").os.windows.WINAPI) u32, Begin_Release: fn( self: *const AsyncIUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_Release: fn( self: *const AsyncIUnknown, ) callconv(@import("std").os.windows.WINAPI) u32, }; 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 AsyncIUnknown_Begin_QueryInterface(self: *const T, riid: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIUnknown.VTable, self.vtable).Begin_QueryInterface(@ptrCast(*const AsyncIUnknown, self), riid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIUnknown_Finish_QueryInterface(self: *const T, ppvObject: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIUnknown.VTable, self.vtable).Finish_QueryInterface(@ptrCast(*const AsyncIUnknown, self), ppvObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIUnknown_Begin_AddRef(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIUnknown.VTable, self.vtable).Begin_AddRef(@ptrCast(*const AsyncIUnknown, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIUnknown_Finish_AddRef(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const AsyncIUnknown.VTable, self.vtable).Finish_AddRef(@ptrCast(*const AsyncIUnknown, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIUnknown_Begin_Release(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIUnknown.VTable, self.vtable).Begin_Release(@ptrCast(*const AsyncIUnknown, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIUnknown_Finish_Release(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const AsyncIUnknown.VTable, self.vtable).Finish_Release(@ptrCast(*const AsyncIUnknown, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IClassFactory_Value = @import("../zig.zig").Guid.initString("00000001-0000-0000-c000-000000000046"); pub const IID_IClassFactory = &IID_IClassFactory_Value; pub const IClassFactory = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateInstance: fn( self: *const IClassFactory, pUnkOuter: ?*IUnknown, riid: ?*const Guid, ppvObject: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, LockServer: fn( self: *const IClassFactory, fLock: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IClassFactory_CreateInstance(self: *const T, pUnkOuter: ?*IUnknown, riid: ?*const Guid, ppvObject: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IClassFactory.VTable, self.vtable).CreateInstance(@ptrCast(*const IClassFactory, self), pUnkOuter, riid, ppvObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IClassFactory_LockServer(self: *const T, fLock: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IClassFactory.VTable, self.vtable).LockServer(@ptrCast(*const IClassFactory, self), fLock); } };} pub usingnamespace MethodMixin(@This()); }; pub const COSERVERINFO = extern struct { dwReserved1: u32, pwszName: ?PWSTR, pAuthInfo: ?*COAUTHINFO, dwReserved2: u32, }; // TODO: this type is limited to platform 'windows5.0' const IID_IMarshal_Value = @import("../zig.zig").Guid.initString("00000003-0000-0000-c000-000000000046"); pub const IID_IMarshal = &IID_IMarshal_Value; pub const IMarshal = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetUnmarshalClass: fn( self: *const IMarshal, riid: ?*const Guid, pv: ?*c_void, dwDestContext: u32, pvDestContext: ?*c_void, mshlflags: u32, pCid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMarshalSizeMax: fn( self: *const IMarshal, riid: ?*const Guid, pv: ?*c_void, dwDestContext: u32, pvDestContext: ?*c_void, mshlflags: u32, pSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MarshalInterface: fn( self: *const IMarshal, pStm: ?*IStream, riid: ?*const Guid, pv: ?*c_void, dwDestContext: u32, pvDestContext: ?*c_void, mshlflags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnmarshalInterface: fn( self: *const IMarshal, pStm: ?*IStream, riid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReleaseMarshalData: fn( self: *const IMarshal, pStm: ?*IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DisconnectObject: fn( self: *const IMarshal, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMarshal_GetUnmarshalClass(self: *const T, riid: ?*const Guid, pv: ?*c_void, dwDestContext: u32, pvDestContext: ?*c_void, mshlflags: u32, pCid: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IMarshal.VTable, self.vtable).GetUnmarshalClass(@ptrCast(*const IMarshal, self), riid, pv, dwDestContext, pvDestContext, mshlflags, pCid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMarshal_GetMarshalSizeMax(self: *const T, riid: ?*const Guid, pv: ?*c_void, dwDestContext: u32, pvDestContext: ?*c_void, mshlflags: u32, pSize: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMarshal.VTable, self.vtable).GetMarshalSizeMax(@ptrCast(*const IMarshal, self), riid, pv, dwDestContext, pvDestContext, mshlflags, pSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMarshal_MarshalInterface(self: *const T, pStm: ?*IStream, riid: ?*const Guid, pv: ?*c_void, dwDestContext: u32, pvDestContext: ?*c_void, mshlflags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMarshal.VTable, self.vtable).MarshalInterface(@ptrCast(*const IMarshal, self), pStm, riid, pv, dwDestContext, pvDestContext, mshlflags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMarshal_UnmarshalInterface(self: *const T, pStm: ?*IStream, riid: ?*const Guid, ppv: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IMarshal.VTable, self.vtable).UnmarshalInterface(@ptrCast(*const IMarshal, self), pStm, riid, ppv); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMarshal_ReleaseMarshalData(self: *const T, pStm: ?*IStream) callconv(.Inline) HRESULT { return @ptrCast(*const IMarshal.VTable, self.vtable).ReleaseMarshalData(@ptrCast(*const IMarshal, self), pStm); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMarshal_DisconnectObject(self: *const T, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMarshal.VTable, self.vtable).DisconnectObject(@ptrCast(*const IMarshal, self), dwReserved); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_INoMarshal_Value = @import("../zig.zig").Guid.initString("ecc8691b-c1db-4dc0-855e-65f6c551af49"); pub const IID_INoMarshal = &IID_INoMarshal_Value; pub const INoMarshal = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IAgileObject_Value = @import("../zig.zig").Guid.initString("94ea2b94-e9cc-49e0-c0ff-ee64ca8f5b90"); pub const IID_IAgileObject = &IID_IAgileObject_Value; pub const IAgileObject = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; const IID_IActivationFilter_Value = @import("../zig.zig").Guid.initString("00000017-0000-0000-c000-000000000046"); pub const IID_IActivationFilter = &IID_IActivationFilter_Value; pub const IActivationFilter = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, HandleActivation: fn( self: *const IActivationFilter, dwActivationType: u32, rclsid: ?*const Guid, pReplacementClsId: ?*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 IActivationFilter_HandleActivation(self: *const T, dwActivationType: u32, rclsid: ?*const Guid, pReplacementClsId: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IActivationFilter.VTable, self.vtable).HandleActivation(@ptrCast(*const IActivationFilter, self), dwActivationType, rclsid, pReplacementClsId); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IMarshal2_Value = @import("../zig.zig").Guid.initString("000001cf-0000-0000-c000-000000000046"); pub const IID_IMarshal2 = &IID_IMarshal2_Value; pub const IMarshal2 = extern struct { pub const VTable = extern struct { base: IMarshal.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IMarshal.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IMalloc_Value = @import("../zig.zig").Guid.initString("00000002-0000-0000-c000-000000000046"); pub const IID_IMalloc = &IID_IMalloc_Value; pub const IMalloc = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Alloc: fn( self: *const IMalloc, cb: usize, ) callconv(@import("std").os.windows.WINAPI) ?*c_void, Realloc: fn( self: *const IMalloc, pv: ?*c_void, cb: usize, ) callconv(@import("std").os.windows.WINAPI) ?*c_void, Free: fn( self: *const IMalloc, pv: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) void, GetSize: fn( self: *const IMalloc, pv: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) usize, DidAlloc: fn( self: *const IMalloc, pv: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) i32, HeapMinimize: fn( self: *const IMalloc, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMalloc_Alloc(self: *const T, cb: usize) callconv(.Inline) ?*c_void { return @ptrCast(*const IMalloc.VTable, self.vtable).Alloc(@ptrCast(*const IMalloc, self), cb); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMalloc_Realloc(self: *const T, pv: ?*c_void, cb: usize) callconv(.Inline) ?*c_void { return @ptrCast(*const IMalloc.VTable, self.vtable).Realloc(@ptrCast(*const IMalloc, self), pv, cb); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMalloc_Free(self: *const T, pv: ?*c_void) callconv(.Inline) void { return @ptrCast(*const IMalloc.VTable, self.vtable).Free(@ptrCast(*const IMalloc, self), pv); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMalloc_GetSize(self: *const T, pv: ?*c_void) callconv(.Inline) usize { return @ptrCast(*const IMalloc.VTable, self.vtable).GetSize(@ptrCast(*const IMalloc, self), pv); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMalloc_DidAlloc(self: *const T, pv: ?*c_void) callconv(.Inline) i32 { return @ptrCast(*const IMalloc.VTable, self.vtable).DidAlloc(@ptrCast(*const IMalloc, self), pv); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMalloc_HeapMinimize(self: *const T) callconv(.Inline) void { return @ptrCast(*const IMalloc.VTable, self.vtable).HeapMinimize(@ptrCast(*const IMalloc, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IStdMarshalInfo_Value = @import("../zig.zig").Guid.initString("00000018-0000-0000-c000-000000000046"); pub const IID_IStdMarshalInfo = &IID_IStdMarshalInfo_Value; pub const IStdMarshalInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetClassForHandler: fn( self: *const IStdMarshalInfo, dwDestContext: u32, pvDestContext: ?*c_void, pClsid: ?*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 IStdMarshalInfo_GetClassForHandler(self: *const T, dwDestContext: u32, pvDestContext: ?*c_void, pClsid: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IStdMarshalInfo.VTable, self.vtable).GetClassForHandler(@ptrCast(*const IStdMarshalInfo, self), dwDestContext, pvDestContext, pClsid); } };} pub usingnamespace MethodMixin(@This()); }; pub const EXTCONN = enum(i32) { STRONG = 1, WEAK = 2, CALLABLE = 4, }; pub const EXTCONN_STRONG = EXTCONN.STRONG; pub const EXTCONN_WEAK = EXTCONN.WEAK; pub const EXTCONN_CALLABLE = EXTCONN.CALLABLE; // TODO: this type is limited to platform 'windows5.0' const IID_IExternalConnection_Value = @import("../zig.zig").Guid.initString("00000019-0000-0000-c000-000000000046"); pub const IID_IExternalConnection = &IID_IExternalConnection_Value; pub const IExternalConnection = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AddConnection: fn( self: *const IExternalConnection, extconn: u32, reserved: u32, ) callconv(@import("std").os.windows.WINAPI) u32, ReleaseConnection: fn( self: *const IExternalConnection, extconn: u32, reserved: u32, fLastReleaseCloses: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32, }; 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 IExternalConnection_AddConnection(self: *const T, extconn: u32, reserved: u32) callconv(.Inline) u32 { return @ptrCast(*const IExternalConnection.VTable, self.vtable).AddConnection(@ptrCast(*const IExternalConnection, self), extconn, reserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IExternalConnection_ReleaseConnection(self: *const T, extconn: u32, reserved: u32, fLastReleaseCloses: BOOL) callconv(.Inline) u32 { return @ptrCast(*const IExternalConnection.VTable, self.vtable).ReleaseConnection(@ptrCast(*const IExternalConnection, self), extconn, reserved, fLastReleaseCloses); } };} pub usingnamespace MethodMixin(@This()); }; pub const MULTI_QI = extern struct { pIID: ?*const Guid, pItf: ?*IUnknown, hr: HRESULT, }; // TODO: this type is limited to platform 'windows5.0' const IID_IMultiQI_Value = @import("../zig.zig").Guid.initString("00000020-0000-0000-c000-000000000046"); pub const IID_IMultiQI = &IID_IMultiQI_Value; pub const IMultiQI = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, QueryMultipleInterfaces: fn( self: *const IMultiQI, cMQIs: u32, pMQIs: [*]MULTI_QI, ) 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 IMultiQI_QueryMultipleInterfaces(self: *const T, cMQIs: u32, pMQIs: [*]MULTI_QI) callconv(.Inline) HRESULT { return @ptrCast(*const IMultiQI.VTable, self.vtable).QueryMultipleInterfaces(@ptrCast(*const IMultiQI, self), cMQIs, pMQIs); } };} pub usingnamespace MethodMixin(@This()); }; const IID_AsyncIMultiQI_Value = @import("../zig.zig").Guid.initString("000e0020-0000-0000-c000-000000000046"); pub const IID_AsyncIMultiQI = &IID_AsyncIMultiQI_Value; pub const AsyncIMultiQI = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Begin_QueryMultipleInterfaces: fn( self: *const AsyncIMultiQI, cMQIs: u32, pMQIs: [*]MULTI_QI, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_QueryMultipleInterfaces: fn( self: *const AsyncIMultiQI, pMQIs: ?*MULTI_QI, ) 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 AsyncIMultiQI_Begin_QueryMultipleInterfaces(self: *const T, cMQIs: u32, pMQIs: [*]MULTI_QI) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIMultiQI.VTable, self.vtable).Begin_QueryMultipleInterfaces(@ptrCast(*const AsyncIMultiQI, self), cMQIs, pMQIs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIMultiQI_Finish_QueryMultipleInterfaces(self: *const T, pMQIs: ?*MULTI_QI) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIMultiQI.VTable, self.vtable).Finish_QueryMultipleInterfaces(@ptrCast(*const AsyncIMultiQI, self), pMQIs); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IInternalUnknown_Value = @import("../zig.zig").Guid.initString("00000021-0000-0000-c000-000000000046"); pub const IID_IInternalUnknown = &IID_IInternalUnknown_Value; pub const IInternalUnknown = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, QueryInternalInterface: fn( self: *const IInternalUnknown, riid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternalUnknown_QueryInternalInterface(self: *const T, riid: ?*const Guid, ppv: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IInternalUnknown.VTable, self.vtable).QueryInternalInterface(@ptrCast(*const IInternalUnknown, self), riid, ppv); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IEnumUnknown_Value = @import("../zig.zig").Guid.initString("00000100-0000-0000-c000-000000000046"); pub const IID_IEnumUnknown = &IID_IEnumUnknown_Value; pub const IEnumUnknown = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumUnknown, celt: u32, rgelt: [*]?*IUnknown, pceltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumUnknown, celt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumUnknown, ppenum: ?*?*IEnumUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumUnknown_Next(self: *const T, celt: u32, rgelt: [*]?*IUnknown, pceltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumUnknown.VTable, self.vtable).Next(@ptrCast(*const IEnumUnknown, self), celt, rgelt, pceltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumUnknown_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumUnknown.VTable, self.vtable).Skip(@ptrCast(*const IEnumUnknown, self), celt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumUnknown_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumUnknown.VTable, self.vtable).Reset(@ptrCast(*const IEnumUnknown, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumUnknown_Clone(self: *const T, ppenum: ?*?*IEnumUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumUnknown.VTable, self.vtable).Clone(@ptrCast(*const IEnumUnknown, self), ppenum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IEnumString_Value = @import("../zig.zig").Guid.initString("00000101-0000-0000-c000-000000000046"); pub const IID_IEnumString = &IID_IEnumString_Value; pub const IEnumString = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumString, celt: u32, rgelt: [*]?PWSTR, pceltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumString, celt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumString, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumString, ppenum: ?*?*IEnumString, ) 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 IEnumString_Next(self: *const T, celt: u32, rgelt: [*]?PWSTR, pceltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumString.VTable, self.vtable).Next(@ptrCast(*const IEnumString, self), celt, rgelt, pceltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumString_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumString.VTable, self.vtable).Skip(@ptrCast(*const IEnumString, self), celt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumString_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumString.VTable, self.vtable).Reset(@ptrCast(*const IEnumString, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumString_Clone(self: *const T, ppenum: ?*?*IEnumString) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumString.VTable, self.vtable).Clone(@ptrCast(*const IEnumString, self), ppenum); } };} pub usingnamespace MethodMixin(@This()); }; pub const RPCOLEMESSAGE = extern struct { reserved1: ?*c_void, dataRepresentation: u32, Buffer: ?*c_void, cbBuffer: u32, iMethod: u32, reserved2: [5]?*c_void, rpcFlags: u32, }; // TODO: this type is limited to platform 'windows5.0' const IID_IRpcChannelBuffer_Value = @import("../zig.zig").Guid.initString("d5f56b60-593b-101a-b569-08002b2dbf7a"); pub const IID_IRpcChannelBuffer = &IID_IRpcChannelBuffer_Value; pub const IRpcChannelBuffer = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetBuffer: fn( self: *const IRpcChannelBuffer, pMessage: ?*RPCOLEMESSAGE, riid: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendReceive: fn( self: *const IRpcChannelBuffer, pMessage: ?*RPCOLEMESSAGE, pStatus: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FreeBuffer: fn( self: *const IRpcChannelBuffer, pMessage: ?*RPCOLEMESSAGE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDestCtx: fn( self: *const IRpcChannelBuffer, pdwDestContext: ?*u32, ppvDestContext: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsConnected: fn( self: *const IRpcChannelBuffer, ) 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 IRpcChannelBuffer_GetBuffer(self: *const T, pMessage: ?*RPCOLEMESSAGE, riid: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcChannelBuffer.VTable, self.vtable).GetBuffer(@ptrCast(*const IRpcChannelBuffer, self), pMessage, riid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcChannelBuffer_SendReceive(self: *const T, pMessage: ?*RPCOLEMESSAGE, pStatus: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcChannelBuffer.VTable, self.vtable).SendReceive(@ptrCast(*const IRpcChannelBuffer, self), pMessage, pStatus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcChannelBuffer_FreeBuffer(self: *const T, pMessage: ?*RPCOLEMESSAGE) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcChannelBuffer.VTable, self.vtable).FreeBuffer(@ptrCast(*const IRpcChannelBuffer, self), pMessage); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcChannelBuffer_GetDestCtx(self: *const T, pdwDestContext: ?*u32, ppvDestContext: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcChannelBuffer.VTable, self.vtable).GetDestCtx(@ptrCast(*const IRpcChannelBuffer, self), pdwDestContext, ppvDestContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcChannelBuffer_IsConnected(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcChannelBuffer.VTable, self.vtable).IsConnected(@ptrCast(*const IRpcChannelBuffer, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IRpcChannelBuffer2_Value = @import("../zig.zig").Guid.initString("594f31d0-7f19-11d0-b194-00a0c90dc8bf"); pub const IID_IRpcChannelBuffer2 = &IID_IRpcChannelBuffer2_Value; pub const IRpcChannelBuffer2 = extern struct { pub const VTable = extern struct { base: IRpcChannelBuffer.VTable, GetProtocolVersion: fn( self: *const IRpcChannelBuffer2, pdwVersion: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IRpcChannelBuffer.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcChannelBuffer2_GetProtocolVersion(self: *const T, pdwVersion: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcChannelBuffer2.VTable, self.vtable).GetProtocolVersion(@ptrCast(*const IRpcChannelBuffer2, self), pdwVersion); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IAsyncRpcChannelBuffer_Value = @import("../zig.zig").Guid.initString("a5029fb6-3c34-11d1-9c99-00c04fb998aa"); pub const IID_IAsyncRpcChannelBuffer = &IID_IAsyncRpcChannelBuffer_Value; pub const IAsyncRpcChannelBuffer = extern struct { pub const VTable = extern struct { base: IRpcChannelBuffer2.VTable, Send: fn( self: *const IAsyncRpcChannelBuffer, pMsg: ?*RPCOLEMESSAGE, pSync: ?*ISynchronize, pulStatus: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Receive: fn( self: *const IAsyncRpcChannelBuffer, pMsg: ?*RPCOLEMESSAGE, pulStatus: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDestCtxEx: fn( self: *const IAsyncRpcChannelBuffer, pMsg: ?*RPCOLEMESSAGE, pdwDestContext: ?*u32, ppvDestContext: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IRpcChannelBuffer2.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAsyncRpcChannelBuffer_Send(self: *const T, pMsg: ?*RPCOLEMESSAGE, pSync: ?*ISynchronize, pulStatus: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAsyncRpcChannelBuffer.VTable, self.vtable).Send(@ptrCast(*const IAsyncRpcChannelBuffer, self), pMsg, pSync, pulStatus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAsyncRpcChannelBuffer_Receive(self: *const T, pMsg: ?*RPCOLEMESSAGE, pulStatus: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAsyncRpcChannelBuffer.VTable, self.vtable).Receive(@ptrCast(*const IAsyncRpcChannelBuffer, self), pMsg, pulStatus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAsyncRpcChannelBuffer_GetDestCtxEx(self: *const T, pMsg: ?*RPCOLEMESSAGE, pdwDestContext: ?*u32, ppvDestContext: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IAsyncRpcChannelBuffer.VTable, self.vtable).GetDestCtxEx(@ptrCast(*const IAsyncRpcChannelBuffer, self), pMsg, pdwDestContext, ppvDestContext); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IRpcChannelBuffer3_Value = @import("../zig.zig").Guid.initString("25b15600-0115-11d0-bf0d-00aa00b8dfd2"); pub const IID_IRpcChannelBuffer3 = &IID_IRpcChannelBuffer3_Value; pub const IRpcChannelBuffer3 = extern struct { pub const VTable = extern struct { base: IRpcChannelBuffer2.VTable, Send: fn( self: *const IRpcChannelBuffer3, pMsg: ?*RPCOLEMESSAGE, pulStatus: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Receive: fn( self: *const IRpcChannelBuffer3, pMsg: ?*RPCOLEMESSAGE, ulSize: u32, pulStatus: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Cancel: fn( self: *const IRpcChannelBuffer3, pMsg: ?*RPCOLEMESSAGE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCallContext: fn( self: *const IRpcChannelBuffer3, pMsg: ?*RPCOLEMESSAGE, riid: ?*const Guid, pInterface: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDestCtxEx: fn( self: *const IRpcChannelBuffer3, pMsg: ?*RPCOLEMESSAGE, pdwDestContext: ?*u32, ppvDestContext: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetState: fn( self: *const IRpcChannelBuffer3, pMsg: ?*RPCOLEMESSAGE, pState: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterAsync: fn( self: *const IRpcChannelBuffer3, pMsg: ?*RPCOLEMESSAGE, pAsyncMgr: ?*IAsyncManager, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IRpcChannelBuffer2.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcChannelBuffer3_Send(self: *const T, pMsg: ?*RPCOLEMESSAGE, pulStatus: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcChannelBuffer3.VTable, self.vtable).Send(@ptrCast(*const IRpcChannelBuffer3, self), pMsg, pulStatus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcChannelBuffer3_Receive(self: *const T, pMsg: ?*RPCOLEMESSAGE, ulSize: u32, pulStatus: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcChannelBuffer3.VTable, self.vtable).Receive(@ptrCast(*const IRpcChannelBuffer3, self), pMsg, ulSize, pulStatus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcChannelBuffer3_Cancel(self: *const T, pMsg: ?*RPCOLEMESSAGE) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcChannelBuffer3.VTable, self.vtable).Cancel(@ptrCast(*const IRpcChannelBuffer3, self), pMsg); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcChannelBuffer3_GetCallContext(self: *const T, pMsg: ?*RPCOLEMESSAGE, riid: ?*const Guid, pInterface: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcChannelBuffer3.VTable, self.vtable).GetCallContext(@ptrCast(*const IRpcChannelBuffer3, self), pMsg, riid, pInterface); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcChannelBuffer3_GetDestCtxEx(self: *const T, pMsg: ?*RPCOLEMESSAGE, pdwDestContext: ?*u32, ppvDestContext: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcChannelBuffer3.VTable, self.vtable).GetDestCtxEx(@ptrCast(*const IRpcChannelBuffer3, self), pMsg, pdwDestContext, ppvDestContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcChannelBuffer3_GetState(self: *const T, pMsg: ?*RPCOLEMESSAGE, pState: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcChannelBuffer3.VTable, self.vtable).GetState(@ptrCast(*const IRpcChannelBuffer3, self), pMsg, pState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcChannelBuffer3_RegisterAsync(self: *const T, pMsg: ?*RPCOLEMESSAGE, pAsyncMgr: ?*IAsyncManager) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcChannelBuffer3.VTable, self.vtable).RegisterAsync(@ptrCast(*const IRpcChannelBuffer3, self), pMsg, pAsyncMgr); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IRpcSyntaxNegotiate_Value = @import("../zig.zig").Guid.initString("58a08519-24c8-4935-b482-3fd823333a4f"); pub const IID_IRpcSyntaxNegotiate = &IID_IRpcSyntaxNegotiate_Value; pub const IRpcSyntaxNegotiate = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, NegotiateSyntax: fn( self: *const IRpcSyntaxNegotiate, pMsg: ?*RPCOLEMESSAGE, ) 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 IRpcSyntaxNegotiate_NegotiateSyntax(self: *const T, pMsg: ?*RPCOLEMESSAGE) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcSyntaxNegotiate.VTable, self.vtable).NegotiateSyntax(@ptrCast(*const IRpcSyntaxNegotiate, self), pMsg); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IRpcProxyBuffer_Value = @import("../zig.zig").Guid.initString("d5f56a34-593b-101a-b569-08002b2dbf7a"); pub const IID_IRpcProxyBuffer = &IID_IRpcProxyBuffer_Value; pub const IRpcProxyBuffer = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Connect: fn( self: *const IRpcProxyBuffer, pRpcChannelBuffer: ?*IRpcChannelBuffer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Disconnect: fn( self: *const IRpcProxyBuffer, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcProxyBuffer_Connect(self: *const T, pRpcChannelBuffer: ?*IRpcChannelBuffer) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcProxyBuffer.VTable, self.vtable).Connect(@ptrCast(*const IRpcProxyBuffer, self), pRpcChannelBuffer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcProxyBuffer_Disconnect(self: *const T) callconv(.Inline) void { return @ptrCast(*const IRpcProxyBuffer.VTable, self.vtable).Disconnect(@ptrCast(*const IRpcProxyBuffer, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IRpcStubBuffer_Value = @import("../zig.zig").Guid.initString("d5f56afc-593b-101a-b569-08002b2dbf7a"); pub const IID_IRpcStubBuffer = &IID_IRpcStubBuffer_Value; pub const IRpcStubBuffer = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Connect: fn( self: *const IRpcStubBuffer, pUnkServer: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Disconnect: fn( self: *const IRpcStubBuffer, ) callconv(@import("std").os.windows.WINAPI) void, Invoke: fn( self: *const IRpcStubBuffer, _prpcmsg: ?*RPCOLEMESSAGE, _pRpcChannelBuffer: ?*IRpcChannelBuffer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsIIDSupported: fn( self: *const IRpcStubBuffer, riid: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) ?*IRpcStubBuffer, CountRefs: fn( self: *const IRpcStubBuffer, ) callconv(@import("std").os.windows.WINAPI) u32, DebugServerQueryInterface: fn( self: *const IRpcStubBuffer, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DebugServerRelease: fn( self: *const IRpcStubBuffer, pv: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcStubBuffer_Connect(self: *const T, pUnkServer: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcStubBuffer.VTable, self.vtable).Connect(@ptrCast(*const IRpcStubBuffer, self), pUnkServer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcStubBuffer_Disconnect(self: *const T) callconv(.Inline) void { return @ptrCast(*const IRpcStubBuffer.VTable, self.vtable).Disconnect(@ptrCast(*const IRpcStubBuffer, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcStubBuffer_Invoke(self: *const T, _prpcmsg: ?*RPCOLEMESSAGE, _pRpcChannelBuffer: ?*IRpcChannelBuffer) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcStubBuffer.VTable, self.vtable).Invoke(@ptrCast(*const IRpcStubBuffer, self), _prpcmsg, _pRpcChannelBuffer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcStubBuffer_IsIIDSupported(self: *const T, riid: ?*const Guid) callconv(.Inline) ?*IRpcStubBuffer { return @ptrCast(*const IRpcStubBuffer.VTable, self.vtable).IsIIDSupported(@ptrCast(*const IRpcStubBuffer, self), riid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcStubBuffer_CountRefs(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const IRpcStubBuffer.VTable, self.vtable).CountRefs(@ptrCast(*const IRpcStubBuffer, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcStubBuffer_DebugServerQueryInterface(self: *const T, ppv: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcStubBuffer.VTable, self.vtable).DebugServerQueryInterface(@ptrCast(*const IRpcStubBuffer, self), ppv); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcStubBuffer_DebugServerRelease(self: *const T, pv: ?*c_void) callconv(.Inline) void { return @ptrCast(*const IRpcStubBuffer.VTable, self.vtable).DebugServerRelease(@ptrCast(*const IRpcStubBuffer, self), pv); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IPSFactoryBuffer_Value = @import("../zig.zig").Guid.initString("d5f569d0-593b-101a-b569-08002b2dbf7a"); pub const IID_IPSFactoryBuffer = &IID_IPSFactoryBuffer_Value; pub const IPSFactoryBuffer = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateProxy: fn( self: *const IPSFactoryBuffer, pUnkOuter: ?*IUnknown, riid: ?*const Guid, ppProxy: ?*?*IRpcProxyBuffer, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateStub: fn( self: *const IPSFactoryBuffer, riid: ?*const Guid, pUnkServer: ?*IUnknown, ppStub: ?*?*IRpcStubBuffer, ) 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 IPSFactoryBuffer_CreateProxy(self: *const T, pUnkOuter: ?*IUnknown, riid: ?*const Guid, ppProxy: ?*?*IRpcProxyBuffer, ppv: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IPSFactoryBuffer.VTable, self.vtable).CreateProxy(@ptrCast(*const IPSFactoryBuffer, self), pUnkOuter, riid, ppProxy, ppv); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPSFactoryBuffer_CreateStub(self: *const T, riid: ?*const Guid, pUnkServer: ?*IUnknown, ppStub: ?*?*IRpcStubBuffer) callconv(.Inline) HRESULT { return @ptrCast(*const IPSFactoryBuffer.VTable, self.vtable).CreateStub(@ptrCast(*const IPSFactoryBuffer, self), riid, pUnkServer, ppStub); } };} pub usingnamespace MethodMixin(@This()); }; pub const SChannelHookCallInfo = extern struct { iid: Guid, cbSize: u32, uCausality: Guid, dwServerPid: u32, iMethod: u32, pObject: ?*c_void, }; const IID_IChannelHook_Value = @import("../zig.zig").Guid.initString("1008c4a0-7613-11cf-9af1-0020af6e72f4"); pub const IID_IChannelHook = &IID_IChannelHook_Value; pub const IChannelHook = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ClientGetSize: fn( self: *const IChannelHook, uExtent: ?*const Guid, riid: ?*const Guid, pDataSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) void, ClientFillBuffer: fn( self: *const IChannelHook, uExtent: ?*const Guid, riid: ?*const Guid, pDataSize: ?*u32, pDataBuffer: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) void, ClientNotify: fn( self: *const IChannelHook, uExtent: ?*const Guid, riid: ?*const Guid, cbDataSize: u32, pDataBuffer: ?*c_void, lDataRep: u32, hrFault: HRESULT, ) callconv(@import("std").os.windows.WINAPI) void, ServerNotify: fn( self: *const IChannelHook, uExtent: ?*const Guid, riid: ?*const Guid, cbDataSize: u32, pDataBuffer: ?*c_void, lDataRep: u32, ) callconv(@import("std").os.windows.WINAPI) void, ServerGetSize: fn( self: *const IChannelHook, uExtent: ?*const Guid, riid: ?*const Guid, hrFault: HRESULT, pDataSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) void, ServerFillBuffer: fn( self: *const IChannelHook, uExtent: ?*const Guid, riid: ?*const Guid, pDataSize: ?*u32, pDataBuffer: ?*c_void, hrFault: HRESULT, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IChannelHook_ClientGetSize(self: *const T, uExtent: ?*const Guid, riid: ?*const Guid, pDataSize: ?*u32) callconv(.Inline) void { return @ptrCast(*const IChannelHook.VTable, self.vtable).ClientGetSize(@ptrCast(*const IChannelHook, self), uExtent, riid, pDataSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IChannelHook_ClientFillBuffer(self: *const T, uExtent: ?*const Guid, riid: ?*const Guid, pDataSize: ?*u32, pDataBuffer: ?*c_void) callconv(.Inline) void { return @ptrCast(*const IChannelHook.VTable, self.vtable).ClientFillBuffer(@ptrCast(*const IChannelHook, self), uExtent, riid, pDataSize, pDataBuffer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IChannelHook_ClientNotify(self: *const T, uExtent: ?*const Guid, riid: ?*const Guid, cbDataSize: u32, pDataBuffer: ?*c_void, lDataRep: u32, hrFault: HRESULT) callconv(.Inline) void { return @ptrCast(*const IChannelHook.VTable, self.vtable).ClientNotify(@ptrCast(*const IChannelHook, self), uExtent, riid, cbDataSize, pDataBuffer, lDataRep, hrFault); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IChannelHook_ServerNotify(self: *const T, uExtent: ?*const Guid, riid: ?*const Guid, cbDataSize: u32, pDataBuffer: ?*c_void, lDataRep: u32) callconv(.Inline) void { return @ptrCast(*const IChannelHook.VTable, self.vtable).ServerNotify(@ptrCast(*const IChannelHook, self), uExtent, riid, cbDataSize, pDataBuffer, lDataRep); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IChannelHook_ServerGetSize(self: *const T, uExtent: ?*const Guid, riid: ?*const Guid, hrFault: HRESULT, pDataSize: ?*u32) callconv(.Inline) void { return @ptrCast(*const IChannelHook.VTable, self.vtable).ServerGetSize(@ptrCast(*const IChannelHook, self), uExtent, riid, hrFault, pDataSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IChannelHook_ServerFillBuffer(self: *const T, uExtent: ?*const Guid, riid: ?*const Guid, pDataSize: ?*u32, pDataBuffer: ?*c_void, hrFault: HRESULT) callconv(.Inline) void { return @ptrCast(*const IChannelHook.VTable, self.vtable).ServerFillBuffer(@ptrCast(*const IChannelHook, self), uExtent, riid, pDataSize, pDataBuffer, hrFault); } };} pub usingnamespace MethodMixin(@This()); }; pub const SOLE_AUTHENTICATION_SERVICE = extern struct { dwAuthnSvc: u32, dwAuthzSvc: u32, pPrincipalName: ?PWSTR, hr: HRESULT, }; pub const EOLE_AUTHENTICATION_CAPABILITIES = enum(i32) { NONE = 0, MUTUAL_AUTH = 1, STATIC_CLOAKING = 32, DYNAMIC_CLOAKING = 64, ANY_AUTHORITY = 128, MAKE_FULLSIC = 256, DEFAULT = 2048, SECURE_REFS = 2, ACCESS_CONTROL = 4, APPID = 8, DYNAMIC = 16, REQUIRE_FULLSIC = 512, AUTO_IMPERSONATE = 1024, DISABLE_AAA = 4096, NO_CUSTOM_MARSHAL = 8192, RESERVED1 = 16384, }; pub const EOAC_NONE = EOLE_AUTHENTICATION_CAPABILITIES.NONE; pub const EOAC_MUTUAL_AUTH = EOLE_AUTHENTICATION_CAPABILITIES.MUTUAL_AUTH; pub const EOAC_STATIC_CLOAKING = EOLE_AUTHENTICATION_CAPABILITIES.STATIC_CLOAKING; pub const EOAC_DYNAMIC_CLOAKING = EOLE_AUTHENTICATION_CAPABILITIES.DYNAMIC_CLOAKING; pub const EOAC_ANY_AUTHORITY = EOLE_AUTHENTICATION_CAPABILITIES.ANY_AUTHORITY; pub const EOAC_MAKE_FULLSIC = EOLE_AUTHENTICATION_CAPABILITIES.MAKE_FULLSIC; pub const EOAC_DEFAULT = EOLE_AUTHENTICATION_CAPABILITIES.DEFAULT; pub const EOAC_SECURE_REFS = EOLE_AUTHENTICATION_CAPABILITIES.SECURE_REFS; pub const EOAC_ACCESS_CONTROL = EOLE_AUTHENTICATION_CAPABILITIES.ACCESS_CONTROL; pub const EOAC_APPID = EOLE_AUTHENTICATION_CAPABILITIES.APPID; pub const EOAC_DYNAMIC = EOLE_AUTHENTICATION_CAPABILITIES.DYNAMIC; pub const EOAC_REQUIRE_FULLSIC = EOLE_AUTHENTICATION_CAPABILITIES.REQUIRE_FULLSIC; pub const EOAC_AUTO_IMPERSONATE = EOLE_AUTHENTICATION_CAPABILITIES.AUTO_IMPERSONATE; pub const EOAC_DISABLE_AAA = EOLE_AUTHENTICATION_CAPABILITIES.DISABLE_AAA; pub const EOAC_NO_CUSTOM_MARSHAL = EOLE_AUTHENTICATION_CAPABILITIES.NO_CUSTOM_MARSHAL; pub const EOAC_RESERVED1 = EOLE_AUTHENTICATION_CAPABILITIES.RESERVED1; pub const SOLE_AUTHENTICATION_INFO = extern struct { dwAuthnSvc: u32, dwAuthzSvc: u32, pAuthInfo: ?*c_void, }; pub const SOLE_AUTHENTICATION_LIST = extern struct { cAuthInfo: u32, aAuthInfo: ?*SOLE_AUTHENTICATION_INFO, }; // TODO: this type is limited to platform 'windows5.0' const IID_IClientSecurity_Value = @import("../zig.zig").Guid.initString("0000013d-0000-0000-c000-000000000046"); pub const IID_IClientSecurity = &IID_IClientSecurity_Value; pub const IClientSecurity = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, QueryBlanket: fn( self: *const IClientSecurity, pProxy: ?*IUnknown, pAuthnSvc: ?*u32, pAuthzSvc: ?*u32, pServerPrincName: ?*?*u16, pAuthnLevel: ?*RPC_C_AUTHN_LEVEL, pImpLevel: ?*RPC_C_IMP_LEVEL, pAuthInfo: ?*?*c_void, pCapabilites: ?*EOLE_AUTHENTICATION_CAPABILITIES, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetBlanket: fn( self: *const IClientSecurity, pProxy: ?*IUnknown, dwAuthnSvc: u32, dwAuthzSvc: u32, pServerPrincName: ?PWSTR, dwAuthnLevel: RPC_C_AUTHN_LEVEL, dwImpLevel: RPC_C_IMP_LEVEL, pAuthInfo: ?*c_void, dwCapabilities: EOLE_AUTHENTICATION_CAPABILITIES, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CopyProxy: fn( self: *const IClientSecurity, pProxy: ?*IUnknown, ppCopy: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IClientSecurity_QueryBlanket(self: *const T, pProxy: ?*IUnknown, pAuthnSvc: ?*u32, pAuthzSvc: ?*u32, pServerPrincName: ?*?*u16, pAuthnLevel: ?*RPC_C_AUTHN_LEVEL, pImpLevel: ?*RPC_C_IMP_LEVEL, pAuthInfo: ?*?*c_void, pCapabilites: ?*EOLE_AUTHENTICATION_CAPABILITIES) callconv(.Inline) HRESULT { return @ptrCast(*const IClientSecurity.VTable, self.vtable).QueryBlanket(@ptrCast(*const IClientSecurity, self), pProxy, pAuthnSvc, pAuthzSvc, pServerPrincName, pAuthnLevel, pImpLevel, pAuthInfo, pCapabilites); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IClientSecurity_SetBlanket(self: *const T, pProxy: ?*IUnknown, dwAuthnSvc: u32, dwAuthzSvc: u32, pServerPrincName: ?PWSTR, dwAuthnLevel: RPC_C_AUTHN_LEVEL, dwImpLevel: RPC_C_IMP_LEVEL, pAuthInfo: ?*c_void, dwCapabilities: EOLE_AUTHENTICATION_CAPABILITIES) callconv(.Inline) HRESULT { return @ptrCast(*const IClientSecurity.VTable, self.vtable).SetBlanket(@ptrCast(*const IClientSecurity, self), pProxy, dwAuthnSvc, dwAuthzSvc, pServerPrincName, dwAuthnLevel, dwImpLevel, pAuthInfo, dwCapabilities); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IClientSecurity_CopyProxy(self: *const T, pProxy: ?*IUnknown, ppCopy: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IClientSecurity.VTable, self.vtable).CopyProxy(@ptrCast(*const IClientSecurity, self), pProxy, ppCopy); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IServerSecurity_Value = @import("../zig.zig").Guid.initString("0000013e-0000-0000-c000-000000000046"); pub const IID_IServerSecurity = &IID_IServerSecurity_Value; pub const IServerSecurity = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, QueryBlanket: fn( self: *const IServerSecurity, pAuthnSvc: ?*u32, pAuthzSvc: ?*u32, pServerPrincName: ?*?*u16, pAuthnLevel: ?*u32, pImpLevel: ?*u32, pPrivs: ?*?*c_void, pCapabilities: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ImpersonateClient: fn( self: *const IServerSecurity, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RevertToSelf: fn( self: *const IServerSecurity, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsImpersonating: fn( self: *const IServerSecurity, ) callconv(@import("std").os.windows.WINAPI) BOOL, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IServerSecurity_QueryBlanket(self: *const T, pAuthnSvc: ?*u32, pAuthzSvc: ?*u32, pServerPrincName: ?*?*u16, pAuthnLevel: ?*u32, pImpLevel: ?*u32, pPrivs: ?*?*c_void, pCapabilities: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IServerSecurity.VTable, self.vtable).QueryBlanket(@ptrCast(*const IServerSecurity, self), pAuthnSvc, pAuthzSvc, pServerPrincName, pAuthnLevel, pImpLevel, pPrivs, pCapabilities); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IServerSecurity_ImpersonateClient(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IServerSecurity.VTable, self.vtable).ImpersonateClient(@ptrCast(*const IServerSecurity, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IServerSecurity_RevertToSelf(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IServerSecurity.VTable, self.vtable).RevertToSelf(@ptrCast(*const IServerSecurity, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IServerSecurity_IsImpersonating(self: *const T) callconv(.Inline) BOOL { return @ptrCast(*const IServerSecurity.VTable, self.vtable).IsImpersonating(@ptrCast(*const IServerSecurity, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const RPCOPT_PROPERTIES = enum(i32) { RPCTIMEOUT = 1, SERVER_LOCALITY = 2, RESERVED1 = 4, RESERVED2 = 5, RESERVED3 = 8, RESERVED4 = 16, }; pub const COMBND_RPCTIMEOUT = RPCOPT_PROPERTIES.RPCTIMEOUT; pub const COMBND_SERVER_LOCALITY = RPCOPT_PROPERTIES.SERVER_LOCALITY; pub const COMBND_RESERVED1 = RPCOPT_PROPERTIES.RESERVED1; pub const COMBND_RESERVED2 = RPCOPT_PROPERTIES.RESERVED2; pub const COMBND_RESERVED3 = RPCOPT_PROPERTIES.RESERVED3; pub const COMBND_RESERVED4 = RPCOPT_PROPERTIES.RESERVED4; pub const RPCOPT_SERVER_LOCALITY_VALUES = enum(i32) { PROCESS_LOCAL = 0, MACHINE_LOCAL = 1, REMOTE = 2, }; pub const SERVER_LOCALITY_PROCESS_LOCAL = RPCOPT_SERVER_LOCALITY_VALUES.PROCESS_LOCAL; pub const SERVER_LOCALITY_MACHINE_LOCAL = RPCOPT_SERVER_LOCALITY_VALUES.MACHINE_LOCAL; pub const SERVER_LOCALITY_REMOTE = RPCOPT_SERVER_LOCALITY_VALUES.REMOTE; // TODO: this type is limited to platform 'windows5.0' const IID_IRpcOptions_Value = @import("../zig.zig").Guid.initString("00000144-0000-0000-c000-000000000046"); pub const IID_IRpcOptions = &IID_IRpcOptions_Value; pub const IRpcOptions = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Set: fn( self: *const IRpcOptions, pPrx: ?*IUnknown, dwProperty: RPCOPT_PROPERTIES, dwValue: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Query: fn( self: *const IRpcOptions, pPrx: ?*IUnknown, dwProperty: RPCOPT_PROPERTIES, pdwValue: ?*usize, ) 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 IRpcOptions_Set(self: *const T, pPrx: ?*IUnknown, dwProperty: RPCOPT_PROPERTIES, dwValue: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcOptions.VTable, self.vtable).Set(@ptrCast(*const IRpcOptions, self), pPrx, dwProperty, dwValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcOptions_Query(self: *const T, pPrx: ?*IUnknown, dwProperty: RPCOPT_PROPERTIES, pdwValue: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcOptions.VTable, self.vtable).Query(@ptrCast(*const IRpcOptions, self), pPrx, dwProperty, pdwValue); } };} pub usingnamespace MethodMixin(@This()); }; pub const GLOBALOPT_PROPERTIES = enum(i32) { EXCEPTION_HANDLING = 1, APPID = 2, RPC_THREADPOOL_SETTING = 3, RO_SETTINGS = 4, UNMARSHALING_POLICY = 5, PROPERTIES_RESERVED1 = 6, PROPERTIES_RESERVED2 = 7, PROPERTIES_RESERVED3 = 8, }; pub const COMGLB_EXCEPTION_HANDLING = GLOBALOPT_PROPERTIES.EXCEPTION_HANDLING; pub const COMGLB_APPID = GLOBALOPT_PROPERTIES.APPID; pub const COMGLB_RPC_THREADPOOL_SETTING = GLOBALOPT_PROPERTIES.RPC_THREADPOOL_SETTING; pub const COMGLB_RO_SETTINGS = GLOBALOPT_PROPERTIES.RO_SETTINGS; pub const COMGLB_UNMARSHALING_POLICY = GLOBALOPT_PROPERTIES.UNMARSHALING_POLICY; pub const COMGLB_PROPERTIES_RESERVED1 = GLOBALOPT_PROPERTIES.PROPERTIES_RESERVED1; pub const COMGLB_PROPERTIES_RESERVED2 = GLOBALOPT_PROPERTIES.PROPERTIES_RESERVED2; pub const COMGLB_PROPERTIES_RESERVED3 = GLOBALOPT_PROPERTIES.PROPERTIES_RESERVED3; pub const GLOBALOPT_EH_VALUES = enum(i32) { HANDLE = 0, DONOT_HANDLE_FATAL = 1, // DONOT_HANDLE = 1, this enum value conflicts with DONOT_HANDLE_FATAL DONOT_HANDLE_ANY = 2, }; pub const COMGLB_EXCEPTION_HANDLE = GLOBALOPT_EH_VALUES.HANDLE; pub const COMGLB_EXCEPTION_DONOT_HANDLE_FATAL = GLOBALOPT_EH_VALUES.DONOT_HANDLE_FATAL; pub const COMGLB_EXCEPTION_DONOT_HANDLE = GLOBALOPT_EH_VALUES.DONOT_HANDLE_FATAL; pub const COMGLB_EXCEPTION_DONOT_HANDLE_ANY = GLOBALOPT_EH_VALUES.DONOT_HANDLE_ANY; pub const GLOBALOPT_RPCTP_VALUES = enum(i32) { DEFAULT_POOL = 0, PRIVATE_POOL = 1, }; pub const COMGLB_RPC_THREADPOOL_SETTING_DEFAULT_POOL = GLOBALOPT_RPCTP_VALUES.DEFAULT_POOL; pub const COMGLB_RPC_THREADPOOL_SETTING_PRIVATE_POOL = GLOBALOPT_RPCTP_VALUES.PRIVATE_POOL; pub const GLOBALOPT_RO_FLAGS = enum(i32) { STA_MODALLOOP_REMOVE_TOUCH_MESSAGES = 1, STA_MODALLOOP_SHARED_QUEUE_REMOVE_INPUT_MESSAGES = 2, STA_MODALLOOP_SHARED_QUEUE_DONOT_REMOVE_INPUT_MESSAGES = 4, FAST_RUNDOWN = 8, RESERVED1 = 16, RESERVED2 = 32, RESERVED3 = 64, STA_MODALLOOP_SHARED_QUEUE_REORDER_POINTER_MESSAGES = 128, RESERVED4 = 256, RESERVED5 = 512, RESERVED6 = 1024, }; pub const COMGLB_STA_MODALLOOP_REMOVE_TOUCH_MESSAGES = GLOBALOPT_RO_FLAGS.STA_MODALLOOP_REMOVE_TOUCH_MESSAGES; pub const COMGLB_STA_MODALLOOP_SHARED_QUEUE_REMOVE_INPUT_MESSAGES = GLOBALOPT_RO_FLAGS.STA_MODALLOOP_SHARED_QUEUE_REMOVE_INPUT_MESSAGES; pub const COMGLB_STA_MODALLOOP_SHARED_QUEUE_DONOT_REMOVE_INPUT_MESSAGES = GLOBALOPT_RO_FLAGS.STA_MODALLOOP_SHARED_QUEUE_DONOT_REMOVE_INPUT_MESSAGES; pub const COMGLB_FAST_RUNDOWN = GLOBALOPT_RO_FLAGS.FAST_RUNDOWN; pub const COMGLB_RESERVED1 = GLOBALOPT_RO_FLAGS.RESERVED1; pub const COMGLB_RESERVED2 = GLOBALOPT_RO_FLAGS.RESERVED2; pub const COMGLB_RESERVED3 = GLOBALOPT_RO_FLAGS.RESERVED3; pub const COMGLB_STA_MODALLOOP_SHARED_QUEUE_REORDER_POINTER_MESSAGES = GLOBALOPT_RO_FLAGS.STA_MODALLOOP_SHARED_QUEUE_REORDER_POINTER_MESSAGES; pub const COMGLB_RESERVED4 = GLOBALOPT_RO_FLAGS.RESERVED4; pub const COMGLB_RESERVED5 = GLOBALOPT_RO_FLAGS.RESERVED5; pub const COMGLB_RESERVED6 = GLOBALOPT_RO_FLAGS.RESERVED6; pub const GLOBALOPT_UNMARSHALING_POLICY_VALUES = enum(i32) { NORMAL = 0, STRONG = 1, HYBRID = 2, }; pub const COMGLB_UNMARSHALING_POLICY_NORMAL = GLOBALOPT_UNMARSHALING_POLICY_VALUES.NORMAL; pub const COMGLB_UNMARSHALING_POLICY_STRONG = GLOBALOPT_UNMARSHALING_POLICY_VALUES.STRONG; pub const COMGLB_UNMARSHALING_POLICY_HYBRID = GLOBALOPT_UNMARSHALING_POLICY_VALUES.HYBRID; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IGlobalOptions_Value = @import("../zig.zig").Guid.initString("0000015b-0000-0000-c000-000000000046"); pub const IID_IGlobalOptions = &IID_IGlobalOptions_Value; pub const IGlobalOptions = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Set: fn( self: *const IGlobalOptions, dwProperty: GLOBALOPT_PROPERTIES, dwValue: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Query: fn( self: *const IGlobalOptions, dwProperty: GLOBALOPT_PROPERTIES, pdwValue: ?*usize, ) 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 IGlobalOptions_Set(self: *const T, dwProperty: GLOBALOPT_PROPERTIES, dwValue: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IGlobalOptions.VTable, self.vtable).Set(@ptrCast(*const IGlobalOptions, self), dwProperty, dwValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGlobalOptions_Query(self: *const T, dwProperty: GLOBALOPT_PROPERTIES, pdwValue: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const IGlobalOptions.VTable, self.vtable).Query(@ptrCast(*const IGlobalOptions, self), dwProperty, pdwValue); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ISurrogate_Value = @import("../zig.zig").Guid.initString("00000022-0000-0000-c000-000000000046"); pub const IID_ISurrogate = &IID_ISurrogate_Value; pub const ISurrogate = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, LoadDllServer: fn( self: *const ISurrogate, Clsid: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FreeSurrogate: fn( self: *const ISurrogate, ) 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 ISurrogate_LoadDllServer(self: *const T, Clsid: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const ISurrogate.VTable, self.vtable).LoadDllServer(@ptrCast(*const ISurrogate, self), Clsid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISurrogate_FreeSurrogate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISurrogate.VTable, self.vtable).FreeSurrogate(@ptrCast(*const ISurrogate, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IGlobalInterfaceTable_Value = @import("../zig.zig").Guid.initString("00000146-0000-0000-c000-000000000046"); pub const IID_IGlobalInterfaceTable = &IID_IGlobalInterfaceTable_Value; pub const IGlobalInterfaceTable = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, RegisterInterfaceInGlobal: fn( self: *const IGlobalInterfaceTable, pUnk: ?*IUnknown, riid: ?*const Guid, pdwCookie: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RevokeInterfaceFromGlobal: fn( self: *const IGlobalInterfaceTable, dwCookie: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInterfaceFromGlobal: fn( self: *const IGlobalInterfaceTable, dwCookie: u32, riid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGlobalInterfaceTable_RegisterInterfaceInGlobal(self: *const T, pUnk: ?*IUnknown, riid: ?*const Guid, pdwCookie: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IGlobalInterfaceTable.VTable, self.vtable).RegisterInterfaceInGlobal(@ptrCast(*const IGlobalInterfaceTable, self), pUnk, riid, pdwCookie); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGlobalInterfaceTable_RevokeInterfaceFromGlobal(self: *const T, dwCookie: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IGlobalInterfaceTable.VTable, self.vtable).RevokeInterfaceFromGlobal(@ptrCast(*const IGlobalInterfaceTable, self), dwCookie); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGlobalInterfaceTable_GetInterfaceFromGlobal(self: *const T, dwCookie: u32, riid: ?*const Guid, ppv: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IGlobalInterfaceTable.VTable, self.vtable).GetInterfaceFromGlobal(@ptrCast(*const IGlobalInterfaceTable, self), dwCookie, riid, ppv); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ISynchronize_Value = @import("../zig.zig").Guid.initString("00000030-0000-0000-c000-000000000046"); pub const IID_ISynchronize = &IID_ISynchronize_Value; pub const ISynchronize = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Wait: fn( self: *const ISynchronize, dwFlags: u32, dwMilliseconds: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Signal: fn( self: *const ISynchronize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const ISynchronize, ) 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 ISynchronize_Wait(self: *const T, dwFlags: u32, dwMilliseconds: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISynchronize.VTable, self.vtable).Wait(@ptrCast(*const ISynchronize, self), dwFlags, dwMilliseconds); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISynchronize_Signal(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISynchronize.VTable, self.vtable).Signal(@ptrCast(*const ISynchronize, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISynchronize_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISynchronize.VTable, self.vtable).Reset(@ptrCast(*const ISynchronize, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ISynchronizeHandle_Value = @import("../zig.zig").Guid.initString("00000031-0000-0000-c000-000000000046"); pub const IID_ISynchronizeHandle = &IID_ISynchronizeHandle_Value; pub const ISynchronizeHandle = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetHandle: fn( self: *const ISynchronizeHandle, ph: ?*?HANDLE, ) 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 ISynchronizeHandle_GetHandle(self: *const T, ph: ?*?HANDLE) callconv(.Inline) HRESULT { return @ptrCast(*const ISynchronizeHandle.VTable, self.vtable).GetHandle(@ptrCast(*const ISynchronizeHandle, self), ph); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ISynchronizeEvent_Value = @import("../zig.zig").Guid.initString("00000032-0000-0000-c000-000000000046"); pub const IID_ISynchronizeEvent = &IID_ISynchronizeEvent_Value; pub const ISynchronizeEvent = extern struct { pub const VTable = extern struct { base: ISynchronizeHandle.VTable, SetEventHandle: fn( self: *const ISynchronizeEvent, ph: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ISynchronizeHandle.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISynchronizeEvent_SetEventHandle(self: *const T, ph: ?*?HANDLE) callconv(.Inline) HRESULT { return @ptrCast(*const ISynchronizeEvent.VTable, self.vtable).SetEventHandle(@ptrCast(*const ISynchronizeEvent, self), ph); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ISynchronizeContainer_Value = @import("../zig.zig").Guid.initString("00000033-0000-0000-c000-000000000046"); pub const IID_ISynchronizeContainer = &IID_ISynchronizeContainer_Value; pub const ISynchronizeContainer = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AddSynchronize: fn( self: *const ISynchronizeContainer, pSync: ?*ISynchronize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, WaitMultiple: fn( self: *const ISynchronizeContainer, dwFlags: u32, dwTimeOut: u32, ppSync: ?*?*ISynchronize, ) 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 ISynchronizeContainer_AddSynchronize(self: *const T, pSync: ?*ISynchronize) callconv(.Inline) HRESULT { return @ptrCast(*const ISynchronizeContainer.VTable, self.vtable).AddSynchronize(@ptrCast(*const ISynchronizeContainer, self), pSync); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISynchronizeContainer_WaitMultiple(self: *const T, dwFlags: u32, dwTimeOut: u32, ppSync: ?*?*ISynchronize) callconv(.Inline) HRESULT { return @ptrCast(*const ISynchronizeContainer.VTable, self.vtable).WaitMultiple(@ptrCast(*const ISynchronizeContainer, self), dwFlags, dwTimeOut, ppSync); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISynchronizeMutex_Value = @import("../zig.zig").Guid.initString("00000025-0000-0000-c000-000000000046"); pub const IID_ISynchronizeMutex = &IID_ISynchronizeMutex_Value; pub const ISynchronizeMutex = extern struct { pub const VTable = extern struct { base: ISynchronize.VTable, ReleaseMutex: fn( self: *const ISynchronizeMutex, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ISynchronize.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISynchronizeMutex_ReleaseMutex(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISynchronizeMutex.VTable, self.vtable).ReleaseMutex(@ptrCast(*const ISynchronizeMutex, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ICancelMethodCalls_Value = @import("../zig.zig").Guid.initString("00000029-0000-0000-c000-000000000046"); pub const IID_ICancelMethodCalls = &IID_ICancelMethodCalls_Value; pub const ICancelMethodCalls = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Cancel: fn( self: *const ICancelMethodCalls, ulSeconds: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TestCancel: fn( self: *const ICancelMethodCalls, ) 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 ICancelMethodCalls_Cancel(self: *const T, ulSeconds: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICancelMethodCalls.VTable, self.vtable).Cancel(@ptrCast(*const ICancelMethodCalls, self), ulSeconds); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICancelMethodCalls_TestCancel(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ICancelMethodCalls.VTable, self.vtable).TestCancel(@ptrCast(*const ICancelMethodCalls, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const DCOM_CALL_STATE = enum(i32) { NONE = 0, CALL_COMPLETE = 1, CALL_CANCELED = 2, }; pub const DCOM_NONE = DCOM_CALL_STATE.NONE; pub const DCOM_CALL_COMPLETE = DCOM_CALL_STATE.CALL_COMPLETE; pub const DCOM_CALL_CANCELED = DCOM_CALL_STATE.CALL_CANCELED; const IID_IAsyncManager_Value = @import("../zig.zig").Guid.initString("0000002a-0000-0000-c000-000000000046"); pub const IID_IAsyncManager = &IID_IAsyncManager_Value; pub const IAsyncManager = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CompleteCall: fn( self: *const IAsyncManager, Result: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCallContext: fn( self: *const IAsyncManager, riid: ?*const Guid, pInterface: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetState: fn( self: *const IAsyncManager, pulStateFlags: ?*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 IAsyncManager_CompleteCall(self: *const T, Result: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IAsyncManager.VTable, self.vtable).CompleteCall(@ptrCast(*const IAsyncManager, self), Result); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAsyncManager_GetCallContext(self: *const T, riid: ?*const Guid, pInterface: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IAsyncManager.VTable, self.vtable).GetCallContext(@ptrCast(*const IAsyncManager, self), riid, pInterface); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAsyncManager_GetState(self: *const T, pulStateFlags: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAsyncManager.VTable, self.vtable).GetState(@ptrCast(*const IAsyncManager, self), pulStateFlags); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ICallFactory_Value = @import("../zig.zig").Guid.initString("1c733a30-2a1c-11ce-ade5-00aa0044773d"); pub const IID_ICallFactory = &IID_ICallFactory_Value; pub const ICallFactory = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateCall: fn( self: *const ICallFactory, riid: ?*const Guid, pCtrlUnk: ?*IUnknown, riid2: ?*const Guid, ppv: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFactory_CreateCall(self: *const T, riid: ?*const Guid, pCtrlUnk: ?*IUnknown, riid2: ?*const Guid, ppv: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ICallFactory.VTable, self.vtable).CreateCall(@ptrCast(*const ICallFactory, self), riid, pCtrlUnk, riid2, ppv); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IRpcHelper_Value = @import("../zig.zig").Guid.initString("00000149-0000-0000-c000-000000000046"); pub const IID_IRpcHelper = &IID_IRpcHelper_Value; pub const IRpcHelper = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetDCOMProtocolVersion: fn( self: *const IRpcHelper, pComVersion: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIIDFromOBJREF: fn( self: *const IRpcHelper, pObjRef: ?*c_void, piid: ?*?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcHelper_GetDCOMProtocolVersion(self: *const T, pComVersion: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcHelper.VTable, self.vtable).GetDCOMProtocolVersion(@ptrCast(*const IRpcHelper, self), pComVersion); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRpcHelper_GetIIDFromOBJREF(self: *const T, pObjRef: ?*c_void, piid: ?*?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IRpcHelper.VTable, self.vtable).GetIIDFromOBJREF(@ptrCast(*const IRpcHelper, self), pObjRef, piid); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IReleaseMarshalBuffers_Value = @import("../zig.zig").Guid.initString("eb0cb9e8-7996-11d2-872e-0000f8080859"); pub const IID_IReleaseMarshalBuffers = &IID_IReleaseMarshalBuffers_Value; pub const IReleaseMarshalBuffers = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ReleaseMarshalBuffer: fn( self: *const IReleaseMarshalBuffers, pMsg: ?*RPCOLEMESSAGE, dwFlags: u32, pChnl: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IReleaseMarshalBuffers_ReleaseMarshalBuffer(self: *const T, pMsg: ?*RPCOLEMESSAGE, dwFlags: u32, pChnl: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IReleaseMarshalBuffers.VTable, self.vtable).ReleaseMarshalBuffer(@ptrCast(*const IReleaseMarshalBuffers, self), pMsg, dwFlags, pChnl); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IWaitMultiple_Value = @import("../zig.zig").Guid.initString("0000002b-0000-0000-c000-000000000046"); pub const IID_IWaitMultiple = &IID_IWaitMultiple_Value; pub const IWaitMultiple = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, WaitMultiple: fn( self: *const IWaitMultiple, timeout: u32, pSync: ?*?*ISynchronize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddSynchronize: fn( self: *const IWaitMultiple, pSync: ?*ISynchronize, ) 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 IWaitMultiple_WaitMultiple(self: *const T, timeout: u32, pSync: ?*?*ISynchronize) callconv(.Inline) HRESULT { return @ptrCast(*const IWaitMultiple.VTable, self.vtable).WaitMultiple(@ptrCast(*const IWaitMultiple, self), timeout, pSync); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWaitMultiple_AddSynchronize(self: *const T, pSync: ?*ISynchronize) callconv(.Inline) HRESULT { return @ptrCast(*const IWaitMultiple.VTable, self.vtable).AddSynchronize(@ptrCast(*const IWaitMultiple, self), pSync); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IAddrTrackingControl_Value = @import("../zig.zig").Guid.initString("00000147-0000-0000-c000-000000000046"); pub const IID_IAddrTrackingControl = &IID_IAddrTrackingControl_Value; pub const IAddrTrackingControl = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, EnableCOMDynamicAddrTracking: fn( self: *const IAddrTrackingControl, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DisableCOMDynamicAddrTracking: fn( self: *const IAddrTrackingControl, ) 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 IAddrTrackingControl_EnableCOMDynamicAddrTracking(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IAddrTrackingControl.VTable, self.vtable).EnableCOMDynamicAddrTracking(@ptrCast(*const IAddrTrackingControl, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAddrTrackingControl_DisableCOMDynamicAddrTracking(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IAddrTrackingControl.VTable, self.vtable).DisableCOMDynamicAddrTracking(@ptrCast(*const IAddrTrackingControl, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IAddrExclusionControl_Value = @import("../zig.zig").Guid.initString("00000148-0000-0000-c000-000000000046"); pub const IID_IAddrExclusionControl = &IID_IAddrExclusionControl_Value; pub const IAddrExclusionControl = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetCurrentAddrExclusionList: fn( self: *const IAddrExclusionControl, riid: ?*const Guid, ppEnumerator: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UpdateAddrExclusionList: fn( self: *const IAddrExclusionControl, pEnumerator: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAddrExclusionControl_GetCurrentAddrExclusionList(self: *const T, riid: ?*const Guid, ppEnumerator: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IAddrExclusionControl.VTable, self.vtable).GetCurrentAddrExclusionList(@ptrCast(*const IAddrExclusionControl, self), riid, ppEnumerator); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAddrExclusionControl_UpdateAddrExclusionList(self: *const T, pEnumerator: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IAddrExclusionControl.VTable, self.vtable).UpdateAddrExclusionList(@ptrCast(*const IAddrExclusionControl, self), pEnumerator); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IPipeByte_Value = @import("../zig.zig").Guid.initString("db2f3aca-2f86-11d1-8e04-00c04fb9989a"); pub const IID_IPipeByte = &IID_IPipeByte_Value; pub const IPipeByte = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Pull: fn( self: *const IPipeByte, buf: [*:0]u8, cRequest: u32, pcReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Push: fn( self: *const IPipeByte, buf: [*:0]u8, cSent: 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 IPipeByte_Pull(self: *const T, buf: [*:0]u8, cRequest: u32, pcReturned: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPipeByte.VTable, self.vtable).Pull(@ptrCast(*const IPipeByte, self), buf, cRequest, pcReturned); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPipeByte_Push(self: *const T, buf: [*:0]u8, cSent: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPipeByte.VTable, self.vtable).Push(@ptrCast(*const IPipeByte, self), buf, cSent); } };} pub usingnamespace MethodMixin(@This()); }; const IID_AsyncIPipeByte_Value = @import("../zig.zig").Guid.initString("db2f3acb-2f86-11d1-8e04-00c04fb9989a"); pub const IID_AsyncIPipeByte = &IID_AsyncIPipeByte_Value; pub const AsyncIPipeByte = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Begin_Pull: fn( self: *const AsyncIPipeByte, cRequest: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_Pull: fn( self: *const AsyncIPipeByte, buf: [*:0]u8, pcReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_Push: fn( self: *const AsyncIPipeByte, buf: [*:0]u8, cSent: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_Push: fn( self: *const AsyncIPipeByte, ) 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 AsyncIPipeByte_Begin_Pull(self: *const T, cRequest: u32) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIPipeByte.VTable, self.vtable).Begin_Pull(@ptrCast(*const AsyncIPipeByte, self), cRequest); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIPipeByte_Finish_Pull(self: *const T, buf: [*:0]u8, pcReturned: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIPipeByte.VTable, self.vtable).Finish_Pull(@ptrCast(*const AsyncIPipeByte, self), buf, pcReturned); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIPipeByte_Begin_Push(self: *const T, buf: [*:0]u8, cSent: u32) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIPipeByte.VTable, self.vtable).Begin_Push(@ptrCast(*const AsyncIPipeByte, self), buf, cSent); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIPipeByte_Finish_Push(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIPipeByte.VTable, self.vtable).Finish_Push(@ptrCast(*const AsyncIPipeByte, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IPipeLong_Value = @import("../zig.zig").Guid.initString("db2f3acc-2f86-11d1-8e04-00c04fb9989a"); pub const IID_IPipeLong = &IID_IPipeLong_Value; pub const IPipeLong = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Pull: fn( self: *const IPipeLong, buf: [*]i32, cRequest: u32, pcReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Push: fn( self: *const IPipeLong, buf: [*]i32, cSent: 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 IPipeLong_Pull(self: *const T, buf: [*]i32, cRequest: u32, pcReturned: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPipeLong.VTable, self.vtable).Pull(@ptrCast(*const IPipeLong, self), buf, cRequest, pcReturned); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPipeLong_Push(self: *const T, buf: [*]i32, cSent: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPipeLong.VTable, self.vtable).Push(@ptrCast(*const IPipeLong, self), buf, cSent); } };} pub usingnamespace MethodMixin(@This()); }; const IID_AsyncIPipeLong_Value = @import("../zig.zig").Guid.initString("db2f3acd-2f86-11d1-8e04-00c04fb9989a"); pub const IID_AsyncIPipeLong = &IID_AsyncIPipeLong_Value; pub const AsyncIPipeLong = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Begin_Pull: fn( self: *const AsyncIPipeLong, cRequest: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_Pull: fn( self: *const AsyncIPipeLong, buf: [*]i32, pcReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_Push: fn( self: *const AsyncIPipeLong, buf: [*]i32, cSent: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_Push: fn( self: *const AsyncIPipeLong, ) 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 AsyncIPipeLong_Begin_Pull(self: *const T, cRequest: u32) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIPipeLong.VTable, self.vtable).Begin_Pull(@ptrCast(*const AsyncIPipeLong, self), cRequest); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIPipeLong_Finish_Pull(self: *const T, buf: [*]i32, pcReturned: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIPipeLong.VTable, self.vtable).Finish_Pull(@ptrCast(*const AsyncIPipeLong, self), buf, pcReturned); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIPipeLong_Begin_Push(self: *const T, buf: [*]i32, cSent: u32) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIPipeLong.VTable, self.vtable).Begin_Push(@ptrCast(*const AsyncIPipeLong, self), buf, cSent); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIPipeLong_Finish_Push(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIPipeLong.VTable, self.vtable).Finish_Push(@ptrCast(*const AsyncIPipeLong, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IPipeDouble_Value = @import("../zig.zig").Guid.initString("db2f3ace-2f86-11d1-8e04-00c04fb9989a"); pub const IID_IPipeDouble = &IID_IPipeDouble_Value; pub const IPipeDouble = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Pull: fn( self: *const IPipeDouble, buf: [*]f64, cRequest: u32, pcReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Push: fn( self: *const IPipeDouble, buf: [*]f64, cSent: 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 IPipeDouble_Pull(self: *const T, buf: [*]f64, cRequest: u32, pcReturned: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPipeDouble.VTable, self.vtable).Pull(@ptrCast(*const IPipeDouble, self), buf, cRequest, pcReturned); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPipeDouble_Push(self: *const T, buf: [*]f64, cSent: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPipeDouble.VTable, self.vtable).Push(@ptrCast(*const IPipeDouble, self), buf, cSent); } };} pub usingnamespace MethodMixin(@This()); }; const IID_AsyncIPipeDouble_Value = @import("../zig.zig").Guid.initString("db2f3acf-2f86-11d1-8e04-00c04fb9989a"); pub const IID_AsyncIPipeDouble = &IID_AsyncIPipeDouble_Value; pub const AsyncIPipeDouble = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Begin_Pull: fn( self: *const AsyncIPipeDouble, cRequest: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_Pull: fn( self: *const AsyncIPipeDouble, buf: [*]f64, pcReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_Push: fn( self: *const AsyncIPipeDouble, buf: [*]f64, cSent: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_Push: fn( self: *const AsyncIPipeDouble, ) 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 AsyncIPipeDouble_Begin_Pull(self: *const T, cRequest: u32) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIPipeDouble.VTable, self.vtable).Begin_Pull(@ptrCast(*const AsyncIPipeDouble, self), cRequest); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIPipeDouble_Finish_Pull(self: *const T, buf: [*]f64, pcReturned: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIPipeDouble.VTable, self.vtable).Finish_Pull(@ptrCast(*const AsyncIPipeDouble, self), buf, pcReturned); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIPipeDouble_Begin_Push(self: *const T, buf: [*]f64, cSent: u32) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIPipeDouble.VTable, self.vtable).Begin_Push(@ptrCast(*const AsyncIPipeDouble, self), buf, cSent); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIPipeDouble_Finish_Push(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIPipeDouble.VTable, self.vtable).Finish_Push(@ptrCast(*const AsyncIPipeDouble, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const APTTYPEQUALIFIER = enum(i32) { NONE = 0, IMPLICIT_MTA = 1, NA_ON_MTA = 2, NA_ON_STA = 3, NA_ON_IMPLICIT_MTA = 4, NA_ON_MAINSTA = 5, APPLICATION_STA = 6, RESERVED_1 = 7, }; pub const APTTYPEQUALIFIER_NONE = APTTYPEQUALIFIER.NONE; pub const APTTYPEQUALIFIER_IMPLICIT_MTA = APTTYPEQUALIFIER.IMPLICIT_MTA; pub const APTTYPEQUALIFIER_NA_ON_MTA = APTTYPEQUALIFIER.NA_ON_MTA; pub const APTTYPEQUALIFIER_NA_ON_STA = APTTYPEQUALIFIER.NA_ON_STA; pub const APTTYPEQUALIFIER_NA_ON_IMPLICIT_MTA = APTTYPEQUALIFIER.NA_ON_IMPLICIT_MTA; pub const APTTYPEQUALIFIER_NA_ON_MAINSTA = APTTYPEQUALIFIER.NA_ON_MAINSTA; pub const APTTYPEQUALIFIER_APPLICATION_STA = APTTYPEQUALIFIER.APPLICATION_STA; pub const APTTYPEQUALIFIER_RESERVED_1 = APTTYPEQUALIFIER.RESERVED_1; pub const APTTYPE = enum(i32) { CURRENT = -1, STA = 0, MTA = 1, NA = 2, MAINSTA = 3, }; pub const APTTYPE_CURRENT = APTTYPE.CURRENT; pub const APTTYPE_STA = APTTYPE.STA; pub const APTTYPE_MTA = APTTYPE.MTA; pub const APTTYPE_NA = APTTYPE.NA; pub const APTTYPE_MAINSTA = APTTYPE.MAINSTA; pub const THDTYPE = enum(i32) { BLOCKMESSAGES = 0, PROCESSMESSAGES = 1, }; pub const THDTYPE_BLOCKMESSAGES = THDTYPE.BLOCKMESSAGES; pub const THDTYPE_PROCESSMESSAGES = THDTYPE.PROCESSMESSAGES; // TODO: this type is limited to platform 'windows5.0' const IID_IComThreadingInfo_Value = @import("../zig.zig").Guid.initString("000001ce-0000-0000-c000-000000000046"); pub const IID_IComThreadingInfo = &IID_IComThreadingInfo_Value; pub const IComThreadingInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetCurrentApartmentType: fn( self: *const IComThreadingInfo, pAptType: ?*APTTYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCurrentThreadType: fn( self: *const IComThreadingInfo, pThreadType: ?*THDTYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCurrentLogicalThreadId: fn( self: *const IComThreadingInfo, pguidLogicalThreadId: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCurrentLogicalThreadId: fn( self: *const IComThreadingInfo, rguid: ?*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 IComThreadingInfo_GetCurrentApartmentType(self: *const T, pAptType: ?*APTTYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IComThreadingInfo.VTable, self.vtable).GetCurrentApartmentType(@ptrCast(*const IComThreadingInfo, self), pAptType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IComThreadingInfo_GetCurrentThreadType(self: *const T, pThreadType: ?*THDTYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IComThreadingInfo.VTable, self.vtable).GetCurrentThreadType(@ptrCast(*const IComThreadingInfo, self), pThreadType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IComThreadingInfo_GetCurrentLogicalThreadId(self: *const T, pguidLogicalThreadId: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IComThreadingInfo.VTable, self.vtable).GetCurrentLogicalThreadId(@ptrCast(*const IComThreadingInfo, self), pguidLogicalThreadId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IComThreadingInfo_SetCurrentLogicalThreadId(self: *const T, rguid: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IComThreadingInfo.VTable, self.vtable).SetCurrentLogicalThreadId(@ptrCast(*const IComThreadingInfo, self), rguid); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IProcessInitControl_Value = @import("../zig.zig").Guid.initString("72380d55-8d2b-43a3-8513-2b6ef31434e9"); pub const IID_IProcessInitControl = &IID_IProcessInitControl_Value; pub const IProcessInitControl = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ResetInitializerTimeout: fn( self: *const IProcessInitControl, dwSecondsRemaining: 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 IProcessInitControl_ResetInitializerTimeout(self: *const T, dwSecondsRemaining: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IProcessInitControl.VTable, self.vtable).ResetInitializerTimeout(@ptrCast(*const IProcessInitControl, self), dwSecondsRemaining); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IFastRundown_Value = @import("../zig.zig").Guid.initString("00000040-0000-0000-c000-000000000046"); pub const IID_IFastRundown = &IID_IFastRundown_Value; pub const IFastRundown = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; pub const CO_MARSHALING_CONTEXT_ATTRIBUTES = enum(i32) { SOURCE_IS_APP_CONTAINER = 0, CONTEXT_ATTRIBUTE_RESERVED_1 = -2147483648, CONTEXT_ATTRIBUTE_RESERVED_2 = -2147483647, CONTEXT_ATTRIBUTE_RESERVED_3 = -2147483646, CONTEXT_ATTRIBUTE_RESERVED_4 = -2147483645, CONTEXT_ATTRIBUTE_RESERVED_5 = -2147483644, CONTEXT_ATTRIBUTE_RESERVED_6 = -2147483643, CONTEXT_ATTRIBUTE_RESERVED_7 = -2147483642, CONTEXT_ATTRIBUTE_RESERVED_8 = -2147483641, CONTEXT_ATTRIBUTE_RESERVED_9 = -2147483640, CONTEXT_ATTRIBUTE_RESERVED_10 = -2147483639, CONTEXT_ATTRIBUTE_RESERVED_11 = -2147483638, CONTEXT_ATTRIBUTE_RESERVED_12 = -2147483637, CONTEXT_ATTRIBUTE_RESERVED_13 = -2147483636, CONTEXT_ATTRIBUTE_RESERVED_14 = -2147483635, CONTEXT_ATTRIBUTE_RESERVED_15 = -2147483634, CONTEXT_ATTRIBUTE_RESERVED_16 = -2147483633, CONTEXT_ATTRIBUTE_RESERVED_17 = -2147483632, CONTEXT_ATTRIBUTE_RESERVED_18 = -2147483631, }; pub const CO_MARSHALING_SOURCE_IS_APP_CONTAINER = CO_MARSHALING_CONTEXT_ATTRIBUTES.SOURCE_IS_APP_CONTAINER; pub const CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_1 = CO_MARSHALING_CONTEXT_ATTRIBUTES.CONTEXT_ATTRIBUTE_RESERVED_1; pub const CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_2 = CO_MARSHALING_CONTEXT_ATTRIBUTES.CONTEXT_ATTRIBUTE_RESERVED_2; pub const CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_3 = CO_MARSHALING_CONTEXT_ATTRIBUTES.CONTEXT_ATTRIBUTE_RESERVED_3; pub const CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_4 = CO_MARSHALING_CONTEXT_ATTRIBUTES.CONTEXT_ATTRIBUTE_RESERVED_4; pub const CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_5 = CO_MARSHALING_CONTEXT_ATTRIBUTES.CONTEXT_ATTRIBUTE_RESERVED_5; pub const CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_6 = CO_MARSHALING_CONTEXT_ATTRIBUTES.CONTEXT_ATTRIBUTE_RESERVED_6; pub const CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_7 = CO_MARSHALING_CONTEXT_ATTRIBUTES.CONTEXT_ATTRIBUTE_RESERVED_7; pub const CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_8 = CO_MARSHALING_CONTEXT_ATTRIBUTES.CONTEXT_ATTRIBUTE_RESERVED_8; pub const CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_9 = CO_MARSHALING_CONTEXT_ATTRIBUTES.CONTEXT_ATTRIBUTE_RESERVED_9; pub const CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_10 = CO_MARSHALING_CONTEXT_ATTRIBUTES.CONTEXT_ATTRIBUTE_RESERVED_10; pub const CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_11 = CO_MARSHALING_CONTEXT_ATTRIBUTES.CONTEXT_ATTRIBUTE_RESERVED_11; pub const CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_12 = CO_MARSHALING_CONTEXT_ATTRIBUTES.CONTEXT_ATTRIBUTE_RESERVED_12; pub const CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_13 = CO_MARSHALING_CONTEXT_ATTRIBUTES.CONTEXT_ATTRIBUTE_RESERVED_13; pub const CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_14 = CO_MARSHALING_CONTEXT_ATTRIBUTES.CONTEXT_ATTRIBUTE_RESERVED_14; pub const CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_15 = CO_MARSHALING_CONTEXT_ATTRIBUTES.CONTEXT_ATTRIBUTE_RESERVED_15; pub const CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_16 = CO_MARSHALING_CONTEXT_ATTRIBUTES.CONTEXT_ATTRIBUTE_RESERVED_16; pub const CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_17 = CO_MARSHALING_CONTEXT_ATTRIBUTES.CONTEXT_ATTRIBUTE_RESERVED_17; pub const CO_MARSHALING_CONTEXT_ATTRIBUTE_RESERVED_18 = CO_MARSHALING_CONTEXT_ATTRIBUTES.CONTEXT_ATTRIBUTE_RESERVED_18; // TODO: this type is limited to platform 'windows8.0' const IID_IMarshalingStream_Value = @import("../zig.zig").Guid.initString("d8f2f5e6-6102-4863-9f26-389a4676efde"); pub const IID_IMarshalingStream = &IID_IMarshalingStream_Value; pub const IMarshalingStream = extern struct { pub const VTable = extern struct { base: IStream.VTable, GetMarshalingContextAttribute: fn( self: *const IMarshalingStream, attribute: CO_MARSHALING_CONTEXT_ATTRIBUTES, pAttributeValue: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IStream.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMarshalingStream_GetMarshalingContextAttribute(self: *const T, attribute: CO_MARSHALING_CONTEXT_ATTRIBUTES, pAttributeValue: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const IMarshalingStream.VTable, self.vtable).GetMarshalingContextAttribute(@ptrCast(*const IMarshalingStream, self), attribute, pAttributeValue); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IMallocSpy_Value = @import("../zig.zig").Guid.initString("0000001d-0000-0000-c000-000000000046"); pub const IID_IMallocSpy = &IID_IMallocSpy_Value; pub const IMallocSpy = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, PreAlloc: fn( self: *const IMallocSpy, cbRequest: usize, ) callconv(@import("std").os.windows.WINAPI) usize, PostAlloc: fn( self: *const IMallocSpy, pActual: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) ?*c_void, PreFree: fn( self: *const IMallocSpy, pRequest: ?*c_void, fSpyed: BOOL, ) callconv(@import("std").os.windows.WINAPI) ?*c_void, PostFree: fn( self: *const IMallocSpy, fSpyed: BOOL, ) callconv(@import("std").os.windows.WINAPI) void, PreRealloc: fn( self: *const IMallocSpy, pRequest: ?*c_void, cbRequest: usize, ppNewRequest: ?*?*c_void, fSpyed: BOOL, ) callconv(@import("std").os.windows.WINAPI) usize, PostRealloc: fn( self: *const IMallocSpy, pActual: ?*c_void, fSpyed: BOOL, ) callconv(@import("std").os.windows.WINAPI) ?*c_void, PreGetSize: fn( self: *const IMallocSpy, pRequest: ?*c_void, fSpyed: BOOL, ) callconv(@import("std").os.windows.WINAPI) ?*c_void, PostGetSize: fn( self: *const IMallocSpy, cbActual: usize, fSpyed: BOOL, ) callconv(@import("std").os.windows.WINAPI) usize, PreDidAlloc: fn( self: *const IMallocSpy, pRequest: ?*c_void, fSpyed: BOOL, ) callconv(@import("std").os.windows.WINAPI) ?*c_void, PostDidAlloc: fn( self: *const IMallocSpy, pRequest: ?*c_void, fSpyed: BOOL, fActual: i32, ) callconv(@import("std").os.windows.WINAPI) i32, PreHeapMinimize: fn( self: *const IMallocSpy, ) callconv(@import("std").os.windows.WINAPI) void, PostHeapMinimize: fn( self: *const IMallocSpy, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMallocSpy_PreAlloc(self: *const T, cbRequest: usize) callconv(.Inline) usize { return @ptrCast(*const IMallocSpy.VTable, self.vtable).PreAlloc(@ptrCast(*const IMallocSpy, self), cbRequest); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMallocSpy_PostAlloc(self: *const T, pActual: ?*c_void) callconv(.Inline) ?*c_void { return @ptrCast(*const IMallocSpy.VTable, self.vtable).PostAlloc(@ptrCast(*const IMallocSpy, self), pActual); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMallocSpy_PreFree(self: *const T, pRequest: ?*c_void, fSpyed: BOOL) callconv(.Inline) ?*c_void { return @ptrCast(*const IMallocSpy.VTable, self.vtable).PreFree(@ptrCast(*const IMallocSpy, self), pRequest, fSpyed); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMallocSpy_PostFree(self: *const T, fSpyed: BOOL) callconv(.Inline) void { return @ptrCast(*const IMallocSpy.VTable, self.vtable).PostFree(@ptrCast(*const IMallocSpy, self), fSpyed); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMallocSpy_PreRealloc(self: *const T, pRequest: ?*c_void, cbRequest: usize, ppNewRequest: ?*?*c_void, fSpyed: BOOL) callconv(.Inline) usize { return @ptrCast(*const IMallocSpy.VTable, self.vtable).PreRealloc(@ptrCast(*const IMallocSpy, self), pRequest, cbRequest, ppNewRequest, fSpyed); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMallocSpy_PostRealloc(self: *const T, pActual: ?*c_void, fSpyed: BOOL) callconv(.Inline) ?*c_void { return @ptrCast(*const IMallocSpy.VTable, self.vtable).PostRealloc(@ptrCast(*const IMallocSpy, self), pActual, fSpyed); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMallocSpy_PreGetSize(self: *const T, pRequest: ?*c_void, fSpyed: BOOL) callconv(.Inline) ?*c_void { return @ptrCast(*const IMallocSpy.VTable, self.vtable).PreGetSize(@ptrCast(*const IMallocSpy, self), pRequest, fSpyed); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMallocSpy_PostGetSize(self: *const T, cbActual: usize, fSpyed: BOOL) callconv(.Inline) usize { return @ptrCast(*const IMallocSpy.VTable, self.vtable).PostGetSize(@ptrCast(*const IMallocSpy, self), cbActual, fSpyed); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMallocSpy_PreDidAlloc(self: *const T, pRequest: ?*c_void, fSpyed: BOOL) callconv(.Inline) ?*c_void { return @ptrCast(*const IMallocSpy.VTable, self.vtable).PreDidAlloc(@ptrCast(*const IMallocSpy, self), pRequest, fSpyed); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMallocSpy_PostDidAlloc(self: *const T, pRequest: ?*c_void, fSpyed: BOOL, fActual: i32) callconv(.Inline) i32 { return @ptrCast(*const IMallocSpy.VTable, self.vtable).PostDidAlloc(@ptrCast(*const IMallocSpy, self), pRequest, fSpyed, fActual); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMallocSpy_PreHeapMinimize(self: *const T) callconv(.Inline) void { return @ptrCast(*const IMallocSpy.VTable, self.vtable).PreHeapMinimize(@ptrCast(*const IMallocSpy, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMallocSpy_PostHeapMinimize(self: *const T) callconv(.Inline) void { return @ptrCast(*const IMallocSpy.VTable, self.vtable).PostHeapMinimize(@ptrCast(*const IMallocSpy, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const BIND_OPTS = extern struct { cbStruct: u32, grfFlags: u32, grfMode: u32, dwTickCountDeadline: u32, }; pub const BIND_OPTS2 = extern struct { __AnonymousBase_objidl_L8479_C36: BIND_OPTS, dwTrackFlags: u32, dwClassContext: u32, locale: u32, pServerInfo: ?*COSERVERINFO, }; pub const BIND_OPTS3 = extern struct { __AnonymousBase_objidl_L8503_C36: BIND_OPTS2, hwnd: ?HWND, }; pub const BIND_FLAGS = enum(i32) { MAYBOTHERUSER = 1, JUSTTESTEXISTENCE = 2, }; pub const BIND_MAYBOTHERUSER = BIND_FLAGS.MAYBOTHERUSER; pub const BIND_JUSTTESTEXISTENCE = BIND_FLAGS.JUSTTESTEXISTENCE; // TODO: this type is limited to platform 'windows5.0' const IID_IBindCtx_Value = @import("../zig.zig").Guid.initString("0000000e-0000-0000-c000-000000000046"); pub const IID_IBindCtx = &IID_IBindCtx_Value; pub const IBindCtx = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, RegisterObjectBound: fn( self: *const IBindCtx, punk: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RevokeObjectBound: fn( self: *const IBindCtx, punk: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReleaseBoundObjects: fn( self: *const IBindCtx, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetBindOptions: fn( self: *const IBindCtx, pbindopts: ?*BIND_OPTS, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBindOptions: fn( self: *const IBindCtx, pbindopts: ?*BIND_OPTS, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRunningObjectTable: fn( self: *const IBindCtx, pprot: ?*?*IRunningObjectTable, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterObjectParam: fn( self: *const IBindCtx, pszKey: ?PWSTR, punk: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetObjectParam: fn( self: *const IBindCtx, pszKey: ?PWSTR, ppunk: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumObjectParam: fn( self: *const IBindCtx, ppenum: ?*?*IEnumString, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RevokeObjectParam: fn( self: *const IBindCtx, pszKey: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindCtx_RegisterObjectBound(self: *const T, punk: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IBindCtx.VTable, self.vtable).RegisterObjectBound(@ptrCast(*const IBindCtx, self), punk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindCtx_RevokeObjectBound(self: *const T, punk: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IBindCtx.VTable, self.vtable).RevokeObjectBound(@ptrCast(*const IBindCtx, self), punk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindCtx_ReleaseBoundObjects(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IBindCtx.VTable, self.vtable).ReleaseBoundObjects(@ptrCast(*const IBindCtx, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindCtx_SetBindOptions(self: *const T, pbindopts: ?*BIND_OPTS) callconv(.Inline) HRESULT { return @ptrCast(*const IBindCtx.VTable, self.vtable).SetBindOptions(@ptrCast(*const IBindCtx, self), pbindopts); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindCtx_GetBindOptions(self: *const T, pbindopts: ?*BIND_OPTS) callconv(.Inline) HRESULT { return @ptrCast(*const IBindCtx.VTable, self.vtable).GetBindOptions(@ptrCast(*const IBindCtx, self), pbindopts); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindCtx_GetRunningObjectTable(self: *const T, pprot: ?*?*IRunningObjectTable) callconv(.Inline) HRESULT { return @ptrCast(*const IBindCtx.VTable, self.vtable).GetRunningObjectTable(@ptrCast(*const IBindCtx, self), pprot); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindCtx_RegisterObjectParam(self: *const T, pszKey: ?PWSTR, punk: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IBindCtx.VTable, self.vtable).RegisterObjectParam(@ptrCast(*const IBindCtx, self), pszKey, punk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindCtx_GetObjectParam(self: *const T, pszKey: ?PWSTR, ppunk: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IBindCtx.VTable, self.vtable).GetObjectParam(@ptrCast(*const IBindCtx, self), pszKey, ppunk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindCtx_EnumObjectParam(self: *const T, ppenum: ?*?*IEnumString) callconv(.Inline) HRESULT { return @ptrCast(*const IBindCtx.VTable, self.vtable).EnumObjectParam(@ptrCast(*const IBindCtx, self), ppenum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindCtx_RevokeObjectParam(self: *const T, pszKey: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IBindCtx.VTable, self.vtable).RevokeObjectParam(@ptrCast(*const IBindCtx, self), pszKey); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IEnumMoniker_Value = @import("../zig.zig").Guid.initString("00000102-0000-0000-c000-000000000046"); pub const IID_IEnumMoniker = &IID_IEnumMoniker_Value; pub const IEnumMoniker = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumMoniker, celt: u32, rgelt: [*]?*IMoniker, pceltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumMoniker, celt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumMoniker, ppenum: ?*?*IEnumMoniker, ) 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 IEnumMoniker_Next(self: *const T, celt: u32, rgelt: [*]?*IMoniker, pceltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumMoniker.VTable, self.vtable).Next(@ptrCast(*const IEnumMoniker, self), celt, rgelt, pceltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumMoniker_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumMoniker.VTable, self.vtable).Skip(@ptrCast(*const IEnumMoniker, self), celt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumMoniker_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumMoniker.VTable, self.vtable).Reset(@ptrCast(*const IEnumMoniker, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumMoniker_Clone(self: *const T, ppenum: ?*?*IEnumMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumMoniker.VTable, self.vtable).Clone(@ptrCast(*const IEnumMoniker, self), ppenum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IRunnableObject_Value = @import("../zig.zig").Guid.initString("00000126-0000-0000-c000-000000000046"); pub const IID_IRunnableObject = &IID_IRunnableObject_Value; pub const IRunnableObject = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetRunningClass: fn( self: *const IRunnableObject, lpClsid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Run: fn( self: *const IRunnableObject, pbc: ?*IBindCtx, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsRunning: fn( self: *const IRunnableObject, ) callconv(@import("std").os.windows.WINAPI) BOOL, LockRunning: fn( self: *const IRunnableObject, fLock: BOOL, fLastUnlockCloses: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetContainedObject: fn( self: *const IRunnableObject, fContained: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunnableObject_GetRunningClass(self: *const T, lpClsid: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IRunnableObject.VTable, self.vtable).GetRunningClass(@ptrCast(*const IRunnableObject, self), lpClsid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunnableObject_Run(self: *const T, pbc: ?*IBindCtx) callconv(.Inline) HRESULT { return @ptrCast(*const IRunnableObject.VTable, self.vtable).Run(@ptrCast(*const IRunnableObject, self), pbc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunnableObject_IsRunning(self: *const T) callconv(.Inline) BOOL { return @ptrCast(*const IRunnableObject.VTable, self.vtable).IsRunning(@ptrCast(*const IRunnableObject, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunnableObject_LockRunning(self: *const T, fLock: BOOL, fLastUnlockCloses: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IRunnableObject.VTable, self.vtable).LockRunning(@ptrCast(*const IRunnableObject, self), fLock, fLastUnlockCloses); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunnableObject_SetContainedObject(self: *const T, fContained: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IRunnableObject.VTable, self.vtable).SetContainedObject(@ptrCast(*const IRunnableObject, self), fContained); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IRunningObjectTable_Value = @import("../zig.zig").Guid.initString("00000010-0000-0000-c000-000000000046"); pub const IID_IRunningObjectTable = &IID_IRunningObjectTable_Value; pub const IRunningObjectTable = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Register: fn( self: *const IRunningObjectTable, grfFlags: u32, punkObject: ?*IUnknown, pmkObjectName: ?*IMoniker, pdwRegister: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Revoke: fn( self: *const IRunningObjectTable, dwRegister: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsRunning: fn( self: *const IRunningObjectTable, pmkObjectName: ?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetObject: fn( self: *const IRunningObjectTable, pmkObjectName: ?*IMoniker, ppunkObject: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, NoteChangeTime: fn( self: *const IRunningObjectTable, dwRegister: u32, pfiletime: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTimeOfLastChange: fn( self: *const IRunningObjectTable, pmkObjectName: ?*IMoniker, pfiletime: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumRunning: fn( self: *const IRunningObjectTable, ppenumMoniker: ?*?*IEnumMoniker, ) 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 IRunningObjectTable_Register(self: *const T, grfFlags: u32, punkObject: ?*IUnknown, pmkObjectName: ?*IMoniker, pdwRegister: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRunningObjectTable.VTable, self.vtable).Register(@ptrCast(*const IRunningObjectTable, self), grfFlags, punkObject, pmkObjectName, pdwRegister); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunningObjectTable_Revoke(self: *const T, dwRegister: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRunningObjectTable.VTable, self.vtable).Revoke(@ptrCast(*const IRunningObjectTable, self), dwRegister); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunningObjectTable_IsRunning(self: *const T, pmkObjectName: ?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IRunningObjectTable.VTable, self.vtable).IsRunning(@ptrCast(*const IRunningObjectTable, self), pmkObjectName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunningObjectTable_GetObject(self: *const T, pmkObjectName: ?*IMoniker, ppunkObject: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IRunningObjectTable.VTable, self.vtable).GetObject(@ptrCast(*const IRunningObjectTable, self), pmkObjectName, ppunkObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunningObjectTable_NoteChangeTime(self: *const T, dwRegister: u32, pfiletime: ?*FILETIME) callconv(.Inline) HRESULT { return @ptrCast(*const IRunningObjectTable.VTable, self.vtable).NoteChangeTime(@ptrCast(*const IRunningObjectTable, self), dwRegister, pfiletime); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunningObjectTable_GetTimeOfLastChange(self: *const T, pmkObjectName: ?*IMoniker, pfiletime: ?*FILETIME) callconv(.Inline) HRESULT { return @ptrCast(*const IRunningObjectTable.VTable, self.vtable).GetTimeOfLastChange(@ptrCast(*const IRunningObjectTable, self), pmkObjectName, pfiletime); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunningObjectTable_EnumRunning(self: *const T, ppenumMoniker: ?*?*IEnumMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IRunningObjectTable.VTable, self.vtable).EnumRunning(@ptrCast(*const IRunningObjectTable, self), ppenumMoniker); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IPersist_Value = @import("../zig.zig").Guid.initString("0000010c-0000-0000-c000-000000000046"); pub const IID_IPersist = &IID_IPersist_Value; pub const IPersist = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetClassID: fn( self: *const IPersist, pClassID: ?*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 IPersist_GetClassID(self: *const T, pClassID: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IPersist.VTable, self.vtable).GetClassID(@ptrCast(*const IPersist, self), pClassID); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IPersistStream_Value = @import("../zig.zig").Guid.initString("00000109-0000-0000-c000-000000000046"); pub const IID_IPersistStream = &IID_IPersistStream_Value; pub const IPersistStream = extern struct { pub const VTable = extern struct { base: IPersist.VTable, IsDirty: fn( self: *const IPersistStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Load: fn( self: *const IPersistStream, pStm: ?*IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Save: fn( self: *const IPersistStream, pStm: ?*IStream, fClearDirty: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSizeMax: fn( self: *const IPersistStream, pcbSize: ?*ULARGE_INTEGER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IPersist.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistStream_IsDirty(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistStream.VTable, self.vtable).IsDirty(@ptrCast(*const IPersistStream, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistStream_Load(self: *const T, pStm: ?*IStream) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistStream.VTable, self.vtable).Load(@ptrCast(*const IPersistStream, self), pStm); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistStream_Save(self: *const T, pStm: ?*IStream, fClearDirty: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistStream.VTable, self.vtable).Save(@ptrCast(*const IPersistStream, self), pStm, fClearDirty); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistStream_GetSizeMax(self: *const T, pcbSize: ?*ULARGE_INTEGER) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistStream.VTable, self.vtable).GetSizeMax(@ptrCast(*const IPersistStream, self), pcbSize); } };} pub usingnamespace MethodMixin(@This()); }; pub const MKSYS = enum(i32) { NONE = 0, GENERICCOMPOSITE = 1, FILEMONIKER = 2, ANTIMONIKER = 3, ITEMMONIKER = 4, POINTERMONIKER = 5, CLASSMONIKER = 7, OBJREFMONIKER = 8, SESSIONMONIKER = 9, LUAMONIKER = 10, }; pub const MKSYS_NONE = MKSYS.NONE; pub const MKSYS_GENERICCOMPOSITE = MKSYS.GENERICCOMPOSITE; pub const MKSYS_FILEMONIKER = MKSYS.FILEMONIKER; pub const MKSYS_ANTIMONIKER = MKSYS.ANTIMONIKER; pub const MKSYS_ITEMMONIKER = MKSYS.ITEMMONIKER; pub const MKSYS_POINTERMONIKER = MKSYS.POINTERMONIKER; pub const MKSYS_CLASSMONIKER = MKSYS.CLASSMONIKER; pub const MKSYS_OBJREFMONIKER = MKSYS.OBJREFMONIKER; pub const MKSYS_SESSIONMONIKER = MKSYS.SESSIONMONIKER; pub const MKSYS_LUAMONIKER = MKSYS.LUAMONIKER; pub const MKREDUCE = enum(i32) { ONE = 196608, TOUSER = 131072, THROUGHUSER = 65536, ALL = 0, }; pub const MKRREDUCE_ONE = MKREDUCE.ONE; pub const MKRREDUCE_TOUSER = MKREDUCE.TOUSER; pub const MKRREDUCE_THROUGHUSER = MKREDUCE.THROUGHUSER; pub const MKRREDUCE_ALL = MKREDUCE.ALL; // TODO: this type is limited to platform 'windows5.0' const IID_IMoniker_Value = @import("../zig.zig").Guid.initString("0000000f-0000-0000-c000-000000000046"); pub const IID_IMoniker = &IID_IMoniker_Value; pub const IMoniker = extern struct { pub const VTable = extern struct { base: IPersistStream.VTable, BindToObject: fn( self: *const IMoniker, pbc: ?*IBindCtx, pmkToLeft: ?*IMoniker, riidResult: ?*const Guid, ppvResult: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BindToStorage: fn( self: *const IMoniker, pbc: ?*IBindCtx, pmkToLeft: ?*IMoniker, riid: ?*const Guid, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reduce: fn( self: *const IMoniker, pbc: ?*IBindCtx, dwReduceHowFar: u32, ppmkToLeft: ?*?*IMoniker, ppmkReduced: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ComposeWith: fn( self: *const IMoniker, pmkRight: ?*IMoniker, fOnlyIfNotGeneric: BOOL, ppmkComposite: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Enum: fn( self: *const IMoniker, fForward: BOOL, ppenumMoniker: ?*?*IEnumMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsEqual: fn( self: *const IMoniker, pmkOtherMoniker: ?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Hash: fn( self: *const IMoniker, pdwHash: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsRunning: fn( self: *const IMoniker, pbc: ?*IBindCtx, pmkToLeft: ?*IMoniker, pmkNewlyRunning: ?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTimeOfLastChange: fn( self: *const IMoniker, pbc: ?*IBindCtx, pmkToLeft: ?*IMoniker, pFileTime: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Inverse: fn( self: *const IMoniker, ppmk: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CommonPrefixWith: fn( self: *const IMoniker, pmkOther: ?*IMoniker, ppmkPrefix: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RelativePathTo: fn( self: *const IMoniker, pmkOther: ?*IMoniker, ppmkRelPath: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDisplayName: fn( self: *const IMoniker, pbc: ?*IBindCtx, pmkToLeft: ?*IMoniker, ppszDisplayName: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ParseDisplayName: fn( self: *const IMoniker, pbc: ?*IBindCtx, pmkToLeft: ?*IMoniker, pszDisplayName: ?PWSTR, pchEaten: ?*u32, ppmkOut: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsSystemMoniker: fn( self: *const IMoniker, pdwMksys: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IPersistStream.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMoniker_BindToObject(self: *const T, pbc: ?*IBindCtx, pmkToLeft: ?*IMoniker, riidResult: ?*const Guid, ppvResult: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IMoniker.VTable, self.vtable).BindToObject(@ptrCast(*const IMoniker, self), pbc, pmkToLeft, riidResult, ppvResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMoniker_BindToStorage(self: *const T, pbc: ?*IBindCtx, pmkToLeft: ?*IMoniker, riid: ?*const Guid, ppvObj: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IMoniker.VTable, self.vtable).BindToStorage(@ptrCast(*const IMoniker, self), pbc, pmkToLeft, riid, ppvObj); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMoniker_Reduce(self: *const T, pbc: ?*IBindCtx, dwReduceHowFar: u32, ppmkToLeft: ?*?*IMoniker, ppmkReduced: ?*?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IMoniker.VTable, self.vtable).Reduce(@ptrCast(*const IMoniker, self), pbc, dwReduceHowFar, ppmkToLeft, ppmkReduced); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMoniker_ComposeWith(self: *const T, pmkRight: ?*IMoniker, fOnlyIfNotGeneric: BOOL, ppmkComposite: ?*?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IMoniker.VTable, self.vtable).ComposeWith(@ptrCast(*const IMoniker, self), pmkRight, fOnlyIfNotGeneric, ppmkComposite); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMoniker_Enum(self: *const T, fForward: BOOL, ppenumMoniker: ?*?*IEnumMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IMoniker.VTable, self.vtable).Enum(@ptrCast(*const IMoniker, self), fForward, ppenumMoniker); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMoniker_IsEqual(self: *const T, pmkOtherMoniker: ?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IMoniker.VTable, self.vtable).IsEqual(@ptrCast(*const IMoniker, self), pmkOtherMoniker); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMoniker_Hash(self: *const T, pdwHash: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMoniker.VTable, self.vtable).Hash(@ptrCast(*const IMoniker, self), pdwHash); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMoniker_IsRunning(self: *const T, pbc: ?*IBindCtx, pmkToLeft: ?*IMoniker, pmkNewlyRunning: ?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IMoniker.VTable, self.vtable).IsRunning(@ptrCast(*const IMoniker, self), pbc, pmkToLeft, pmkNewlyRunning); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMoniker_GetTimeOfLastChange(self: *const T, pbc: ?*IBindCtx, pmkToLeft: ?*IMoniker, pFileTime: ?*FILETIME) callconv(.Inline) HRESULT { return @ptrCast(*const IMoniker.VTable, self.vtable).GetTimeOfLastChange(@ptrCast(*const IMoniker, self), pbc, pmkToLeft, pFileTime); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMoniker_Inverse(self: *const T, ppmk: ?*?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IMoniker.VTable, self.vtable).Inverse(@ptrCast(*const IMoniker, self), ppmk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMoniker_CommonPrefixWith(self: *const T, pmkOther: ?*IMoniker, ppmkPrefix: ?*?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IMoniker.VTable, self.vtable).CommonPrefixWith(@ptrCast(*const IMoniker, self), pmkOther, ppmkPrefix); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMoniker_RelativePathTo(self: *const T, pmkOther: ?*IMoniker, ppmkRelPath: ?*?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IMoniker.VTable, self.vtable).RelativePathTo(@ptrCast(*const IMoniker, self), pmkOther, ppmkRelPath); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMoniker_GetDisplayName(self: *const T, pbc: ?*IBindCtx, pmkToLeft: ?*IMoniker, ppszDisplayName: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMoniker.VTable, self.vtable).GetDisplayName(@ptrCast(*const IMoniker, self), pbc, pmkToLeft, ppszDisplayName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMoniker_ParseDisplayName(self: *const T, pbc: ?*IBindCtx, pmkToLeft: ?*IMoniker, pszDisplayName: ?PWSTR, pchEaten: ?*u32, ppmkOut: ?*?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IMoniker.VTable, self.vtable).ParseDisplayName(@ptrCast(*const IMoniker, self), pbc, pmkToLeft, pszDisplayName, pchEaten, ppmkOut); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMoniker_IsSystemMoniker(self: *const T, pdwMksys: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMoniker.VTable, self.vtable).IsSystemMoniker(@ptrCast(*const IMoniker, self), pdwMksys); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IROTData_Value = @import("../zig.zig").Guid.initString("f29f6bc0-5021-11ce-aa15-00006901293f"); pub const IID_IROTData = &IID_IROTData_Value; pub const IROTData = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetComparisonData: fn( self: *const IROTData, pbData: [*:0]u8, cbMax: u32, pcbData: ?*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 IROTData_GetComparisonData(self: *const T, pbData: [*:0]u8, cbMax: u32, pcbData: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IROTData.VTable, self.vtable).GetComparisonData(@ptrCast(*const IROTData, self), pbData, cbMax, pcbData); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IPersistFile_Value = @import("../zig.zig").Guid.initString("0000010b-0000-0000-c000-000000000046"); pub const IID_IPersistFile = &IID_IPersistFile_Value; pub const IPersistFile = extern struct { pub const VTable = extern struct { base: IPersist.VTable, IsDirty: fn( self: *const IPersistFile, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Load: fn( self: *const IPersistFile, pszFileName: ?[*:0]const u16, dwMode: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Save: fn( self: *const IPersistFile, pszFileName: ?[*:0]const u16, fRemember: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SaveCompleted: fn( self: *const IPersistFile, pszFileName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCurFile: fn( self: *const IPersistFile, ppszFileName: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IPersist.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistFile_IsDirty(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistFile.VTable, self.vtable).IsDirty(@ptrCast(*const IPersistFile, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistFile_Load(self: *const T, pszFileName: ?[*:0]const u16, dwMode: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistFile.VTable, self.vtable).Load(@ptrCast(*const IPersistFile, self), pszFileName, dwMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistFile_Save(self: *const T, pszFileName: ?[*:0]const u16, fRemember: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistFile.VTable, self.vtable).Save(@ptrCast(*const IPersistFile, self), pszFileName, fRemember); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistFile_SaveCompleted(self: *const T, pszFileName: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistFile.VTable, self.vtable).SaveCompleted(@ptrCast(*const IPersistFile, self), pszFileName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistFile_GetCurFile(self: *const T, ppszFileName: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistFile.VTable, self.vtable).GetCurFile(@ptrCast(*const IPersistFile, self), ppszFileName); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IPersistStorage_Value = @import("../zig.zig").Guid.initString("0000010a-0000-0000-c000-000000000046"); pub const IID_IPersistStorage = &IID_IPersistStorage_Value; pub const IPersistStorage = extern struct { pub const VTable = extern struct { base: IPersist.VTable, IsDirty: fn( self: *const IPersistStorage, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InitNew: fn( self: *const IPersistStorage, pStg: ?*IStorage, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Load: fn( self: *const IPersistStorage, pStg: ?*IStorage, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Save: fn( self: *const IPersistStorage, pStgSave: ?*IStorage, fSameAsLoad: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SaveCompleted: fn( self: *const IPersistStorage, pStgNew: ?*IStorage, ) callconv(@import("std").os.windows.WINAPI) HRESULT, HandsOffStorage: fn( self: *const IPersistStorage, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IPersist.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistStorage_IsDirty(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistStorage.VTable, self.vtable).IsDirty(@ptrCast(*const IPersistStorage, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistStorage_InitNew(self: *const T, pStg: ?*IStorage) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistStorage.VTable, self.vtable).InitNew(@ptrCast(*const IPersistStorage, self), pStg); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistStorage_Load(self: *const T, pStg: ?*IStorage) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistStorage.VTable, self.vtable).Load(@ptrCast(*const IPersistStorage, self), pStg); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistStorage_Save(self: *const T, pStgSave: ?*IStorage, fSameAsLoad: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistStorage.VTable, self.vtable).Save(@ptrCast(*const IPersistStorage, self), pStgSave, fSameAsLoad); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistStorage_SaveCompleted(self: *const T, pStgNew: ?*IStorage) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistStorage.VTable, self.vtable).SaveCompleted(@ptrCast(*const IPersistStorage, self), pStgNew); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistStorage_HandsOffStorage(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistStorage.VTable, self.vtable).HandsOffStorage(@ptrCast(*const IPersistStorage, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const DVTARGETDEVICE = extern struct { tdSize: u32, tdDriverNameOffset: u16, tdDeviceNameOffset: u16, tdPortNameOffset: u16, tdExtDevmodeOffset: u16, tdData: [1]u8, }; pub const FORMATETC = extern struct { cfFormat: u16, ptd: ?*DVTARGETDEVICE, dwAspect: u32, lindex: i32, tymed: u32, }; // TODO: this type is limited to platform 'windows5.0' const IID_IEnumFORMATETC_Value = @import("../zig.zig").Guid.initString("00000103-0000-0000-c000-000000000046"); pub const IID_IEnumFORMATETC = &IID_IEnumFORMATETC_Value; pub const IEnumFORMATETC = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumFORMATETC, celt: u32, rgelt: [*]FORMATETC, pceltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumFORMATETC, celt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumFORMATETC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumFORMATETC, ppenum: ?*?*IEnumFORMATETC, ) 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 IEnumFORMATETC_Next(self: *const T, celt: u32, rgelt: [*]FORMATETC, pceltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumFORMATETC.VTable, self.vtable).Next(@ptrCast(*const IEnumFORMATETC, self), celt, rgelt, pceltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumFORMATETC_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumFORMATETC.VTable, self.vtable).Skip(@ptrCast(*const IEnumFORMATETC, self), celt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumFORMATETC_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumFORMATETC.VTable, self.vtable).Reset(@ptrCast(*const IEnumFORMATETC, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumFORMATETC_Clone(self: *const T, ppenum: ?*?*IEnumFORMATETC) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumFORMATETC.VTable, self.vtable).Clone(@ptrCast(*const IEnumFORMATETC, self), ppenum); } };} pub usingnamespace MethodMixin(@This()); }; pub const ADVF = enum(i32) { _NODATA = 1, _PRIMEFIRST = 2, _ONLYONCE = 4, _DATAONSTOP = 64, CACHE_NOHANDLER = 8, CACHE_FORCEBUILTIN = 16, CACHE_ONSAVE = 32, }; pub const ADVF_NODATA = ADVF._NODATA; pub const ADVF_PRIMEFIRST = ADVF._PRIMEFIRST; pub const ADVF_ONLYONCE = ADVF._ONLYONCE; pub const ADVF_DATAONSTOP = ADVF._DATAONSTOP; pub const ADVFCACHE_NOHANDLER = ADVF.CACHE_NOHANDLER; pub const ADVFCACHE_FORCEBUILTIN = ADVF.CACHE_FORCEBUILTIN; pub const ADVFCACHE_ONSAVE = ADVF.CACHE_ONSAVE; pub const STATDATA = extern struct { formatetc: FORMATETC, advf: u32, pAdvSink: ?*IAdviseSink, dwConnection: u32, }; // TODO: this type is limited to platform 'windows5.0' const IID_IEnumSTATDATA_Value = @import("../zig.zig").Guid.initString("00000105-0000-0000-c000-000000000046"); pub const IID_IEnumSTATDATA = &IID_IEnumSTATDATA_Value; pub const IEnumSTATDATA = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumSTATDATA, celt: u32, rgelt: [*]STATDATA, pceltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumSTATDATA, celt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumSTATDATA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumSTATDATA, ppenum: ?*?*IEnumSTATDATA, ) 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 IEnumSTATDATA_Next(self: *const T, celt: u32, rgelt: [*]STATDATA, pceltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumSTATDATA.VTable, self.vtable).Next(@ptrCast(*const IEnumSTATDATA, self), celt, rgelt, pceltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumSTATDATA_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumSTATDATA.VTable, self.vtable).Skip(@ptrCast(*const IEnumSTATDATA, self), celt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumSTATDATA_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumSTATDATA.VTable, self.vtable).Reset(@ptrCast(*const IEnumSTATDATA, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumSTATDATA_Clone(self: *const T, ppenum: ?*?*IEnumSTATDATA) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumSTATDATA.VTable, self.vtable).Clone(@ptrCast(*const IEnumSTATDATA, self), ppenum); } };} pub usingnamespace MethodMixin(@This()); }; pub const TYMED = enum(i32) { HGLOBAL = 1, FILE = 2, ISTREAM = 4, ISTORAGE = 8, GDI = 16, MFPICT = 32, ENHMF = 64, NULL = 0, }; pub const TYMED_HGLOBAL = TYMED.HGLOBAL; pub const TYMED_FILE = TYMED.FILE; pub const TYMED_ISTREAM = TYMED.ISTREAM; pub const TYMED_ISTORAGE = TYMED.ISTORAGE; pub const TYMED_GDI = TYMED.GDI; pub const TYMED_MFPICT = TYMED.MFPICT; pub const TYMED_ENHMF = TYMED.ENHMF; pub const TYMED_NULL = TYMED.NULL; pub const RemSTGMEDIUM = extern struct { tymed: u32, dwHandleType: u32, pData: u32, pUnkForRelease: u32, cbData: u32, data: [1]u8, }; pub const STGMEDIUM = extern struct { tymed: u32, Anonymous: extern union { hBitmap: ?HBITMAP, hMetaFilePict: ?*c_void, hEnhMetaFile: ?HENHMETAFILE, hGlobal: isize, lpszFileName: ?PWSTR, pstm: ?*IStream, pstg: ?*IStorage, }, pUnkForRelease: ?*IUnknown, }; pub const GDI_OBJECT = extern struct { ObjectType: u32, u: extern struct { hBitmap: ?*userHBITMAP, hPalette: ?*userHPALETTE, hGeneric: ?*userHGLOBAL, }, }; pub const userSTGMEDIUM = extern struct { pub const _STGMEDIUM_UNION = extern struct { tymed: u32, u: extern struct { hMetaFilePict: ?*userHMETAFILEPICT, hHEnhMetaFile: ?*userHENHMETAFILE, hGdiHandle: ?*GDI_OBJECT, hGlobal: ?*userHGLOBAL, lpszFileName: ?PWSTR, pstm: ?*BYTE_BLOB, pstg: ?*BYTE_BLOB, }, }; pUnkForRelease: ?*IUnknown, }; pub const userFLAG_STGMEDIUM = extern struct { ContextFlags: i32, fPassOwnership: i32, Stgmed: userSTGMEDIUM, }; pub const FLAG_STGMEDIUM = extern struct { ContextFlags: i32, fPassOwnership: i32, Stgmed: STGMEDIUM, }; // TODO: this type is limited to platform 'windows5.0' const IID_IAdviseSink_Value = @import("../zig.zig").Guid.initString("0000010f-0000-0000-c000-000000000046"); pub const IID_IAdviseSink = &IID_IAdviseSink_Value; pub const IAdviseSink = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnDataChange: fn( self: *const IAdviseSink, pFormatetc: ?*FORMATETC, pStgmed: ?*STGMEDIUM, ) callconv(@import("std").os.windows.WINAPI) void, OnViewChange: fn( self: *const IAdviseSink, dwAspect: u32, lindex: i32, ) callconv(@import("std").os.windows.WINAPI) void, OnRename: fn( self: *const IAdviseSink, pmk: ?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) void, OnSave: fn( self: *const IAdviseSink, ) callconv(@import("std").os.windows.WINAPI) void, OnClose: fn( self: *const IAdviseSink, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAdviseSink_OnDataChange(self: *const T, pFormatetc: ?*FORMATETC, pStgmed: ?*STGMEDIUM) callconv(.Inline) void { return @ptrCast(*const IAdviseSink.VTable, self.vtable).OnDataChange(@ptrCast(*const IAdviseSink, self), pFormatetc, pStgmed); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAdviseSink_OnViewChange(self: *const T, dwAspect: u32, lindex: i32) callconv(.Inline) void { return @ptrCast(*const IAdviseSink.VTable, self.vtable).OnViewChange(@ptrCast(*const IAdviseSink, self), dwAspect, lindex); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAdviseSink_OnRename(self: *const T, pmk: ?*IMoniker) callconv(.Inline) void { return @ptrCast(*const IAdviseSink.VTable, self.vtable).OnRename(@ptrCast(*const IAdviseSink, self), pmk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAdviseSink_OnSave(self: *const T) callconv(.Inline) void { return @ptrCast(*const IAdviseSink.VTable, self.vtable).OnSave(@ptrCast(*const IAdviseSink, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAdviseSink_OnClose(self: *const T) callconv(.Inline) void { return @ptrCast(*const IAdviseSink.VTable, self.vtable).OnClose(@ptrCast(*const IAdviseSink, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_AsyncIAdviseSink_Value = @import("../zig.zig").Guid.initString("00000150-0000-0000-c000-000000000046"); pub const IID_AsyncIAdviseSink = &IID_AsyncIAdviseSink_Value; pub const AsyncIAdviseSink = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Begin_OnDataChange: fn( self: *const AsyncIAdviseSink, pFormatetc: ?*FORMATETC, pStgmed: ?*STGMEDIUM, ) callconv(@import("std").os.windows.WINAPI) void, Finish_OnDataChange: fn( self: *const AsyncIAdviseSink, ) callconv(@import("std").os.windows.WINAPI) void, Begin_OnViewChange: fn( self: *const AsyncIAdviseSink, dwAspect: u32, lindex: i32, ) callconv(@import("std").os.windows.WINAPI) void, Finish_OnViewChange: fn( self: *const AsyncIAdviseSink, ) callconv(@import("std").os.windows.WINAPI) void, Begin_OnRename: fn( self: *const AsyncIAdviseSink, pmk: ?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) void, Finish_OnRename: fn( self: *const AsyncIAdviseSink, ) callconv(@import("std").os.windows.WINAPI) void, Begin_OnSave: fn( self: *const AsyncIAdviseSink, ) callconv(@import("std").os.windows.WINAPI) void, Finish_OnSave: fn( self: *const AsyncIAdviseSink, ) callconv(@import("std").os.windows.WINAPI) void, Begin_OnClose: fn( self: *const AsyncIAdviseSink, ) callconv(@import("std").os.windows.WINAPI) void, Finish_OnClose: fn( self: *const AsyncIAdviseSink, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIAdviseSink_Begin_OnDataChange(self: *const T, pFormatetc: ?*FORMATETC, pStgmed: ?*STGMEDIUM) callconv(.Inline) void { return @ptrCast(*const AsyncIAdviseSink.VTable, self.vtable).Begin_OnDataChange(@ptrCast(*const AsyncIAdviseSink, self), pFormatetc, pStgmed); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIAdviseSink_Finish_OnDataChange(self: *const T) callconv(.Inline) void { return @ptrCast(*const AsyncIAdviseSink.VTable, self.vtable).Finish_OnDataChange(@ptrCast(*const AsyncIAdviseSink, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIAdviseSink_Begin_OnViewChange(self: *const T, dwAspect: u32, lindex: i32) callconv(.Inline) void { return @ptrCast(*const AsyncIAdviseSink.VTable, self.vtable).Begin_OnViewChange(@ptrCast(*const AsyncIAdviseSink, self), dwAspect, lindex); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIAdviseSink_Finish_OnViewChange(self: *const T) callconv(.Inline) void { return @ptrCast(*const AsyncIAdviseSink.VTable, self.vtable).Finish_OnViewChange(@ptrCast(*const AsyncIAdviseSink, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIAdviseSink_Begin_OnRename(self: *const T, pmk: ?*IMoniker) callconv(.Inline) void { return @ptrCast(*const AsyncIAdviseSink.VTable, self.vtable).Begin_OnRename(@ptrCast(*const AsyncIAdviseSink, self), pmk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIAdviseSink_Finish_OnRename(self: *const T) callconv(.Inline) void { return @ptrCast(*const AsyncIAdviseSink.VTable, self.vtable).Finish_OnRename(@ptrCast(*const AsyncIAdviseSink, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIAdviseSink_Begin_OnSave(self: *const T) callconv(.Inline) void { return @ptrCast(*const AsyncIAdviseSink.VTable, self.vtable).Begin_OnSave(@ptrCast(*const AsyncIAdviseSink, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIAdviseSink_Finish_OnSave(self: *const T) callconv(.Inline) void { return @ptrCast(*const AsyncIAdviseSink.VTable, self.vtable).Finish_OnSave(@ptrCast(*const AsyncIAdviseSink, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIAdviseSink_Begin_OnClose(self: *const T) callconv(.Inline) void { return @ptrCast(*const AsyncIAdviseSink.VTable, self.vtable).Begin_OnClose(@ptrCast(*const AsyncIAdviseSink, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIAdviseSink_Finish_OnClose(self: *const T) callconv(.Inline) void { return @ptrCast(*const AsyncIAdviseSink.VTable, self.vtable).Finish_OnClose(@ptrCast(*const AsyncIAdviseSink, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IAdviseSink2_Value = @import("../zig.zig").Guid.initString("00000125-0000-0000-c000-000000000046"); pub const IID_IAdviseSink2 = &IID_IAdviseSink2_Value; pub const IAdviseSink2 = extern struct { pub const VTable = extern struct { base: IAdviseSink.VTable, OnLinkSrcChange: fn( self: *const IAdviseSink2, pmk: ?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IAdviseSink.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAdviseSink2_OnLinkSrcChange(self: *const T, pmk: ?*IMoniker) callconv(.Inline) void { return @ptrCast(*const IAdviseSink2.VTable, self.vtable).OnLinkSrcChange(@ptrCast(*const IAdviseSink2, self), pmk); } };} pub usingnamespace MethodMixin(@This()); }; const IID_AsyncIAdviseSink2_Value = @import("../zig.zig").Guid.initString("00000151-0000-0000-c000-000000000046"); pub const IID_AsyncIAdviseSink2 = &IID_AsyncIAdviseSink2_Value; pub const AsyncIAdviseSink2 = extern struct { pub const VTable = extern struct { base: AsyncIAdviseSink.VTable, Begin_OnLinkSrcChange: fn( self: *const AsyncIAdviseSink2, pmk: ?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) void, Finish_OnLinkSrcChange: fn( self: *const AsyncIAdviseSink2, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace AsyncIAdviseSink.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIAdviseSink2_Begin_OnLinkSrcChange(self: *const T, pmk: ?*IMoniker) callconv(.Inline) void { return @ptrCast(*const AsyncIAdviseSink2.VTable, self.vtable).Begin_OnLinkSrcChange(@ptrCast(*const AsyncIAdviseSink2, self), pmk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIAdviseSink2_Finish_OnLinkSrcChange(self: *const T) callconv(.Inline) void { return @ptrCast(*const AsyncIAdviseSink2.VTable, self.vtable).Finish_OnLinkSrcChange(@ptrCast(*const AsyncIAdviseSink2, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const DATADIR = enum(i32) { GET = 1, SET = 2, }; pub const DATADIR_GET = DATADIR.GET; pub const DATADIR_SET = DATADIR.SET; // TODO: this type is limited to platform 'windows5.0' const IID_IDataObject_Value = @import("../zig.zig").Guid.initString("0000010e-0000-0000-c000-000000000046"); pub const IID_IDataObject = &IID_IDataObject_Value; pub const IDataObject = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetData: fn( self: *const IDataObject, pformatetcIn: ?*FORMATETC, pmedium: ?*STGMEDIUM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDataHere: fn( self: *const IDataObject, pformatetc: ?*FORMATETC, pmedium: ?*STGMEDIUM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, QueryGetData: fn( self: *const IDataObject, pformatetc: ?*FORMATETC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCanonicalFormatEtc: fn( self: *const IDataObject, pformatectIn: ?*FORMATETC, pformatetcOut: ?*FORMATETC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetData: fn( self: *const IDataObject, pformatetc: ?*FORMATETC, pmedium: ?*STGMEDIUM, fRelease: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumFormatEtc: fn( self: *const IDataObject, dwDirection: u32, ppenumFormatEtc: ?*?*IEnumFORMATETC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DAdvise: fn( self: *const IDataObject, pformatetc: ?*FORMATETC, advf: u32, pAdvSink: ?*IAdviseSink, pdwConnection: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DUnadvise: fn( self: *const IDataObject, dwConnection: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumDAdvise: fn( self: *const IDataObject, ppenumAdvise: ?*?*IEnumSTATDATA, ) 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 IDataObject_GetData(self: *const T, pformatetcIn: ?*FORMATETC, pmedium: ?*STGMEDIUM) callconv(.Inline) HRESULT { return @ptrCast(*const IDataObject.VTable, self.vtable).GetData(@ptrCast(*const IDataObject, self), pformatetcIn, pmedium); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDataObject_GetDataHere(self: *const T, pformatetc: ?*FORMATETC, pmedium: ?*STGMEDIUM) callconv(.Inline) HRESULT { return @ptrCast(*const IDataObject.VTable, self.vtable).GetDataHere(@ptrCast(*const IDataObject, self), pformatetc, pmedium); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDataObject_QueryGetData(self: *const T, pformatetc: ?*FORMATETC) callconv(.Inline) HRESULT { return @ptrCast(*const IDataObject.VTable, self.vtable).QueryGetData(@ptrCast(*const IDataObject, self), pformatetc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDataObject_GetCanonicalFormatEtc(self: *const T, pformatectIn: ?*FORMATETC, pformatetcOut: ?*FORMATETC) callconv(.Inline) HRESULT { return @ptrCast(*const IDataObject.VTable, self.vtable).GetCanonicalFormatEtc(@ptrCast(*const IDataObject, self), pformatectIn, pformatetcOut); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDataObject_SetData(self: *const T, pformatetc: ?*FORMATETC, pmedium: ?*STGMEDIUM, fRelease: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IDataObject.VTable, self.vtable).SetData(@ptrCast(*const IDataObject, self), pformatetc, pmedium, fRelease); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDataObject_EnumFormatEtc(self: *const T, dwDirection: u32, ppenumFormatEtc: ?*?*IEnumFORMATETC) callconv(.Inline) HRESULT { return @ptrCast(*const IDataObject.VTable, self.vtable).EnumFormatEtc(@ptrCast(*const IDataObject, self), dwDirection, ppenumFormatEtc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDataObject_DAdvise(self: *const T, pformatetc: ?*FORMATETC, advf: u32, pAdvSink: ?*IAdviseSink, pdwConnection: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDataObject.VTable, self.vtable).DAdvise(@ptrCast(*const IDataObject, self), pformatetc, advf, pAdvSink, pdwConnection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDataObject_DUnadvise(self: *const T, dwConnection: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDataObject.VTable, self.vtable).DUnadvise(@ptrCast(*const IDataObject, self), dwConnection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDataObject_EnumDAdvise(self: *const T, ppenumAdvise: ?*?*IEnumSTATDATA) callconv(.Inline) HRESULT { return @ptrCast(*const IDataObject.VTable, self.vtable).EnumDAdvise(@ptrCast(*const IDataObject, self), ppenumAdvise); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IDataAdviseHolder_Value = @import("../zig.zig").Guid.initString("00000110-0000-0000-c000-000000000046"); pub const IID_IDataAdviseHolder = &IID_IDataAdviseHolder_Value; pub const IDataAdviseHolder = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Advise: fn( self: *const IDataAdviseHolder, pDataObject: ?*IDataObject, pFetc: ?*FORMATETC, advf: u32, pAdvise: ?*IAdviseSink, pdwConnection: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unadvise: fn( self: *const IDataAdviseHolder, dwConnection: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumAdvise: fn( self: *const IDataAdviseHolder, ppenumAdvise: ?*?*IEnumSTATDATA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendOnDataChange: fn( self: *const IDataAdviseHolder, pDataObject: ?*IDataObject, dwReserved: u32, advf: 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 IDataAdviseHolder_Advise(self: *const T, pDataObject: ?*IDataObject, pFetc: ?*FORMATETC, advf: u32, pAdvise: ?*IAdviseSink, pdwConnection: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDataAdviseHolder.VTable, self.vtable).Advise(@ptrCast(*const IDataAdviseHolder, self), pDataObject, pFetc, advf, pAdvise, pdwConnection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDataAdviseHolder_Unadvise(self: *const T, dwConnection: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDataAdviseHolder.VTable, self.vtable).Unadvise(@ptrCast(*const IDataAdviseHolder, self), dwConnection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDataAdviseHolder_EnumAdvise(self: *const T, ppenumAdvise: ?*?*IEnumSTATDATA) callconv(.Inline) HRESULT { return @ptrCast(*const IDataAdviseHolder.VTable, self.vtable).EnumAdvise(@ptrCast(*const IDataAdviseHolder, self), ppenumAdvise); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDataAdviseHolder_SendOnDataChange(self: *const T, pDataObject: ?*IDataObject, dwReserved: u32, advf: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDataAdviseHolder.VTable, self.vtable).SendOnDataChange(@ptrCast(*const IDataAdviseHolder, self), pDataObject, dwReserved, advf); } };} pub usingnamespace MethodMixin(@This()); }; pub const CALLTYPE = enum(i32) { TOPLEVEL = 1, NESTED = 2, ASYNC = 3, TOPLEVEL_CALLPENDING = 4, ASYNC_CALLPENDING = 5, }; pub const CALLTYPE_TOPLEVEL = CALLTYPE.TOPLEVEL; pub const CALLTYPE_NESTED = CALLTYPE.NESTED; pub const CALLTYPE_ASYNC = CALLTYPE.ASYNC; pub const CALLTYPE_TOPLEVEL_CALLPENDING = CALLTYPE.TOPLEVEL_CALLPENDING; pub const CALLTYPE_ASYNC_CALLPENDING = CALLTYPE.ASYNC_CALLPENDING; pub const SERVERCALL = enum(i32) { ISHANDLED = 0, REJECTED = 1, RETRYLATER = 2, }; pub const SERVERCALL_ISHANDLED = SERVERCALL.ISHANDLED; pub const SERVERCALL_REJECTED = SERVERCALL.REJECTED; pub const SERVERCALL_RETRYLATER = SERVERCALL.RETRYLATER; pub const PENDINGTYPE = enum(i32) { TOPLEVEL = 1, NESTED = 2, }; pub const PENDINGTYPE_TOPLEVEL = PENDINGTYPE.TOPLEVEL; pub const PENDINGTYPE_NESTED = PENDINGTYPE.NESTED; pub const PENDINGMSG = enum(i32) { CANCELCALL = 0, WAITNOPROCESS = 1, WAITDEFPROCESS = 2, }; pub const PENDINGMSG_CANCELCALL = PENDINGMSG.CANCELCALL; pub const PENDINGMSG_WAITNOPROCESS = PENDINGMSG.WAITNOPROCESS; pub const PENDINGMSG_WAITDEFPROCESS = PENDINGMSG.WAITDEFPROCESS; pub const INTERFACEINFO = extern struct { pUnk: ?*IUnknown, iid: Guid, wMethod: u16, }; // TODO: this type is limited to platform 'windows5.0' const IID_IMessageFilter_Value = @import("../zig.zig").Guid.initString("00000016-0000-0000-c000-000000000046"); pub const IID_IMessageFilter = &IID_IMessageFilter_Value; pub const IMessageFilter = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, HandleInComingCall: fn( self: *const IMessageFilter, dwCallType: u32, htaskCaller: ?HTASK, dwTickCount: u32, lpInterfaceInfo: ?*INTERFACEINFO, ) callconv(@import("std").os.windows.WINAPI) u32, RetryRejectedCall: fn( self: *const IMessageFilter, htaskCallee: ?HTASK, dwTickCount: u32, dwRejectType: u32, ) callconv(@import("std").os.windows.WINAPI) u32, MessagePending: fn( self: *const IMessageFilter, htaskCallee: ?HTASK, dwTickCount: u32, dwPendingType: u32, ) callconv(@import("std").os.windows.WINAPI) u32, }; 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 IMessageFilter_HandleInComingCall(self: *const T, dwCallType: u32, htaskCaller: ?HTASK, dwTickCount: u32, lpInterfaceInfo: ?*INTERFACEINFO) callconv(.Inline) u32 { return @ptrCast(*const IMessageFilter.VTable, self.vtable).HandleInComingCall(@ptrCast(*const IMessageFilter, self), dwCallType, htaskCaller, dwTickCount, lpInterfaceInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMessageFilter_RetryRejectedCall(self: *const T, htaskCallee: ?HTASK, dwTickCount: u32, dwRejectType: u32) callconv(.Inline) u32 { return @ptrCast(*const IMessageFilter.VTable, self.vtable).RetryRejectedCall(@ptrCast(*const IMessageFilter, self), htaskCallee, dwTickCount, dwRejectType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMessageFilter_MessagePending(self: *const T, htaskCallee: ?HTASK, dwTickCount: u32, dwPendingType: u32) callconv(.Inline) u32 { return @ptrCast(*const IMessageFilter.VTable, self.vtable).MessagePending(@ptrCast(*const IMessageFilter, self), htaskCallee, dwTickCount, dwPendingType); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IClassActivator_Value = @import("../zig.zig").Guid.initString("00000140-0000-0000-c000-000000000046"); pub const IID_IClassActivator = &IID_IClassActivator_Value; pub const IClassActivator = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetClassObject: fn( self: *const IClassActivator, rclsid: ?*const Guid, dwClassContext: u32, locale: u32, riid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IClassActivator_GetClassObject(self: *const T, rclsid: ?*const Guid, dwClassContext: u32, locale: u32, riid: ?*const Guid, ppv: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IClassActivator.VTable, self.vtable).GetClassObject(@ptrCast(*const IClassActivator, self), rclsid, dwClassContext, locale, riid, ppv); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IProgressNotify_Value = @import("../zig.zig").Guid.initString("a9d758a0-4617-11cf-95fc-00aa00680db4"); pub const IID_IProgressNotify = &IID_IProgressNotify_Value; pub const IProgressNotify = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnProgress: fn( self: *const IProgressNotify, dwProgressCurrent: u32, dwProgressMaximum: u32, fAccurate: BOOL, fOwner: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IProgressNotify_OnProgress(self: *const T, dwProgressCurrent: u32, dwProgressMaximum: u32, fAccurate: BOOL, fOwner: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IProgressNotify.VTable, self.vtable).OnProgress(@ptrCast(*const IProgressNotify, self), dwProgressCurrent, dwProgressMaximum, fAccurate, fOwner); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IBlockingLock_Value = @import("../zig.zig").Guid.initString("30f3d47a-6447-11d1-8e3c-00c04fb9386d"); pub const IID_IBlockingLock = &IID_IBlockingLock_Value; pub const IBlockingLock = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Lock: fn( self: *const IBlockingLock, dwTimeout: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unlock: fn( self: *const IBlockingLock, ) 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 IBlockingLock_Lock(self: *const T, dwTimeout: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IBlockingLock.VTable, self.vtable).Lock(@ptrCast(*const IBlockingLock, self), dwTimeout); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBlockingLock_Unlock(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IBlockingLock.VTable, self.vtable).Unlock(@ptrCast(*const IBlockingLock, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ITimeAndNoticeControl_Value = @import("../zig.zig").Guid.initString("bc0bf6ae-8878-11d1-83e9-00c04fc2c6d4"); pub const IID_ITimeAndNoticeControl = &IID_ITimeAndNoticeControl_Value; pub const ITimeAndNoticeControl = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SuppressChanges: fn( self: *const ITimeAndNoticeControl, res1: u32, res2: 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 ITimeAndNoticeControl_SuppressChanges(self: *const T, res1: u32, res2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITimeAndNoticeControl.VTable, self.vtable).SuppressChanges(@ptrCast(*const ITimeAndNoticeControl, self), res1, res2); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IOplockStorage_Value = @import("../zig.zig").Guid.initString("8d19c834-8879-11d1-83e9-00c04fc2c6d4"); pub const IID_IOplockStorage = &IID_IOplockStorage_Value; pub const IOplockStorage = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateStorageEx: fn( self: *const IOplockStorage, pwcsName: ?[*:0]const u16, grfMode: u32, stgfmt: u32, grfAttrs: u32, riid: ?*const Guid, ppstgOpen: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OpenStorageEx: fn( self: *const IOplockStorage, pwcsName: ?[*:0]const u16, grfMode: u32, stgfmt: u32, grfAttrs: u32, riid: ?*const Guid, ppstgOpen: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOplockStorage_CreateStorageEx(self: *const T, pwcsName: ?[*:0]const u16, grfMode: u32, stgfmt: u32, grfAttrs: u32, riid: ?*const Guid, ppstgOpen: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IOplockStorage.VTable, self.vtable).CreateStorageEx(@ptrCast(*const IOplockStorage, self), pwcsName, grfMode, stgfmt, grfAttrs, riid, ppstgOpen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOplockStorage_OpenStorageEx(self: *const T, pwcsName: ?[*:0]const u16, grfMode: u32, stgfmt: u32, grfAttrs: u32, riid: ?*const Guid, ppstgOpen: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IOplockStorage.VTable, self.vtable).OpenStorageEx(@ptrCast(*const IOplockStorage, self), pwcsName, grfMode, stgfmt, grfAttrs, riid, ppstgOpen); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IUrlMon_Value = @import("../zig.zig").Guid.initString("00000026-0000-0000-c000-000000000046"); pub const IID_IUrlMon = &IID_IUrlMon_Value; pub const IUrlMon = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AsyncGetClassBits: fn( self: *const IUrlMon, rclsid: ?*const Guid, pszTYPE: ?[*:0]const u16, pszExt: ?[*:0]const u16, dwFileVersionMS: u32, dwFileVersionLS: u32, pszCodeBase: ?[*:0]const u16, pbc: ?*IBindCtx, dwClassContext: u32, riid: ?*const Guid, flags: 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 IUrlMon_AsyncGetClassBits(self: *const T, rclsid: ?*const Guid, pszTYPE: ?[*:0]const u16, pszExt: ?[*:0]const u16, dwFileVersionMS: u32, dwFileVersionLS: u32, pszCodeBase: ?[*:0]const u16, pbc: ?*IBindCtx, dwClassContext: u32, riid: ?*const Guid, flags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IUrlMon.VTable, self.vtable).AsyncGetClassBits(@ptrCast(*const IUrlMon, self), rclsid, pszTYPE, pszExt, dwFileVersionMS, dwFileVersionLS, pszCodeBase, pbc, dwClassContext, riid, flags); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IForegroundTransfer_Value = @import("../zig.zig").Guid.initString("00000145-0000-0000-c000-000000000046"); pub const IID_IForegroundTransfer = &IID_IForegroundTransfer_Value; pub const IForegroundTransfer = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AllowForegroundTransfer: fn( self: *const IForegroundTransfer, lpvReserved: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IForegroundTransfer_AllowForegroundTransfer(self: *const T, lpvReserved: ?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IForegroundTransfer.VTable, self.vtable).AllowForegroundTransfer(@ptrCast(*const IForegroundTransfer, self), lpvReserved); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IThumbnailExtractor_Value = @import("../zig.zig").Guid.initString("969dc708-5c76-11d1-8d86-0000f804b057"); pub const IID_IThumbnailExtractor = &IID_IThumbnailExtractor_Value; pub const IThumbnailExtractor = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ExtractThumbnail: fn( self: *const IThumbnailExtractor, pStg: ?*IStorage, ulLength: u32, ulHeight: u32, pulOutputLength: ?*u32, pulOutputHeight: ?*u32, phOutputBitmap: ?*?HBITMAP, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnFileUpdated: fn( self: *const IThumbnailExtractor, pStg: ?*IStorage, ) 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 IThumbnailExtractor_ExtractThumbnail(self: *const T, pStg: ?*IStorage, ulLength: u32, ulHeight: u32, pulOutputLength: ?*u32, pulOutputHeight: ?*u32, phOutputBitmap: ?*?HBITMAP) callconv(.Inline) HRESULT { return @ptrCast(*const IThumbnailExtractor.VTable, self.vtable).ExtractThumbnail(@ptrCast(*const IThumbnailExtractor, self), pStg, ulLength, ulHeight, pulOutputLength, pulOutputHeight, phOutputBitmap); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IThumbnailExtractor_OnFileUpdated(self: *const T, pStg: ?*IStorage) callconv(.Inline) HRESULT { return @ptrCast(*const IThumbnailExtractor.VTable, self.vtable).OnFileUpdated(@ptrCast(*const IThumbnailExtractor, self), pStg); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDummyHICONIncluder_Value = @import("../zig.zig").Guid.initString("947990de-cc28-11d2-a0f7-00805f858fb1"); pub const IID_IDummyHICONIncluder = &IID_IDummyHICONIncluder_Value; pub const IDummyHICONIncluder = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Dummy: fn( self: *const IDummyHICONIncluder, h1: ?HICON, h2: ?HDC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDummyHICONIncluder_Dummy(self: *const T, h1: ?HICON, h2: ?HDC) callconv(.Inline) HRESULT { return @ptrCast(*const IDummyHICONIncluder.VTable, self.vtable).Dummy(@ptrCast(*const IDummyHICONIncluder, self), h1, h2); } };} pub usingnamespace MethodMixin(@This()); }; pub const ApplicationType = enum(i32) { ServerApplication = 0, LibraryApplication = 1, }; pub const ServerApplication = ApplicationType.ServerApplication; pub const LibraryApplication = ApplicationType.LibraryApplication; pub const ShutdownType = enum(i32) { IdleShutdown = 0, ForcedShutdown = 1, }; pub const IdleShutdown = ShutdownType.IdleShutdown; pub const ForcedShutdown = ShutdownType.ForcedShutdown; // TODO: this type is limited to platform 'windows5.0' const IID_IProcessLock_Value = @import("../zig.zig").Guid.initString("000001d5-0000-0000-c000-000000000046"); pub const IID_IProcessLock = &IID_IProcessLock_Value; pub const IProcessLock = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AddRefOnProcess: fn( self: *const IProcessLock, ) callconv(@import("std").os.windows.WINAPI) u32, ReleaseRefOnProcess: fn( self: *const IProcessLock, ) callconv(@import("std").os.windows.WINAPI) u32, }; 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 IProcessLock_AddRefOnProcess(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const IProcessLock.VTable, self.vtable).AddRefOnProcess(@ptrCast(*const IProcessLock, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IProcessLock_ReleaseRefOnProcess(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const IProcessLock.VTable, self.vtable).ReleaseRefOnProcess(@ptrCast(*const IProcessLock, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ISurrogateService_Value = @import("../zig.zig").Guid.initString("000001d4-0000-0000-c000-000000000046"); pub const IID_ISurrogateService = &IID_ISurrogateService_Value; pub const ISurrogateService = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Init: fn( self: *const ISurrogateService, rguidProcessID: ?*const Guid, pProcessLock: ?*IProcessLock, pfApplicationAware: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ApplicationLaunch: fn( self: *const ISurrogateService, rguidApplID: ?*const Guid, appType: ApplicationType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ApplicationFree: fn( self: *const ISurrogateService, rguidApplID: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CatalogRefresh: fn( self: *const ISurrogateService, ulReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ProcessShutdown: fn( self: *const ISurrogateService, shutdownType: ShutdownType, ) 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 ISurrogateService_Init(self: *const T, rguidProcessID: ?*const Guid, pProcessLock: ?*IProcessLock, pfApplicationAware: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ISurrogateService.VTable, self.vtable).Init(@ptrCast(*const ISurrogateService, self), rguidProcessID, pProcessLock, pfApplicationAware); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISurrogateService_ApplicationLaunch(self: *const T, rguidApplID: ?*const Guid, appType: ApplicationType) callconv(.Inline) HRESULT { return @ptrCast(*const ISurrogateService.VTable, self.vtable).ApplicationLaunch(@ptrCast(*const ISurrogateService, self), rguidApplID, appType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISurrogateService_ApplicationFree(self: *const T, rguidApplID: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const ISurrogateService.VTable, self.vtable).ApplicationFree(@ptrCast(*const ISurrogateService, self), rguidApplID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISurrogateService_CatalogRefresh(self: *const T, ulReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISurrogateService.VTable, self.vtable).CatalogRefresh(@ptrCast(*const ISurrogateService, self), ulReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISurrogateService_ProcessShutdown(self: *const T, shutdownType: ShutdownType) callconv(.Inline) HRESULT { return @ptrCast(*const ISurrogateService.VTable, self.vtable).ProcessShutdown(@ptrCast(*const ISurrogateService, self), shutdownType); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_IInitializeSpy_Value = @import("../zig.zig").Guid.initString("00000034-0000-0000-c000-000000000046"); pub const IID_IInitializeSpy = &IID_IInitializeSpy_Value; pub const IInitializeSpy = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, PreInitialize: fn( self: *const IInitializeSpy, dwCoInit: u32, dwCurThreadAptRefs: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PostInitialize: fn( self: *const IInitializeSpy, hrCoInit: HRESULT, dwCoInit: u32, dwNewThreadAptRefs: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PreUninitialize: fn( self: *const IInitializeSpy, dwCurThreadAptRefs: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PostUninitialize: fn( self: *const IInitializeSpy, dwNewThreadAptRefs: 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 IInitializeSpy_PreInitialize(self: *const T, dwCoInit: u32, dwCurThreadAptRefs: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInitializeSpy.VTable, self.vtable).PreInitialize(@ptrCast(*const IInitializeSpy, self), dwCoInit, dwCurThreadAptRefs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInitializeSpy_PostInitialize(self: *const T, hrCoInit: HRESULT, dwCoInit: u32, dwNewThreadAptRefs: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInitializeSpy.VTable, self.vtable).PostInitialize(@ptrCast(*const IInitializeSpy, self), hrCoInit, dwCoInit, dwNewThreadAptRefs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInitializeSpy_PreUninitialize(self: *const T, dwCurThreadAptRefs: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInitializeSpy.VTable, self.vtable).PreUninitialize(@ptrCast(*const IInitializeSpy, self), dwCurThreadAptRefs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInitializeSpy_PostUninitialize(self: *const T, dwNewThreadAptRefs: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInitializeSpy.VTable, self.vtable).PostUninitialize(@ptrCast(*const IInitializeSpy, self), dwNewThreadAptRefs); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleAdviseHolder_Value = @import("../zig.zig").Guid.initString("00000111-0000-0000-c000-000000000046"); pub const IID_IOleAdviseHolder = &IID_IOleAdviseHolder_Value; pub const IOleAdviseHolder = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Advise: fn( self: *const IOleAdviseHolder, pAdvise: ?*IAdviseSink, pdwConnection: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unadvise: fn( self: *const IOleAdviseHolder, dwConnection: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumAdvise: fn( self: *const IOleAdviseHolder, ppenumAdvise: ?*?*IEnumSTATDATA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendOnRename: fn( self: *const IOleAdviseHolder, pmk: ?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendOnSave: fn( self: *const IOleAdviseHolder, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendOnClose: fn( self: *const IOleAdviseHolder, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleAdviseHolder_Advise(self: *const T, pAdvise: ?*IAdviseSink, pdwConnection: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleAdviseHolder.VTable, self.vtable).Advise(@ptrCast(*const IOleAdviseHolder, self), pAdvise, pdwConnection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleAdviseHolder_Unadvise(self: *const T, dwConnection: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleAdviseHolder.VTable, self.vtable).Unadvise(@ptrCast(*const IOleAdviseHolder, self), dwConnection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleAdviseHolder_EnumAdvise(self: *const T, ppenumAdvise: ?*?*IEnumSTATDATA) callconv(.Inline) HRESULT { return @ptrCast(*const IOleAdviseHolder.VTable, self.vtable).EnumAdvise(@ptrCast(*const IOleAdviseHolder, self), ppenumAdvise); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleAdviseHolder_SendOnRename(self: *const T, pmk: ?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IOleAdviseHolder.VTable, self.vtable).SendOnRename(@ptrCast(*const IOleAdviseHolder, self), pmk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleAdviseHolder_SendOnSave(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleAdviseHolder.VTable, self.vtable).SendOnSave(@ptrCast(*const IOleAdviseHolder, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleAdviseHolder_SendOnClose(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleAdviseHolder.VTable, self.vtable).SendOnClose(@ptrCast(*const IOleAdviseHolder, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleCache_Value = @import("../zig.zig").Guid.initString("0000011e-0000-0000-c000-000000000046"); pub const IID_IOleCache = &IID_IOleCache_Value; pub const IOleCache = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Cache: fn( self: *const IOleCache, pformatetc: ?*FORMATETC, advf: u32, pdwConnection: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Uncache: fn( self: *const IOleCache, dwConnection: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumCache: fn( self: *const IOleCache, ppenumSTATDATA: ?*?*IEnumSTATDATA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InitCache: fn( self: *const IOleCache, pDataObject: ?*IDataObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetData: fn( self: *const IOleCache, pformatetc: ?*FORMATETC, pmedium: ?*STGMEDIUM, fRelease: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleCache_Cache(self: *const T, pformatetc: ?*FORMATETC, advf: u32, pdwConnection: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCache.VTable, self.vtable).Cache(@ptrCast(*const IOleCache, self), pformatetc, advf, pdwConnection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleCache_Uncache(self: *const T, dwConnection: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCache.VTable, self.vtable).Uncache(@ptrCast(*const IOleCache, self), dwConnection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleCache_EnumCache(self: *const T, ppenumSTATDATA: ?*?*IEnumSTATDATA) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCache.VTable, self.vtable).EnumCache(@ptrCast(*const IOleCache, self), ppenumSTATDATA); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleCache_InitCache(self: *const T, pDataObject: ?*IDataObject) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCache.VTable, self.vtable).InitCache(@ptrCast(*const IOleCache, self), pDataObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleCache_SetData(self: *const T, pformatetc: ?*FORMATETC, pmedium: ?*STGMEDIUM, fRelease: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCache.VTable, self.vtable).SetData(@ptrCast(*const IOleCache, self), pformatetc, pmedium, fRelease); } };} pub usingnamespace MethodMixin(@This()); }; pub const DISCARDCACHE = enum(i32) { SAVEIFDIRTY = 0, NOSAVE = 1, }; pub const DISCARDCACHE_SAVEIFDIRTY = DISCARDCACHE.SAVEIFDIRTY; pub const DISCARDCACHE_NOSAVE = DISCARDCACHE.NOSAVE; // TODO: this type is limited to platform 'windows5.0' const IID_IOleCache2_Value = @import("../zig.zig").Guid.initString("00000128-0000-0000-c000-000000000046"); pub const IID_IOleCache2 = &IID_IOleCache2_Value; pub const IOleCache2 = extern struct { pub const VTable = extern struct { base: IOleCache.VTable, UpdateCache: fn( self: *const IOleCache2, pDataObject: ?*IDataObject, grfUpdf: UPDFCACHE_FLAGS, pReserved: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DiscardCache: fn( self: *const IOleCache2, dwDiscardOptions: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleCache.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleCache2_UpdateCache(self: *const T, pDataObject: ?*IDataObject, grfUpdf: UPDFCACHE_FLAGS, pReserved: ?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCache2.VTable, self.vtable).UpdateCache(@ptrCast(*const IOleCache2, self), pDataObject, grfUpdf, pReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleCache2_DiscardCache(self: *const T, dwDiscardOptions: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCache2.VTable, self.vtable).DiscardCache(@ptrCast(*const IOleCache2, self), dwDiscardOptions); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleCacheControl_Value = @import("../zig.zig").Guid.initString("00000129-0000-0000-c000-000000000046"); pub const IID_IOleCacheControl = &IID_IOleCacheControl_Value; pub const IOleCacheControl = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnRun: fn( self: *const IOleCacheControl, pDataObject: ?*IDataObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnStop: fn( self: *const IOleCacheControl, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleCacheControl_OnRun(self: *const T, pDataObject: ?*IDataObject) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCacheControl.VTable, self.vtable).OnRun(@ptrCast(*const IOleCacheControl, self), pDataObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleCacheControl_OnStop(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCacheControl.VTable, self.vtable).OnStop(@ptrCast(*const IOleCacheControl, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IParseDisplayName_Value = @import("../zig.zig").Guid.initString("0000011a-0000-0000-c000-000000000046"); pub const IID_IParseDisplayName = &IID_IParseDisplayName_Value; pub const IParseDisplayName = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ParseDisplayName: fn( self: *const IParseDisplayName, pbc: ?*IBindCtx, pszDisplayName: ?PWSTR, pchEaten: ?*u32, ppmkOut: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IParseDisplayName_ParseDisplayName(self: *const T, pbc: ?*IBindCtx, pszDisplayName: ?PWSTR, pchEaten: ?*u32, ppmkOut: ?*?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IParseDisplayName.VTable, self.vtable).ParseDisplayName(@ptrCast(*const IParseDisplayName, self), pbc, pszDisplayName, pchEaten, ppmkOut); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleContainer_Value = @import("../zig.zig").Guid.initString("0000011b-0000-0000-c000-000000000046"); pub const IID_IOleContainer = &IID_IOleContainer_Value; pub const IOleContainer = extern struct { pub const VTable = extern struct { base: IParseDisplayName.VTable, EnumObjects: fn( self: *const IOleContainer, grfFlags: u32, ppenum: ?*?*IEnumUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, LockContainer: fn( self: *const IOleContainer, fLock: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IParseDisplayName.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleContainer_EnumObjects(self: *const T, grfFlags: u32, ppenum: ?*?*IEnumUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IOleContainer.VTable, self.vtable).EnumObjects(@ptrCast(*const IOleContainer, self), grfFlags, ppenum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleContainer_LockContainer(self: *const T, fLock: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleContainer.VTable, self.vtable).LockContainer(@ptrCast(*const IOleContainer, self), fLock); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleClientSite_Value = @import("../zig.zig").Guid.initString("00000118-0000-0000-c000-000000000046"); pub const IID_IOleClientSite = &IID_IOleClientSite_Value; pub const IOleClientSite = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SaveObject: fn( self: *const IOleClientSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMoniker: fn( self: *const IOleClientSite, dwAssign: u32, dwWhichMoniker: u32, ppmk: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetContainer: fn( self: *const IOleClientSite, ppContainer: ?*?*IOleContainer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ShowObject: fn( self: *const IOleClientSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnShowWindow: fn( self: *const IOleClientSite, fShow: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RequestNewObjectLayout: fn( self: *const IOleClientSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleClientSite_SaveObject(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleClientSite.VTable, self.vtable).SaveObject(@ptrCast(*const IOleClientSite, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleClientSite_GetMoniker(self: *const T, dwAssign: u32, dwWhichMoniker: u32, ppmk: ?*?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IOleClientSite.VTable, self.vtable).GetMoniker(@ptrCast(*const IOleClientSite, self), dwAssign, dwWhichMoniker, ppmk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleClientSite_GetContainer(self: *const T, ppContainer: ?*?*IOleContainer) callconv(.Inline) HRESULT { return @ptrCast(*const IOleClientSite.VTable, self.vtable).GetContainer(@ptrCast(*const IOleClientSite, self), ppContainer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleClientSite_ShowObject(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleClientSite.VTable, self.vtable).ShowObject(@ptrCast(*const IOleClientSite, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleClientSite_OnShowWindow(self: *const T, fShow: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleClientSite.VTable, self.vtable).OnShowWindow(@ptrCast(*const IOleClientSite, self), fShow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleClientSite_RequestNewObjectLayout(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleClientSite.VTable, self.vtable).RequestNewObjectLayout(@ptrCast(*const IOleClientSite, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const OLEGETMONIKER = enum(i32) { ONLYIFTHERE = 1, FORCEASSIGN = 2, UNASSIGN = 3, TEMPFORUSER = 4, }; pub const OLEGETMONIKER_ONLYIFTHERE = OLEGETMONIKER.ONLYIFTHERE; pub const OLEGETMONIKER_FORCEASSIGN = OLEGETMONIKER.FORCEASSIGN; pub const OLEGETMONIKER_UNASSIGN = OLEGETMONIKER.UNASSIGN; pub const OLEGETMONIKER_TEMPFORUSER = OLEGETMONIKER.TEMPFORUSER; pub const OLEWHICHMK = enum(i32) { CONTAINER = 1, OBJREL = 2, OBJFULL = 3, }; pub const OLEWHICHMK_CONTAINER = OLEWHICHMK.CONTAINER; pub const OLEWHICHMK_OBJREL = OLEWHICHMK.OBJREL; pub const OLEWHICHMK_OBJFULL = OLEWHICHMK.OBJFULL; pub const USERCLASSTYPE = enum(i32) { FULL = 1, SHORT = 2, APPNAME = 3, }; pub const USERCLASSTYPE_FULL = USERCLASSTYPE.FULL; pub const USERCLASSTYPE_SHORT = USERCLASSTYPE.SHORT; pub const USERCLASSTYPE_APPNAME = USERCLASSTYPE.APPNAME; pub const OLEMISC = enum(i32) { RECOMPOSEONRESIZE = 1, ONLYICONIC = 2, INSERTNOTREPLACE = 4, STATIC = 8, CANTLINKINSIDE = 16, CANLINKBYOLE1 = 32, ISLINKOBJECT = 64, INSIDEOUT = 128, ACTIVATEWHENVISIBLE = 256, RENDERINGISDEVICEINDEPENDENT = 512, INVISIBLEATRUNTIME = 1024, ALWAYSRUN = 2048, ACTSLIKEBUTTON = 4096, ACTSLIKELABEL = 8192, NOUIACTIVATE = 16384, ALIGNABLE = 32768, SIMPLEFRAME = 65536, SETCLIENTSITEFIRST = 131072, IMEMODE = 262144, IGNOREACTIVATEWHENVISIBLE = 524288, WANTSTOMENUMERGE = 1048576, SUPPORTSMULTILEVELUNDO = 2097152, }; // TODO: enum 'OLEMISC' has known issues with its value aliases pub const OLECLOSE = enum(i32) { SAVEIFDIRTY = 0, NOSAVE = 1, PROMPTSAVE = 2, }; pub const OLECLOSE_SAVEIFDIRTY = OLECLOSE.SAVEIFDIRTY; pub const OLECLOSE_NOSAVE = OLECLOSE.NOSAVE; pub const OLECLOSE_PROMPTSAVE = OLECLOSE.PROMPTSAVE; // TODO: this type is limited to platform 'windows5.0' const IID_IOleObject_Value = @import("../zig.zig").Guid.initString("00000112-0000-0000-c000-000000000046"); pub const IID_IOleObject = &IID_IOleObject_Value; pub const IOleObject = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetClientSite: fn( self: *const IOleObject, pClientSite: ?*IOleClientSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetClientSite: fn( self: *const IOleObject, ppClientSite: ?*?*IOleClientSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetHostNames: fn( self: *const IOleObject, szContainerApp: ?[*:0]const u16, szContainerObj: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Close: fn( self: *const IOleObject, dwSaveOption: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetMoniker: fn( self: *const IOleObject, dwWhichMoniker: u32, pmk: ?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMoniker: fn( self: *const IOleObject, dwAssign: u32, dwWhichMoniker: u32, ppmk: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InitFromData: fn( self: *const IOleObject, pDataObject: ?*IDataObject, fCreation: BOOL, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetClipboardData: fn( self: *const IOleObject, dwReserved: u32, ppDataObject: ?*?*IDataObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DoVerb: fn( self: *const IOleObject, iVerb: i32, lpmsg: ?*MSG, pActiveSite: ?*IOleClientSite, lindex: i32, hwndParent: ?HWND, lprcPosRect: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumVerbs: fn( self: *const IOleObject, ppEnumOleVerb: ?*?*IEnumOLEVERB, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Update: fn( self: *const IOleObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsUpToDate: fn( self: *const IOleObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUserClassID: fn( self: *const IOleObject, pClsid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUserType: fn( self: *const IOleObject, dwFormOfType: u32, pszUserType: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetExtent: fn( self: *const IOleObject, dwDrawAspect: u32, psizel: ?*SIZE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetExtent: fn( self: *const IOleObject, dwDrawAspect: u32, psizel: ?*SIZE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Advise: fn( self: *const IOleObject, pAdvSink: ?*IAdviseSink, pdwConnection: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unadvise: fn( self: *const IOleObject, dwConnection: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumAdvise: fn( self: *const IOleObject, ppenumAdvise: ?*?*IEnumSTATDATA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMiscStatus: fn( self: *const IOleObject, dwAspect: u32, pdwStatus: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetColorScheme: fn( self: *const IOleObject, pLogpal: ?*LOGPALETTE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_SetClientSite(self: *const T, pClientSite: ?*IOleClientSite) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).SetClientSite(@ptrCast(*const IOleObject, self), pClientSite); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_GetClientSite(self: *const T, ppClientSite: ?*?*IOleClientSite) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).GetClientSite(@ptrCast(*const IOleObject, self), ppClientSite); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_SetHostNames(self: *const T, szContainerApp: ?[*:0]const u16, szContainerObj: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).SetHostNames(@ptrCast(*const IOleObject, self), szContainerApp, szContainerObj); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_Close(self: *const T, dwSaveOption: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).Close(@ptrCast(*const IOleObject, self), dwSaveOption); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_SetMoniker(self: *const T, dwWhichMoniker: u32, pmk: ?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).SetMoniker(@ptrCast(*const IOleObject, self), dwWhichMoniker, pmk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_GetMoniker(self: *const T, dwAssign: u32, dwWhichMoniker: u32, ppmk: ?*?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).GetMoniker(@ptrCast(*const IOleObject, self), dwAssign, dwWhichMoniker, ppmk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_InitFromData(self: *const T, pDataObject: ?*IDataObject, fCreation: BOOL, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).InitFromData(@ptrCast(*const IOleObject, self), pDataObject, fCreation, dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_GetClipboardData(self: *const T, dwReserved: u32, ppDataObject: ?*?*IDataObject) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).GetClipboardData(@ptrCast(*const IOleObject, self), dwReserved, ppDataObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_DoVerb(self: *const T, iVerb: i32, lpmsg: ?*MSG, pActiveSite: ?*IOleClientSite, lindex: i32, hwndParent: ?HWND, lprcPosRect: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).DoVerb(@ptrCast(*const IOleObject, self), iVerb, lpmsg, pActiveSite, lindex, hwndParent, lprcPosRect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_EnumVerbs(self: *const T, ppEnumOleVerb: ?*?*IEnumOLEVERB) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).EnumVerbs(@ptrCast(*const IOleObject, self), ppEnumOleVerb); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_Update(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).Update(@ptrCast(*const IOleObject, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_IsUpToDate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).IsUpToDate(@ptrCast(*const IOleObject, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_GetUserClassID(self: *const T, pClsid: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).GetUserClassID(@ptrCast(*const IOleObject, self), pClsid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_GetUserType(self: *const T, dwFormOfType: u32, pszUserType: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).GetUserType(@ptrCast(*const IOleObject, self), dwFormOfType, pszUserType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_SetExtent(self: *const T, dwDrawAspect: u32, psizel: ?*SIZE) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).SetExtent(@ptrCast(*const IOleObject, self), dwDrawAspect, psizel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_GetExtent(self: *const T, dwDrawAspect: u32, psizel: ?*SIZE) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).GetExtent(@ptrCast(*const IOleObject, self), dwDrawAspect, psizel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_Advise(self: *const T, pAdvSink: ?*IAdviseSink, pdwConnection: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).Advise(@ptrCast(*const IOleObject, self), pAdvSink, pdwConnection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_Unadvise(self: *const T, dwConnection: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).Unadvise(@ptrCast(*const IOleObject, self), dwConnection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_EnumAdvise(self: *const T, ppenumAdvise: ?*?*IEnumSTATDATA) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).EnumAdvise(@ptrCast(*const IOleObject, self), ppenumAdvise); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_GetMiscStatus(self: *const T, dwAspect: u32, pdwStatus: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).GetMiscStatus(@ptrCast(*const IOleObject, self), dwAspect, pdwStatus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_SetColorScheme(self: *const T, pLogpal: ?*LOGPALETTE) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).SetColorScheme(@ptrCast(*const IOleObject, self), pLogpal); } };} pub usingnamespace MethodMixin(@This()); }; pub const OLERENDER = enum(i32) { NONE = 0, DRAW = 1, FORMAT = 2, ASIS = 3, }; pub const OLERENDER_NONE = OLERENDER.NONE; pub const OLERENDER_DRAW = OLERENDER.DRAW; pub const OLERENDER_FORMAT = OLERENDER.FORMAT; pub const OLERENDER_ASIS = OLERENDER.ASIS; pub const OBJECTDESCRIPTOR = extern struct { cbSize: u32, clsid: Guid, dwDrawAspect: u32, sizel: SIZE, pointl: POINTL, dwStatus: u32, dwFullUserTypeName: u32, dwSrcOfCopy: u32, }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleWindow_Value = @import("../zig.zig").Guid.initString("00000114-0000-0000-c000-000000000046"); pub const IID_IOleWindow = &IID_IOleWindow_Value; pub const IOleWindow = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetWindow: fn( self: *const IOleWindow, phwnd: ?*?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ContextSensitiveHelp: fn( self: *const IOleWindow, fEnterMode: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleWindow_GetWindow(self: *const T, phwnd: ?*?HWND) callconv(.Inline) HRESULT { return @ptrCast(*const IOleWindow.VTable, self.vtable).GetWindow(@ptrCast(*const IOleWindow, self), phwnd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleWindow_ContextSensitiveHelp(self: *const T, fEnterMode: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleWindow.VTable, self.vtable).ContextSensitiveHelp(@ptrCast(*const IOleWindow, self), fEnterMode); } };} pub usingnamespace MethodMixin(@This()); }; pub const OLEUPDATE = enum(i32) { ALWAYS = 1, ONCALL = 3, }; pub const OLEUPDATE_ALWAYS = OLEUPDATE.ALWAYS; pub const OLEUPDATE_ONCALL = OLEUPDATE.ONCALL; pub const OLELINKBIND = enum(i32) { F = 1, }; pub const OLELINKBIND_EVENIFCLASSDIFF = OLELINKBIND.F; // TODO: this type is limited to platform 'windows5.0' const IID_IOleLink_Value = @import("../zig.zig").Guid.initString("0000011d-0000-0000-c000-000000000046"); pub const IID_IOleLink = &IID_IOleLink_Value; pub const IOleLink = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetUpdateOptions: fn( self: *const IOleLink, dwUpdateOpt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUpdateOptions: fn( self: *const IOleLink, pdwUpdateOpt: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSourceMoniker: fn( self: *const IOleLink, pmk: ?*IMoniker, rclsid: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSourceMoniker: fn( self: *const IOleLink, ppmk: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSourceDisplayName: fn( self: *const IOleLink, pszStatusText: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSourceDisplayName: fn( self: *const IOleLink, ppszDisplayName: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BindToSource: fn( self: *const IOleLink, bindflags: u32, pbc: ?*IBindCtx, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BindIfRunning: fn( self: *const IOleLink, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBoundSource: fn( self: *const IOleLink, ppunk: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnbindSource: fn( self: *const IOleLink, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Update: fn( self: *const IOleLink, pbc: ?*IBindCtx, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_SetUpdateOptions(self: *const T, dwUpdateOpt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).SetUpdateOptions(@ptrCast(*const IOleLink, self), dwUpdateOpt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_GetUpdateOptions(self: *const T, pdwUpdateOpt: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).GetUpdateOptions(@ptrCast(*const IOleLink, self), pdwUpdateOpt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_SetSourceMoniker(self: *const T, pmk: ?*IMoniker, rclsid: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).SetSourceMoniker(@ptrCast(*const IOleLink, self), pmk, rclsid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_GetSourceMoniker(self: *const T, ppmk: ?*?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).GetSourceMoniker(@ptrCast(*const IOleLink, self), ppmk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_SetSourceDisplayName(self: *const T, pszStatusText: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).SetSourceDisplayName(@ptrCast(*const IOleLink, self), pszStatusText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_GetSourceDisplayName(self: *const T, ppszDisplayName: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).GetSourceDisplayName(@ptrCast(*const IOleLink, self), ppszDisplayName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_BindToSource(self: *const T, bindflags: u32, pbc: ?*IBindCtx) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).BindToSource(@ptrCast(*const IOleLink, self), bindflags, pbc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_BindIfRunning(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).BindIfRunning(@ptrCast(*const IOleLink, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_GetBoundSource(self: *const T, ppunk: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).GetBoundSource(@ptrCast(*const IOleLink, self), ppunk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_UnbindSource(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).UnbindSource(@ptrCast(*const IOleLink, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_Update(self: *const T, pbc: ?*IBindCtx) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).Update(@ptrCast(*const IOleLink, self), pbc); } };} pub usingnamespace MethodMixin(@This()); }; pub const BINDSPEED = enum(i32) { INDEFINITE = 1, MODERATE = 2, IMMEDIATE = 3, }; pub const BINDSPEED_INDEFINITE = BINDSPEED.INDEFINITE; pub const BINDSPEED_MODERATE = BINDSPEED.MODERATE; pub const BINDSPEED_IMMEDIATE = BINDSPEED.IMMEDIATE; pub const OLECONTF = enum(i32) { EMBEDDINGS = 1, LINKS = 2, OTHERS = 4, ONLYUSER = 8, ONLYIFRUNNING = 16, }; pub const OLECONTF_EMBEDDINGS = OLECONTF.EMBEDDINGS; pub const OLECONTF_LINKS = OLECONTF.LINKS; pub const OLECONTF_OTHERS = OLECONTF.OTHERS; pub const OLECONTF_ONLYUSER = OLECONTF.ONLYUSER; pub const OLECONTF_ONLYIFRUNNING = OLECONTF.ONLYIFRUNNING; // TODO: this type is limited to platform 'windows5.0' const IID_IOleItemContainer_Value = @import("../zig.zig").Guid.initString("0000011c-0000-0000-c000-000000000046"); pub const IID_IOleItemContainer = &IID_IOleItemContainer_Value; pub const IOleItemContainer = extern struct { pub const VTable = extern struct { base: IOleContainer.VTable, GetObject: fn( self: *const IOleItemContainer, pszItem: ?PWSTR, dwSpeedNeeded: u32, pbc: ?*IBindCtx, riid: ?*const Guid, ppvObject: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetObjectStorage: fn( self: *const IOleItemContainer, pszItem: ?PWSTR, pbc: ?*IBindCtx, riid: ?*const Guid, ppvStorage: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsRunning: fn( self: *const IOleItemContainer, pszItem: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleContainer.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleItemContainer_GetObject(self: *const T, pszItem: ?PWSTR, dwSpeedNeeded: u32, pbc: ?*IBindCtx, riid: ?*const Guid, ppvObject: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IOleItemContainer.VTable, self.vtable).GetObject(@ptrCast(*const IOleItemContainer, self), pszItem, dwSpeedNeeded, pbc, riid, ppvObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleItemContainer_GetObjectStorage(self: *const T, pszItem: ?PWSTR, pbc: ?*IBindCtx, riid: ?*const Guid, ppvStorage: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IOleItemContainer.VTable, self.vtable).GetObjectStorage(@ptrCast(*const IOleItemContainer, self), pszItem, pbc, riid, ppvStorage); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleItemContainer_IsRunning(self: *const T, pszItem: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOleItemContainer.VTable, self.vtable).IsRunning(@ptrCast(*const IOleItemContainer, self), pszItem); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleInPlaceUIWindow_Value = @import("../zig.zig").Guid.initString("00000115-0000-0000-c000-000000000046"); pub const IID_IOleInPlaceUIWindow = &IID_IOleInPlaceUIWindow_Value; pub const IOleInPlaceUIWindow = extern struct { pub const VTable = extern struct { base: IOleWindow.VTable, GetBorder: fn( self: *const IOleInPlaceUIWindow, lprectBorder: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RequestBorderSpace: fn( self: *const IOleInPlaceUIWindow, pborderwidths: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetBorderSpace: fn( self: *const IOleInPlaceUIWindow, pborderwidths: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetActiveObject: fn( self: *const IOleInPlaceUIWindow, pActiveObject: ?*IOleInPlaceActiveObject, pszObjName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleWindow.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceUIWindow_GetBorder(self: *const T, lprectBorder: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceUIWindow.VTable, self.vtable).GetBorder(@ptrCast(*const IOleInPlaceUIWindow, self), lprectBorder); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceUIWindow_RequestBorderSpace(self: *const T, pborderwidths: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceUIWindow.VTable, self.vtable).RequestBorderSpace(@ptrCast(*const IOleInPlaceUIWindow, self), pborderwidths); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceUIWindow_SetBorderSpace(self: *const T, pborderwidths: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceUIWindow.VTable, self.vtable).SetBorderSpace(@ptrCast(*const IOleInPlaceUIWindow, self), pborderwidths); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceUIWindow_SetActiveObject(self: *const T, pActiveObject: ?*IOleInPlaceActiveObject, pszObjName: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceUIWindow.VTable, self.vtable).SetActiveObject(@ptrCast(*const IOleInPlaceUIWindow, self), pActiveObject, pszObjName); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleInPlaceActiveObject_Value = @import("../zig.zig").Guid.initString("00000117-0000-0000-c000-000000000046"); pub const IID_IOleInPlaceActiveObject = &IID_IOleInPlaceActiveObject_Value; pub const IOleInPlaceActiveObject = extern struct { pub const VTable = extern struct { base: IOleWindow.VTable, TranslateAccelerator: fn( self: *const IOleInPlaceActiveObject, lpmsg: ?*MSG, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnFrameWindowActivate: fn( self: *const IOleInPlaceActiveObject, fActivate: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnDocWindowActivate: fn( self: *const IOleInPlaceActiveObject, fActivate: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ResizeBorder: fn( self: *const IOleInPlaceActiveObject, prcBorder: ?*RECT, pUIWindow: ?*IOleInPlaceUIWindow, fFrameWindow: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnableModeless: fn( self: *const IOleInPlaceActiveObject, fEnable: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleWindow.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceActiveObject_TranslateAccelerator(self: *const T, lpmsg: ?*MSG) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceActiveObject.VTable, self.vtable).TranslateAccelerator(@ptrCast(*const IOleInPlaceActiveObject, self), lpmsg); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceActiveObject_OnFrameWindowActivate(self: *const T, fActivate: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceActiveObject.VTable, self.vtable).OnFrameWindowActivate(@ptrCast(*const IOleInPlaceActiveObject, self), fActivate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceActiveObject_OnDocWindowActivate(self: *const T, fActivate: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceActiveObject.VTable, self.vtable).OnDocWindowActivate(@ptrCast(*const IOleInPlaceActiveObject, self), fActivate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceActiveObject_ResizeBorder(self: *const T, prcBorder: ?*RECT, pUIWindow: ?*IOleInPlaceUIWindow, fFrameWindow: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceActiveObject.VTable, self.vtable).ResizeBorder(@ptrCast(*const IOleInPlaceActiveObject, self), prcBorder, pUIWindow, fFrameWindow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceActiveObject_EnableModeless(self: *const T, fEnable: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceActiveObject.VTable, self.vtable).EnableModeless(@ptrCast(*const IOleInPlaceActiveObject, self), fEnable); } };} pub usingnamespace MethodMixin(@This()); }; pub const OIFI = extern struct { cb: u32, fMDIApp: BOOL, hwndFrame: ?HWND, haccel: ?HACCEL, cAccelEntries: u32, }; pub const OleMenuGroupWidths = extern struct { width: [6]i32, }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleInPlaceFrame_Value = @import("../zig.zig").Guid.initString("00000116-0000-0000-c000-000000000046"); pub const IID_IOleInPlaceFrame = &IID_IOleInPlaceFrame_Value; pub const IOleInPlaceFrame = extern struct { pub const VTable = extern struct { base: IOleInPlaceUIWindow.VTable, InsertMenus: fn( self: *const IOleInPlaceFrame, hmenuShared: ?HMENU, lpMenuWidths: ?*OleMenuGroupWidths, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetMenu: fn( self: *const IOleInPlaceFrame, hmenuShared: ?HMENU, holemenu: isize, hwndActiveObject: ?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveMenus: fn( self: *const IOleInPlaceFrame, hmenuShared: ?HMENU, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetStatusText: fn( self: *const IOleInPlaceFrame, pszStatusText: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnableModeless: fn( self: *const IOleInPlaceFrame, fEnable: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TranslateAccelerator: fn( self: *const IOleInPlaceFrame, lpmsg: ?*MSG, wID: u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleInPlaceUIWindow.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceFrame_InsertMenus(self: *const T, hmenuShared: ?HMENU, lpMenuWidths: ?*OleMenuGroupWidths) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceFrame.VTable, self.vtable).InsertMenus(@ptrCast(*const IOleInPlaceFrame, self), hmenuShared, lpMenuWidths); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceFrame_SetMenu(self: *const T, hmenuShared: ?HMENU, holemenu: isize, hwndActiveObject: ?HWND) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceFrame.VTable, self.vtable).SetMenu(@ptrCast(*const IOleInPlaceFrame, self), hmenuShared, holemenu, hwndActiveObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceFrame_RemoveMenus(self: *const T, hmenuShared: ?HMENU) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceFrame.VTable, self.vtable).RemoveMenus(@ptrCast(*const IOleInPlaceFrame, self), hmenuShared); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceFrame_SetStatusText(self: *const T, pszStatusText: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceFrame.VTable, self.vtable).SetStatusText(@ptrCast(*const IOleInPlaceFrame, self), pszStatusText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceFrame_EnableModeless(self: *const T, fEnable: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceFrame.VTable, self.vtable).EnableModeless(@ptrCast(*const IOleInPlaceFrame, self), fEnable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceFrame_TranslateAccelerator(self: *const T, lpmsg: ?*MSG, wID: u16) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceFrame.VTable, self.vtable).TranslateAccelerator(@ptrCast(*const IOleInPlaceFrame, self), lpmsg, wID); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleInPlaceObject_Value = @import("../zig.zig").Guid.initString("00000113-0000-0000-c000-000000000046"); pub const IID_IOleInPlaceObject = &IID_IOleInPlaceObject_Value; pub const IOleInPlaceObject = extern struct { pub const VTable = extern struct { base: IOleWindow.VTable, InPlaceDeactivate: fn( self: *const IOleInPlaceObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UIDeactivate: fn( self: *const IOleInPlaceObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetObjectRects: fn( self: *const IOleInPlaceObject, lprcPosRect: ?*RECT, lprcClipRect: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReactivateAndUndo: fn( self: *const IOleInPlaceObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleWindow.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceObject_InPlaceDeactivate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceObject.VTable, self.vtable).InPlaceDeactivate(@ptrCast(*const IOleInPlaceObject, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceObject_UIDeactivate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceObject.VTable, self.vtable).UIDeactivate(@ptrCast(*const IOleInPlaceObject, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceObject_SetObjectRects(self: *const T, lprcPosRect: ?*RECT, lprcClipRect: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceObject.VTable, self.vtable).SetObjectRects(@ptrCast(*const IOleInPlaceObject, self), lprcPosRect, lprcClipRect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceObject_ReactivateAndUndo(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceObject.VTable, self.vtable).ReactivateAndUndo(@ptrCast(*const IOleInPlaceObject, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleInPlaceSite_Value = @import("../zig.zig").Guid.initString("00000119-0000-0000-c000-000000000046"); pub const IID_IOleInPlaceSite = &IID_IOleInPlaceSite_Value; pub const IOleInPlaceSite = extern struct { pub const VTable = extern struct { base: IOleWindow.VTable, CanInPlaceActivate: fn( self: *const IOleInPlaceSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnInPlaceActivate: fn( self: *const IOleInPlaceSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnUIActivate: fn( self: *const IOleInPlaceSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetWindowContext: fn( self: *const IOleInPlaceSite, ppFrame: ?*?*IOleInPlaceFrame, ppDoc: ?*?*IOleInPlaceUIWindow, lprcPosRect: ?*RECT, lprcClipRect: ?*RECT, lpFrameInfo: ?*OIFI, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Scroll: fn( self: *const IOleInPlaceSite, scrollExtant: SIZE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnUIDeactivate: fn( self: *const IOleInPlaceSite, fUndoable: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnInPlaceDeactivate: fn( self: *const IOleInPlaceSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DiscardUndoState: fn( self: *const IOleInPlaceSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeactivateAndUndo: fn( self: *const IOleInPlaceSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnPosRectChange: fn( self: *const IOleInPlaceSite, lprcPosRect: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleWindow.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_CanInPlaceActivate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).CanInPlaceActivate(@ptrCast(*const IOleInPlaceSite, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_OnInPlaceActivate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).OnInPlaceActivate(@ptrCast(*const IOleInPlaceSite, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_OnUIActivate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).OnUIActivate(@ptrCast(*const IOleInPlaceSite, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_GetWindowContext(self: *const T, ppFrame: ?*?*IOleInPlaceFrame, ppDoc: ?*?*IOleInPlaceUIWindow, lprcPosRect: ?*RECT, lprcClipRect: ?*RECT, lpFrameInfo: ?*OIFI) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).GetWindowContext(@ptrCast(*const IOleInPlaceSite, self), ppFrame, ppDoc, lprcPosRect, lprcClipRect, lpFrameInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_Scroll(self: *const T, scrollExtant: SIZE) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).Scroll(@ptrCast(*const IOleInPlaceSite, self), scrollExtant); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_OnUIDeactivate(self: *const T, fUndoable: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).OnUIDeactivate(@ptrCast(*const IOleInPlaceSite, self), fUndoable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_OnInPlaceDeactivate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).OnInPlaceDeactivate(@ptrCast(*const IOleInPlaceSite, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_DiscardUndoState(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).DiscardUndoState(@ptrCast(*const IOleInPlaceSite, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_DeactivateAndUndo(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).DeactivateAndUndo(@ptrCast(*const IOleInPlaceSite, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_OnPosRectChange(self: *const T, lprcPosRect: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).OnPosRectChange(@ptrCast(*const IOleInPlaceSite, self), lprcPosRect); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IContinue_Value = @import("../zig.zig").Guid.initString("0000012a-0000-0000-c000-000000000046"); pub const IID_IContinue = &IID_IContinue_Value; pub const IContinue = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, FContinue: fn( self: *const IContinue, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IContinue_FContinue(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IContinue.VTable, self.vtable).FContinue(@ptrCast(*const IContinue, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IViewObject_Value = @import("../zig.zig").Guid.initString("0000010d-0000-0000-c000-000000000046"); pub const IID_IViewObject = &IID_IViewObject_Value; pub const IViewObject = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Draw: fn( self: *const IViewObject, dwDrawAspect: u32, lindex: i32, pvAspect: ?*c_void, ptd: ?*DVTARGETDEVICE, hdcTargetDev: ?HDC, hdcDraw: ?HDC, lprcBounds: ?*RECTL, lprcWBounds: ?*RECTL, pfnContinue: isize, dwContinue: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetColorSet: fn( self: *const IViewObject, dwDrawAspect: u32, lindex: i32, pvAspect: ?*c_void, ptd: ?*DVTARGETDEVICE, hicTargetDev: ?HDC, ppColorSet: ?*?*LOGPALETTE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Freeze: fn( self: *const IViewObject, dwDrawAspect: u32, lindex: i32, pvAspect: ?*c_void, pdwFreeze: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unfreeze: fn( self: *const IViewObject, dwFreeze: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetAdvise: fn( self: *const IViewObject, aspects: u32, advf: u32, pAdvSink: ?*IAdviseSink, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAdvise: fn( self: *const IViewObject, pAspects: ?*u32, pAdvf: ?*u32, ppAdvSink: ?*?*IAdviseSink, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObject_Draw(self: *const T, dwDrawAspect: u32, lindex: i32, pvAspect: ?*c_void, ptd: ?*DVTARGETDEVICE, hdcTargetDev: ?HDC, hdcDraw: ?HDC, lprcBounds: ?*RECTL, lprcWBounds: ?*RECTL, pfnContinue: isize, dwContinue: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObject.VTable, self.vtable).Draw(@ptrCast(*const IViewObject, self), dwDrawAspect, lindex, pvAspect, ptd, hdcTargetDev, hdcDraw, lprcBounds, lprcWBounds, pfnContinue, dwContinue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObject_GetColorSet(self: *const T, dwDrawAspect: u32, lindex: i32, pvAspect: ?*c_void, ptd: ?*DVTARGETDEVICE, hicTargetDev: ?HDC, ppColorSet: ?*?*LOGPALETTE) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObject.VTable, self.vtable).GetColorSet(@ptrCast(*const IViewObject, self), dwDrawAspect, lindex, pvAspect, ptd, hicTargetDev, ppColorSet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObject_Freeze(self: *const T, dwDrawAspect: u32, lindex: i32, pvAspect: ?*c_void, pdwFreeze: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObject.VTable, self.vtable).Freeze(@ptrCast(*const IViewObject, self), dwDrawAspect, lindex, pvAspect, pdwFreeze); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObject_Unfreeze(self: *const T, dwFreeze: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObject.VTable, self.vtable).Unfreeze(@ptrCast(*const IViewObject, self), dwFreeze); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObject_SetAdvise(self: *const T, aspects: u32, advf: u32, pAdvSink: ?*IAdviseSink) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObject.VTable, self.vtable).SetAdvise(@ptrCast(*const IViewObject, self), aspects, advf, pAdvSink); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObject_GetAdvise(self: *const T, pAspects: ?*u32, pAdvf: ?*u32, ppAdvSink: ?*?*IAdviseSink) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObject.VTable, self.vtable).GetAdvise(@ptrCast(*const IViewObject, self), pAspects, pAdvf, ppAdvSink); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IViewObject2_Value = @import("../zig.zig").Guid.initString("00000127-0000-0000-c000-000000000046"); pub const IID_IViewObject2 = &IID_IViewObject2_Value; pub const IViewObject2 = extern struct { pub const VTable = extern struct { base: IViewObject.VTable, GetExtent: fn( self: *const IViewObject2, dwDrawAspect: u32, lindex: i32, ptd: ?*DVTARGETDEVICE, lpsizel: ?*SIZE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IViewObject.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObject2_GetExtent(self: *const T, dwDrawAspect: u32, lindex: i32, ptd: ?*DVTARGETDEVICE, lpsizel: ?*SIZE) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObject2.VTable, self.vtable).GetExtent(@ptrCast(*const IViewObject2, self), dwDrawAspect, lindex, ptd, lpsizel); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IDropSource_Value = @import("../zig.zig").Guid.initString("00000121-0000-0000-c000-000000000046"); pub const IID_IDropSource = &IID_IDropSource_Value; pub const IDropSource = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, QueryContinueDrag: fn( self: *const IDropSource, fEscapePressed: BOOL, grfKeyState: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GiveFeedback: fn( self: *const IDropSource, dwEffect: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDropSource_QueryContinueDrag(self: *const T, fEscapePressed: BOOL, grfKeyState: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDropSource.VTable, self.vtable).QueryContinueDrag(@ptrCast(*const IDropSource, self), fEscapePressed, grfKeyState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDropSource_GiveFeedback(self: *const T, dwEffect: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDropSource.VTable, self.vtable).GiveFeedback(@ptrCast(*const IDropSource, self), dwEffect); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IDropTarget_Value = @import("../zig.zig").Guid.initString("00000122-0000-0000-c000-000000000046"); pub const IID_IDropTarget = &IID_IDropTarget_Value; pub const IDropTarget = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, DragEnter: fn( self: *const IDropTarget, pDataObj: ?*IDataObject, grfKeyState: u32, pt: POINTL, pdwEffect: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DragOver: fn( self: *const IDropTarget, grfKeyState: u32, pt: POINTL, pdwEffect: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DragLeave: fn( self: *const IDropTarget, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Drop: fn( self: *const IDropTarget, pDataObj: ?*IDataObject, grfKeyState: u32, pt: POINTL, pdwEffect: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDropTarget_DragEnter(self: *const T, pDataObj: ?*IDataObject, grfKeyState: u32, pt: POINTL, pdwEffect: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDropTarget.VTable, self.vtable).DragEnter(@ptrCast(*const IDropTarget, self), pDataObj, grfKeyState, pt, pdwEffect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDropTarget_DragOver(self: *const T, grfKeyState: u32, pt: POINTL, pdwEffect: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDropTarget.VTable, self.vtable).DragOver(@ptrCast(*const IDropTarget, self), grfKeyState, pt, pdwEffect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDropTarget_DragLeave(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDropTarget.VTable, self.vtable).DragLeave(@ptrCast(*const IDropTarget, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDropTarget_Drop(self: *const T, pDataObj: ?*IDataObject, grfKeyState: u32, pt: POINTL, pdwEffect: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDropTarget.VTable, self.vtable).Drop(@ptrCast(*const IDropTarget, self), pDataObj, grfKeyState, pt, pdwEffect); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IDropSourceNotify_Value = @import("../zig.zig").Guid.initString("0000012b-0000-0000-c000-000000000046"); pub const IID_IDropSourceNotify = &IID_IDropSourceNotify_Value; pub const IDropSourceNotify = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, DragEnterTarget: fn( self: *const IDropSourceNotify, hwndTarget: ?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DragLeaveTarget: fn( self: *const IDropSourceNotify, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDropSourceNotify_DragEnterTarget(self: *const T, hwndTarget: ?HWND) callconv(.Inline) HRESULT { return @ptrCast(*const IDropSourceNotify.VTable, self.vtable).DragEnterTarget(@ptrCast(*const IDropSourceNotify, self), hwndTarget); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDropSourceNotify_DragLeaveTarget(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDropSourceNotify.VTable, self.vtable).DragLeaveTarget(@ptrCast(*const IDropSourceNotify, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.10240' const IID_IEnterpriseDropTarget_Value = @import("../zig.zig").Guid.initString("390e3878-fd55-4e18-819d-4682081c0cfd"); pub const IID_IEnterpriseDropTarget = &IID_IEnterpriseDropTarget_Value; pub const IEnterpriseDropTarget = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetDropSourceEnterpriseId: fn( self: *const IEnterpriseDropTarget, identity: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsEvaluatingEdpPolicy: fn( self: *const IEnterpriseDropTarget, value: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnterpriseDropTarget_SetDropSourceEnterpriseId(self: *const T, identity: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IEnterpriseDropTarget.VTable, self.vtable).SetDropSourceEnterpriseId(@ptrCast(*const IEnterpriseDropTarget, self), identity); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnterpriseDropTarget_IsEvaluatingEdpPolicy(self: *const T, value: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IEnterpriseDropTarget.VTable, self.vtable).IsEvaluatingEdpPolicy(@ptrCast(*const IEnterpriseDropTarget, self), value); } };} pub usingnamespace MethodMixin(@This()); }; pub const OLEVERB = extern struct { lVerb: i32, lpszVerbName: ?PWSTR, fuFlags: u32, grfAttribs: u32, }; pub const OLEVERBATTRIB = enum(i32) { NEVERDIRTIES = 1, ONCONTAINERMENU = 2, }; pub const OLEVERBATTRIB_NEVERDIRTIES = OLEVERBATTRIB.NEVERDIRTIES; pub const OLEVERBATTRIB_ONCONTAINERMENU = OLEVERBATTRIB.ONCONTAINERMENU; // TODO: this type is limited to platform 'windows5.0' const IID_IEnumOLEVERB_Value = @import("../zig.zig").Guid.initString("00000104-0000-0000-c000-000000000046"); pub const IID_IEnumOLEVERB = &IID_IEnumOLEVERB_Value; pub const IEnumOLEVERB = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumOLEVERB, celt: u32, rgelt: [*]OLEVERB, pceltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumOLEVERB, celt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumOLEVERB, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumOLEVERB, ppenum: ?*?*IEnumOLEVERB, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOLEVERB_Next(self: *const T, celt: u32, rgelt: [*]OLEVERB, pceltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOLEVERB.VTable, self.vtable).Next(@ptrCast(*const IEnumOLEVERB, self), celt, rgelt, pceltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOLEVERB_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOLEVERB.VTable, self.vtable).Skip(@ptrCast(*const IEnumOLEVERB, self), celt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOLEVERB_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOLEVERB.VTable, self.vtable).Reset(@ptrCast(*const IEnumOLEVERB, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOLEVERB_Clone(self: *const T, ppenum: ?*?*IEnumOLEVERB) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOLEVERB.VTable, self.vtable).Clone(@ptrCast(*const IEnumOLEVERB, self), ppenum); } };} pub usingnamespace MethodMixin(@This()); }; pub const IEObjectType = enum(i32) { EVENT = 0, MUTEX = 1, SEMAPHORE = 2, SHARED_MEMORY = 3, WAITABLE_TIMER = 4, FILE = 5, NAMED_PIPE = 6, REGISTRY = 7, }; pub const IE_EPM_OBJECT_EVENT = IEObjectType.EVENT; pub const IE_EPM_OBJECT_MUTEX = IEObjectType.MUTEX; pub const IE_EPM_OBJECT_SEMAPHORE = IEObjectType.SEMAPHORE; pub const IE_EPM_OBJECT_SHARED_MEMORY = IEObjectType.SHARED_MEMORY; pub const IE_EPM_OBJECT_WAITABLE_TIMER = IEObjectType.WAITABLE_TIMER; pub const IE_EPM_OBJECT_FILE = IEObjectType.FILE; pub const IE_EPM_OBJECT_NAMED_PIPE = IEObjectType.NAMED_PIPE; pub const IE_EPM_OBJECT_REGISTRY = IEObjectType.REGISTRY; const IID_IPersistMoniker_Value = @import("../zig.zig").Guid.initString("79eac9c9-baf9-11ce-8c82-00aa004ba90b"); pub const IID_IPersistMoniker = &IID_IPersistMoniker_Value; pub const IPersistMoniker = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetClassID: fn( self: *const IPersistMoniker, pClassID: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsDirty: fn( self: *const IPersistMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Load: fn( self: *const IPersistMoniker, fFullyAvailable: BOOL, pimkName: ?*IMoniker, pibc: ?*IBindCtx, grfMode: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Save: fn( self: *const IPersistMoniker, pimkName: ?*IMoniker, pbc: ?*IBindCtx, fRemember: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SaveCompleted: fn( self: *const IPersistMoniker, pimkName: ?*IMoniker, pibc: ?*IBindCtx, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCurMoniker: fn( self: *const IPersistMoniker, ppimkName: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistMoniker_GetClassID(self: *const T, pClassID: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistMoniker.VTable, self.vtable).GetClassID(@ptrCast(*const IPersistMoniker, self), pClassID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistMoniker_IsDirty(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistMoniker.VTable, self.vtable).IsDirty(@ptrCast(*const IPersistMoniker, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistMoniker_Load(self: *const T, fFullyAvailable: BOOL, pimkName: ?*IMoniker, pibc: ?*IBindCtx, grfMode: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistMoniker.VTable, self.vtable).Load(@ptrCast(*const IPersistMoniker, self), fFullyAvailable, pimkName, pibc, grfMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistMoniker_Save(self: *const T, pimkName: ?*IMoniker, pbc: ?*IBindCtx, fRemember: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistMoniker.VTable, self.vtable).Save(@ptrCast(*const IPersistMoniker, self), pimkName, pbc, fRemember); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistMoniker_SaveCompleted(self: *const T, pimkName: ?*IMoniker, pibc: ?*IBindCtx) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistMoniker.VTable, self.vtable).SaveCompleted(@ptrCast(*const IPersistMoniker, self), pimkName, pibc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistMoniker_GetCurMoniker(self: *const T, ppimkName: ?*?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistMoniker.VTable, self.vtable).GetCurMoniker(@ptrCast(*const IPersistMoniker, self), ppimkName); } };} pub usingnamespace MethodMixin(@This()); }; pub const MONIKERPROPERTY = enum(i32) { MIMETYPEPROP = 0, USE_SRC_URL = 1, CLASSIDPROP = 2, TRUSTEDDOWNLOADPROP = 3, POPUPLEVELPROP = 4, }; pub const MIMETYPEPROP = MONIKERPROPERTY.MIMETYPEPROP; pub const USE_SRC_URL = MONIKERPROPERTY.USE_SRC_URL; pub const CLASSIDPROP = MONIKERPROPERTY.CLASSIDPROP; pub const TRUSTEDDOWNLOADPROP = MONIKERPROPERTY.TRUSTEDDOWNLOADPROP; pub const POPUPLEVELPROP = MONIKERPROPERTY.POPUPLEVELPROP; const IID_IMonikerProp_Value = @import("../zig.zig").Guid.initString("a5ca5f7f-1847-4d87-9c5b-918509f7511d"); pub const IID_IMonikerProp = &IID_IMonikerProp_Value; pub const IMonikerProp = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, PutProperty: fn( self: *const IMonikerProp, mkp: MONIKERPROPERTY, val: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMonikerProp_PutProperty(self: *const T, mkp: MONIKERPROPERTY, val: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IMonikerProp.VTable, self.vtable).PutProperty(@ptrCast(*const IMonikerProp, self), mkp, val); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IBindProtocol_Value = @import("../zig.zig").Guid.initString("79eac9cd-baf9-11ce-8c82-00aa004ba90b"); pub const IID_IBindProtocol = &IID_IBindProtocol_Value; pub const IBindProtocol = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateBinding: fn( self: *const IBindProtocol, szUrl: ?[*:0]const u16, pbc: ?*IBindCtx, ppb: ?*?*IBinding, ) 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 IBindProtocol_CreateBinding(self: *const T, szUrl: ?[*:0]const u16, pbc: ?*IBindCtx, ppb: ?*?*IBinding) callconv(.Inline) HRESULT { return @ptrCast(*const IBindProtocol.VTable, self.vtable).CreateBinding(@ptrCast(*const IBindProtocol, self), szUrl, pbc, ppb); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IBinding_Value = @import("../zig.zig").Guid.initString("79eac9c0-baf9-11ce-8c82-00aa004ba90b"); pub const IID_IBinding = &IID_IBinding_Value; pub const IBinding = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Abort: fn( self: *const IBinding, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Suspend: fn( self: *const IBinding, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Resume: fn( self: *const IBinding, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetPriority: fn( self: *const IBinding, nPriority: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPriority: fn( self: *const IBinding, pnPriority: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBindResult: fn( self: *const IBinding, pclsidProtocol: ?*Guid, pdwResult: ?*u32, pszResult: ?*?PWSTR, pdwReserved: ?*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 IBinding_Abort(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IBinding.VTable, self.vtable).Abort(@ptrCast(*const IBinding, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBinding_Suspend(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IBinding.VTable, self.vtable).Suspend(@ptrCast(*const IBinding, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBinding_Resume(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IBinding.VTable, self.vtable).Resume(@ptrCast(*const IBinding, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBinding_SetPriority(self: *const T, nPriority: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IBinding.VTable, self.vtable).SetPriority(@ptrCast(*const IBinding, self), nPriority); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBinding_GetPriority(self: *const T, pnPriority: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IBinding.VTable, self.vtable).GetPriority(@ptrCast(*const IBinding, self), pnPriority); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBinding_GetBindResult(self: *const T, pclsidProtocol: ?*Guid, pdwResult: ?*u32, pszResult: ?*?PWSTR, pdwReserved: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IBinding.VTable, self.vtable).GetBindResult(@ptrCast(*const IBinding, self), pclsidProtocol, pdwResult, pszResult, pdwReserved); } };} pub usingnamespace MethodMixin(@This()); }; pub const BINDVERB = enum(i32) { GET = 0, POST = 1, PUT = 2, CUSTOM = 3, RESERVED1 = 4, }; pub const BINDVERB_GET = BINDVERB.GET; pub const BINDVERB_POST = BINDVERB.POST; pub const BINDVERB_PUT = BINDVERB.PUT; pub const BINDVERB_CUSTOM = BINDVERB.CUSTOM; pub const BINDVERB_RESERVED1 = BINDVERB.RESERVED1; pub const BINDINFOF = enum(i32) { STGMEDDATA = 1, DEXTRAINFO = 2, }; pub const BINDINFOF_URLENCODESTGMEDDATA = BINDINFOF.STGMEDDATA; pub const BINDINFOF_URLENCODEDEXTRAINFO = BINDINFOF.DEXTRAINFO; pub const BINDF = enum(i32) { ASYNCHRONOUS = 1, ASYNCSTORAGE = 2, NOPROGRESSIVERENDERING = 4, OFFLINEOPERATION = 8, GETNEWESTVERSION = 16, NOWRITECACHE = 32, NEEDFILE = 64, PULLDATA = 128, IGNORESECURITYPROBLEM = 256, RESYNCHRONIZE = 512, HYPERLINK = 1024, NO_UI = 2048, SILENTOPERATION = 4096, PRAGMA_NO_CACHE = 8192, GETCLASSOBJECT = 16384, RESERVED_1 = 32768, FREE_THREADED = 65536, DIRECT_READ = 131072, FORMS_SUBMIT = 262144, GETFROMCACHE_IF_NET_FAIL = 524288, FROMURLMON = 1048576, FWD_BACK = 2097152, PREFERDEFAULTHANDLER = 4194304, ENFORCERESTRICTED = 8388608, RESERVED_2 = -2147483648, RESERVED_3 = 16777216, RESERVED_4 = 33554432, RESERVED_5 = 67108864, RESERVED_6 = 134217728, RESERVED_7 = 1073741824, RESERVED_8 = 536870912, }; pub const BINDF_ASYNCHRONOUS = BINDF.ASYNCHRONOUS; pub const BINDF_ASYNCSTORAGE = BINDF.ASYNCSTORAGE; pub const BINDF_NOPROGRESSIVERENDERING = BINDF.NOPROGRESSIVERENDERING; pub const BINDF_OFFLINEOPERATION = BINDF.OFFLINEOPERATION; pub const BINDF_GETNEWESTVERSION = BINDF.GETNEWESTVERSION; pub const BINDF_NOWRITECACHE = BINDF.NOWRITECACHE; pub const BINDF_NEEDFILE = BINDF.NEEDFILE; pub const BINDF_PULLDATA = BINDF.PULLDATA; pub const BINDF_IGNORESECURITYPROBLEM = BINDF.IGNORESECURITYPROBLEM; pub const BINDF_RESYNCHRONIZE = BINDF.RESYNCHRONIZE; pub const BINDF_HYPERLINK = BINDF.HYPERLINK; pub const BINDF_NO_UI = BINDF.NO_UI; pub const BINDF_SILENTOPERATION = BINDF.SILENTOPERATION; pub const BINDF_PRAGMA_NO_CACHE = BINDF.PRAGMA_NO_CACHE; pub const BINDF_GETCLASSOBJECT = BINDF.GETCLASSOBJECT; pub const BINDF_RESERVED_1 = BINDF.RESERVED_1; pub const BINDF_FREE_THREADED = BINDF.FREE_THREADED; pub const BINDF_DIRECT_READ = BINDF.DIRECT_READ; pub const BINDF_FORMS_SUBMIT = BINDF.FORMS_SUBMIT; pub const BINDF_GETFROMCACHE_IF_NET_FAIL = BINDF.GETFROMCACHE_IF_NET_FAIL; pub const BINDF_FROMURLMON = BINDF.FROMURLMON; pub const BINDF_FWD_BACK = BINDF.FWD_BACK; pub const BINDF_PREFERDEFAULTHANDLER = BINDF.PREFERDEFAULTHANDLER; pub const BINDF_ENFORCERESTRICTED = BINDF.ENFORCERESTRICTED; pub const BINDF_RESERVED_2 = BINDF.RESERVED_2; pub const BINDF_RESERVED_3 = BINDF.RESERVED_3; pub const BINDF_RESERVED_4 = BINDF.RESERVED_4; pub const BINDF_RESERVED_5 = BINDF.RESERVED_5; pub const BINDF_RESERVED_6 = BINDF.RESERVED_6; pub const BINDF_RESERVED_7 = BINDF.RESERVED_7; pub const BINDF_RESERVED_8 = BINDF.RESERVED_8; pub const URL_ENCODING = enum(i32) { NONE = 0, ENABLE_UTF8 = 268435456, DISABLE_UTF8 = 536870912, }; pub const URL_ENCODING_NONE = URL_ENCODING.NONE; pub const URL_ENCODING_ENABLE_UTF8 = URL_ENCODING.ENABLE_UTF8; pub const URL_ENCODING_DISABLE_UTF8 = URL_ENCODING.DISABLE_UTF8; pub const BINDINFO = extern struct { cbSize: u32, szExtraInfo: ?PWSTR, stgmedData: STGMEDIUM, grfBindInfoF: u32, dwBindVerb: u32, szCustomVerb: ?PWSTR, cbstgmedData: u32, dwOptions: u32, dwOptionsFlags: u32, dwCodePage: u32, securityAttributes: SECURITY_ATTRIBUTES, iid: Guid, pUnk: ?*IUnknown, dwReserved: u32, }; pub const REMSECURITY_ATTRIBUTES = extern struct { nLength: u32, lpSecurityDescriptor: u32, bInheritHandle: BOOL, }; pub const RemBINDINFO = extern struct { cbSize: u32, szExtraInfo: ?PWSTR, grfBindInfoF: u32, dwBindVerb: u32, szCustomVerb: ?PWSTR, cbstgmedData: u32, dwOptions: u32, dwOptionsFlags: u32, dwCodePage: u32, securityAttributes: REMSECURITY_ATTRIBUTES, iid: Guid, pUnk: ?*IUnknown, dwReserved: u32, }; pub const RemFORMATETC = extern struct { cfFormat: u32, ptd: u32, dwAspect: u32, lindex: i32, tymed: u32, }; pub const BINDINFO_OPTIONS = enum(i32) { OPTIONS_WININETFLAG = 65536, OPTIONS_ENABLE_UTF8 = 131072, OPTIONS_DISABLE_UTF8 = 262144, OPTIONS_USE_IE_ENCODING = 524288, OPTIONS_BINDTOOBJECT = 1048576, OPTIONS_SECURITYOPTOUT = 2097152, OPTIONS_IGNOREMIMETEXTPLAIN = 4194304, OPTIONS_USEBINDSTRINGCREDS = 8388608, OPTIONS_IGNOREHTTPHTTPSREDIRECTS = 16777216, OPTIONS_IGNORE_SSLERRORS_ONCE = 33554432, WPC_DOWNLOADBLOCKED = 134217728, WPC_LOGGING_ENABLED = 268435456, OPTIONS_ALLOWCONNECTDATA = 536870912, OPTIONS_DISABLEAUTOREDIRECTS = 1073741824, OPTIONS_SHDOCVW_NAVIGATE = -2147483648, }; pub const BINDINFO_OPTIONS_WININETFLAG = BINDINFO_OPTIONS.OPTIONS_WININETFLAG; pub const BINDINFO_OPTIONS_ENABLE_UTF8 = BINDINFO_OPTIONS.OPTIONS_ENABLE_UTF8; pub const BINDINFO_OPTIONS_DISABLE_UTF8 = BINDINFO_OPTIONS.OPTIONS_DISABLE_UTF8; pub const BINDINFO_OPTIONS_USE_IE_ENCODING = BINDINFO_OPTIONS.OPTIONS_USE_IE_ENCODING; pub const BINDINFO_OPTIONS_BINDTOOBJECT = BINDINFO_OPTIONS.OPTIONS_BINDTOOBJECT; pub const BINDINFO_OPTIONS_SECURITYOPTOUT = BINDINFO_OPTIONS.OPTIONS_SECURITYOPTOUT; pub const BINDINFO_OPTIONS_IGNOREMIMETEXTPLAIN = BINDINFO_OPTIONS.OPTIONS_IGNOREMIMETEXTPLAIN; pub const BINDINFO_OPTIONS_USEBINDSTRINGCREDS = BINDINFO_OPTIONS.OPTIONS_USEBINDSTRINGCREDS; pub const BINDINFO_OPTIONS_IGNOREHTTPHTTPSREDIRECTS = BINDINFO_OPTIONS.OPTIONS_IGNOREHTTPHTTPSREDIRECTS; pub const BINDINFO_OPTIONS_IGNORE_SSLERRORS_ONCE = BINDINFO_OPTIONS.OPTIONS_IGNORE_SSLERRORS_ONCE; pub const BINDINFO_WPC_DOWNLOADBLOCKED = BINDINFO_OPTIONS.WPC_DOWNLOADBLOCKED; pub const BINDINFO_WPC_LOGGING_ENABLED = BINDINFO_OPTIONS.WPC_LOGGING_ENABLED; pub const BINDINFO_OPTIONS_ALLOWCONNECTDATA = BINDINFO_OPTIONS.OPTIONS_ALLOWCONNECTDATA; pub const BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS = BINDINFO_OPTIONS.OPTIONS_DISABLEAUTOREDIRECTS; pub const BINDINFO_OPTIONS_SHDOCVW_NAVIGATE = BINDINFO_OPTIONS.OPTIONS_SHDOCVW_NAVIGATE; pub const BSCF = enum(i32) { FIRSTDATANOTIFICATION = 1, INTERMEDIATEDATANOTIFICATION = 2, LASTDATANOTIFICATION = 4, DATAFULLYAVAILABLE = 8, AVAILABLEDATASIZEUNKNOWN = 16, SKIPDRAINDATAFORFILEURLS = 32, @"64BITLENGTHDOWNLOAD" = 64, }; pub const BSCF_FIRSTDATANOTIFICATION = BSCF.FIRSTDATANOTIFICATION; pub const BSCF_INTERMEDIATEDATANOTIFICATION = BSCF.INTERMEDIATEDATANOTIFICATION; pub const BSCF_LASTDATANOTIFICATION = BSCF.LASTDATANOTIFICATION; pub const BSCF_DATAFULLYAVAILABLE = BSCF.DATAFULLYAVAILABLE; pub const BSCF_AVAILABLEDATASIZEUNKNOWN = BSCF.AVAILABLEDATASIZEUNKNOWN; pub const BSCF_SKIPDRAINDATAFORFILEURLS = BSCF.SKIPDRAINDATAFORFILEURLS; pub const BSCF_64BITLENGTHDOWNLOAD = BSCF.@"64BITLENGTHDOWNLOAD"; pub const BINDSTATUS = enum(i32) { FINDINGRESOURCE = 1, CONNECTING = 2, REDIRECTING = 3, BEGINDOWNLOADDATA = 4, DOWNLOADINGDATA = 5, ENDDOWNLOADDATA = 6, BEGINDOWNLOADCOMPONENTS = 7, INSTALLINGCOMPONENTS = 8, ENDDOWNLOADCOMPONENTS = 9, USINGCACHEDCOPY = 10, SENDINGREQUEST = 11, CLASSIDAVAILABLE = 12, MIMETYPEAVAILABLE = 13, CACHEFILENAMEAVAILABLE = 14, BEGINSYNCOPERATION = 15, ENDSYNCOPERATION = 16, BEGINUPLOADDATA = 17, UPLOADINGDATA = 18, ENDUPLOADDATA = 19, PROTOCOLCLASSID = 20, ENCODING = 21, VERIFIEDMIMETYPEAVAILABLE = 22, CLASSINSTALLLOCATION = 23, DECODING = 24, LOADINGMIMEHANDLER = 25, CONTENTDISPOSITIONATTACH = 26, FILTERREPORTMIMETYPE = 27, CLSIDCANINSTANTIATE = 28, IUNKNOWNAVAILABLE = 29, DIRECTBIND = 30, RAWMIMETYPE = 31, PROXYDETECTING = 32, ACCEPTRANGES = 33, COOKIE_SENT = 34, COMPACT_POLICY_RECEIVED = 35, COOKIE_SUPPRESSED = 36, COOKIE_STATE_UNKNOWN = 37, COOKIE_STATE_ACCEPT = 38, COOKIE_STATE_REJECT = 39, COOKIE_STATE_PROMPT = 40, COOKIE_STATE_LEASH = 41, COOKIE_STATE_DOWNGRADE = 42, POLICY_HREF = 43, P3P_HEADER = 44, SESSION_COOKIE_RECEIVED = 45, PERSISTENT_COOKIE_RECEIVED = 46, SESSION_COOKIES_ALLOWED = 47, CACHECONTROL = 48, CONTENTDISPOSITIONFILENAME = 49, MIMETEXTPLAINMISMATCH = 50, PUBLISHERAVAILABLE = 51, DISPLAYNAMEAVAILABLE = 52, SSLUX_NAVBLOCKED = 53, SERVER_MIMETYPEAVAILABLE = 54, SNIFFED_CLASSIDAVAILABLE = 55, @"64BIT_PROGRESS" = 56, // LAST = 56, this enum value conflicts with @"64BIT_PROGRESS" RESERVED_0 = 57, RESERVED_1 = 58, RESERVED_2 = 59, RESERVED_3 = 60, RESERVED_4 = 61, RESERVED_5 = 62, RESERVED_6 = 63, RESERVED_7 = 64, RESERVED_8 = 65, RESERVED_9 = 66, RESERVED_A = 67, RESERVED_B = 68, RESERVED_C = 69, RESERVED_D = 70, RESERVED_E = 71, RESERVED_F = 72, RESERVED_10 = 73, RESERVED_11 = 74, RESERVED_12 = 75, RESERVED_13 = 76, // LAST_PRIVATE = 76, this enum value conflicts with RESERVED_13 }; pub const BINDSTATUS_FINDINGRESOURCE = BINDSTATUS.FINDINGRESOURCE; pub const BINDSTATUS_CONNECTING = BINDSTATUS.CONNECTING; pub const BINDSTATUS_REDIRECTING = BINDSTATUS.REDIRECTING; pub const BINDSTATUS_BEGINDOWNLOADDATA = BINDSTATUS.BEGINDOWNLOADDATA; pub const BINDSTATUS_DOWNLOADINGDATA = BINDSTATUS.DOWNLOADINGDATA; pub const BINDSTATUS_ENDDOWNLOADDATA = BINDSTATUS.ENDDOWNLOADDATA; pub const BINDSTATUS_BEGINDOWNLOADCOMPONENTS = BINDSTATUS.BEGINDOWNLOADCOMPONENTS; pub const BINDSTATUS_INSTALLINGCOMPONENTS = BINDSTATUS.INSTALLINGCOMPONENTS; pub const BINDSTATUS_ENDDOWNLOADCOMPONENTS = BINDSTATUS.ENDDOWNLOADCOMPONENTS; pub const BINDSTATUS_USINGCACHEDCOPY = BINDSTATUS.USINGCACHEDCOPY; pub const BINDSTATUS_SENDINGREQUEST = BINDSTATUS.SENDINGREQUEST; pub const BINDSTATUS_CLASSIDAVAILABLE = BINDSTATUS.CLASSIDAVAILABLE; pub const BINDSTATUS_MIMETYPEAVAILABLE = BINDSTATUS.MIMETYPEAVAILABLE; pub const BINDSTATUS_CACHEFILENAMEAVAILABLE = BINDSTATUS.CACHEFILENAMEAVAILABLE; pub const BINDSTATUS_BEGINSYNCOPERATION = BINDSTATUS.BEGINSYNCOPERATION; pub const BINDSTATUS_ENDSYNCOPERATION = BINDSTATUS.ENDSYNCOPERATION; pub const BINDSTATUS_BEGINUPLOADDATA = BINDSTATUS.BEGINUPLOADDATA; pub const BINDSTATUS_UPLOADINGDATA = BINDSTATUS.UPLOADINGDATA; pub const BINDSTATUS_ENDUPLOADDATA = BINDSTATUS.ENDUPLOADDATA; pub const BINDSTATUS_PROTOCOLCLASSID = BINDSTATUS.PROTOCOLCLASSID; pub const BINDSTATUS_ENCODING = BINDSTATUS.ENCODING; pub const BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE = BINDSTATUS.VERIFIEDMIMETYPEAVAILABLE; pub const BINDSTATUS_CLASSINSTALLLOCATION = BINDSTATUS.CLASSINSTALLLOCATION; pub const BINDSTATUS_DECODING = BINDSTATUS.DECODING; pub const BINDSTATUS_LOADINGMIMEHANDLER = BINDSTATUS.LOADINGMIMEHANDLER; pub const BINDSTATUS_CONTENTDISPOSITIONATTACH = BINDSTATUS.CONTENTDISPOSITIONATTACH; pub const BINDSTATUS_FILTERREPORTMIMETYPE = BINDSTATUS.FILTERREPORTMIMETYPE; pub const BINDSTATUS_CLSIDCANINSTANTIATE = BINDSTATUS.CLSIDCANINSTANTIATE; pub const BINDSTATUS_IUNKNOWNAVAILABLE = BINDSTATUS.IUNKNOWNAVAILABLE; pub const BINDSTATUS_DIRECTBIND = BINDSTATUS.DIRECTBIND; pub const BINDSTATUS_RAWMIMETYPE = BINDSTATUS.RAWMIMETYPE; pub const BINDSTATUS_PROXYDETECTING = BINDSTATUS.PROXYDETECTING; pub const BINDSTATUS_ACCEPTRANGES = BINDSTATUS.ACCEPTRANGES; pub const BINDSTATUS_COOKIE_SENT = BINDSTATUS.COOKIE_SENT; pub const BINDSTATUS_COMPACT_POLICY_RECEIVED = BINDSTATUS.COMPACT_POLICY_RECEIVED; pub const BINDSTATUS_COOKIE_SUPPRESSED = BINDSTATUS.COOKIE_SUPPRESSED; pub const BINDSTATUS_COOKIE_STATE_UNKNOWN = BINDSTATUS.COOKIE_STATE_UNKNOWN; pub const BINDSTATUS_COOKIE_STATE_ACCEPT = BINDSTATUS.COOKIE_STATE_ACCEPT; pub const BINDSTATUS_COOKIE_STATE_REJECT = BINDSTATUS.COOKIE_STATE_REJECT; pub const BINDSTATUS_COOKIE_STATE_PROMPT = BINDSTATUS.COOKIE_STATE_PROMPT; pub const BINDSTATUS_COOKIE_STATE_LEASH = BINDSTATUS.COOKIE_STATE_LEASH; pub const BINDSTATUS_COOKIE_STATE_DOWNGRADE = BINDSTATUS.COOKIE_STATE_DOWNGRADE; pub const BINDSTATUS_POLICY_HREF = BINDSTATUS.POLICY_HREF; pub const BINDSTATUS_P3P_HEADER = BINDSTATUS.P3P_HEADER; pub const BINDSTATUS_SESSION_COOKIE_RECEIVED = BINDSTATUS.SESSION_COOKIE_RECEIVED; pub const BINDSTATUS_PERSISTENT_COOKIE_RECEIVED = BINDSTATUS.PERSISTENT_COOKIE_RECEIVED; pub const BINDSTATUS_SESSION_COOKIES_ALLOWED = BINDSTATUS.SESSION_COOKIES_ALLOWED; pub const BINDSTATUS_CACHECONTROL = BINDSTATUS.CACHECONTROL; pub const BINDSTATUS_CONTENTDISPOSITIONFILENAME = BINDSTATUS.CONTENTDISPOSITIONFILENAME; pub const BINDSTATUS_MIMETEXTPLAINMISMATCH = BINDSTATUS.MIMETEXTPLAINMISMATCH; pub const BINDSTATUS_PUBLISHERAVAILABLE = BINDSTATUS.PUBLISHERAVAILABLE; pub const BINDSTATUS_DISPLAYNAMEAVAILABLE = BINDSTATUS.DISPLAYNAMEAVAILABLE; pub const BINDSTATUS_SSLUX_NAVBLOCKED = BINDSTATUS.SSLUX_NAVBLOCKED; pub const BINDSTATUS_SERVER_MIMETYPEAVAILABLE = BINDSTATUS.SERVER_MIMETYPEAVAILABLE; pub const BINDSTATUS_SNIFFED_CLASSIDAVAILABLE = BINDSTATUS.SNIFFED_CLASSIDAVAILABLE; pub const BINDSTATUS_64BIT_PROGRESS = BINDSTATUS.@"64BIT_PROGRESS"; pub const BINDSTATUS_LAST = BINDSTATUS.@"64BIT_PROGRESS"; pub const BINDSTATUS_RESERVED_0 = BINDSTATUS.RESERVED_0; pub const BINDSTATUS_RESERVED_1 = BINDSTATUS.RESERVED_1; pub const BINDSTATUS_RESERVED_2 = BINDSTATUS.RESERVED_2; pub const BINDSTATUS_RESERVED_3 = BINDSTATUS.RESERVED_3; pub const BINDSTATUS_RESERVED_4 = BINDSTATUS.RESERVED_4; pub const BINDSTATUS_RESERVED_5 = BINDSTATUS.RESERVED_5; pub const BINDSTATUS_RESERVED_6 = BINDSTATUS.RESERVED_6; pub const BINDSTATUS_RESERVED_7 = BINDSTATUS.RESERVED_7; pub const BINDSTATUS_RESERVED_8 = BINDSTATUS.RESERVED_8; pub const BINDSTATUS_RESERVED_9 = BINDSTATUS.RESERVED_9; pub const BINDSTATUS_RESERVED_A = BINDSTATUS.RESERVED_A; pub const BINDSTATUS_RESERVED_B = BINDSTATUS.RESERVED_B; pub const BINDSTATUS_RESERVED_C = BINDSTATUS.RESERVED_C; pub const BINDSTATUS_RESERVED_D = BINDSTATUS.RESERVED_D; pub const BINDSTATUS_RESERVED_E = BINDSTATUS.RESERVED_E; pub const BINDSTATUS_RESERVED_F = BINDSTATUS.RESERVED_F; pub const BINDSTATUS_RESERVED_10 = BINDSTATUS.RESERVED_10; pub const BINDSTATUS_RESERVED_11 = BINDSTATUS.RESERVED_11; pub const BINDSTATUS_RESERVED_12 = BINDSTATUS.RESERVED_12; pub const BINDSTATUS_RESERVED_13 = BINDSTATUS.RESERVED_13; pub const BINDSTATUS_LAST_PRIVATE = BINDSTATUS.RESERVED_13; const IID_IBindStatusCallback_Value = @import("../zig.zig").Guid.initString("79eac9c1-baf9-11ce-8c82-00aa004ba90b"); pub const IID_IBindStatusCallback = &IID_IBindStatusCallback_Value; pub const IBindStatusCallback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnStartBinding: fn( self: *const IBindStatusCallback, dwReserved: u32, pib: ?*IBinding, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPriority: fn( self: *const IBindStatusCallback, pnPriority: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnLowResource: fn( self: *const IBindStatusCallback, reserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnProgress: fn( self: *const IBindStatusCallback, ulProgress: u32, ulProgressMax: u32, ulStatusCode: u32, szStatusText: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnStopBinding: fn( self: *const IBindStatusCallback, hresult: HRESULT, szError: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBindInfo: fn( self: *const IBindStatusCallback, grfBINDF: ?*u32, pbindinfo: ?*BINDINFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnDataAvailable: fn( self: *const IBindStatusCallback, grfBSCF: u32, dwSize: u32, pformatetc: ?*FORMATETC, pstgmed: ?*STGMEDIUM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnObjectAvailable: fn( self: *const IBindStatusCallback, riid: ?*const Guid, punk: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindStatusCallback_OnStartBinding(self: *const T, dwReserved: u32, pib: ?*IBinding) callconv(.Inline) HRESULT { return @ptrCast(*const IBindStatusCallback.VTable, self.vtable).OnStartBinding(@ptrCast(*const IBindStatusCallback, self), dwReserved, pib); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindStatusCallback_GetPriority(self: *const T, pnPriority: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IBindStatusCallback.VTable, self.vtable).GetPriority(@ptrCast(*const IBindStatusCallback, self), pnPriority); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindStatusCallback_OnLowResource(self: *const T, reserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IBindStatusCallback.VTable, self.vtable).OnLowResource(@ptrCast(*const IBindStatusCallback, self), reserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindStatusCallback_OnProgress(self: *const T, ulProgress: u32, ulProgressMax: u32, ulStatusCode: u32, szStatusText: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IBindStatusCallback.VTable, self.vtable).OnProgress(@ptrCast(*const IBindStatusCallback, self), ulProgress, ulProgressMax, ulStatusCode, szStatusText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindStatusCallback_OnStopBinding(self: *const T, hresult: HRESULT, szError: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IBindStatusCallback.VTable, self.vtable).OnStopBinding(@ptrCast(*const IBindStatusCallback, self), hresult, szError); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindStatusCallback_GetBindInfo(self: *const T, grfBINDF: ?*u32, pbindinfo: ?*BINDINFO) callconv(.Inline) HRESULT { return @ptrCast(*const IBindStatusCallback.VTable, self.vtable).GetBindInfo(@ptrCast(*const IBindStatusCallback, self), grfBINDF, pbindinfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindStatusCallback_OnDataAvailable(self: *const T, grfBSCF: u32, dwSize: u32, pformatetc: ?*FORMATETC, pstgmed: ?*STGMEDIUM) callconv(.Inline) HRESULT { return @ptrCast(*const IBindStatusCallback.VTable, self.vtable).OnDataAvailable(@ptrCast(*const IBindStatusCallback, self), grfBSCF, dwSize, pformatetc, pstgmed); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindStatusCallback_OnObjectAvailable(self: *const T, riid: ?*const Guid, punk: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IBindStatusCallback.VTable, self.vtable).OnObjectAvailable(@ptrCast(*const IBindStatusCallback, self), riid, punk); } };} pub usingnamespace MethodMixin(@This()); }; pub const BINDF2 = enum(i32) { DISABLEBASICOVERHTTP = 1, DISABLEAUTOCOOKIEHANDLING = 2, READ_DATA_GREATER_THAN_4GB = 4, DISABLE_HTTP_REDIRECT_XSECURITYID = 8, SETDOWNLOADMODE = 32, DISABLE_HTTP_REDIRECT_CACHING = 64, KEEP_CALLBACK_MODULE_LOADED = 128, ALLOW_PROXY_CRED_PROMPT = 256, RESERVED_17 = 512, RESERVED_16 = 1024, RESERVED_15 = 2048, RESERVED_14 = 4096, RESERVED_13 = 8192, RESERVED_12 = 16384, RESERVED_11 = 32768, RESERVED_10 = 65536, RESERVED_F = 131072, RESERVED_E = 262144, RESERVED_D = 524288, RESERVED_C = 1048576, RESERVED_B = 2097152, RESERVED_A = 4194304, RESERVED_9 = 8388608, RESERVED_8 = 16777216, RESERVED_7 = 33554432, RESERVED_6 = 67108864, RESERVED_5 = 134217728, RESERVED_4 = 268435456, RESERVED_3 = 536870912, RESERVED_2 = 1073741824, RESERVED_1 = -2147483648, }; pub const BINDF2_DISABLEBASICOVERHTTP = BINDF2.DISABLEBASICOVERHTTP; pub const BINDF2_DISABLEAUTOCOOKIEHANDLING = BINDF2.DISABLEAUTOCOOKIEHANDLING; pub const BINDF2_READ_DATA_GREATER_THAN_4GB = BINDF2.READ_DATA_GREATER_THAN_4GB; pub const BINDF2_DISABLE_HTTP_REDIRECT_XSECURITYID = BINDF2.DISABLE_HTTP_REDIRECT_XSECURITYID; pub const BINDF2_SETDOWNLOADMODE = BINDF2.SETDOWNLOADMODE; pub const BINDF2_DISABLE_HTTP_REDIRECT_CACHING = BINDF2.DISABLE_HTTP_REDIRECT_CACHING; pub const BINDF2_KEEP_CALLBACK_MODULE_LOADED = BINDF2.KEEP_CALLBACK_MODULE_LOADED; pub const BINDF2_ALLOW_PROXY_CRED_PROMPT = BINDF2.ALLOW_PROXY_CRED_PROMPT; pub const BINDF2_RESERVED_17 = BINDF2.RESERVED_17; pub const BINDF2_RESERVED_16 = BINDF2.RESERVED_16; pub const BINDF2_RESERVED_15 = BINDF2.RESERVED_15; pub const BINDF2_RESERVED_14 = BINDF2.RESERVED_14; pub const BINDF2_RESERVED_13 = BINDF2.RESERVED_13; pub const BINDF2_RESERVED_12 = BINDF2.RESERVED_12; pub const BINDF2_RESERVED_11 = BINDF2.RESERVED_11; pub const BINDF2_RESERVED_10 = BINDF2.RESERVED_10; pub const BINDF2_RESERVED_F = BINDF2.RESERVED_F; pub const BINDF2_RESERVED_E = BINDF2.RESERVED_E; pub const BINDF2_RESERVED_D = BINDF2.RESERVED_D; pub const BINDF2_RESERVED_C = BINDF2.RESERVED_C; pub const BINDF2_RESERVED_B = BINDF2.RESERVED_B; pub const BINDF2_RESERVED_A = BINDF2.RESERVED_A; pub const BINDF2_RESERVED_9 = BINDF2.RESERVED_9; pub const BINDF2_RESERVED_8 = BINDF2.RESERVED_8; pub const BINDF2_RESERVED_7 = BINDF2.RESERVED_7; pub const BINDF2_RESERVED_6 = BINDF2.RESERVED_6; pub const BINDF2_RESERVED_5 = BINDF2.RESERVED_5; pub const BINDF2_RESERVED_4 = BINDF2.RESERVED_4; pub const BINDF2_RESERVED_3 = BINDF2.RESERVED_3; pub const BINDF2_RESERVED_2 = BINDF2.RESERVED_2; pub const BINDF2_RESERVED_1 = BINDF2.RESERVED_1; const IID_IBindStatusCallbackEx_Value = @import("../zig.zig").Guid.initString("aaa74ef9-8ee7-4659-88d9-f8c504da73cc"); pub const IID_IBindStatusCallbackEx = &IID_IBindStatusCallbackEx_Value; pub const IBindStatusCallbackEx = extern struct { pub const VTable = extern struct { base: IBindStatusCallback.VTable, GetBindInfoEx: fn( self: *const IBindStatusCallbackEx, grfBINDF: ?*u32, pbindinfo: ?*BINDINFO, grfBINDF2: ?*u32, pdwReserved: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IBindStatusCallback.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindStatusCallbackEx_GetBindInfoEx(self: *const T, grfBINDF: ?*u32, pbindinfo: ?*BINDINFO, grfBINDF2: ?*u32, pdwReserved: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IBindStatusCallbackEx.VTable, self.vtable).GetBindInfoEx(@ptrCast(*const IBindStatusCallbackEx, self), grfBINDF, pbindinfo, grfBINDF2, pdwReserved); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IAuthenticate_Value = @import("../zig.zig").Guid.initString("79eac9d0-baf9-11ce-8c82-00aa004ba90b"); pub const IID_IAuthenticate = &IID_IAuthenticate_Value; pub const IAuthenticate = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Authenticate: fn( self: *const IAuthenticate, phwnd: ?*?HWND, pszUsername: ?*?PWSTR, pszPassword: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAuthenticate_Authenticate(self: *const T, phwnd: ?*?HWND, pszUsername: ?*?PWSTR, pszPassword: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IAuthenticate.VTable, self.vtable).Authenticate(@ptrCast(*const IAuthenticate, self), phwnd, pszUsername, pszPassword); } };} pub usingnamespace MethodMixin(@This()); }; pub const AUTHENTICATEF = enum(i32) { PROXY = 1, BASIC = 2, HTTP = 4, }; pub const AUTHENTICATEF_PROXY = AUTHENTICATEF.PROXY; pub const AUTHENTICATEF_BASIC = AUTHENTICATEF.BASIC; pub const AUTHENTICATEF_HTTP = AUTHENTICATEF.HTTP; pub const AUTHENTICATEINFO = extern struct { dwFlags: u32, dwReserved: u32, }; const IID_IAuthenticateEx_Value = @import("../zig.zig").Guid.initString("2ad1edaf-d83d-48b5-9adf-03dbe19f53bd"); pub const IID_IAuthenticateEx = &IID_IAuthenticateEx_Value; pub const IAuthenticateEx = extern struct { pub const VTable = extern struct { base: IAuthenticate.VTable, AuthenticateEx: fn( self: *const IAuthenticateEx, phwnd: ?*?HWND, pszUsername: ?*?PWSTR, pszPassword: ?*?PWSTR, pauthinfo: ?*AUTHENTICATEINFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IAuthenticate.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAuthenticateEx_AuthenticateEx(self: *const T, phwnd: ?*?HWND, pszUsername: ?*?PWSTR, pszPassword: ?*?PWSTR, pauthinfo: ?*AUTHENTICATEINFO) callconv(.Inline) HRESULT { return @ptrCast(*const IAuthenticateEx.VTable, self.vtable).AuthenticateEx(@ptrCast(*const IAuthenticateEx, self), phwnd, pszUsername, pszPassword, pauthinfo); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IHttpNegotiate_Value = @import("../zig.zig").Guid.initString("79eac9d2-baf9-11ce-8c82-00aa004ba90b"); pub const IID_IHttpNegotiate = &IID_IHttpNegotiate_Value; pub const IHttpNegotiate = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, BeginningTransaction: fn( self: *const IHttpNegotiate, szURL: ?[*:0]const u16, szHeaders: ?[*:0]const u16, dwReserved: u32, pszAdditionalHeaders: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnResponse: fn( self: *const IHttpNegotiate, dwResponseCode: u32, szResponseHeaders: ?[*:0]const u16, szRequestHeaders: ?[*:0]const u16, pszAdditionalRequestHeaders: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IHttpNegotiate_BeginningTransaction(self: *const T, szURL: ?[*:0]const u16, szHeaders: ?[*:0]const u16, dwReserved: u32, pszAdditionalHeaders: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IHttpNegotiate.VTable, self.vtable).BeginningTransaction(@ptrCast(*const IHttpNegotiate, self), szURL, szHeaders, dwReserved, pszAdditionalHeaders); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IHttpNegotiate_OnResponse(self: *const T, dwResponseCode: u32, szResponseHeaders: ?[*:0]const u16, szRequestHeaders: ?[*:0]const u16, pszAdditionalRequestHeaders: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IHttpNegotiate.VTable, self.vtable).OnResponse(@ptrCast(*const IHttpNegotiate, self), dwResponseCode, szResponseHeaders, szRequestHeaders, pszAdditionalRequestHeaders); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IHttpNegotiate2_Value = @import("../zig.zig").Guid.initString("4f9f9fcb-e0f4-48eb-b7ab-fa2ea9365cb4"); pub const IID_IHttpNegotiate2 = &IID_IHttpNegotiate2_Value; pub const IHttpNegotiate2 = extern struct { pub const VTable = extern struct { base: IHttpNegotiate.VTable, GetRootSecurityId: fn( self: *const IHttpNegotiate2, pbSecurityId: [*:0]u8, pcbSecurityId: ?*u32, dwReserved: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IHttpNegotiate.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IHttpNegotiate2_GetRootSecurityId(self: *const T, pbSecurityId: [*:0]u8, pcbSecurityId: ?*u32, dwReserved: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IHttpNegotiate2.VTable, self.vtable).GetRootSecurityId(@ptrCast(*const IHttpNegotiate2, self), pbSecurityId, pcbSecurityId, dwReserved); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IHttpNegotiate3_Value = @import("../zig.zig").Guid.initString("57b6c80a-34c2-4602-bc26-66a02fc57153"); pub const IID_IHttpNegotiate3 = &IID_IHttpNegotiate3_Value; pub const IHttpNegotiate3 = extern struct { pub const VTable = extern struct { base: IHttpNegotiate2.VTable, GetSerializedClientCertContext: fn( self: *const IHttpNegotiate3, ppbCert: [*]?*u8, pcbCert: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IHttpNegotiate2.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IHttpNegotiate3_GetSerializedClientCertContext(self: *const T, ppbCert: [*]?*u8, pcbCert: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IHttpNegotiate3.VTable, self.vtable).GetSerializedClientCertContext(@ptrCast(*const IHttpNegotiate3, self), ppbCert, pcbCert); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IWinInetFileStream_Value = @import("../zig.zig").Guid.initString("f134c4b7-b1f8-4e75-b886-74b90943becb"); pub const IID_IWinInetFileStream = &IID_IWinInetFileStream_Value; pub const IWinInetFileStream = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetHandleForUnlock: fn( self: *const IWinInetFileStream, hWinInetLockHandle: usize, dwReserved: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetDeleteFile: fn( self: *const IWinInetFileStream, dwReserved: usize, ) 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 IWinInetFileStream_SetHandleForUnlock(self: *const T, hWinInetLockHandle: usize, dwReserved: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IWinInetFileStream.VTable, self.vtable).SetHandleForUnlock(@ptrCast(*const IWinInetFileStream, self), hWinInetLockHandle, dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWinInetFileStream_SetDeleteFile(self: *const T, dwReserved: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IWinInetFileStream.VTable, self.vtable).SetDeleteFile(@ptrCast(*const IWinInetFileStream, self), dwReserved); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IWindowForBindingUI_Value = @import("../zig.zig").Guid.initString("79eac9d5-bafa-11ce-8c82-00aa004ba90b"); pub const IID_IWindowForBindingUI = &IID_IWindowForBindingUI_Value; pub const IWindowForBindingUI = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetWindow: fn( self: *const IWindowForBindingUI, rguidReason: ?*const Guid, phwnd: ?*?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWindowForBindingUI_GetWindow(self: *const T, rguidReason: ?*const Guid, phwnd: ?*?HWND) callconv(.Inline) HRESULT { return @ptrCast(*const IWindowForBindingUI.VTable, self.vtable).GetWindow(@ptrCast(*const IWindowForBindingUI, self), rguidReason, phwnd); } };} pub usingnamespace MethodMixin(@This()); }; pub const CIP_STATUS = enum(i32) { DISK_FULL = 0, ACCESS_DENIED = 1, NEWER_VERSION_EXISTS = 2, OLDER_VERSION_EXISTS = 3, NAME_CONFLICT = 4, TRUST_VERIFICATION_COMPONENT_MISSING = 5, EXE_SELF_REGISTERATION_TIMEOUT = 6, UNSAFE_TO_ABORT = 7, NEED_REBOOT = 8, NEED_REBOOT_UI_PERMISSION = 9, }; pub const CIP_DISK_FULL = CIP_STATUS.DISK_FULL; pub const CIP_ACCESS_DENIED = CIP_STATUS.ACCESS_DENIED; pub const CIP_NEWER_VERSION_EXISTS = CIP_STATUS.NEWER_VERSION_EXISTS; pub const CIP_OLDER_VERSION_EXISTS = CIP_STATUS.OLDER_VERSION_EXISTS; pub const CIP_NAME_CONFLICT = CIP_STATUS.NAME_CONFLICT; pub const CIP_TRUST_VERIFICATION_COMPONENT_MISSING = CIP_STATUS.TRUST_VERIFICATION_COMPONENT_MISSING; pub const CIP_EXE_SELF_REGISTERATION_TIMEOUT = CIP_STATUS.EXE_SELF_REGISTERATION_TIMEOUT; pub const CIP_UNSAFE_TO_ABORT = CIP_STATUS.UNSAFE_TO_ABORT; pub const CIP_NEED_REBOOT = CIP_STATUS.NEED_REBOOT; pub const CIP_NEED_REBOOT_UI_PERMISSION = CIP_STATUS.NEED_REBOOT_UI_PERMISSION; const IID_ICodeInstall_Value = @import("../zig.zig").Guid.initString("79eac9d1-baf9-11ce-8c82-00aa004ba90b"); pub const IID_ICodeInstall = &IID_ICodeInstall_Value; pub const ICodeInstall = extern struct { pub const VTable = extern struct { base: IWindowForBindingUI.VTable, OnCodeInstallProblem: fn( self: *const ICodeInstall, ulStatusCode: u32, szDestination: ?[*:0]const u16, szSource: ?[*:0]const u16, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IWindowForBindingUI.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICodeInstall_OnCodeInstallProblem(self: *const T, ulStatusCode: u32, szDestination: ?[*:0]const u16, szSource: ?[*:0]const u16, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICodeInstall.VTable, self.vtable).OnCodeInstallProblem(@ptrCast(*const ICodeInstall, self), ulStatusCode, szDestination, szSource, dwReserved); } };} pub usingnamespace MethodMixin(@This()); }; pub const Uri_PROPERTY = enum(i32) { ABSOLUTE_URI = 0, // STRING_START = 0, this enum value conflicts with ABSOLUTE_URI AUTHORITY = 1, DISPLAY_URI = 2, DOMAIN = 3, EXTENSION = 4, FRAGMENT = 5, HOST = 6, PASSWORD = 7, PATH = 8, PATH_AND_QUERY = 9, QUERY = 10, RAW_URI = 11, SCHEME_NAME = 12, USER_INFO = 13, USER_NAME = 14, // STRING_LAST = 14, this enum value conflicts with USER_NAME HOST_TYPE = 15, // DWORD_START = 15, this enum value conflicts with HOST_TYPE PORT = 16, SCHEME = 17, ZONE = 18, // DWORD_LAST = 18, this enum value conflicts with ZONE }; pub const Uri_PROPERTY_ABSOLUTE_URI = Uri_PROPERTY.ABSOLUTE_URI; pub const Uri_PROPERTY_STRING_START = Uri_PROPERTY.ABSOLUTE_URI; pub const Uri_PROPERTY_AUTHORITY = Uri_PROPERTY.AUTHORITY; pub const Uri_PROPERTY_DISPLAY_URI = Uri_PROPERTY.DISPLAY_URI; pub const Uri_PROPERTY_DOMAIN = Uri_PROPERTY.DOMAIN; pub const Uri_PROPERTY_EXTENSION = Uri_PROPERTY.EXTENSION; pub const Uri_PROPERTY_FRAGMENT = Uri_PROPERTY.FRAGMENT; pub const Uri_PROPERTY_HOST = Uri_PROPERTY.HOST; pub const Uri_PROPERTY_PASSWORD = Uri_PROPERTY.PASSWORD; pub const Uri_PROPERTY_PATH = Uri_PROPERTY.PATH; pub const Uri_PROPERTY_PATH_AND_QUERY = Uri_PROPERTY.PATH_AND_QUERY; pub const Uri_PROPERTY_QUERY = Uri_PROPERTY.QUERY; pub const Uri_PROPERTY_RAW_URI = Uri_PROPERTY.RAW_URI; pub const Uri_PROPERTY_SCHEME_NAME = Uri_PROPERTY.SCHEME_NAME; pub const Uri_PROPERTY_USER_INFO = Uri_PROPERTY.USER_INFO; pub const Uri_PROPERTY_USER_NAME = Uri_PROPERTY.USER_NAME; pub const Uri_PROPERTY_STRING_LAST = Uri_PROPERTY.USER_NAME; pub const Uri_PROPERTY_HOST_TYPE = Uri_PROPERTY.HOST_TYPE; pub const Uri_PROPERTY_DWORD_START = Uri_PROPERTY.HOST_TYPE; pub const Uri_PROPERTY_PORT = Uri_PROPERTY.PORT; pub const Uri_PROPERTY_SCHEME = Uri_PROPERTY.SCHEME; pub const Uri_PROPERTY_ZONE = Uri_PROPERTY.ZONE; pub const Uri_PROPERTY_DWORD_LAST = Uri_PROPERTY.ZONE; pub const Uri_HOST_TYPE = enum(i32) { UNKNOWN = 0, DNS = 1, IPV4 = 2, IPV6 = 3, IDN = 4, }; pub const Uri_HOST_UNKNOWN = Uri_HOST_TYPE.UNKNOWN; pub const Uri_HOST_DNS = Uri_HOST_TYPE.DNS; pub const Uri_HOST_IPV4 = Uri_HOST_TYPE.IPV4; pub const Uri_HOST_IPV6 = Uri_HOST_TYPE.IPV6; pub const Uri_HOST_IDN = Uri_HOST_TYPE.IDN; const IID_IUri_Value = @import("../zig.zig").Guid.initString("a39ee748-6a27-4817-a6f2-13914bef5890"); pub const IID_IUri = &IID_IUri_Value; pub const IUri = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetPropertyBSTR: fn( self: *const IUri, uriProp: Uri_PROPERTY, pbstrProperty: ?*?BSTR, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPropertyLength: fn( self: *const IUri, uriProp: Uri_PROPERTY, pcchProperty: ?*u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPropertyDWORD: fn( self: *const IUri, uriProp: Uri_PROPERTY, pdwProperty: ?*u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, HasProperty: fn( self: *const IUri, uriProp: Uri_PROPERTY, pfHasProperty: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAbsoluteUri: fn( self: *const IUri, pbstrAbsoluteUri: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAuthority: fn( self: *const IUri, pbstrAuthority: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDisplayUri: fn( self: *const IUri, pbstrDisplayString: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDomain: fn( self: *const IUri, pbstrDomain: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetExtension: fn( self: *const IUri, pbstrExtension: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFragment: fn( self: *const IUri, pbstrFragment: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetHost: fn( self: *const IUri, pbstrHost: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPassword: fn( self: *const IUri, pbstrPassword: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPath: fn( self: *const IUri, pbstrPath: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPathAndQuery: fn( self: *const IUri, pbstrPathAndQuery: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetQuery: fn( self: *const IUri, pbstrQuery: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRawUri: fn( self: *const IUri, pbstrRawUri: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSchemeName: fn( self: *const IUri, pbstrSchemeName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUserInfo: fn( self: *const IUri, pbstrUserInfo: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUserName: fn( self: *const IUri, pbstrUserName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetHostType: fn( self: *const IUri, pdwHostType: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPort: fn( self: *const IUri, pdwPort: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetScheme: fn( self: *const IUri, pdwScheme: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetZone: fn( self: *const IUri, pdwZone: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetProperties: fn( self: *const IUri, pdwFlags: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsEqual: fn( self: *const IUri, pUri: ?*IUri, pfEqual: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetPropertyBSTR(self: *const T, uriProp: Uri_PROPERTY, pbstrProperty: ?*?BSTR, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetPropertyBSTR(@ptrCast(*const IUri, self), uriProp, pbstrProperty, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetPropertyLength(self: *const T, uriProp: Uri_PROPERTY, pcchProperty: ?*u32, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetPropertyLength(@ptrCast(*const IUri, self), uriProp, pcchProperty, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetPropertyDWORD(self: *const T, uriProp: Uri_PROPERTY, pdwProperty: ?*u32, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetPropertyDWORD(@ptrCast(*const IUri, self), uriProp, pdwProperty, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_HasProperty(self: *const T, uriProp: Uri_PROPERTY, pfHasProperty: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).HasProperty(@ptrCast(*const IUri, self), uriProp, pfHasProperty); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetAbsoluteUri(self: *const T, pbstrAbsoluteUri: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetAbsoluteUri(@ptrCast(*const IUri, self), pbstrAbsoluteUri); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetAuthority(self: *const T, pbstrAuthority: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetAuthority(@ptrCast(*const IUri, self), pbstrAuthority); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetDisplayUri(self: *const T, pbstrDisplayString: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetDisplayUri(@ptrCast(*const IUri, self), pbstrDisplayString); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetDomain(self: *const T, pbstrDomain: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetDomain(@ptrCast(*const IUri, self), pbstrDomain); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetExtension(self: *const T, pbstrExtension: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetExtension(@ptrCast(*const IUri, self), pbstrExtension); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetFragment(self: *const T, pbstrFragment: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetFragment(@ptrCast(*const IUri, self), pbstrFragment); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetHost(self: *const T, pbstrHost: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetHost(@ptrCast(*const IUri, self), pbstrHost); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetPassword(self: *const T, pbstrPassword: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetPassword(@ptrCast(*const IUri, self), pbstrPassword); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetPath(self: *const T, pbstrPath: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetPath(@ptrCast(*const IUri, self), pbstrPath); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetPathAndQuery(self: *const T, pbstrPathAndQuery: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetPathAndQuery(@ptrCast(*const IUri, self), pbstrPathAndQuery); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetQuery(self: *const T, pbstrQuery: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetQuery(@ptrCast(*const IUri, self), pbstrQuery); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetRawUri(self: *const T, pbstrRawUri: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetRawUri(@ptrCast(*const IUri, self), pbstrRawUri); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetSchemeName(self: *const T, pbstrSchemeName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetSchemeName(@ptrCast(*const IUri, self), pbstrSchemeName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetUserInfo(self: *const T, pbstrUserInfo: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetUserInfo(@ptrCast(*const IUri, self), pbstrUserInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetUserName(self: *const T, pbstrUserName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetUserName(@ptrCast(*const IUri, self), pbstrUserName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetHostType(self: *const T, pdwHostType: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetHostType(@ptrCast(*const IUri, self), pdwHostType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetPort(self: *const T, pdwPort: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetPort(@ptrCast(*const IUri, self), pdwPort); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetScheme(self: *const T, pdwScheme: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetScheme(@ptrCast(*const IUri, self), pdwScheme); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetZone(self: *const T, pdwZone: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetZone(@ptrCast(*const IUri, self), pdwZone); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_GetProperties(self: *const T, pdwFlags: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).GetProperties(@ptrCast(*const IUri, self), pdwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUri_IsEqual(self: *const T, pUri: ?*IUri, pfEqual: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IUri.VTable, self.vtable).IsEqual(@ptrCast(*const IUri, self), pUri, pfEqual); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IUriContainer_Value = @import("../zig.zig").Guid.initString("a158a630-ed6f-45fb-b987-f68676f57752"); pub const IID_IUriContainer = &IID_IUriContainer_Value; pub const IUriContainer = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetIUri: fn( self: *const IUriContainer, ppIUri: ?*?*IUri, ) 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 IUriContainer_GetIUri(self: *const T, ppIUri: ?*?*IUri) callconv(.Inline) HRESULT { return @ptrCast(*const IUriContainer.VTable, self.vtable).GetIUri(@ptrCast(*const IUriContainer, self), ppIUri); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IUriBuilder_Value = @import("../zig.zig").Guid.initString("4221b2e1-8955-46c0-bd5b-de9897565de7"); pub const IID_IUriBuilder = &IID_IUriBuilder_Value; pub const IUriBuilder = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateUriSimple: fn( self: *const IUriBuilder, dwAllowEncodingPropertyMask: u32, dwReserved: usize, ppIUri: ?*?*IUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateUri: fn( self: *const IUriBuilder, dwCreateFlags: u32, dwAllowEncodingPropertyMask: u32, dwReserved: usize, ppIUri: ?*?*IUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateUriWithFlags: fn( self: *const IUriBuilder, dwCreateFlags: u32, dwUriBuilderFlags: u32, dwAllowEncodingPropertyMask: u32, dwReserved: usize, ppIUri: ?*?*IUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIUri: fn( self: *const IUriBuilder, ppIUri: ?*?*IUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetIUri: fn( self: *const IUriBuilder, pIUri: ?*IUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFragment: fn( self: *const IUriBuilder, pcchFragment: ?*u32, ppwzFragment: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetHost: fn( self: *const IUriBuilder, pcchHost: ?*u32, ppwzHost: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPassword: fn( self: *const IUriBuilder, pcchPassword: ?*u32, ppwzPassword: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPath: fn( self: *const IUriBuilder, pcchPath: ?*u32, ppwzPath: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPort: fn( self: *const IUriBuilder, pfHasPort: ?*BOOL, pdwPort: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetQuery: fn( self: *const IUriBuilder, pcchQuery: ?*u32, ppwzQuery: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSchemeName: fn( self: *const IUriBuilder, pcchSchemeName: ?*u32, ppwzSchemeName: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUserName: fn( self: *const IUriBuilder, pcchUserName: ?*u32, ppwzUserName: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetFragment: fn( self: *const IUriBuilder, pwzNewValue: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetHost: fn( self: *const IUriBuilder, pwzNewValue: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetPassword: fn( self: *const IUriBuilder, pwzNewValue: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetPath: fn( self: *const IUriBuilder, pwzNewValue: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetPort: fn( self: *const IUriBuilder, fHasPort: BOOL, dwNewValue: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetQuery: fn( self: *const IUriBuilder, pwzNewValue: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSchemeName: fn( self: *const IUriBuilder, pwzNewValue: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetUserName: fn( self: *const IUriBuilder, pwzNewValue: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveProperties: fn( self: *const IUriBuilder, dwPropertyMask: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, HasBeenModified: fn( self: *const IUriBuilder, pfModified: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_CreateUriSimple(self: *const T, dwAllowEncodingPropertyMask: u32, dwReserved: usize, ppIUri: ?*?*IUri) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).CreateUriSimple(@ptrCast(*const IUriBuilder, self), dwAllowEncodingPropertyMask, dwReserved, ppIUri); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_CreateUri(self: *const T, dwCreateFlags: u32, dwAllowEncodingPropertyMask: u32, dwReserved: usize, ppIUri: ?*?*IUri) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).CreateUri(@ptrCast(*const IUriBuilder, self), dwCreateFlags, dwAllowEncodingPropertyMask, dwReserved, ppIUri); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_CreateUriWithFlags(self: *const T, dwCreateFlags: u32, dwUriBuilderFlags: u32, dwAllowEncodingPropertyMask: u32, dwReserved: usize, ppIUri: ?*?*IUri) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).CreateUriWithFlags(@ptrCast(*const IUriBuilder, self), dwCreateFlags, dwUriBuilderFlags, dwAllowEncodingPropertyMask, dwReserved, ppIUri); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_GetIUri(self: *const T, ppIUri: ?*?*IUri) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).GetIUri(@ptrCast(*const IUriBuilder, self), ppIUri); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_SetIUri(self: *const T, pIUri: ?*IUri) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).SetIUri(@ptrCast(*const IUriBuilder, self), pIUri); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_GetFragment(self: *const T, pcchFragment: ?*u32, ppwzFragment: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).GetFragment(@ptrCast(*const IUriBuilder, self), pcchFragment, ppwzFragment); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_GetHost(self: *const T, pcchHost: ?*u32, ppwzHost: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).GetHost(@ptrCast(*const IUriBuilder, self), pcchHost, ppwzHost); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_GetPassword(self: *const T, pcchPassword: ?*u32, ppwzPassword: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).GetPassword(@ptrCast(*const IUriBuilder, self), pcchPassword, ppwzPassword); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_GetPath(self: *const T, pcchPath: ?*u32, ppwzPath: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).GetPath(@ptrCast(*const IUriBuilder, self), pcchPath, ppwzPath); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_GetPort(self: *const T, pfHasPort: ?*BOOL, pdwPort: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).GetPort(@ptrCast(*const IUriBuilder, self), pfHasPort, pdwPort); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_GetQuery(self: *const T, pcchQuery: ?*u32, ppwzQuery: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).GetQuery(@ptrCast(*const IUriBuilder, self), pcchQuery, ppwzQuery); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_GetSchemeName(self: *const T, pcchSchemeName: ?*u32, ppwzSchemeName: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).GetSchemeName(@ptrCast(*const IUriBuilder, self), pcchSchemeName, ppwzSchemeName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_GetUserName(self: *const T, pcchUserName: ?*u32, ppwzUserName: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).GetUserName(@ptrCast(*const IUriBuilder, self), pcchUserName, ppwzUserName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_SetFragment(self: *const T, pwzNewValue: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).SetFragment(@ptrCast(*const IUriBuilder, self), pwzNewValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_SetHost(self: *const T, pwzNewValue: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).SetHost(@ptrCast(*const IUriBuilder, self), pwzNewValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_SetPassword(self: *const T, pwzNewValue: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).SetPassword(@ptrCast(*const IUriBuilder, self), pwzNewValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_SetPath(self: *const T, pwzNewValue: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).SetPath(@ptrCast(*const IUriBuilder, self), pwzNewValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_SetPort(self: *const T, fHasPort: BOOL, dwNewValue: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).SetPort(@ptrCast(*const IUriBuilder, self), fHasPort, dwNewValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_SetQuery(self: *const T, pwzNewValue: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).SetQuery(@ptrCast(*const IUriBuilder, self), pwzNewValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_SetSchemeName(self: *const T, pwzNewValue: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).SetSchemeName(@ptrCast(*const IUriBuilder, self), pwzNewValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_SetUserName(self: *const T, pwzNewValue: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).SetUserName(@ptrCast(*const IUriBuilder, self), pwzNewValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_RemoveProperties(self: *const T, dwPropertyMask: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).RemoveProperties(@ptrCast(*const IUriBuilder, self), dwPropertyMask); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilder_HasBeenModified(self: *const T, pfModified: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilder.VTable, self.vtable).HasBeenModified(@ptrCast(*const IUriBuilder, self), pfModified); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IUriBuilderFactory_Value = @import("../zig.zig").Guid.initString("e982ce48-0b96-440c-bc37-0c869b27a29e"); pub const IID_IUriBuilderFactory = &IID_IUriBuilderFactory_Value; pub const IUriBuilderFactory = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateIUriBuilder: fn( self: *const IUriBuilderFactory, dwFlags: u32, dwReserved: usize, ppIUriBuilder: ?*?*IUriBuilder, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateInitializedIUriBuilder: fn( self: *const IUriBuilderFactory, dwFlags: u32, dwReserved: usize, ppIUriBuilder: ?*?*IUriBuilder, ) 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 IUriBuilderFactory_CreateIUriBuilder(self: *const T, dwFlags: u32, dwReserved: usize, ppIUriBuilder: ?*?*IUriBuilder) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilderFactory.VTable, self.vtable).CreateIUriBuilder(@ptrCast(*const IUriBuilderFactory, self), dwFlags, dwReserved, ppIUriBuilder); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUriBuilderFactory_CreateInitializedIUriBuilder(self: *const T, dwFlags: u32, dwReserved: usize, ppIUriBuilder: ?*?*IUriBuilder) callconv(.Inline) HRESULT { return @ptrCast(*const IUriBuilderFactory.VTable, self.vtable).CreateInitializedIUriBuilder(@ptrCast(*const IUriBuilderFactory, self), dwFlags, dwReserved, ppIUriBuilder); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IWinInetInfo_Value = @import("../zig.zig").Guid.initString("79eac9d6-bafa-11ce-8c82-00aa004ba90b"); pub const IID_IWinInetInfo = &IID_IWinInetInfo_Value; pub const IWinInetInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, QueryOption: fn( self: *const IWinInetInfo, dwOption: u32, pBuffer: [*]u8, pcbBuf: ?*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 IWinInetInfo_QueryOption(self: *const T, dwOption: u32, pBuffer: [*]u8, pcbBuf: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IWinInetInfo.VTable, self.vtable).QueryOption(@ptrCast(*const IWinInetInfo, self), dwOption, pBuffer, pcbBuf); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IHttpSecurity_Value = @import("../zig.zig").Guid.initString("79eac9d7-bafa-11ce-8c82-00aa004ba90b"); pub const IID_IHttpSecurity = &IID_IHttpSecurity_Value; pub const IHttpSecurity = extern struct { pub const VTable = extern struct { base: IWindowForBindingUI.VTable, OnSecurityProblem: fn( self: *const IHttpSecurity, dwProblem: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IWindowForBindingUI.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IHttpSecurity_OnSecurityProblem(self: *const T, dwProblem: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IHttpSecurity.VTable, self.vtable).OnSecurityProblem(@ptrCast(*const IHttpSecurity, self), dwProblem); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IWinInetHttpInfo_Value = @import("../zig.zig").Guid.initString("79eac9d8-bafa-11ce-8c82-00aa004ba90b"); pub const IID_IWinInetHttpInfo = &IID_IWinInetHttpInfo_Value; pub const IWinInetHttpInfo = extern struct { pub const VTable = extern struct { base: IWinInetInfo.VTable, QueryInfo: fn( self: *const IWinInetHttpInfo, dwOption: u32, pBuffer: [*]u8, pcbBuf: ?*u32, pdwFlags: ?*u32, pdwReserved: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IWinInetInfo.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWinInetHttpInfo_QueryInfo(self: *const T, dwOption: u32, pBuffer: [*]u8, pcbBuf: ?*u32, pdwFlags: ?*u32, pdwReserved: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IWinInetHttpInfo.VTable, self.vtable).QueryInfo(@ptrCast(*const IWinInetHttpInfo, self), dwOption, pBuffer, pcbBuf, pdwFlags, pdwReserved); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IWinInetHttpTimeouts_Value = @import("../zig.zig").Guid.initString("f286fa56-c1fd-4270-8e67-b3eb790a81e8"); pub const IID_IWinInetHttpTimeouts = &IID_IWinInetHttpTimeouts_Value; pub const IWinInetHttpTimeouts = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetRequestTimeouts: fn( self: *const IWinInetHttpTimeouts, pdwConnectTimeout: ?*u32, pdwSendTimeout: ?*u32, pdwReceiveTimeout: ?*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 IWinInetHttpTimeouts_GetRequestTimeouts(self: *const T, pdwConnectTimeout: ?*u32, pdwSendTimeout: ?*u32, pdwReceiveTimeout: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IWinInetHttpTimeouts.VTable, self.vtable).GetRequestTimeouts(@ptrCast(*const IWinInetHttpTimeouts, self), pdwConnectTimeout, pdwSendTimeout, pdwReceiveTimeout); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IWinInetCacheHints_Value = @import("../zig.zig").Guid.initString("dd1ec3b3-8391-4fdb-a9e6-347c3caaa7dd"); pub const IID_IWinInetCacheHints = &IID_IWinInetCacheHints_Value; pub const IWinInetCacheHints = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetCacheExtension: fn( self: *const IWinInetCacheHints, pwzExt: ?[*:0]const u16, pszCacheFile: [*]u8, pcbCacheFile: ?*u32, pdwWinInetError: ?*u32, pdwReserved: ?*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 IWinInetCacheHints_SetCacheExtension(self: *const T, pwzExt: ?[*:0]const u16, pszCacheFile: [*]u8, pcbCacheFile: ?*u32, pdwWinInetError: ?*u32, pdwReserved: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IWinInetCacheHints.VTable, self.vtable).SetCacheExtension(@ptrCast(*const IWinInetCacheHints, self), pwzExt, pszCacheFile, pcbCacheFile, pdwWinInetError, pdwReserved); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IWinInetCacheHints2_Value = @import("../zig.zig").Guid.initString("7857aeac-d31f-49bf-884e-dd46df36780a"); pub const IID_IWinInetCacheHints2 = &IID_IWinInetCacheHints2_Value; pub const IWinInetCacheHints2 = extern struct { pub const VTable = extern struct { base: IWinInetCacheHints.VTable, SetCacheExtension2: fn( self: *const IWinInetCacheHints2, pwzExt: ?[*:0]const u16, pwzCacheFile: ?PWSTR, pcchCacheFile: ?*u32, pdwWinInetError: ?*u32, pdwReserved: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IWinInetCacheHints.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWinInetCacheHints2_SetCacheExtension2(self: *const T, pwzExt: ?[*:0]const u16, pwzCacheFile: ?PWSTR, pcchCacheFile: ?*u32, pdwWinInetError: ?*u32, pdwReserved: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IWinInetCacheHints2.VTable, self.vtable).SetCacheExtension2(@ptrCast(*const IWinInetCacheHints2, self), pwzExt, pwzCacheFile, pcchCacheFile, pdwWinInetError, pdwReserved); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IBindHost_Value = @import("../zig.zig").Guid.initString("fc4801a1-2ba9-11cf-a229-00aa003d7352"); pub const IID_IBindHost = &IID_IBindHost_Value; pub const IBindHost = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateMoniker: fn( self: *const IBindHost, szName: ?PWSTR, pBC: ?*IBindCtx, ppmk: ?*?*IMoniker, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MonikerBindToStorage: fn( self: *const IBindHost, pMk: ?*IMoniker, pBC: ?*IBindCtx, pBSC: ?*IBindStatusCallback, riid: ?*const Guid, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MonikerBindToObject: fn( self: *const IBindHost, pMk: ?*IMoniker, pBC: ?*IBindCtx, pBSC: ?*IBindStatusCallback, riid: ?*const Guid, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindHost_CreateMoniker(self: *const T, szName: ?PWSTR, pBC: ?*IBindCtx, ppmk: ?*?*IMoniker, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IBindHost.VTable, self.vtable).CreateMoniker(@ptrCast(*const IBindHost, self), szName, pBC, ppmk, dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindHost_MonikerBindToStorage(self: *const T, pMk: ?*IMoniker, pBC: ?*IBindCtx, pBSC: ?*IBindStatusCallback, riid: ?*const Guid, ppvObj: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IBindHost.VTable, self.vtable).MonikerBindToStorage(@ptrCast(*const IBindHost, self), pMk, pBC, pBSC, riid, ppvObj); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindHost_MonikerBindToObject(self: *const T, pMk: ?*IMoniker, pBC: ?*IBindCtx, pBSC: ?*IBindStatusCallback, riid: ?*const Guid, ppvObj: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IBindHost.VTable, self.vtable).MonikerBindToObject(@ptrCast(*const IBindHost, self), pMk, pBC, pBSC, riid, ppvObj); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInternet_Value = @import("../zig.zig").Guid.initString("79eac9e0-baf9-11ce-8c82-00aa004ba90b"); pub const IID_IInternet = &IID_IInternet_Value; pub const IInternet = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; pub const BINDSTRING = enum(i32) { HEADERS = 1, ACCEPT_MIMES = 2, EXTRA_URL = 3, LANGUAGE = 4, USERNAME = 5, PASSWORD = 6, UA_PIXELS = 7, UA_COLOR = 8, OS = 9, USER_AGENT = 10, ACCEPT_ENCODINGS = 11, POST_COOKIE = 12, POST_DATA_MIME = 13, URL = 14, IID = 15, FLAG_BIND_TO_OBJECT = 16, PTR_BIND_CONTEXT = 17, XDR_ORIGIN = 18, DOWNLOADPATH = 19, ROOTDOC_URL = 20, INITIAL_FILENAME = 21, PROXY_USERNAME = 22, PROXY_PASSWORD = 23, ENTERPRISE_ID = 24, DOC_URL = 25, SAMESITE_COOKIE_LEVEL = 26, }; pub const BINDSTRING_HEADERS = BINDSTRING.HEADERS; pub const BINDSTRING_ACCEPT_MIMES = BINDSTRING.ACCEPT_MIMES; pub const BINDSTRING_EXTRA_URL = BINDSTRING.EXTRA_URL; pub const BINDSTRING_LANGUAGE = BINDSTRING.LANGUAGE; pub const BINDSTRING_USERNAME = BINDSTRING.USERNAME; pub const BINDSTRING_PASSWORD = BINDSTRING.PASSWORD; pub const BINDSTRING_UA_PIXELS = BINDSTRING.UA_PIXELS; pub const BINDSTRING_UA_COLOR = BINDSTRING.UA_COLOR; pub const BINDSTRING_OS = BINDSTRING.OS; pub const BINDSTRING_USER_AGENT = BINDSTRING.USER_AGENT; pub const BINDSTRING_ACCEPT_ENCODINGS = BINDSTRING.ACCEPT_ENCODINGS; pub const BINDSTRING_POST_COOKIE = BINDSTRING.POST_COOKIE; pub const BINDSTRING_POST_DATA_MIME = BINDSTRING.POST_DATA_MIME; pub const BINDSTRING_URL = BINDSTRING.URL; pub const BINDSTRING_IID = BINDSTRING.IID; pub const BINDSTRING_FLAG_BIND_TO_OBJECT = BINDSTRING.FLAG_BIND_TO_OBJECT; pub const BINDSTRING_PTR_BIND_CONTEXT = BINDSTRING.PTR_BIND_CONTEXT; pub const BINDSTRING_XDR_ORIGIN = BINDSTRING.XDR_ORIGIN; pub const BINDSTRING_DOWNLOADPATH = BINDSTRING.DOWNLOADPATH; pub const BINDSTRING_ROOTDOC_URL = BINDSTRING.ROOTDOC_URL; pub const BINDSTRING_INITIAL_FILENAME = BINDSTRING.INITIAL_FILENAME; pub const BINDSTRING_PROXY_USERNAME = BINDSTRING.PROXY_USERNAME; pub const BINDSTRING_PROXY_PASSWORD = BINDSTRING.PROXY_PASSWORD; pub const BINDSTRING_ENTERPRISE_ID = BINDSTRING.ENTERPRISE_ID; pub const BINDSTRING_DOC_URL = BINDSTRING.DOC_URL; pub const BINDSTRING_SAMESITE_COOKIE_LEVEL = BINDSTRING.SAMESITE_COOKIE_LEVEL; const IID_IInternetBindInfo_Value = @import("../zig.zig").Guid.initString("79eac9e1-baf9-11ce-8c82-00aa004ba90b"); pub const IID_IInternetBindInfo = &IID_IInternetBindInfo_Value; pub const IInternetBindInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetBindInfo: fn( self: *const IInternetBindInfo, grfBINDF: ?*u32, pbindinfo: ?*BINDINFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBindString: fn( self: *const IInternetBindInfo, ulStringType: u32, ppwzStr: ?*?PWSTR, cEl: u32, pcElFetched: ?*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 IInternetBindInfo_GetBindInfo(self: *const T, grfBINDF: ?*u32, pbindinfo: ?*BINDINFO) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetBindInfo.VTable, self.vtable).GetBindInfo(@ptrCast(*const IInternetBindInfo, self), grfBINDF, pbindinfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetBindInfo_GetBindString(self: *const T, ulStringType: u32, ppwzStr: ?*?PWSTR, cEl: u32, pcElFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetBindInfo.VTable, self.vtable).GetBindString(@ptrCast(*const IInternetBindInfo, self), ulStringType, ppwzStr, cEl, pcElFetched); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInternetBindInfoEx_Value = @import("../zig.zig").Guid.initString("a3e015b7-a82c-4dcd-a150-569aeeed36ab"); pub const IID_IInternetBindInfoEx = &IID_IInternetBindInfoEx_Value; pub const IInternetBindInfoEx = extern struct { pub const VTable = extern struct { base: IInternetBindInfo.VTable, GetBindInfoEx: fn( self: *const IInternetBindInfoEx, grfBINDF: ?*u32, pbindinfo: ?*BINDINFO, grfBINDF2: ?*u32, pdwReserved: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IInternetBindInfo.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetBindInfoEx_GetBindInfoEx(self: *const T, grfBINDF: ?*u32, pbindinfo: ?*BINDINFO, grfBINDF2: ?*u32, pdwReserved: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetBindInfoEx.VTable, self.vtable).GetBindInfoEx(@ptrCast(*const IInternetBindInfoEx, self), grfBINDF, pbindinfo, grfBINDF2, pdwReserved); } };} pub usingnamespace MethodMixin(@This()); }; pub const PI_FLAGS = enum(i32) { I_PARSE_URL = 1, I_FILTER_MODE = 2, I_FORCE_ASYNC = 4, I_USE_WORKERTHREAD = 8, I_MIMEVERIFICATION = 16, I_CLSIDLOOKUP = 32, I_DATAPROGRESS = 64, I_SYNCHRONOUS = 128, I_APARTMENTTHREADED = 256, I_CLASSINSTALL = 512, I_PASSONBINDCTX = 8192, I_NOMIMEHANDLER = 32768, I_LOADAPPDIRECT = 16384, D_FORCE_SWITCH = 65536, I_PREFERDEFAULTHANDLER = 131072, }; pub const PI_PARSE_URL = PI_FLAGS.I_PARSE_URL; pub const PI_FILTER_MODE = PI_FLAGS.I_FILTER_MODE; pub const PI_FORCE_ASYNC = PI_FLAGS.I_FORCE_ASYNC; pub const PI_USE_WORKERTHREAD = PI_FLAGS.I_USE_WORKERTHREAD; pub const PI_MIMEVERIFICATION = PI_FLAGS.I_MIMEVERIFICATION; pub const PI_CLSIDLOOKUP = PI_FLAGS.I_CLSIDLOOKUP; pub const PI_DATAPROGRESS = PI_FLAGS.I_DATAPROGRESS; pub const PI_SYNCHRONOUS = PI_FLAGS.I_SYNCHRONOUS; pub const PI_APARTMENTTHREADED = PI_FLAGS.I_APARTMENTTHREADED; pub const PI_CLASSINSTALL = PI_FLAGS.I_CLASSINSTALL; pub const PI_PASSONBINDCTX = PI_FLAGS.I_PASSONBINDCTX; pub const PI_NOMIMEHANDLER = PI_FLAGS.I_NOMIMEHANDLER; pub const PI_LOADAPPDIRECT = PI_FLAGS.I_LOADAPPDIRECT; pub const PD_FORCE_SWITCH = PI_FLAGS.D_FORCE_SWITCH; pub const PI_PREFERDEFAULTHANDLER = PI_FLAGS.I_PREFERDEFAULTHANDLER; pub const PROTOCOLDATA = extern struct { grfFlags: u32, dwState: u32, pData: ?*c_void, cbData: u32, }; pub const StartParam = extern struct { iid: Guid, pIBindCtx: ?*IBindCtx, pItf: ?*IUnknown, }; const IID_IInternetProtocolRoot_Value = @import("../zig.zig").Guid.initString("79eac9e3-baf9-11ce-8c82-00aa004ba90b"); pub const IID_IInternetProtocolRoot = &IID_IInternetProtocolRoot_Value; pub const IInternetProtocolRoot = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Start: fn( self: *const IInternetProtocolRoot, szUrl: ?[*:0]const u16, pOIProtSink: ?*IInternetProtocolSink, pOIBindInfo: ?*IInternetBindInfo, grfPI: u32, dwReserved: HANDLE_PTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Continue: fn( self: *const IInternetProtocolRoot, pProtocolData: ?*PROTOCOLDATA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Abort: fn( self: *const IInternetProtocolRoot, hrReason: HRESULT, dwOptions: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Terminate: fn( self: *const IInternetProtocolRoot, dwOptions: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Suspend: fn( self: *const IInternetProtocolRoot, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Resume: fn( self: *const IInternetProtocolRoot, ) 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 IInternetProtocolRoot_Start(self: *const T, szUrl: ?[*:0]const u16, pOIProtSink: ?*IInternetProtocolSink, pOIBindInfo: ?*IInternetBindInfo, grfPI: u32, dwReserved: HANDLE_PTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocolRoot.VTable, self.vtable).Start(@ptrCast(*const IInternetProtocolRoot, self), szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocolRoot_Continue(self: *const T, pProtocolData: ?*PROTOCOLDATA) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocolRoot.VTable, self.vtable).Continue(@ptrCast(*const IInternetProtocolRoot, self), pProtocolData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocolRoot_Abort(self: *const T, hrReason: HRESULT, dwOptions: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocolRoot.VTable, self.vtable).Abort(@ptrCast(*const IInternetProtocolRoot, self), hrReason, dwOptions); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocolRoot_Terminate(self: *const T, dwOptions: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocolRoot.VTable, self.vtable).Terminate(@ptrCast(*const IInternetProtocolRoot, self), dwOptions); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocolRoot_Suspend(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocolRoot.VTable, self.vtable).Suspend(@ptrCast(*const IInternetProtocolRoot, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocolRoot_Resume(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocolRoot.VTable, self.vtable).Resume(@ptrCast(*const IInternetProtocolRoot, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInternetProtocol_Value = @import("../zig.zig").Guid.initString("79eac9e4-baf9-11ce-8c82-00aa004ba90b"); pub const IID_IInternetProtocol = &IID_IInternetProtocol_Value; pub const IInternetProtocol = extern struct { pub const VTable = extern struct { base: IInternetProtocolRoot.VTable, Read: fn( self: *const IInternetProtocol, pv: [*]u8, cb: u32, pcbRead: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Seek: fn( self: *const IInternetProtocol, dlibMove: LARGE_INTEGER, dwOrigin: u32, plibNewPosition: ?*ULARGE_INTEGER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, LockRequest: fn( self: *const IInternetProtocol, dwOptions: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnlockRequest: fn( self: *const IInternetProtocol, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IInternetProtocolRoot.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocol_Read(self: *const T, pv: [*]u8, cb: u32, pcbRead: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocol.VTable, self.vtable).Read(@ptrCast(*const IInternetProtocol, self), pv, cb, pcbRead); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocol_Seek(self: *const T, dlibMove: LARGE_INTEGER, dwOrigin: u32, plibNewPosition: ?*ULARGE_INTEGER) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocol.VTable, self.vtable).Seek(@ptrCast(*const IInternetProtocol, self), dlibMove, dwOrigin, plibNewPosition); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocol_LockRequest(self: *const T, dwOptions: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocol.VTable, self.vtable).LockRequest(@ptrCast(*const IInternetProtocol, self), dwOptions); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocol_UnlockRequest(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocol.VTable, self.vtable).UnlockRequest(@ptrCast(*const IInternetProtocol, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInternetProtocolEx_Value = @import("../zig.zig").Guid.initString("c7a98e66-1010-492c-a1c8-c809e1f75905"); pub const IID_IInternetProtocolEx = &IID_IInternetProtocolEx_Value; pub const IInternetProtocolEx = extern struct { pub const VTable = extern struct { base: IInternetProtocol.VTable, StartEx: fn( self: *const IInternetProtocolEx, pUri: ?*IUri, pOIProtSink: ?*IInternetProtocolSink, pOIBindInfo: ?*IInternetBindInfo, grfPI: u32, dwReserved: HANDLE_PTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IInternetProtocol.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocolEx_StartEx(self: *const T, pUri: ?*IUri, pOIProtSink: ?*IInternetProtocolSink, pOIBindInfo: ?*IInternetBindInfo, grfPI: u32, dwReserved: HANDLE_PTR) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocolEx.VTable, self.vtable).StartEx(@ptrCast(*const IInternetProtocolEx, self), pUri, pOIProtSink, pOIBindInfo, grfPI, dwReserved); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInternetProtocolSink_Value = @import("../zig.zig").Guid.initString("79eac9e5-baf9-11ce-8c82-00aa004ba90b"); pub const IID_IInternetProtocolSink = &IID_IInternetProtocolSink_Value; pub const IInternetProtocolSink = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Switch: fn( self: *const IInternetProtocolSink, pProtocolData: ?*PROTOCOLDATA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReportProgress: fn( self: *const IInternetProtocolSink, ulStatusCode: u32, szStatusText: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReportData: fn( self: *const IInternetProtocolSink, grfBSCF: u32, ulProgress: u32, ulProgressMax: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReportResult: fn( self: *const IInternetProtocolSink, hrResult: HRESULT, dwError: u32, szResult: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocolSink_Switch(self: *const T, pProtocolData: ?*PROTOCOLDATA) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocolSink.VTable, self.vtable).Switch(@ptrCast(*const IInternetProtocolSink, self), pProtocolData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocolSink_ReportProgress(self: *const T, ulStatusCode: u32, szStatusText: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocolSink.VTable, self.vtable).ReportProgress(@ptrCast(*const IInternetProtocolSink, self), ulStatusCode, szStatusText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocolSink_ReportData(self: *const T, grfBSCF: u32, ulProgress: u32, ulProgressMax: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocolSink.VTable, self.vtable).ReportData(@ptrCast(*const IInternetProtocolSink, self), grfBSCF, ulProgress, ulProgressMax); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocolSink_ReportResult(self: *const T, hrResult: HRESULT, dwError: u32, szResult: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocolSink.VTable, self.vtable).ReportResult(@ptrCast(*const IInternetProtocolSink, self), hrResult, dwError, szResult); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInternetProtocolSinkStackable_Value = @import("../zig.zig").Guid.initString("79eac9f0-baf9-11ce-8c82-00aa004ba90b"); pub const IID_IInternetProtocolSinkStackable = &IID_IInternetProtocolSinkStackable_Value; pub const IInternetProtocolSinkStackable = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SwitchSink: fn( self: *const IInternetProtocolSinkStackable, pOIProtSink: ?*IInternetProtocolSink, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CommitSwitch: fn( self: *const IInternetProtocolSinkStackable, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RollbackSwitch: fn( self: *const IInternetProtocolSinkStackable, ) 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 IInternetProtocolSinkStackable_SwitchSink(self: *const T, pOIProtSink: ?*IInternetProtocolSink) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocolSinkStackable.VTable, self.vtable).SwitchSink(@ptrCast(*const IInternetProtocolSinkStackable, self), pOIProtSink); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocolSinkStackable_CommitSwitch(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocolSinkStackable.VTable, self.vtable).CommitSwitch(@ptrCast(*const IInternetProtocolSinkStackable, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocolSinkStackable_RollbackSwitch(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocolSinkStackable.VTable, self.vtable).RollbackSwitch(@ptrCast(*const IInternetProtocolSinkStackable, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const OIBDG_FLAGS = enum(i32) { APARTMENTTHREADED = 256, DATAONLY = 4096, }; pub const OIBDG_APARTMENTTHREADED = OIBDG_FLAGS.APARTMENTTHREADED; pub const OIBDG_DATAONLY = OIBDG_FLAGS.DATAONLY; const IID_IInternetSession_Value = @import("../zig.zig").Guid.initString("79eac9e7-baf9-11ce-8c82-00aa004ba90b"); pub const IID_IInternetSession = &IID_IInternetSession_Value; pub const IInternetSession = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, RegisterNameSpace: fn( self: *const IInternetSession, pCF: ?*IClassFactory, rclsid: ?*const Guid, pwzProtocol: ?[*:0]const u16, cPatterns: u32, ppwzPatterns: ?*const ?PWSTR, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnregisterNameSpace: fn( self: *const IInternetSession, pCF: ?*IClassFactory, pszProtocol: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterMimeFilter: fn( self: *const IInternetSession, pCF: ?*IClassFactory, rclsid: ?*const Guid, pwzType: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnregisterMimeFilter: fn( self: *const IInternetSession, pCF: ?*IClassFactory, pwzType: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateBinding: fn( self: *const IInternetSession, pBC: ?*IBindCtx, szUrl: ?[*:0]const u16, pUnkOuter: ?*IUnknown, ppUnk: ?*?*IUnknown, ppOInetProt: ?*?*IInternetProtocol, dwOption: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSessionOption: fn( self: *const IInternetSession, dwOption: u32, pBuffer: ?*c_void, dwBufferLength: u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSessionOption: fn( self: *const IInternetSession, dwOption: u32, pBuffer: ?*c_void, pdwBufferLength: ?*u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSession_RegisterNameSpace(self: *const T, pCF: ?*IClassFactory, rclsid: ?*const Guid, pwzProtocol: ?[*:0]const u16, cPatterns: u32, ppwzPatterns: ?*const ?PWSTR, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSession.VTable, self.vtable).RegisterNameSpace(@ptrCast(*const IInternetSession, self), pCF, rclsid, pwzProtocol, cPatterns, ppwzPatterns, dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSession_UnregisterNameSpace(self: *const T, pCF: ?*IClassFactory, pszProtocol: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSession.VTable, self.vtable).UnregisterNameSpace(@ptrCast(*const IInternetSession, self), pCF, pszProtocol); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSession_RegisterMimeFilter(self: *const T, pCF: ?*IClassFactory, rclsid: ?*const Guid, pwzType: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSession.VTable, self.vtable).RegisterMimeFilter(@ptrCast(*const IInternetSession, self), pCF, rclsid, pwzType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSession_UnregisterMimeFilter(self: *const T, pCF: ?*IClassFactory, pwzType: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSession.VTable, self.vtable).UnregisterMimeFilter(@ptrCast(*const IInternetSession, self), pCF, pwzType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSession_CreateBinding(self: *const T, pBC: ?*IBindCtx, szUrl: ?[*:0]const u16, pUnkOuter: ?*IUnknown, ppUnk: ?*?*IUnknown, ppOInetProt: ?*?*IInternetProtocol, dwOption: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSession.VTable, self.vtable).CreateBinding(@ptrCast(*const IInternetSession, self), pBC, szUrl, pUnkOuter, ppUnk, ppOInetProt, dwOption); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSession_SetSessionOption(self: *const T, dwOption: u32, pBuffer: ?*c_void, dwBufferLength: u32, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSession.VTable, self.vtable).SetSessionOption(@ptrCast(*const IInternetSession, self), dwOption, pBuffer, dwBufferLength, dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSession_GetSessionOption(self: *const T, dwOption: u32, pBuffer: ?*c_void, pdwBufferLength: ?*u32, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSession.VTable, self.vtable).GetSessionOption(@ptrCast(*const IInternetSession, self), dwOption, pBuffer, pdwBufferLength, dwReserved); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInternetThreadSwitch_Value = @import("../zig.zig").Guid.initString("79eac9e8-baf9-11ce-8c82-00aa004ba90b"); pub const IID_IInternetThreadSwitch = &IID_IInternetThreadSwitch_Value; pub const IInternetThreadSwitch = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Prepare: fn( self: *const IInternetThreadSwitch, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Continue: fn( self: *const IInternetThreadSwitch, ) 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 IInternetThreadSwitch_Prepare(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetThreadSwitch.VTable, self.vtable).Prepare(@ptrCast(*const IInternetThreadSwitch, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetThreadSwitch_Continue(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetThreadSwitch.VTable, self.vtable).Continue(@ptrCast(*const IInternetThreadSwitch, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInternetPriority_Value = @import("../zig.zig").Guid.initString("79eac9eb-baf9-11ce-8c82-00aa004ba90b"); pub const IID_IInternetPriority = &IID_IInternetPriority_Value; pub const IInternetPriority = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetPriority: fn( self: *const IInternetPriority, nPriority: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPriority: fn( self: *const IInternetPriority, pnPriority: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetPriority_SetPriority(self: *const T, nPriority: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetPriority.VTable, self.vtable).SetPriority(@ptrCast(*const IInternetPriority, self), nPriority); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetPriority_GetPriority(self: *const T, pnPriority: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetPriority.VTable, self.vtable).GetPriority(@ptrCast(*const IInternetPriority, self), pnPriority); } };} pub usingnamespace MethodMixin(@This()); }; pub const PARSEACTION = enum(i32) { CANONICALIZE = 1, FRIENDLY = 2, SECURITY_URL = 3, ROOTDOCUMENT = 4, DOCUMENT = 5, ANCHOR = 6, ENCODE_IS_UNESCAPE = 7, DECODE_IS_ESCAPE = 8, PATH_FROM_URL = 9, URL_FROM_PATH = 10, MIME = 11, SERVER = 12, SCHEMA = 13, SITE = 14, DOMAIN = 15, LOCATION = 16, SECURITY_DOMAIN = 17, ESCAPE = 18, UNESCAPE = 19, }; pub const PARSE_CANONICALIZE = PARSEACTION.CANONICALIZE; pub const PARSE_FRIENDLY = PARSEACTION.FRIENDLY; pub const PARSE_SECURITY_URL = PARSEACTION.SECURITY_URL; pub const PARSE_ROOTDOCUMENT = PARSEACTION.ROOTDOCUMENT; pub const PARSE_DOCUMENT = PARSEACTION.DOCUMENT; pub const PARSE_ANCHOR = PARSEACTION.ANCHOR; pub const PARSE_ENCODE_IS_UNESCAPE = PARSEACTION.ENCODE_IS_UNESCAPE; pub const PARSE_DECODE_IS_ESCAPE = PARSEACTION.DECODE_IS_ESCAPE; pub const PARSE_PATH_FROM_URL = PARSEACTION.PATH_FROM_URL; pub const PARSE_URL_FROM_PATH = PARSEACTION.URL_FROM_PATH; pub const PARSE_MIME = PARSEACTION.MIME; pub const PARSE_SERVER = PARSEACTION.SERVER; pub const PARSE_SCHEMA = PARSEACTION.SCHEMA; pub const PARSE_SITE = PARSEACTION.SITE; pub const PARSE_DOMAIN = PARSEACTION.DOMAIN; pub const PARSE_LOCATION = PARSEACTION.LOCATION; pub const PARSE_SECURITY_DOMAIN = PARSEACTION.SECURITY_DOMAIN; pub const PARSE_ESCAPE = PARSEACTION.ESCAPE; pub const PARSE_UNESCAPE = PARSEACTION.UNESCAPE; pub const PSUACTION = enum(i32) { DEFAULT = 1, SECURITY_URL_ONLY = 2, }; pub const PSU_DEFAULT = PSUACTION.DEFAULT; pub const PSU_SECURITY_URL_ONLY = PSUACTION.SECURITY_URL_ONLY; pub const QUERYOPTION = enum(i32) { EXPIRATION_DATE = 1, TIME_OF_LAST_CHANGE = 2, CONTENT_ENCODING = 3, CONTENT_TYPE = 4, REFRESH = 5, RECOMBINE = 6, CAN_NAVIGATE = 7, USES_NETWORK = 8, IS_CACHED = 9, IS_INSTALLEDENTRY = 10, IS_CACHED_OR_MAPPED = 11, USES_CACHE = 12, IS_SECURE = 13, IS_SAFE = 14, USES_HISTORYFOLDER = 15, IS_CACHED_AND_USABLE_OFFLINE = 16, }; pub const QUERY_EXPIRATION_DATE = QUERYOPTION.EXPIRATION_DATE; pub const QUERY_TIME_OF_LAST_CHANGE = QUERYOPTION.TIME_OF_LAST_CHANGE; pub const QUERY_CONTENT_ENCODING = QUERYOPTION.CONTENT_ENCODING; pub const QUERY_CONTENT_TYPE = QUERYOPTION.CONTENT_TYPE; pub const QUERY_REFRESH = QUERYOPTION.REFRESH; pub const QUERY_RECOMBINE = QUERYOPTION.RECOMBINE; pub const QUERY_CAN_NAVIGATE = QUERYOPTION.CAN_NAVIGATE; pub const QUERY_USES_NETWORK = QUERYOPTION.USES_NETWORK; pub const QUERY_IS_CACHED = QUERYOPTION.IS_CACHED; pub const QUERY_IS_INSTALLEDENTRY = QUERYOPTION.IS_INSTALLEDENTRY; pub const QUERY_IS_CACHED_OR_MAPPED = QUERYOPTION.IS_CACHED_OR_MAPPED; pub const QUERY_USES_CACHE = QUERYOPTION.USES_CACHE; pub const QUERY_IS_SECURE = QUERYOPTION.IS_SECURE; pub const QUERY_IS_SAFE = QUERYOPTION.IS_SAFE; pub const QUERY_USES_HISTORYFOLDER = QUERYOPTION.USES_HISTORYFOLDER; pub const QUERY_IS_CACHED_AND_USABLE_OFFLINE = QUERYOPTION.IS_CACHED_AND_USABLE_OFFLINE; const IID_IInternetProtocolInfo_Value = @import("../zig.zig").Guid.initString("79eac9ec-baf9-11ce-8c82-00aa004ba90b"); pub const IID_IInternetProtocolInfo = &IID_IInternetProtocolInfo_Value; pub const IInternetProtocolInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ParseUrl: fn( self: *const IInternetProtocolInfo, pwzUrl: ?[*:0]const u16, ParseAction: PARSEACTION, dwParseFlags: u32, pwzResult: ?PWSTR, cchResult: u32, pcchResult: ?*u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CombineUrl: fn( self: *const IInternetProtocolInfo, pwzBaseUrl: ?[*:0]const u16, pwzRelativeUrl: ?[*:0]const u16, dwCombineFlags: u32, pwzResult: ?PWSTR, cchResult: u32, pcchResult: ?*u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CompareUrl: fn( self: *const IInternetProtocolInfo, pwzUrl1: ?[*:0]const u16, pwzUrl2: ?[*:0]const u16, dwCompareFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, QueryInfo: fn( self: *const IInternetProtocolInfo, pwzUrl: ?[*:0]const u16, OueryOption: QUERYOPTION, dwQueryFlags: u32, pBuffer: [*]u8, cbBuffer: u32, pcbBuf: ?*u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocolInfo_ParseUrl(self: *const T, pwzUrl: ?[*:0]const u16, ParseAction: PARSEACTION, dwParseFlags: u32, pwzResult: ?PWSTR, cchResult: u32, pcchResult: ?*u32, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocolInfo.VTable, self.vtable).ParseUrl(@ptrCast(*const IInternetProtocolInfo, self), pwzUrl, ParseAction, dwParseFlags, pwzResult, cchResult, pcchResult, dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocolInfo_CombineUrl(self: *const T, pwzBaseUrl: ?[*:0]const u16, pwzRelativeUrl: ?[*:0]const u16, dwCombineFlags: u32, pwzResult: ?PWSTR, cchResult: u32, pcchResult: ?*u32, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocolInfo.VTable, self.vtable).CombineUrl(@ptrCast(*const IInternetProtocolInfo, self), pwzBaseUrl, pwzRelativeUrl, dwCombineFlags, pwzResult, cchResult, pcchResult, dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocolInfo_CompareUrl(self: *const T, pwzUrl1: ?[*:0]const u16, pwzUrl2: ?[*:0]const u16, dwCompareFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocolInfo.VTable, self.vtable).CompareUrl(@ptrCast(*const IInternetProtocolInfo, self), pwzUrl1, pwzUrl2, dwCompareFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetProtocolInfo_QueryInfo(self: *const T, pwzUrl: ?[*:0]const u16, OueryOption: QUERYOPTION, dwQueryFlags: u32, pBuffer: [*]u8, cbBuffer: u32, pcbBuf: ?*u32, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetProtocolInfo.VTable, self.vtable).QueryInfo(@ptrCast(*const IInternetProtocolInfo, self), pwzUrl, OueryOption, dwQueryFlags, pBuffer, cbBuffer, pcbBuf, dwReserved); } };} pub usingnamespace MethodMixin(@This()); }; pub const INTERNETFEATURELIST = enum(i32) { OBJECT_CACHING = 0, ZONE_ELEVATION = 1, MIME_HANDLING = 2, MIME_SNIFFING = 3, WINDOW_RESTRICTIONS = 4, WEBOC_POPUPMANAGEMENT = 5, BEHAVIORS = 6, DISABLE_MK_PROTOCOL = 7, LOCALMACHINE_LOCKDOWN = 8, SECURITYBAND = 9, RESTRICT_ACTIVEXINSTALL = 10, VALIDATE_NAVIGATE_URL = 11, RESTRICT_FILEDOWNLOAD = 12, ADDON_MANAGEMENT = 13, PROTOCOL_LOCKDOWN = 14, HTTP_USERNAME_PASSWORD_DISABLE = 15, SAFE_BINDTOOBJECT = 16, UNC_SAVEDFILECHECK = 17, GET_URL_DOM_FILEPATH_UNENCODED = 18, TABBED_BROWSING = 19, SSLUX = 20, DISABLE_NAVIGATION_SOUNDS = 21, DISABLE_LEGACY_COMPRESSION = 22, FORCE_ADDR_AND_STATUS = 23, XMLHTTP = 24, DISABLE_TELNET_PROTOCOL = 25, FEEDS = 26, BLOCK_INPUT_PROMPTS = 27, ENTRY_COUNT = 28, }; pub const FEATURE_OBJECT_CACHING = INTERNETFEATURELIST.OBJECT_CACHING; pub const FEATURE_ZONE_ELEVATION = INTERNETFEATURELIST.ZONE_ELEVATION; pub const FEATURE_MIME_HANDLING = INTERNETFEATURELIST.MIME_HANDLING; pub const FEATURE_MIME_SNIFFING = INTERNETFEATURELIST.MIME_SNIFFING; pub const FEATURE_WINDOW_RESTRICTIONS = INTERNETFEATURELIST.WINDOW_RESTRICTIONS; pub const FEATURE_WEBOC_POPUPMANAGEMENT = INTERNETFEATURELIST.WEBOC_POPUPMANAGEMENT; pub const FEATURE_BEHAVIORS = INTERNETFEATURELIST.BEHAVIORS; pub const FEATURE_DISABLE_MK_PROTOCOL = INTERNETFEATURELIST.DISABLE_MK_PROTOCOL; pub const FEATURE_LOCALMACHINE_LOCKDOWN = INTERNETFEATURELIST.LOCALMACHINE_LOCKDOWN; pub const FEATURE_SECURITYBAND = INTERNETFEATURELIST.SECURITYBAND; pub const FEATURE_RESTRICT_ACTIVEXINSTALL = INTERNETFEATURELIST.RESTRICT_ACTIVEXINSTALL; pub const FEATURE_VALIDATE_NAVIGATE_URL = INTERNETFEATURELIST.VALIDATE_NAVIGATE_URL; pub const FEATURE_RESTRICT_FILEDOWNLOAD = INTERNETFEATURELIST.RESTRICT_FILEDOWNLOAD; pub const FEATURE_ADDON_MANAGEMENT = INTERNETFEATURELIST.ADDON_MANAGEMENT; pub const FEATURE_PROTOCOL_LOCKDOWN = INTERNETFEATURELIST.PROTOCOL_LOCKDOWN; pub const FEATURE_HTTP_USERNAME_PASSWORD_DISABLE = INTERNETFEATURELIST.HTTP_USERNAME_PASSWORD_DISABLE; pub const FEATURE_SAFE_BINDTOOBJECT = INTERNETFEATURELIST.SAFE_BINDTOOBJECT; pub const FEATURE_UNC_SAVEDFILECHECK = INTERNETFEATURELIST.UNC_SAVEDFILECHECK; pub const FEATURE_GET_URL_DOM_FILEPATH_UNENCODED = INTERNETFEATURELIST.GET_URL_DOM_FILEPATH_UNENCODED; pub const FEATURE_TABBED_BROWSING = INTERNETFEATURELIST.TABBED_BROWSING; pub const FEATURE_SSLUX = INTERNETFEATURELIST.SSLUX; pub const FEATURE_DISABLE_NAVIGATION_SOUNDS = INTERNETFEATURELIST.DISABLE_NAVIGATION_SOUNDS; pub const FEATURE_DISABLE_LEGACY_COMPRESSION = INTERNETFEATURELIST.DISABLE_LEGACY_COMPRESSION; pub const FEATURE_FORCE_ADDR_AND_STATUS = INTERNETFEATURELIST.FORCE_ADDR_AND_STATUS; pub const FEATURE_XMLHTTP = INTERNETFEATURELIST.XMLHTTP; pub const FEATURE_DISABLE_TELNET_PROTOCOL = INTERNETFEATURELIST.DISABLE_TELNET_PROTOCOL; pub const FEATURE_FEEDS = INTERNETFEATURELIST.FEEDS; pub const FEATURE_BLOCK_INPUT_PROMPTS = INTERNETFEATURELIST.BLOCK_INPUT_PROMPTS; pub const FEATURE_ENTRY_COUNT = INTERNETFEATURELIST.ENTRY_COUNT; const IID_IInternetSecurityMgrSite_Value = @import("../zig.zig").Guid.initString("79eac9ed-baf9-11ce-8c82-00aa004ba90b"); pub const IID_IInternetSecurityMgrSite = &IID_IInternetSecurityMgrSite_Value; pub const IInternetSecurityMgrSite = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetWindow: fn( self: *const IInternetSecurityMgrSite, phwnd: ?*?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnableModeless: fn( self: *const IInternetSecurityMgrSite, fEnable: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSecurityMgrSite_GetWindow(self: *const T, phwnd: ?*?HWND) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSecurityMgrSite.VTable, self.vtable).GetWindow(@ptrCast(*const IInternetSecurityMgrSite, self), phwnd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSecurityMgrSite_EnableModeless(self: *const T, fEnable: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSecurityMgrSite.VTable, self.vtable).EnableModeless(@ptrCast(*const IInternetSecurityMgrSite, self), fEnable); } };} pub usingnamespace MethodMixin(@This()); }; pub const PUAF = enum(i32) { DEFAULT = 0, NOUI = 1, ISFILE = 2, WARN_IF_DENIED = 4, FORCEUI_FOREGROUND = 8, CHECK_TIFS = 16, DONTCHECKBOXINDIALOG = 32, TRUSTED = 64, ACCEPT_WILDCARD_SCHEME = 128, ENFORCERESTRICTED = 256, NOSAVEDFILECHECK = 512, REQUIRESAVEDFILECHECK = 1024, DONT_USE_CACHE = 4096, RESERVED1 = 8192, RESERVED2 = 16384, LMZ_UNLOCKED = 65536, LMZ_LOCKED = 131072, DEFAULTZONEPOL = 262144, NPL_USE_LOCKED_IF_RESTRICTED = 524288, NOUIIFLOCKED = 1048576, DRAGPROTOCOLCHECK = 2097152, }; pub const PUAF_DEFAULT = PUAF.DEFAULT; pub const PUAF_NOUI = PUAF.NOUI; pub const PUAF_ISFILE = PUAF.ISFILE; pub const PUAF_WARN_IF_DENIED = PUAF.WARN_IF_DENIED; pub const PUAF_FORCEUI_FOREGROUND = PUAF.FORCEUI_FOREGROUND; pub const PUAF_CHECK_TIFS = PUAF.CHECK_TIFS; pub const PUAF_DONTCHECKBOXINDIALOG = PUAF.DONTCHECKBOXINDIALOG; pub const PUAF_TRUSTED = PUAF.TRUSTED; pub const PUAF_ACCEPT_WILDCARD_SCHEME = PUAF.ACCEPT_WILDCARD_SCHEME; pub const PUAF_ENFORCERESTRICTED = PUAF.ENFORCERESTRICTED; pub const PUAF_NOSAVEDFILECHECK = PUAF.NOSAVEDFILECHECK; pub const PUAF_REQUIRESAVEDFILECHECK = PUAF.REQUIRESAVEDFILECHECK; pub const PUAF_DONT_USE_CACHE = PUAF.DONT_USE_CACHE; pub const PUAF_RESERVED1 = PUAF.RESERVED1; pub const PUAF_RESERVED2 = PUAF.RESERVED2; pub const PUAF_LMZ_UNLOCKED = PUAF.LMZ_UNLOCKED; pub const PUAF_LMZ_LOCKED = PUAF.LMZ_LOCKED; pub const PUAF_DEFAULTZONEPOL = PUAF.DEFAULTZONEPOL; pub const PUAF_NPL_USE_LOCKED_IF_RESTRICTED = PUAF.NPL_USE_LOCKED_IF_RESTRICTED; pub const PUAF_NOUIIFLOCKED = PUAF.NOUIIFLOCKED; pub const PUAF_DRAGPROTOCOLCHECK = PUAF.DRAGPROTOCOLCHECK; pub const PUAFOUT = enum(i32) { DEFAULT = 0, ISLOCKZONEPOLICY = 1, }; pub const PUAFOUT_DEFAULT = PUAFOUT.DEFAULT; pub const PUAFOUT_ISLOCKZONEPOLICY = PUAFOUT.ISLOCKZONEPOLICY; pub const SZM_FLAGS = enum(i32) { CREATE = 0, DELETE = 1, }; pub const SZM_CREATE = SZM_FLAGS.CREATE; pub const SZM_DELETE = SZM_FLAGS.DELETE; const IID_IInternetSecurityManager_Value = @import("../zig.zig").Guid.initString("79eac9ee-baf9-11ce-8c82-00aa004ba90b"); pub const IID_IInternetSecurityManager = &IID_IInternetSecurityManager_Value; pub const IInternetSecurityManager = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetSecuritySite: fn( self: *const IInternetSecurityManager, pSite: ?*IInternetSecurityMgrSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSecuritySite: fn( self: *const IInternetSecurityManager, ppSite: ?*?*IInternetSecurityMgrSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MapUrlToZone: fn( self: *const IInternetSecurityManager, pwszUrl: ?[*:0]const u16, pdwZone: ?*u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSecurityId: fn( self: *const IInternetSecurityManager, pwszUrl: ?[*:0]const u16, pbSecurityId: *[512]u8, pcbSecurityId: ?*u32, dwReserved: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ProcessUrlAction: fn( self: *const IInternetSecurityManager, pwszUrl: ?[*:0]const u16, dwAction: u32, pPolicy: [*:0]u8, cbPolicy: u32, pContext: ?*u8, cbContext: u32, dwFlags: u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, QueryCustomPolicy: fn( self: *const IInternetSecurityManager, pwszUrl: ?[*:0]const u16, guidKey: ?*const Guid, ppPolicy: [*]?*u8, pcbPolicy: ?*u32, pContext: ?*u8, cbContext: u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetZoneMapping: fn( self: *const IInternetSecurityManager, dwZone: u32, lpszPattern: ?[*:0]const u16, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetZoneMappings: fn( self: *const IInternetSecurityManager, dwZone: u32, ppenumString: ?*?*IEnumString, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSecurityManager_SetSecuritySite(self: *const T, pSite: ?*IInternetSecurityMgrSite) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSecurityManager.VTable, self.vtable).SetSecuritySite(@ptrCast(*const IInternetSecurityManager, self), pSite); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSecurityManager_GetSecuritySite(self: *const T, ppSite: ?*?*IInternetSecurityMgrSite) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSecurityManager.VTable, self.vtable).GetSecuritySite(@ptrCast(*const IInternetSecurityManager, self), ppSite); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSecurityManager_MapUrlToZone(self: *const T, pwszUrl: ?[*:0]const u16, pdwZone: ?*u32, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSecurityManager.VTable, self.vtable).MapUrlToZone(@ptrCast(*const IInternetSecurityManager, self), pwszUrl, pdwZone, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSecurityManager_GetSecurityId(self: *const T, pwszUrl: ?[*:0]const u16, pbSecurityId: *[512]u8, pcbSecurityId: ?*u32, dwReserved: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSecurityManager.VTable, self.vtable).GetSecurityId(@ptrCast(*const IInternetSecurityManager, self), pwszUrl, pbSecurityId, pcbSecurityId, dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSecurityManager_ProcessUrlAction(self: *const T, pwszUrl: ?[*:0]const u16, dwAction: u32, pPolicy: [*:0]u8, cbPolicy: u32, pContext: ?*u8, cbContext: u32, dwFlags: u32, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSecurityManager.VTable, self.vtable).ProcessUrlAction(@ptrCast(*const IInternetSecurityManager, self), pwszUrl, dwAction, pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSecurityManager_QueryCustomPolicy(self: *const T, pwszUrl: ?[*:0]const u16, guidKey: ?*const Guid, ppPolicy: [*]?*u8, pcbPolicy: ?*u32, pContext: ?*u8, cbContext: u32, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSecurityManager.VTable, self.vtable).QueryCustomPolicy(@ptrCast(*const IInternetSecurityManager, self), pwszUrl, guidKey, ppPolicy, pcbPolicy, pContext, cbContext, dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSecurityManager_SetZoneMapping(self: *const T, dwZone: u32, lpszPattern: ?[*:0]const u16, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSecurityManager.VTable, self.vtable).SetZoneMapping(@ptrCast(*const IInternetSecurityManager, self), dwZone, lpszPattern, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSecurityManager_GetZoneMappings(self: *const T, dwZone: u32, ppenumString: ?*?*IEnumString, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSecurityManager.VTable, self.vtable).GetZoneMappings(@ptrCast(*const IInternetSecurityManager, self), dwZone, ppenumString, dwFlags); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInternetSecurityManagerEx_Value = @import("../zig.zig").Guid.initString("f164edf1-cc7c-4f0d-9a94-34222625c393"); pub const IID_IInternetSecurityManagerEx = &IID_IInternetSecurityManagerEx_Value; pub const IInternetSecurityManagerEx = extern struct { pub const VTable = extern struct { base: IInternetSecurityManager.VTable, ProcessUrlActionEx: fn( self: *const IInternetSecurityManagerEx, pwszUrl: ?[*:0]const u16, dwAction: u32, pPolicy: [*:0]u8, cbPolicy: u32, pContext: ?*u8, cbContext: u32, dwFlags: u32, dwReserved: u32, pdwOutFlags: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IInternetSecurityManager.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSecurityManagerEx_ProcessUrlActionEx(self: *const T, pwszUrl: ?[*:0]const u16, dwAction: u32, pPolicy: [*:0]u8, cbPolicy: u32, pContext: ?*u8, cbContext: u32, dwFlags: u32, dwReserved: u32, pdwOutFlags: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSecurityManagerEx.VTable, self.vtable).ProcessUrlActionEx(@ptrCast(*const IInternetSecurityManagerEx, self), pwszUrl, dwAction, pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved, pdwOutFlags); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInternetSecurityManagerEx2_Value = @import("../zig.zig").Guid.initString("f1e50292-a795-4117-8e09-2b560a72ac60"); pub const IID_IInternetSecurityManagerEx2 = &IID_IInternetSecurityManagerEx2_Value; pub const IInternetSecurityManagerEx2 = extern struct { pub const VTable = extern struct { base: IInternetSecurityManagerEx.VTable, MapUrlToZoneEx2: fn( self: *const IInternetSecurityManagerEx2, pUri: ?*IUri, pdwZone: ?*u32, dwFlags: u32, ppwszMappedUrl: ?*?PWSTR, pdwOutFlags: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ProcessUrlActionEx2: fn( self: *const IInternetSecurityManagerEx2, pUri: ?*IUri, dwAction: u32, pPolicy: [*:0]u8, cbPolicy: u32, pContext: ?*u8, cbContext: u32, dwFlags: u32, dwReserved: usize, pdwOutFlags: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSecurityIdEx2: fn( self: *const IInternetSecurityManagerEx2, pUri: ?*IUri, pbSecurityId: *[512]u8, pcbSecurityId: ?*u32, dwReserved: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, QueryCustomPolicyEx2: fn( self: *const IInternetSecurityManagerEx2, pUri: ?*IUri, guidKey: ?*const Guid, ppPolicy: [*]?*u8, pcbPolicy: ?*u32, pContext: ?*u8, cbContext: u32, dwReserved: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IInternetSecurityManagerEx.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSecurityManagerEx2_MapUrlToZoneEx2(self: *const T, pUri: ?*IUri, pdwZone: ?*u32, dwFlags: u32, ppwszMappedUrl: ?*?PWSTR, pdwOutFlags: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSecurityManagerEx2.VTable, self.vtable).MapUrlToZoneEx2(@ptrCast(*const IInternetSecurityManagerEx2, self), pUri, pdwZone, dwFlags, ppwszMappedUrl, pdwOutFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSecurityManagerEx2_ProcessUrlActionEx2(self: *const T, pUri: ?*IUri, dwAction: u32, pPolicy: [*:0]u8, cbPolicy: u32, pContext: ?*u8, cbContext: u32, dwFlags: u32, dwReserved: usize, pdwOutFlags: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSecurityManagerEx2.VTable, self.vtable).ProcessUrlActionEx2(@ptrCast(*const IInternetSecurityManagerEx2, self), pUri, dwAction, pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved, pdwOutFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSecurityManagerEx2_GetSecurityIdEx2(self: *const T, pUri: ?*IUri, pbSecurityId: *[512]u8, pcbSecurityId: ?*u32, dwReserved: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSecurityManagerEx2.VTable, self.vtable).GetSecurityIdEx2(@ptrCast(*const IInternetSecurityManagerEx2, self), pUri, pbSecurityId, pcbSecurityId, dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetSecurityManagerEx2_QueryCustomPolicyEx2(self: *const T, pUri: ?*IUri, guidKey: ?*const Guid, ppPolicy: [*]?*u8, pcbPolicy: ?*u32, pContext: ?*u8, cbContext: u32, dwReserved: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetSecurityManagerEx2.VTable, self.vtable).QueryCustomPolicyEx2(@ptrCast(*const IInternetSecurityManagerEx2, self), pUri, guidKey, ppPolicy, pcbPolicy, pContext, cbContext, dwReserved); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IZoneIdentifier_Value = @import("../zig.zig").Guid.initString("cd45f185-1b21-48e2-967b-ead743a8914e"); pub const IID_IZoneIdentifier = &IID_IZoneIdentifier_Value; pub const IZoneIdentifier = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetId: fn( self: *const IZoneIdentifier, pdwZone: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetId: fn( self: *const IZoneIdentifier, dwZone: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Remove: fn( self: *const IZoneIdentifier, ) 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 IZoneIdentifier_GetId(self: *const T, pdwZone: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IZoneIdentifier.VTable, self.vtable).GetId(@ptrCast(*const IZoneIdentifier, self), pdwZone); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IZoneIdentifier_SetId(self: *const T, dwZone: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IZoneIdentifier.VTable, self.vtable).SetId(@ptrCast(*const IZoneIdentifier, self), dwZone); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IZoneIdentifier_Remove(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IZoneIdentifier.VTable, self.vtable).Remove(@ptrCast(*const IZoneIdentifier, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IZoneIdentifier2_Value = @import("../zig.zig").Guid.initString("eb5e760c-09ef-45c0-b510-70830ce31e6a"); pub const IID_IZoneIdentifier2 = &IID_IZoneIdentifier2_Value; pub const IZoneIdentifier2 = extern struct { pub const VTable = extern struct { base: IZoneIdentifier.VTable, GetLastWriterPackageFamilyName: fn( self: *const IZoneIdentifier2, packageFamilyName: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetLastWriterPackageFamilyName: fn( self: *const IZoneIdentifier2, packageFamilyName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveLastWriterPackageFamilyName: fn( self: *const IZoneIdentifier2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAppZoneId: fn( self: *const IZoneIdentifier2, zone: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetAppZoneId: fn( self: *const IZoneIdentifier2, zone: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveAppZoneId: fn( self: *const IZoneIdentifier2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IZoneIdentifier.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IZoneIdentifier2_GetLastWriterPackageFamilyName(self: *const T, packageFamilyName: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IZoneIdentifier2.VTable, self.vtable).GetLastWriterPackageFamilyName(@ptrCast(*const IZoneIdentifier2, self), packageFamilyName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IZoneIdentifier2_SetLastWriterPackageFamilyName(self: *const T, packageFamilyName: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IZoneIdentifier2.VTable, self.vtable).SetLastWriterPackageFamilyName(@ptrCast(*const IZoneIdentifier2, self), packageFamilyName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IZoneIdentifier2_RemoveLastWriterPackageFamilyName(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IZoneIdentifier2.VTable, self.vtable).RemoveLastWriterPackageFamilyName(@ptrCast(*const IZoneIdentifier2, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IZoneIdentifier2_GetAppZoneId(self: *const T, zone: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IZoneIdentifier2.VTable, self.vtable).GetAppZoneId(@ptrCast(*const IZoneIdentifier2, self), zone); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IZoneIdentifier2_SetAppZoneId(self: *const T, zone: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IZoneIdentifier2.VTable, self.vtable).SetAppZoneId(@ptrCast(*const IZoneIdentifier2, self), zone); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IZoneIdentifier2_RemoveAppZoneId(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IZoneIdentifier2.VTable, self.vtable).RemoveAppZoneId(@ptrCast(*const IZoneIdentifier2, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInternetHostSecurityManager_Value = @import("../zig.zig").Guid.initString("3af280b6-cb3f-11d0-891e-00c04fb6bfc4"); pub const IID_IInternetHostSecurityManager = &IID_IInternetHostSecurityManager_Value; pub const IInternetHostSecurityManager = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetSecurityId: fn( self: *const IInternetHostSecurityManager, pbSecurityId: [*:0]u8, pcbSecurityId: ?*u32, dwReserved: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ProcessUrlAction: fn( self: *const IInternetHostSecurityManager, dwAction: u32, pPolicy: ?*u8, cbPolicy: u32, pContext: ?[*:0]u8, cbContext: u32, dwFlags: u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, QueryCustomPolicy: fn( self: *const IInternetHostSecurityManager, guidKey: ?*const Guid, ppPolicy: ?[*]?*u8, pcbPolicy: ?*u32, pContext: [*:0]u8, cbContext: u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetHostSecurityManager_GetSecurityId(self: *const T, pbSecurityId: [*:0]u8, pcbSecurityId: ?*u32, dwReserved: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetHostSecurityManager.VTable, self.vtable).GetSecurityId(@ptrCast(*const IInternetHostSecurityManager, self), pbSecurityId, pcbSecurityId, dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetHostSecurityManager_ProcessUrlAction(self: *const T, dwAction: u32, pPolicy: ?*u8, cbPolicy: u32, pContext: ?[*:0]u8, cbContext: u32, dwFlags: u32, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetHostSecurityManager.VTable, self.vtable).ProcessUrlAction(@ptrCast(*const IInternetHostSecurityManager, self), dwAction, pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetHostSecurityManager_QueryCustomPolicy(self: *const T, guidKey: ?*const Guid, ppPolicy: ?[*]?*u8, pcbPolicy: ?*u32, pContext: [*:0]u8, cbContext: u32, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetHostSecurityManager.VTable, self.vtable).QueryCustomPolicy(@ptrCast(*const IInternetHostSecurityManager, self), guidKey, ppPolicy, pcbPolicy, pContext, cbContext, dwReserved); } };} pub usingnamespace MethodMixin(@This()); }; pub const URLZONE = enum(i32) { INVALID = -1, PREDEFINED_MIN = 0, // LOCAL_MACHINE = 0, this enum value conflicts with PREDEFINED_MIN INTRANET = 1, TRUSTED = 2, INTERNET = 3, UNTRUSTED = 4, PREDEFINED_MAX = 999, USER_MIN = 1000, USER_MAX = 10000, }; pub const URLZONE_INVALID = URLZONE.INVALID; pub const URLZONE_PREDEFINED_MIN = URLZONE.PREDEFINED_MIN; pub const URLZONE_LOCAL_MACHINE = URLZONE.PREDEFINED_MIN; pub const URLZONE_INTRANET = URLZONE.INTRANET; pub const URLZONE_TRUSTED = URLZONE.TRUSTED; pub const URLZONE_INTERNET = URLZONE.INTERNET; pub const URLZONE_UNTRUSTED = URLZONE.UNTRUSTED; pub const URLZONE_PREDEFINED_MAX = URLZONE.PREDEFINED_MAX; pub const URLZONE_USER_MIN = URLZONE.USER_MIN; pub const URLZONE_USER_MAX = URLZONE.USER_MAX; pub const URLTEMPLATE = enum(i32) { CUSTOM = 0, PREDEFINED_MIN = 65536, // LOW = 65536, this enum value conflicts with PREDEFINED_MIN MEDLOW = 66816, MEDIUM = 69632, MEDHIGH = 70912, HIGH = 73728, PREDEFINED_MAX = 131072, }; pub const URLTEMPLATE_CUSTOM = URLTEMPLATE.CUSTOM; pub const URLTEMPLATE_PREDEFINED_MIN = URLTEMPLATE.PREDEFINED_MIN; pub const URLTEMPLATE_LOW = URLTEMPLATE.PREDEFINED_MIN; pub const URLTEMPLATE_MEDLOW = URLTEMPLATE.MEDLOW; pub const URLTEMPLATE_MEDIUM = URLTEMPLATE.MEDIUM; pub const URLTEMPLATE_MEDHIGH = URLTEMPLATE.MEDHIGH; pub const URLTEMPLATE_HIGH = URLTEMPLATE.HIGH; pub const URLTEMPLATE_PREDEFINED_MAX = URLTEMPLATE.PREDEFINED_MAX; pub const INET_ZONE_MANAGER_CONSTANTS = enum(i32) { PATH = 260, DESCRIPTION = 200, }; pub const MAX_ZONE_PATH = INET_ZONE_MANAGER_CONSTANTS.PATH; pub const MAX_ZONE_DESCRIPTION = INET_ZONE_MANAGER_CONSTANTS.DESCRIPTION; pub const ZAFLAGS = enum(i32) { CUSTOM_EDIT = 1, ADD_SITES = 2, REQUIRE_VERIFICATION = 4, INCLUDE_PROXY_OVERRIDE = 8, INCLUDE_INTRANET_SITES = 16, NO_UI = 32, SUPPORTS_VERIFICATION = 64, UNC_AS_INTRANET = 128, DETECT_INTRANET = 256, USE_LOCKED_ZONES = 65536, VERIFY_TEMPLATE_SETTINGS = 131072, NO_CACHE = 262144, }; pub const ZAFLAGS_CUSTOM_EDIT = ZAFLAGS.CUSTOM_EDIT; pub const ZAFLAGS_ADD_SITES = ZAFLAGS.ADD_SITES; pub const ZAFLAGS_REQUIRE_VERIFICATION = ZAFLAGS.REQUIRE_VERIFICATION; pub const ZAFLAGS_INCLUDE_PROXY_OVERRIDE = ZAFLAGS.INCLUDE_PROXY_OVERRIDE; pub const ZAFLAGS_INCLUDE_INTRANET_SITES = ZAFLAGS.INCLUDE_INTRANET_SITES; pub const ZAFLAGS_NO_UI = ZAFLAGS.NO_UI; pub const ZAFLAGS_SUPPORTS_VERIFICATION = ZAFLAGS.SUPPORTS_VERIFICATION; pub const ZAFLAGS_UNC_AS_INTRANET = ZAFLAGS.UNC_AS_INTRANET; pub const ZAFLAGS_DETECT_INTRANET = ZAFLAGS.DETECT_INTRANET; pub const ZAFLAGS_USE_LOCKED_ZONES = ZAFLAGS.USE_LOCKED_ZONES; pub const ZAFLAGS_VERIFY_TEMPLATE_SETTINGS = ZAFLAGS.VERIFY_TEMPLATE_SETTINGS; pub const ZAFLAGS_NO_CACHE = ZAFLAGS.NO_CACHE; pub const ZONEATTRIBUTES = extern struct { cbSize: u32, szDisplayName: [260]u16, szDescription: [200]u16, szIconPath: [260]u16, dwTemplateMinLevel: u32, dwTemplateRecommended: u32, dwTemplateCurrentLevel: u32, dwFlags: u32, }; pub const URLZONEREG = enum(i32) { DEFAULT = 0, HKLM = 1, HKCU = 2, }; pub const URLZONEREG_DEFAULT = URLZONEREG.DEFAULT; pub const URLZONEREG_HKLM = URLZONEREG.HKLM; pub const URLZONEREG_HKCU = URLZONEREG.HKCU; const IID_IInternetZoneManager_Value = @import("../zig.zig").Guid.initString("79eac9ef-baf9-11ce-8c82-00aa004ba90b"); pub const IID_IInternetZoneManager = &IID_IInternetZoneManager_Value; pub const IInternetZoneManager = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetZoneAttributes: fn( self: *const IInternetZoneManager, dwZone: u32, pZoneAttributes: ?*ZONEATTRIBUTES, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetZoneAttributes: fn( self: *const IInternetZoneManager, dwZone: u32, pZoneAttributes: ?*ZONEATTRIBUTES, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetZoneCustomPolicy: fn( self: *const IInternetZoneManager, dwZone: u32, guidKey: ?*const Guid, ppPolicy: ?*?*u8, pcbPolicy: ?*u32, urlZoneReg: URLZONEREG, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetZoneCustomPolicy: fn( self: *const IInternetZoneManager, dwZone: u32, guidKey: ?*const Guid, pPolicy: [*:0]u8, cbPolicy: u32, urlZoneReg: URLZONEREG, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetZoneActionPolicy: fn( self: *const IInternetZoneManager, dwZone: u32, dwAction: u32, pPolicy: [*:0]u8, cbPolicy: u32, urlZoneReg: URLZONEREG, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetZoneActionPolicy: fn( self: *const IInternetZoneManager, dwZone: u32, dwAction: u32, pPolicy: [*:0]u8, cbPolicy: u32, urlZoneReg: URLZONEREG, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PromptAction: fn( self: *const IInternetZoneManager, dwAction: u32, hwndParent: ?HWND, pwszUrl: ?[*:0]const u16, pwszText: ?[*:0]const u16, dwPromptFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, LogAction: fn( self: *const IInternetZoneManager, dwAction: u32, pwszUrl: ?[*:0]const u16, pwszText: ?[*:0]const u16, dwLogFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateZoneEnumerator: fn( self: *const IInternetZoneManager, pdwEnum: ?*u32, pdwCount: ?*u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetZoneAt: fn( self: *const IInternetZoneManager, dwEnum: u32, dwIndex: u32, pdwZone: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DestroyZoneEnumerator: fn( self: *const IInternetZoneManager, dwEnum: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CopyTemplatePoliciesToZone: fn( self: *const IInternetZoneManager, dwTemplate: u32, dwZone: u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetZoneManager_GetZoneAttributes(self: *const T, dwZone: u32, pZoneAttributes: ?*ZONEATTRIBUTES) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetZoneManager.VTable, self.vtable).GetZoneAttributes(@ptrCast(*const IInternetZoneManager, self), dwZone, pZoneAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetZoneManager_SetZoneAttributes(self: *const T, dwZone: u32, pZoneAttributes: ?*ZONEATTRIBUTES) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetZoneManager.VTable, self.vtable).SetZoneAttributes(@ptrCast(*const IInternetZoneManager, self), dwZone, pZoneAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetZoneManager_GetZoneCustomPolicy(self: *const T, dwZone: u32, guidKey: ?*const Guid, ppPolicy: ?*?*u8, pcbPolicy: ?*u32, urlZoneReg: URLZONEREG) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetZoneManager.VTable, self.vtable).GetZoneCustomPolicy(@ptrCast(*const IInternetZoneManager, self), dwZone, guidKey, ppPolicy, pcbPolicy, urlZoneReg); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetZoneManager_SetZoneCustomPolicy(self: *const T, dwZone: u32, guidKey: ?*const Guid, pPolicy: [*:0]u8, cbPolicy: u32, urlZoneReg: URLZONEREG) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetZoneManager.VTable, self.vtable).SetZoneCustomPolicy(@ptrCast(*const IInternetZoneManager, self), dwZone, guidKey, pPolicy, cbPolicy, urlZoneReg); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetZoneManager_GetZoneActionPolicy(self: *const T, dwZone: u32, dwAction: u32, pPolicy: [*:0]u8, cbPolicy: u32, urlZoneReg: URLZONEREG) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetZoneManager.VTable, self.vtable).GetZoneActionPolicy(@ptrCast(*const IInternetZoneManager, self), dwZone, dwAction, pPolicy, cbPolicy, urlZoneReg); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetZoneManager_SetZoneActionPolicy(self: *const T, dwZone: u32, dwAction: u32, pPolicy: [*:0]u8, cbPolicy: u32, urlZoneReg: URLZONEREG) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetZoneManager.VTable, self.vtable).SetZoneActionPolicy(@ptrCast(*const IInternetZoneManager, self), dwZone, dwAction, pPolicy, cbPolicy, urlZoneReg); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetZoneManager_PromptAction(self: *const T, dwAction: u32, hwndParent: ?HWND, pwszUrl: ?[*:0]const u16, pwszText: ?[*:0]const u16, dwPromptFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetZoneManager.VTable, self.vtable).PromptAction(@ptrCast(*const IInternetZoneManager, self), dwAction, hwndParent, pwszUrl, pwszText, dwPromptFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetZoneManager_LogAction(self: *const T, dwAction: u32, pwszUrl: ?[*:0]const u16, pwszText: ?[*:0]const u16, dwLogFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetZoneManager.VTable, self.vtable).LogAction(@ptrCast(*const IInternetZoneManager, self), dwAction, pwszUrl, pwszText, dwLogFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetZoneManager_CreateZoneEnumerator(self: *const T, pdwEnum: ?*u32, pdwCount: ?*u32, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetZoneManager.VTable, self.vtable).CreateZoneEnumerator(@ptrCast(*const IInternetZoneManager, self), pdwEnum, pdwCount, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetZoneManager_GetZoneAt(self: *const T, dwEnum: u32, dwIndex: u32, pdwZone: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetZoneManager.VTable, self.vtable).GetZoneAt(@ptrCast(*const IInternetZoneManager, self), dwEnum, dwIndex, pdwZone); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetZoneManager_DestroyZoneEnumerator(self: *const T, dwEnum: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetZoneManager.VTable, self.vtable).DestroyZoneEnumerator(@ptrCast(*const IInternetZoneManager, self), dwEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetZoneManager_CopyTemplatePoliciesToZone(self: *const T, dwTemplate: u32, dwZone: u32, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetZoneManager.VTable, self.vtable).CopyTemplatePoliciesToZone(@ptrCast(*const IInternetZoneManager, self), dwTemplate, dwZone, dwReserved); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInternetZoneManagerEx_Value = @import("../zig.zig").Guid.initString("a4c23339-8e06-431e-9bf4-7e711c085648"); pub const IID_IInternetZoneManagerEx = &IID_IInternetZoneManagerEx_Value; pub const IInternetZoneManagerEx = extern struct { pub const VTable = extern struct { base: IInternetZoneManager.VTable, GetZoneActionPolicyEx: fn( self: *const IInternetZoneManagerEx, dwZone: u32, dwAction: u32, pPolicy: [*:0]u8, cbPolicy: u32, urlZoneReg: URLZONEREG, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetZoneActionPolicyEx: fn( self: *const IInternetZoneManagerEx, dwZone: u32, dwAction: u32, pPolicy: [*:0]u8, cbPolicy: u32, urlZoneReg: URLZONEREG, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IInternetZoneManager.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetZoneManagerEx_GetZoneActionPolicyEx(self: *const T, dwZone: u32, dwAction: u32, pPolicy: [*:0]u8, cbPolicy: u32, urlZoneReg: URLZONEREG, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetZoneManagerEx.VTable, self.vtable).GetZoneActionPolicyEx(@ptrCast(*const IInternetZoneManagerEx, self), dwZone, dwAction, pPolicy, cbPolicy, urlZoneReg, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetZoneManagerEx_SetZoneActionPolicyEx(self: *const T, dwZone: u32, dwAction: u32, pPolicy: [*:0]u8, cbPolicy: u32, urlZoneReg: URLZONEREG, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetZoneManagerEx.VTable, self.vtable).SetZoneActionPolicyEx(@ptrCast(*const IInternetZoneManagerEx, self), dwZone, dwAction, pPolicy, cbPolicy, urlZoneReg, dwFlags); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInternetZoneManagerEx2_Value = @import("../zig.zig").Guid.initString("edc17559-dd5d-4846-8eef-8becba5a4abf"); pub const IID_IInternetZoneManagerEx2 = &IID_IInternetZoneManagerEx2_Value; pub const IInternetZoneManagerEx2 = extern struct { pub const VTable = extern struct { base: IInternetZoneManagerEx.VTable, GetZoneAttributesEx: fn( self: *const IInternetZoneManagerEx2, dwZone: u32, pZoneAttributes: ?*ZONEATTRIBUTES, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetZoneSecurityState: fn( self: *const IInternetZoneManagerEx2, dwZoneIndex: u32, fRespectPolicy: BOOL, pdwState: ?*u32, pfPolicyEncountered: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIESecurityState: fn( self: *const IInternetZoneManagerEx2, fRespectPolicy: BOOL, pdwState: ?*u32, pfPolicyEncountered: ?*BOOL, fNoCache: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FixUnsecureSettings: fn( self: *const IInternetZoneManagerEx2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IInternetZoneManagerEx.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetZoneManagerEx2_GetZoneAttributesEx(self: *const T, dwZone: u32, pZoneAttributes: ?*ZONEATTRIBUTES, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetZoneManagerEx2.VTable, self.vtable).GetZoneAttributesEx(@ptrCast(*const IInternetZoneManagerEx2, self), dwZone, pZoneAttributes, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetZoneManagerEx2_GetZoneSecurityState(self: *const T, dwZoneIndex: u32, fRespectPolicy: BOOL, pdwState: ?*u32, pfPolicyEncountered: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetZoneManagerEx2.VTable, self.vtable).GetZoneSecurityState(@ptrCast(*const IInternetZoneManagerEx2, self), dwZoneIndex, fRespectPolicy, pdwState, pfPolicyEncountered); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetZoneManagerEx2_GetIESecurityState(self: *const T, fRespectPolicy: BOOL, pdwState: ?*u32, pfPolicyEncountered: ?*BOOL, fNoCache: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetZoneManagerEx2.VTable, self.vtable).GetIESecurityState(@ptrCast(*const IInternetZoneManagerEx2, self), fRespectPolicy, pdwState, pfPolicyEncountered, fNoCache); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternetZoneManagerEx2_FixUnsecureSettings(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IInternetZoneManagerEx2.VTable, self.vtable).FixUnsecureSettings(@ptrCast(*const IInternetZoneManagerEx2, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const CODEBASEHOLD = extern struct { cbSize: u32, szDistUnit: ?PWSTR, szCodeBase: ?PWSTR, dwVersionMS: u32, dwVersionLS: u32, dwStyle: u32, }; const IID_ISoftDistExt_Value = @import("../zig.zig").Guid.initString("b15b8dc1-c7e1-11d0-8680-00aa00bdcb71"); pub const IID_ISoftDistExt = &IID_ISoftDistExt_Value; pub const ISoftDistExt = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ProcessSoftDist: fn( self: *const ISoftDistExt, szCDFURL: ?[*:0]const u16, pSoftDistElement: ?*IXMLElement, lpsdi: ?*SOFTDISTINFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFirstCodeBase: fn( self: *const ISoftDistExt, szCodeBase: ?*?PWSTR, dwMaxSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetNextCodeBase: fn( self: *const ISoftDistExt, szCodeBase: ?*?PWSTR, dwMaxSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AsyncInstallDistributionUnit: fn( self: *const ISoftDistExt, pbc: ?*IBindCtx, pvReserved: ?*c_void, flags: u32, lpcbh: ?*CODEBASEHOLD, ) 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 ISoftDistExt_ProcessSoftDist(self: *const T, szCDFURL: ?[*:0]const u16, pSoftDistElement: ?*IXMLElement, lpsdi: ?*SOFTDISTINFO) callconv(.Inline) HRESULT { return @ptrCast(*const ISoftDistExt.VTable, self.vtable).ProcessSoftDist(@ptrCast(*const ISoftDistExt, self), szCDFURL, pSoftDistElement, lpsdi); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISoftDistExt_GetFirstCodeBase(self: *const T, szCodeBase: ?*?PWSTR, dwMaxSize: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISoftDistExt.VTable, self.vtable).GetFirstCodeBase(@ptrCast(*const ISoftDistExt, self), szCodeBase, dwMaxSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISoftDistExt_GetNextCodeBase(self: *const T, szCodeBase: ?*?PWSTR, dwMaxSize: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISoftDistExt.VTable, self.vtable).GetNextCodeBase(@ptrCast(*const ISoftDistExt, self), szCodeBase, dwMaxSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISoftDistExt_AsyncInstallDistributionUnit(self: *const T, pbc: ?*IBindCtx, pvReserved: ?*c_void, flags: u32, lpcbh: ?*CODEBASEHOLD) callconv(.Inline) HRESULT { return @ptrCast(*const ISoftDistExt.VTable, self.vtable).AsyncInstallDistributionUnit(@ptrCast(*const ISoftDistExt, self), pbc, pvReserved, flags, lpcbh); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ICatalogFileInfo_Value = @import("../zig.zig").Guid.initString("711c7600-6b48-11d1-b403-00aa00b92af1"); pub const IID_ICatalogFileInfo = &IID_ICatalogFileInfo_Value; pub const ICatalogFileInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetCatalogFile: fn( self: *const ICatalogFileInfo, ppszCatalogFile: ?*?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetJavaTrust: fn( self: *const ICatalogFileInfo, ppJavaTrust: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICatalogFileInfo_GetCatalogFile(self: *const T, ppszCatalogFile: ?*?PSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICatalogFileInfo.VTable, self.vtable).GetCatalogFile(@ptrCast(*const ICatalogFileInfo, self), ppszCatalogFile); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICatalogFileInfo_GetJavaTrust(self: *const T, ppJavaTrust: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const ICatalogFileInfo.VTable, self.vtable).GetJavaTrust(@ptrCast(*const ICatalogFileInfo, self), ppJavaTrust); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDataFilter_Value = @import("../zig.zig").Guid.initString("69d14c80-c18e-11d0-a9ce-006097942311"); pub const IID_IDataFilter = &IID_IDataFilter_Value; pub const IDataFilter = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, DoEncode: fn( self: *const IDataFilter, dwFlags: u32, lInBufferSize: i32, pbInBuffer: [*:0]u8, lOutBufferSize: i32, pbOutBuffer: [*:0]u8, lInBytesAvailable: i32, plInBytesRead: ?*i32, plOutBytesWritten: ?*i32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DoDecode: fn( self: *const IDataFilter, dwFlags: u32, lInBufferSize: i32, pbInBuffer: [*:0]u8, lOutBufferSize: i32, pbOutBuffer: [*:0]u8, lInBytesAvailable: i32, plInBytesRead: ?*i32, plOutBytesWritten: ?*i32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetEncodingLevel: fn( self: *const IDataFilter, dwEncLevel: 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 IDataFilter_DoEncode(self: *const T, dwFlags: u32, lInBufferSize: i32, pbInBuffer: [*:0]u8, lOutBufferSize: i32, pbOutBuffer: [*:0]u8, lInBytesAvailable: i32, plInBytesRead: ?*i32, plOutBytesWritten: ?*i32, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDataFilter.VTable, self.vtable).DoEncode(@ptrCast(*const IDataFilter, self), dwFlags, lInBufferSize, pbInBuffer, lOutBufferSize, pbOutBuffer, lInBytesAvailable, plInBytesRead, plOutBytesWritten, dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDataFilter_DoDecode(self: *const T, dwFlags: u32, lInBufferSize: i32, pbInBuffer: [*:0]u8, lOutBufferSize: i32, pbOutBuffer: [*:0]u8, lInBytesAvailable: i32, plInBytesRead: ?*i32, plOutBytesWritten: ?*i32, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDataFilter.VTable, self.vtable).DoDecode(@ptrCast(*const IDataFilter, self), dwFlags, lInBufferSize, pbInBuffer, lOutBufferSize, pbOutBuffer, lInBytesAvailable, plInBytesRead, plOutBytesWritten, dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDataFilter_SetEncodingLevel(self: *const T, dwEncLevel: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDataFilter.VTable, self.vtable).SetEncodingLevel(@ptrCast(*const IDataFilter, self), dwEncLevel); } };} pub usingnamespace MethodMixin(@This()); }; pub const PROTOCOLFILTERDATA = extern struct { cbSize: u32, pProtocolSink: ?*IInternetProtocolSink, pProtocol: ?*IInternetProtocol, pUnk: ?*IUnknown, dwFilterFlags: u32, }; pub const DATAINFO = extern struct { ulTotalSize: u32, ulavrPacketSize: u32, ulConnectSpeed: u32, ulProcessorSpeed: u32, }; const IID_IEncodingFilterFactory_Value = @import("../zig.zig").Guid.initString("70bdde00-c18e-11d0-a9ce-006097942311"); pub const IID_IEncodingFilterFactory = &IID_IEncodingFilterFactory_Value; pub const IEncodingFilterFactory = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, FindBestFilter: fn( self: *const IEncodingFilterFactory, pwzCodeIn: ?[*:0]const u16, pwzCodeOut: ?[*:0]const u16, info: DATAINFO, ppDF: ?*?*IDataFilter, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDefaultFilter: fn( self: *const IEncodingFilterFactory, pwzCodeIn: ?[*:0]const u16, pwzCodeOut: ?[*:0]const u16, ppDF: ?*?*IDataFilter, ) 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 IEncodingFilterFactory_FindBestFilter(self: *const T, pwzCodeIn: ?[*:0]const u16, pwzCodeOut: ?[*:0]const u16, info: DATAINFO, ppDF: ?*?*IDataFilter) callconv(.Inline) HRESULT { return @ptrCast(*const IEncodingFilterFactory.VTable, self.vtable).FindBestFilter(@ptrCast(*const IEncodingFilterFactory, self), pwzCodeIn, pwzCodeOut, info, ppDF); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEncodingFilterFactory_GetDefaultFilter(self: *const T, pwzCodeIn: ?[*:0]const u16, pwzCodeOut: ?[*:0]const u16, ppDF: ?*?*IDataFilter) callconv(.Inline) HRESULT { return @ptrCast(*const IEncodingFilterFactory.VTable, self.vtable).GetDefaultFilter(@ptrCast(*const IEncodingFilterFactory, self), pwzCodeIn, pwzCodeOut, ppDF); } };} pub usingnamespace MethodMixin(@This()); }; pub const HIT_LOGGING_INFO = extern struct { dwStructSize: u32, lpszLoggedUrlName: ?PSTR, StartTime: SYSTEMTIME, EndTime: SYSTEMTIME, lpszExtendedInfo: ?PSTR, }; pub const CONFIRMSAFETY = extern struct { clsid: Guid, pUnk: ?*IUnknown, dwFlags: u32, }; const IID_IWrappedProtocol_Value = @import("../zig.zig").Guid.initString("53c84785-8425-4dc5-971b-e58d9c19f9b6"); pub const IID_IWrappedProtocol = &IID_IWrappedProtocol_Value; pub const IWrappedProtocol = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetWrapperCode: fn( self: *const IWrappedProtocol, pnCode: ?*i32, dwReserved: usize, ) 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 IWrappedProtocol_GetWrapperCode(self: *const T, pnCode: ?*i32, dwReserved: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IWrappedProtocol.VTable, self.vtable).GetWrapperCode(@ptrCast(*const IWrappedProtocol, self), pnCode, dwReserved); } };} pub usingnamespace MethodMixin(@This()); }; pub const BINDHANDLETYPES = enum(i32) { APPCACHE = 0, DEPENDENCY = 1, COUNT = 2, }; pub const BINDHANDLETYPES_APPCACHE = BINDHANDLETYPES.APPCACHE; pub const BINDHANDLETYPES_DEPENDENCY = BINDHANDLETYPES.DEPENDENCY; pub const BINDHANDLETYPES_COUNT = BINDHANDLETYPES.COUNT; const IID_IGetBindHandle_Value = @import("../zig.zig").Guid.initString("af0ff408-129d-4b20-91f0-02bd23d88352"); pub const IID_IGetBindHandle = &IID_IGetBindHandle_Value; pub const IGetBindHandle = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetBindHandle: fn( self: *const IGetBindHandle, enumRequestedHandle: BINDHANDLETYPES, pRetHandle: ?*?HANDLE, ) 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 IGetBindHandle_GetBindHandle(self: *const T, enumRequestedHandle: BINDHANDLETYPES, pRetHandle: ?*?HANDLE) callconv(.Inline) HRESULT { return @ptrCast(*const IGetBindHandle.VTable, self.vtable).GetBindHandle(@ptrCast(*const IGetBindHandle, self), enumRequestedHandle, pRetHandle); } };} pub usingnamespace MethodMixin(@This()); }; pub const PROTOCOL_ARGUMENT = extern struct { szMethod: ?[*:0]const u16, szTargetUrl: ?[*:0]const u16, }; const IID_IBindCallbackRedirect_Value = @import("../zig.zig").Guid.initString("11c81bc2-121e-4ed5-b9c4-b430bd54f2c0"); pub const IID_IBindCallbackRedirect = &IID_IBindCallbackRedirect_Value; pub const IBindCallbackRedirect = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Redirect: fn( self: *const IBindCallbackRedirect, lpcUrl: ?[*:0]const u16, vbCancel: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBindCallbackRedirect_Redirect(self: *const T, lpcUrl: ?[*:0]const u16, vbCancel: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IBindCallbackRedirect.VTable, self.vtable).Redirect(@ptrCast(*const IBindCallbackRedirect, self), lpcUrl, vbCancel); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IBindHttpSecurity_Value = @import("../zig.zig").Guid.initString("a9eda967-f50e-4a33-b358-206f6ef3086d"); pub const IID_IBindHttpSecurity = &IID_IBindHttpSecurity_Value; pub const IBindHttpSecurity = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetIgnoreCertMask: fn( self: *const IBindHttpSecurity, pdwIgnoreCertMask: ?*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 IBindHttpSecurity_GetIgnoreCertMask(self: *const T, pdwIgnoreCertMask: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IBindHttpSecurity.VTable, self.vtable).GetIgnoreCertMask(@ptrCast(*const IBindHttpSecurity, self), pdwIgnoreCertMask); } };} pub usingnamespace MethodMixin(@This()); }; pub const OLESTREAMVTBL = extern struct { Get: isize, Put: isize, }; pub const OLESTREAM = extern struct { lpstbl: ?*OLESTREAMVTBL, }; pub const STDMSHLFLAGS = enum(i32) { SERVER = 1, HANDLER = 2, }; pub const SMEXF_SERVER = STDMSHLFLAGS.SERVER; pub const SMEXF_HANDLER = STDMSHLFLAGS.HANDLER; pub const COWAIT_FLAGS = enum(i32) { DEFAULT = 0, WAITALL = 1, ALERTABLE = 2, INPUTAVAILABLE = 4, DISPATCH_CALLS = 8, DISPATCH_WINDOW_MESSAGES = 16, }; pub const COWAIT_DEFAULT = COWAIT_FLAGS.DEFAULT; pub const COWAIT_WAITALL = COWAIT_FLAGS.WAITALL; pub const COWAIT_ALERTABLE = COWAIT_FLAGS.ALERTABLE; pub const COWAIT_INPUTAVAILABLE = COWAIT_FLAGS.INPUTAVAILABLE; pub const COWAIT_DISPATCH_CALLS = COWAIT_FLAGS.DISPATCH_CALLS; pub const COWAIT_DISPATCH_WINDOW_MESSAGES = COWAIT_FLAGS.DISPATCH_WINDOW_MESSAGES; pub const CWMO_FLAGS = enum(i32) { EFAULT = 0, ISPATCH_CALLS = 1, ISPATCH_WINDOW_MESSAGES = 2, }; pub const CWMO_DEFAULT = CWMO_FLAGS.EFAULT; pub const CWMO_DISPATCH_CALLS = CWMO_FLAGS.ISPATCH_CALLS; pub const CWMO_DISPATCH_WINDOW_MESSAGES = CWMO_FLAGS.ISPATCH_WINDOW_MESSAGES; pub const LPFNGETCLASSOBJECT = fn( param0: ?*const Guid, param1: ?*const Guid, param2: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const LPFNCANUNLOADNOW = fn( ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const UASFLAGS = enum(i32) { NORMAL = 0, BLOCKED = 1, NOPARENTENABLE = 2, MASK = 3, }; pub const UAS_NORMAL = UASFLAGS.NORMAL; pub const UAS_BLOCKED = UASFLAGS.BLOCKED; pub const UAS_NOPARENTENABLE = UASFLAGS.NOPARENTENABLE; pub const UAS_MASK = UASFLAGS.MASK; pub const READYSTATE = enum(i32) { UNINITIALIZED = 0, LOADING = 1, LOADED = 2, INTERACTIVE = 3, COMPLETE = 4, }; pub const READYSTATE_UNINITIALIZED = READYSTATE.UNINITIALIZED; pub const READYSTATE_LOADING = READYSTATE.LOADING; pub const READYSTATE_LOADED = READYSTATE.LOADED; pub const READYSTATE_INTERACTIVE = READYSTATE.INTERACTIVE; pub const READYSTATE_COMPLETE = READYSTATE.COMPLETE; pub const CONNECTDATA = extern struct { pUnk: ?*IUnknown, dwCookie: u32, }; // TODO: this type is limited to platform 'windows5.0' const IID_IEnumConnections_Value = @import("../zig.zig").Guid.initString("b196b287-bab4-101a-b69c-00aa00341d07"); pub const IID_IEnumConnections = &IID_IEnumConnections_Value; pub const IEnumConnections = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumConnections, cConnections: u32, rgcd: [*]CONNECTDATA, pcFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumConnections, cConnections: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumConnections, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumConnections, ppEnum: ?*?*IEnumConnections, ) 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 IEnumConnections_Next(self: *const T, cConnections: u32, rgcd: [*]CONNECTDATA, pcFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumConnections.VTable, self.vtable).Next(@ptrCast(*const IEnumConnections, self), cConnections, rgcd, pcFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumConnections_Skip(self: *const T, cConnections: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumConnections.VTable, self.vtable).Skip(@ptrCast(*const IEnumConnections, self), cConnections); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumConnections_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumConnections.VTable, self.vtable).Reset(@ptrCast(*const IEnumConnections, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumConnections_Clone(self: *const T, ppEnum: ?*?*IEnumConnections) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumConnections.VTable, self.vtable).Clone(@ptrCast(*const IEnumConnections, self), ppEnum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IConnectionPoint_Value = @import("../zig.zig").Guid.initString("b196b286-bab4-101a-b69c-00aa00341d07"); pub const IID_IConnectionPoint = &IID_IConnectionPoint_Value; pub const IConnectionPoint = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetConnectionInterface: fn( self: *const IConnectionPoint, pIID: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConnectionPointContainer: fn( self: *const IConnectionPoint, ppCPC: ?*?*IConnectionPointContainer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Advise: fn( self: *const IConnectionPoint, pUnkSink: ?*IUnknown, pdwCookie: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unadvise: fn( self: *const IConnectionPoint, dwCookie: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumConnections: fn( self: *const IConnectionPoint, ppEnum: ?*?*IEnumConnections, ) 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 IConnectionPoint_GetConnectionInterface(self: *const T, pIID: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IConnectionPoint.VTable, self.vtable).GetConnectionInterface(@ptrCast(*const IConnectionPoint, self), pIID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IConnectionPoint_GetConnectionPointContainer(self: *const T, ppCPC: ?*?*IConnectionPointContainer) callconv(.Inline) HRESULT { return @ptrCast(*const IConnectionPoint.VTable, self.vtable).GetConnectionPointContainer(@ptrCast(*const IConnectionPoint, self), ppCPC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IConnectionPoint_Advise(self: *const T, pUnkSink: ?*IUnknown, pdwCookie: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IConnectionPoint.VTable, self.vtable).Advise(@ptrCast(*const IConnectionPoint, self), pUnkSink, pdwCookie); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IConnectionPoint_Unadvise(self: *const T, dwCookie: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IConnectionPoint.VTable, self.vtable).Unadvise(@ptrCast(*const IConnectionPoint, self), dwCookie); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IConnectionPoint_EnumConnections(self: *const T, ppEnum: ?*?*IEnumConnections) callconv(.Inline) HRESULT { return @ptrCast(*const IConnectionPoint.VTable, self.vtable).EnumConnections(@ptrCast(*const IConnectionPoint, self), ppEnum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IEnumConnectionPoints_Value = @import("../zig.zig").Guid.initString("b196b285-bab4-101a-b69c-00aa00341d07"); pub const IID_IEnumConnectionPoints = &IID_IEnumConnectionPoints_Value; pub const IEnumConnectionPoints = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumConnectionPoints, cConnections: u32, ppCP: [*]?*IConnectionPoint, pcFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumConnectionPoints, cConnections: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumConnectionPoints, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumConnectionPoints, ppEnum: ?*?*IEnumConnectionPoints, ) 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 IEnumConnectionPoints_Next(self: *const T, cConnections: u32, ppCP: [*]?*IConnectionPoint, pcFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumConnectionPoints.VTable, self.vtable).Next(@ptrCast(*const IEnumConnectionPoints, self), cConnections, ppCP, pcFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumConnectionPoints_Skip(self: *const T, cConnections: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumConnectionPoints.VTable, self.vtable).Skip(@ptrCast(*const IEnumConnectionPoints, self), cConnections); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumConnectionPoints_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumConnectionPoints.VTable, self.vtable).Reset(@ptrCast(*const IEnumConnectionPoints, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumConnectionPoints_Clone(self: *const T, ppEnum: ?*?*IEnumConnectionPoints) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumConnectionPoints.VTable, self.vtable).Clone(@ptrCast(*const IEnumConnectionPoints, self), ppEnum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IConnectionPointContainer_Value = @import("../zig.zig").Guid.initString("b196b284-bab4-101a-b69c-00aa00341d07"); pub const IID_IConnectionPointContainer = &IID_IConnectionPointContainer_Value; pub const IConnectionPointContainer = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, EnumConnectionPoints: fn( self: *const IConnectionPointContainer, ppEnum: ?*?*IEnumConnectionPoints, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FindConnectionPoint: fn( self: *const IConnectionPointContainer, riid: ?*const Guid, ppCP: ?*?*IConnectionPoint, ) 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 IConnectionPointContainer_EnumConnectionPoints(self: *const T, ppEnum: ?*?*IEnumConnectionPoints) callconv(.Inline) HRESULT { return @ptrCast(*const IConnectionPointContainer.VTable, self.vtable).EnumConnectionPoints(@ptrCast(*const IConnectionPointContainer, self), ppEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IConnectionPointContainer_FindConnectionPoint(self: *const T, riid: ?*const Guid, ppCP: ?*?*IConnectionPoint) callconv(.Inline) HRESULT { return @ptrCast(*const IConnectionPointContainer.VTable, self.vtable).FindConnectionPoint(@ptrCast(*const IConnectionPointContainer, self), riid, ppCP); } };} pub usingnamespace MethodMixin(@This()); }; pub const LICINFO = extern struct { cbLicInfo: i32, fRuntimeKeyAvail: BOOL, fLicVerified: BOOL, }; // TODO: this type is limited to platform 'windows5.0' const IID_IClassFactory2_Value = @import("../zig.zig").Guid.initString("b196b28f-bab4-101a-b69c-00aa00341d07"); pub const IID_IClassFactory2 = &IID_IClassFactory2_Value; pub const IClassFactory2 = extern struct { pub const VTable = extern struct { base: IClassFactory.VTable, GetLicInfo: fn( self: *const IClassFactory2, pLicInfo: ?*LICINFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RequestLicKey: fn( self: *const IClassFactory2, dwReserved: u32, pBstrKey: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateInstanceLic: fn( self: *const IClassFactory2, pUnkOuter: ?*IUnknown, pUnkReserved: ?*IUnknown, riid: ?*const Guid, bstrKey: ?BSTR, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IClassFactory.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IClassFactory2_GetLicInfo(self: *const T, pLicInfo: ?*LICINFO) callconv(.Inline) HRESULT { return @ptrCast(*const IClassFactory2.VTable, self.vtable).GetLicInfo(@ptrCast(*const IClassFactory2, self), pLicInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IClassFactory2_RequestLicKey(self: *const T, dwReserved: u32, pBstrKey: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IClassFactory2.VTable, self.vtable).RequestLicKey(@ptrCast(*const IClassFactory2, self), dwReserved, pBstrKey); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IClassFactory2_CreateInstanceLic(self: *const T, pUnkOuter: ?*IUnknown, pUnkReserved: ?*IUnknown, riid: ?*const Guid, bstrKey: ?BSTR, ppvObj: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IClassFactory2.VTable, self.vtable).CreateInstanceLic(@ptrCast(*const IClassFactory2, self), pUnkOuter, pUnkReserved, riid, bstrKey, ppvObj); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IProvideClassInfo_Value = @import("../zig.zig").Guid.initString("b196b283-bab4-101a-b69c-00aa00341d07"); pub const IID_IProvideClassInfo = &IID_IProvideClassInfo_Value; pub const IProvideClassInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetClassInfo: fn( self: *const IProvideClassInfo, ppTI: ?*?*ITypeInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IProvideClassInfo_GetClassInfo(self: *const T, ppTI: ?*?*ITypeInfo) callconv(.Inline) HRESULT { return @ptrCast(*const IProvideClassInfo.VTable, self.vtable).GetClassInfo(@ptrCast(*const IProvideClassInfo, self), ppTI); } };} pub usingnamespace MethodMixin(@This()); }; pub const GUIDKIND = enum(i32) { D = 1, }; pub const GUIDKIND_DEFAULT_SOURCE_DISP_IID = GUIDKIND.D; // TODO: this type is limited to platform 'windows5.0' const IID_IProvideClassInfo2_Value = @import("../zig.zig").Guid.initString("a6bc3ac0-dbaa-11ce-9de3-00aa004bb851"); pub const IID_IProvideClassInfo2 = &IID_IProvideClassInfo2_Value; pub const IProvideClassInfo2 = extern struct { pub const VTable = extern struct { base: IProvideClassInfo.VTable, GetGUID: fn( self: *const IProvideClassInfo2, dwGuidKind: u32, pGUID: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IProvideClassInfo.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IProvideClassInfo2_GetGUID(self: *const T, dwGuidKind: u32, pGUID: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IProvideClassInfo2.VTable, self.vtable).GetGUID(@ptrCast(*const IProvideClassInfo2, self), dwGuidKind, pGUID); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IProvideMultipleClassInfo_Value = @import("../zig.zig").Guid.initString("a7aba9c1-8983-11cf-8f20-00805f2cd064"); pub const IID_IProvideMultipleClassInfo = &IID_IProvideMultipleClassInfo_Value; pub const IProvideMultipleClassInfo = extern struct { pub const VTable = extern struct { base: IProvideClassInfo2.VTable, GetMultiTypeInfoCount: fn( self: *const IProvideMultipleClassInfo, pcti: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInfoOfIndex: fn( self: *const IProvideMultipleClassInfo, iti: u32, dwFlags: MULTICLASSINFO_FLAGS, pptiCoClass: ?*?*ITypeInfo, pdwTIFlags: ?*u32, pcdispidReserved: ?*u32, piidPrimary: ?*Guid, piidSource: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IProvideClassInfo2.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IProvideMultipleClassInfo_GetMultiTypeInfoCount(self: *const T, pcti: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IProvideMultipleClassInfo.VTable, self.vtable).GetMultiTypeInfoCount(@ptrCast(*const IProvideMultipleClassInfo, self), pcti); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IProvideMultipleClassInfo_GetInfoOfIndex(self: *const T, iti: u32, dwFlags: MULTICLASSINFO_FLAGS, pptiCoClass: ?*?*ITypeInfo, pdwTIFlags: ?*u32, pcdispidReserved: ?*u32, piidPrimary: ?*Guid, piidSource: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IProvideMultipleClassInfo.VTable, self.vtable).GetInfoOfIndex(@ptrCast(*const IProvideMultipleClassInfo, self), iti, dwFlags, pptiCoClass, pdwTIFlags, pcdispidReserved, piidPrimary, piidSource); } };} pub usingnamespace MethodMixin(@This()); }; pub const CONTROLINFO = extern struct { cb: u32, hAccel: ?HACCEL, cAccel: u16, dwFlags: u32, }; pub const CTRLINFO = enum(i32) { RETURN = 1, ESCAPE = 2, }; pub const CTRLINFO_EATS_RETURN = CTRLINFO.RETURN; pub const CTRLINFO_EATS_ESCAPE = CTRLINFO.ESCAPE; // TODO: this type is limited to platform 'windows5.0' const IID_IOleControl_Value = @import("../zig.zig").Guid.initString("b196b288-bab4-101a-b69c-00aa00341d07"); pub const IID_IOleControl = &IID_IOleControl_Value; pub const IOleControl = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetControlInfo: fn( self: *const IOleControl, pCI: ?*CONTROLINFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnMnemonic: fn( self: *const IOleControl, pMsg: ?*MSG, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnAmbientPropertyChange: fn( self: *const IOleControl, dispID: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FreezeEvents: fn( self: *const IOleControl, bFreeze: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControl_GetControlInfo(self: *const T, pCI: ?*CONTROLINFO) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControl.VTable, self.vtable).GetControlInfo(@ptrCast(*const IOleControl, self), pCI); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControl_OnMnemonic(self: *const T, pMsg: ?*MSG) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControl.VTable, self.vtable).OnMnemonic(@ptrCast(*const IOleControl, self), pMsg); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControl_OnAmbientPropertyChange(self: *const T, dispID: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControl.VTable, self.vtable).OnAmbientPropertyChange(@ptrCast(*const IOleControl, self), dispID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControl_FreezeEvents(self: *const T, bFreeze: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControl.VTable, self.vtable).FreezeEvents(@ptrCast(*const IOleControl, self), bFreeze); } };} pub usingnamespace MethodMixin(@This()); }; pub const POINTF = extern struct { x: f32, y: f32, }; pub const XFORMCOORDS = enum(i32) { POSITION = 1, SIZE = 2, HIMETRICTOCONTAINER = 4, CONTAINERTOHIMETRIC = 8, EVENTCOMPAT = 16, }; pub const XFORMCOORDS_POSITION = XFORMCOORDS.POSITION; pub const XFORMCOORDS_SIZE = XFORMCOORDS.SIZE; pub const XFORMCOORDS_HIMETRICTOCONTAINER = XFORMCOORDS.HIMETRICTOCONTAINER; pub const XFORMCOORDS_CONTAINERTOHIMETRIC = XFORMCOORDS.CONTAINERTOHIMETRIC; pub const XFORMCOORDS_EVENTCOMPAT = XFORMCOORDS.EVENTCOMPAT; // TODO: this type is limited to platform 'windows5.0' const IID_IOleControlSite_Value = @import("../zig.zig").Guid.initString("b196b289-bab4-101a-b69c-00aa00341d07"); pub const IID_IOleControlSite = &IID_IOleControlSite_Value; pub const IOleControlSite = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnControlInfoChanged: fn( self: *const IOleControlSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, LockInPlaceActive: fn( self: *const IOleControlSite, fLock: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetExtendedControl: fn( self: *const IOleControlSite, ppDisp: ?*?*IDispatch, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TransformCoords: fn( self: *const IOleControlSite, pPtlHimetric: ?*POINTL, pPtfContainer: ?*POINTF, dwFlags: XFORMCOORDS, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TranslateAccelerator: fn( self: *const IOleControlSite, pMsg: ?*MSG, grfModifiers: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnFocus: fn( self: *const IOleControlSite, fGotFocus: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ShowPropertyFrame: fn( self: *const IOleControlSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControlSite_OnControlInfoChanged(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControlSite.VTable, self.vtable).OnControlInfoChanged(@ptrCast(*const IOleControlSite, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControlSite_LockInPlaceActive(self: *const T, fLock: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControlSite.VTable, self.vtable).LockInPlaceActive(@ptrCast(*const IOleControlSite, self), fLock); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControlSite_GetExtendedControl(self: *const T, ppDisp: ?*?*IDispatch) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControlSite.VTable, self.vtable).GetExtendedControl(@ptrCast(*const IOleControlSite, self), ppDisp); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControlSite_TransformCoords(self: *const T, pPtlHimetric: ?*POINTL, pPtfContainer: ?*POINTF, dwFlags: XFORMCOORDS) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControlSite.VTable, self.vtable).TransformCoords(@ptrCast(*const IOleControlSite, self), pPtlHimetric, pPtfContainer, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControlSite_TranslateAccelerator(self: *const T, pMsg: ?*MSG, grfModifiers: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControlSite.VTable, self.vtable).TranslateAccelerator(@ptrCast(*const IOleControlSite, self), pMsg, grfModifiers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControlSite_OnFocus(self: *const T, fGotFocus: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControlSite.VTable, self.vtable).OnFocus(@ptrCast(*const IOleControlSite, self), fGotFocus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControlSite_ShowPropertyFrame(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControlSite.VTable, self.vtable).ShowPropertyFrame(@ptrCast(*const IOleControlSite, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const PROPPAGEINFO = extern struct { cb: u32, pszTitle: ?PWSTR, size: SIZE, pszDocString: ?PWSTR, pszHelpFile: ?PWSTR, dwHelpContext: u32, }; // TODO: this type is limited to platform 'windows5.0' const IID_IPropertyPage_Value = @import("../zig.zig").Guid.initString("b196b28d-bab4-101a-b69c-00aa00341d07"); pub const IID_IPropertyPage = &IID_IPropertyPage_Value; pub const IPropertyPage = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetPageSite: fn( self: *const IPropertyPage, pPageSite: ?*IPropertyPageSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Activate: fn( self: *const IPropertyPage, hWndParent: ?HWND, pRect: ?*RECT, bModal: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Deactivate: fn( self: *const IPropertyPage, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPageInfo: fn( self: *const IPropertyPage, pPageInfo: ?*PROPPAGEINFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetObjects: fn( self: *const IPropertyPage, cObjects: u32, ppUnk: [*]?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Show: fn( self: *const IPropertyPage, nCmdShow: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Move: fn( self: *const IPropertyPage, pRect: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsPageDirty: fn( self: *const IPropertyPage, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Apply: fn( self: *const IPropertyPage, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Help: fn( self: *const IPropertyPage, pszHelpDir: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TranslateAccelerator: fn( self: *const IPropertyPage, pMsg: ?*MSG, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_SetPageSite(self: *const T, pPageSite: ?*IPropertyPageSite) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).SetPageSite(@ptrCast(*const IPropertyPage, self), pPageSite); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_Activate(self: *const T, hWndParent: ?HWND, pRect: ?*RECT, bModal: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).Activate(@ptrCast(*const IPropertyPage, self), hWndParent, pRect, bModal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_Deactivate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).Deactivate(@ptrCast(*const IPropertyPage, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_GetPageInfo(self: *const T, pPageInfo: ?*PROPPAGEINFO) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).GetPageInfo(@ptrCast(*const IPropertyPage, self), pPageInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_SetObjects(self: *const T, cObjects: u32, ppUnk: [*]?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).SetObjects(@ptrCast(*const IPropertyPage, self), cObjects, ppUnk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_Show(self: *const T, nCmdShow: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).Show(@ptrCast(*const IPropertyPage, self), nCmdShow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_Move(self: *const T, pRect: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).Move(@ptrCast(*const IPropertyPage, self), pRect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_IsPageDirty(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).IsPageDirty(@ptrCast(*const IPropertyPage, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_Apply(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).Apply(@ptrCast(*const IPropertyPage, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_Help(self: *const T, pszHelpDir: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).Help(@ptrCast(*const IPropertyPage, self), pszHelpDir); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_TranslateAccelerator(self: *const T, pMsg: ?*MSG) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).TranslateAccelerator(@ptrCast(*const IPropertyPage, self), pMsg); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IPropertyPage2_Value = @import("../zig.zig").Guid.initString("01e44665-24ac-101b-84ed-08002b2ec713"); pub const IID_IPropertyPage2 = &IID_IPropertyPage2_Value; pub const IPropertyPage2 = extern struct { pub const VTable = extern struct { base: IPropertyPage.VTable, EditProperty: fn( self: *const IPropertyPage2, dispID: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IPropertyPage.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage2_EditProperty(self: *const T, dispID: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage2.VTable, self.vtable).EditProperty(@ptrCast(*const IPropertyPage2, self), dispID); } };} pub usingnamespace MethodMixin(@This()); }; pub const PROPPAGESTATUS = enum(i32) { DIRTY = 1, VALIDATE = 2, CLEAN = 4, }; pub const PROPPAGESTATUS_DIRTY = PROPPAGESTATUS.DIRTY; pub const PROPPAGESTATUS_VALIDATE = PROPPAGESTATUS.VALIDATE; pub const PROPPAGESTATUS_CLEAN = PROPPAGESTATUS.CLEAN; // TODO: this type is limited to platform 'windows5.0' const IID_IPropertyPageSite_Value = @import("../zig.zig").Guid.initString("b196b28c-bab4-101a-b69c-00aa00341d07"); pub const IID_IPropertyPageSite = &IID_IPropertyPageSite_Value; pub const IPropertyPageSite = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnStatusChange: fn( self: *const IPropertyPageSite, dwFlags: PROPPAGESTATUS, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLocaleID: fn( self: *const IPropertyPageSite, pLocaleID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPageContainer: fn( self: *const IPropertyPageSite, ppUnk: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TranslateAccelerator: fn( self: *const IPropertyPageSite, pMsg: ?*MSG, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPageSite_OnStatusChange(self: *const T, dwFlags: PROPPAGESTATUS) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPageSite.VTable, self.vtable).OnStatusChange(@ptrCast(*const IPropertyPageSite, self), dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPageSite_GetLocaleID(self: *const T, pLocaleID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPageSite.VTable, self.vtable).GetLocaleID(@ptrCast(*const IPropertyPageSite, self), pLocaleID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPageSite_GetPageContainer(self: *const T, ppUnk: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPageSite.VTable, self.vtable).GetPageContainer(@ptrCast(*const IPropertyPageSite, self), ppUnk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPageSite_TranslateAccelerator(self: *const T, pMsg: ?*MSG) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPageSite.VTable, self.vtable).TranslateAccelerator(@ptrCast(*const IPropertyPageSite, self), pMsg); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IPropertyNotifySink_Value = @import("../zig.zig").Guid.initString("9bfbbc02-eff1-101a-84ed-00aa00341d07"); pub const IID_IPropertyNotifySink = &IID_IPropertyNotifySink_Value; pub const IPropertyNotifySink = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnChanged: fn( self: *const IPropertyNotifySink, dispID: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnRequestEdit: fn( self: *const IPropertyNotifySink, dispID: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyNotifySink_OnChanged(self: *const T, dispID: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyNotifySink.VTable, self.vtable).OnChanged(@ptrCast(*const IPropertyNotifySink, self), dispID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyNotifySink_OnRequestEdit(self: *const T, dispID: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyNotifySink.VTable, self.vtable).OnRequestEdit(@ptrCast(*const IPropertyNotifySink, self), dispID); } };} pub usingnamespace MethodMixin(@This()); }; pub const CAUUID = extern struct { cElems: u32, pElems: ?*Guid, }; // TODO: this type is limited to platform 'windows5.0' const IID_ISpecifyPropertyPages_Value = @import("../zig.zig").Guid.initString("b196b28b-bab4-101a-b69c-00aa00341d07"); pub const IID_ISpecifyPropertyPages = &IID_ISpecifyPropertyPages_Value; pub const ISpecifyPropertyPages = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetPages: fn( self: *const ISpecifyPropertyPages, pPages: ?*CAUUID, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpecifyPropertyPages_GetPages(self: *const T, pPages: ?*CAUUID) callconv(.Inline) HRESULT { return @ptrCast(*const ISpecifyPropertyPages.VTable, self.vtable).GetPages(@ptrCast(*const ISpecifyPropertyPages, self), pPages); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPersistMemory_Value = @import("../zig.zig").Guid.initString("bd1ae5e0-a6ae-11ce-bd37-504200c10000"); pub const IID_IPersistMemory = &IID_IPersistMemory_Value; pub const IPersistMemory = extern struct { pub const VTable = extern struct { base: IPersist.VTable, IsDirty: fn( self: *const IPersistMemory, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Load: fn( self: *const IPersistMemory, pMem: [*]u8, cbSize: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Save: fn( self: *const IPersistMemory, pMem: [*]u8, fClearDirty: BOOL, cbSize: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSizeMax: fn( self: *const IPersistMemory, pCbSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InitNew: fn( self: *const IPersistMemory, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IPersist.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistMemory_IsDirty(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistMemory.VTable, self.vtable).IsDirty(@ptrCast(*const IPersistMemory, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistMemory_Load(self: *const T, pMem: [*]u8, cbSize: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistMemory.VTable, self.vtable).Load(@ptrCast(*const IPersistMemory, self), pMem, cbSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistMemory_Save(self: *const T, pMem: [*]u8, fClearDirty: BOOL, cbSize: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistMemory.VTable, self.vtable).Save(@ptrCast(*const IPersistMemory, self), pMem, fClearDirty, cbSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistMemory_GetSizeMax(self: *const T, pCbSize: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistMemory.VTable, self.vtable).GetSizeMax(@ptrCast(*const IPersistMemory, self), pCbSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistMemory_InitNew(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistMemory.VTable, self.vtable).InitNew(@ptrCast(*const IPersistMemory, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IPersistStreamInit_Value = @import("../zig.zig").Guid.initString("7fd52380-4e07-101b-ae2d-08002b2ec713"); pub const IID_IPersistStreamInit = &IID_IPersistStreamInit_Value; pub const IPersistStreamInit = extern struct { pub const VTable = extern struct { base: IPersist.VTable, IsDirty: fn( self: *const IPersistStreamInit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Load: fn( self: *const IPersistStreamInit, pStm: ?*IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Save: fn( self: *const IPersistStreamInit, pStm: ?*IStream, fClearDirty: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSizeMax: fn( self: *const IPersistStreamInit, pCbSize: ?*ULARGE_INTEGER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InitNew: fn( self: *const IPersistStreamInit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IPersist.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistStreamInit_IsDirty(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistStreamInit.VTable, self.vtable).IsDirty(@ptrCast(*const IPersistStreamInit, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistStreamInit_Load(self: *const T, pStm: ?*IStream) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistStreamInit.VTable, self.vtable).Load(@ptrCast(*const IPersistStreamInit, self), pStm); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistStreamInit_Save(self: *const T, pStm: ?*IStream, fClearDirty: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistStreamInit.VTable, self.vtable).Save(@ptrCast(*const IPersistStreamInit, self), pStm, fClearDirty); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistStreamInit_GetSizeMax(self: *const T, pCbSize: ?*ULARGE_INTEGER) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistStreamInit.VTable, self.vtable).GetSizeMax(@ptrCast(*const IPersistStreamInit, self), pCbSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistStreamInit_InitNew(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistStreamInit.VTable, self.vtable).InitNew(@ptrCast(*const IPersistStreamInit, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPersistPropertyBag_Value = @import("../zig.zig").Guid.initString("37d84f60-42cb-11ce-8135-00aa004bb851"); pub const IID_IPersistPropertyBag = &IID_IPersistPropertyBag_Value; pub const IPersistPropertyBag = extern struct { pub const VTable = extern struct { base: IPersist.VTable, InitNew: fn( self: *const IPersistPropertyBag, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Load: fn( self: *const IPersistPropertyBag, pPropBag: ?*IPropertyBag, pErrorLog: ?*IErrorLog, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Save: fn( self: *const IPersistPropertyBag, pPropBag: ?*IPropertyBag, fClearDirty: BOOL, fSaveAllProperties: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IPersist.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistPropertyBag_InitNew(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistPropertyBag.VTable, self.vtable).InitNew(@ptrCast(*const IPersistPropertyBag, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistPropertyBag_Load(self: *const T, pPropBag: ?*IPropertyBag, pErrorLog: ?*IErrorLog) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistPropertyBag.VTable, self.vtable).Load(@ptrCast(*const IPersistPropertyBag, self), pPropBag, pErrorLog); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistPropertyBag_Save(self: *const T, pPropBag: ?*IPropertyBag, fClearDirty: BOOL, fSaveAllProperties: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistPropertyBag.VTable, self.vtable).Save(@ptrCast(*const IPersistPropertyBag, self), pPropBag, fClearDirty, fSaveAllProperties); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ISimpleFrameSite_Value = @import("../zig.zig").Guid.initString("742b0e01-14e6-101b-914e-00aa00300cab"); pub const IID_ISimpleFrameSite = &IID_ISimpleFrameSite_Value; pub const ISimpleFrameSite = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, PreMessageFilter: fn( self: *const ISimpleFrameSite, hWnd: ?HWND, msg: u32, wp: WPARAM, lp: LPARAM, plResult: ?*LRESULT, pdwCookie: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PostMessageFilter: fn( self: *const ISimpleFrameSite, hWnd: ?HWND, msg: u32, wp: WPARAM, lp: LPARAM, plResult: ?*LRESULT, dwCookie: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISimpleFrameSite_PreMessageFilter(self: *const T, hWnd: ?HWND, msg: u32, wp: WPARAM, lp: LPARAM, plResult: ?*LRESULT, pdwCookie: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISimpleFrameSite.VTable, self.vtable).PreMessageFilter(@ptrCast(*const ISimpleFrameSite, self), hWnd, msg, wp, lp, plResult, pdwCookie); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISimpleFrameSite_PostMessageFilter(self: *const T, hWnd: ?HWND, msg: u32, wp: WPARAM, lp: LPARAM, plResult: ?*LRESULT, dwCookie: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISimpleFrameSite.VTable, self.vtable).PostMessageFilter(@ptrCast(*const ISimpleFrameSite, self), hWnd, msg, wp, lp, plResult, dwCookie); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IFont_Value = @import("../zig.zig").Guid.initString("bef6e002-a874-101a-8bba-00aa00300cab"); pub const IID_IFont = &IID_IFont_Value; pub const IFont = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const IFont, pName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Name: fn( self: *const IFont, name: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Size: fn( self: *const IFont, pSize: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Size: fn( self: *const IFont, size: CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Bold: fn( self: *const IFont, pBold: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Bold: fn( self: *const IFont, bold: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Italic: fn( self: *const IFont, pItalic: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Italic: fn( self: *const IFont, italic: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Underline: fn( self: *const IFont, pUnderline: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Underline: fn( self: *const IFont, underline: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Strikethrough: fn( self: *const IFont, pStrikethrough: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Strikethrough: fn( self: *const IFont, strikethrough: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Weight: fn( self: *const IFont, pWeight: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Weight: fn( self: *const IFont, weight: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Charset: fn( self: *const IFont, pCharset: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Charset: fn( self: *const IFont, charset: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_hFont: fn( self: *const IFont, phFont: ?*?HFONT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IFont, ppFont: ?*?*IFont, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsEqual: fn( self: *const IFont, pFontOther: ?*IFont, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetRatio: fn( self: *const IFont, cyLogical: i32, cyHimetric: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, QueryTextMetrics: fn( self: *const IFont, pTM: ?*TEXTMETRICW, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddRefHfont: fn( self: *const IFont, hFont: ?HFONT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReleaseHfont: fn( self: *const IFont, hFont: ?HFONT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetHdc: fn( self: *const IFont, hDC: ?HDC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_get_Name(self: *const T, pName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).get_Name(@ptrCast(*const IFont, self), pName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_put_Name(self: *const T, name: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).put_Name(@ptrCast(*const IFont, self), name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_get_Size(self: *const T, pSize: ?*CY) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).get_Size(@ptrCast(*const IFont, self), pSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_put_Size(self: *const T, size: CY) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).put_Size(@ptrCast(*const IFont, self), size); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_get_Bold(self: *const T, pBold: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).get_Bold(@ptrCast(*const IFont, self), pBold); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_put_Bold(self: *const T, bold: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).put_Bold(@ptrCast(*const IFont, self), bold); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_get_Italic(self: *const T, pItalic: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).get_Italic(@ptrCast(*const IFont, self), pItalic); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_put_Italic(self: *const T, italic: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).put_Italic(@ptrCast(*const IFont, self), italic); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_get_Underline(self: *const T, pUnderline: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).get_Underline(@ptrCast(*const IFont, self), pUnderline); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_put_Underline(self: *const T, underline: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).put_Underline(@ptrCast(*const IFont, self), underline); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_get_Strikethrough(self: *const T, pStrikethrough: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).get_Strikethrough(@ptrCast(*const IFont, self), pStrikethrough); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_put_Strikethrough(self: *const T, strikethrough: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).put_Strikethrough(@ptrCast(*const IFont, self), strikethrough); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_get_Weight(self: *const T, pWeight: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).get_Weight(@ptrCast(*const IFont, self), pWeight); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_put_Weight(self: *const T, weight: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).put_Weight(@ptrCast(*const IFont, self), weight); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_get_Charset(self: *const T, pCharset: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).get_Charset(@ptrCast(*const IFont, self), pCharset); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_put_Charset(self: *const T, charset: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).put_Charset(@ptrCast(*const IFont, self), charset); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_get_hFont(self: *const T, phFont: ?*?HFONT) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).get_hFont(@ptrCast(*const IFont, self), phFont); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_Clone(self: *const T, ppFont: ?*?*IFont) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).Clone(@ptrCast(*const IFont, self), ppFont); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_IsEqual(self: *const T, pFontOther: ?*IFont) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).IsEqual(@ptrCast(*const IFont, self), pFontOther); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_SetRatio(self: *const T, cyLogical: i32, cyHimetric: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).SetRatio(@ptrCast(*const IFont, self), cyLogical, cyHimetric); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_QueryTextMetrics(self: *const T, pTM: ?*TEXTMETRICW) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).QueryTextMetrics(@ptrCast(*const IFont, self), pTM); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_AddRefHfont(self: *const T, hFont: ?HFONT) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).AddRefHfont(@ptrCast(*const IFont, self), hFont); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_ReleaseHfont(self: *const T, hFont: ?HFONT) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).ReleaseHfont(@ptrCast(*const IFont, self), hFont); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_SetHdc(self: *const T, hDC: ?HDC) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).SetHdc(@ptrCast(*const IFont, self), hDC); } };} pub usingnamespace MethodMixin(@This()); }; pub const PictureAttributes = enum(i32) { SCALABLE = 1, TRANSPARENT = 2, }; pub const PICTURE_SCALABLE = PictureAttributes.SCALABLE; pub const PICTURE_TRANSPARENT = PictureAttributes.TRANSPARENT; // TODO: this type is limited to platform 'windows5.0' const IID_IPicture_Value = @import("../zig.zig").Guid.initString("7bf80980-bf32-101a-8bbb-00aa00300cab"); pub const IID_IPicture = &IID_IPicture_Value; pub const IPicture = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Handle: fn( self: *const IPicture, pHandle: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_hPal: fn( self: *const IPicture, phPal: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Type: fn( self: *const IPicture, pType: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Width: fn( self: *const IPicture, pWidth: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Height: fn( self: *const IPicture, pHeight: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Render: fn( self: *const IPicture, hDC: ?HDC, x: i32, y: i32, cx: i32, cy: i32, xSrc: i32, ySrc: i32, cxSrc: i32, cySrc: i32, pRcWBounds: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, set_hPal: fn( self: *const IPicture, hPal: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CurDC: fn( self: *const IPicture, phDC: ?*?HDC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SelectPicture: fn( self: *const IPicture, hDCIn: ?HDC, phDCOut: ?*?HDC, phBmpOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_KeepOriginalFormat: fn( self: *const IPicture, pKeep: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_KeepOriginalFormat: fn( self: *const IPicture, keep: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PictureChanged: fn( self: *const IPicture, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SaveAsFile: fn( self: *const IPicture, pStream: ?*IStream, fSaveMemCopy: BOOL, pCbSize: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Attributes: fn( self: *const IPicture, pDwAttr: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_get_Handle(self: *const T, pHandle: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).get_Handle(@ptrCast(*const IPicture, self), pHandle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_get_hPal(self: *const T, phPal: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).get_hPal(@ptrCast(*const IPicture, self), phPal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_get_Type(self: *const T, pType: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).get_Type(@ptrCast(*const IPicture, self), pType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_get_Width(self: *const T, pWidth: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).get_Width(@ptrCast(*const IPicture, self), pWidth); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_get_Height(self: *const T, pHeight: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).get_Height(@ptrCast(*const IPicture, self), pHeight); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_Render(self: *const T, hDC: ?HDC, x: i32, y: i32, cx: i32, cy: i32, xSrc: i32, ySrc: i32, cxSrc: i32, cySrc: i32, pRcWBounds: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).Render(@ptrCast(*const IPicture, self), hDC, x, y, cx, cy, xSrc, ySrc, cxSrc, cySrc, pRcWBounds); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_set_hPal(self: *const T, hPal: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).set_hPal(@ptrCast(*const IPicture, self), hPal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_get_CurDC(self: *const T, phDC: ?*?HDC) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).get_CurDC(@ptrCast(*const IPicture, self), phDC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_SelectPicture(self: *const T, hDCIn: ?HDC, phDCOut: ?*?HDC, phBmpOut: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).SelectPicture(@ptrCast(*const IPicture, self), hDCIn, phDCOut, phBmpOut); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_get_KeepOriginalFormat(self: *const T, pKeep: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).get_KeepOriginalFormat(@ptrCast(*const IPicture, self), pKeep); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_put_KeepOriginalFormat(self: *const T, keep: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).put_KeepOriginalFormat(@ptrCast(*const IPicture, self), keep); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_PictureChanged(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).PictureChanged(@ptrCast(*const IPicture, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_SaveAsFile(self: *const T, pStream: ?*IStream, fSaveMemCopy: BOOL, pCbSize: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).SaveAsFile(@ptrCast(*const IPicture, self), pStream, fSaveMemCopy, pCbSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_get_Attributes(self: *const T, pDwAttr: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).get_Attributes(@ptrCast(*const IPicture, self), pDwAttr); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPicture2_Value = @import("../zig.zig").Guid.initString("f5185dd8-2012-4b0b-aad9-f052c6bd482b"); pub const IID_IPicture2 = &IID_IPicture2_Value; pub const IPicture2 = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Handle: fn( self: *const IPicture2, pHandle: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_hPal: fn( self: *const IPicture2, phPal: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Type: fn( self: *const IPicture2, pType: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Width: fn( self: *const IPicture2, pWidth: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Height: fn( self: *const IPicture2, pHeight: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Render: fn( self: *const IPicture2, hDC: ?HDC, x: i32, y: i32, cx: i32, cy: i32, xSrc: i32, ySrc: i32, cxSrc: i32, cySrc: i32, pRcWBounds: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, set_hPal: fn( self: *const IPicture2, hPal: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CurDC: fn( self: *const IPicture2, phDC: ?*?HDC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SelectPicture: fn( self: *const IPicture2, hDCIn: ?HDC, phDCOut: ?*?HDC, phBmpOut: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_KeepOriginalFormat: fn( self: *const IPicture2, pKeep: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_KeepOriginalFormat: fn( self: *const IPicture2, keep: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PictureChanged: fn( self: *const IPicture2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SaveAsFile: fn( self: *const IPicture2, pStream: ?*IStream, fSaveMemCopy: BOOL, pCbSize: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Attributes: fn( self: *const IPicture2, pDwAttr: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_get_Handle(self: *const T, pHandle: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).get_Handle(@ptrCast(*const IPicture2, self), pHandle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_get_hPal(self: *const T, phPal: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).get_hPal(@ptrCast(*const IPicture2, self), phPal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_get_Type(self: *const T, pType: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).get_Type(@ptrCast(*const IPicture2, self), pType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_get_Width(self: *const T, pWidth: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).get_Width(@ptrCast(*const IPicture2, self), pWidth); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_get_Height(self: *const T, pHeight: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).get_Height(@ptrCast(*const IPicture2, self), pHeight); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_Render(self: *const T, hDC: ?HDC, x: i32, y: i32, cx: i32, cy: i32, xSrc: i32, ySrc: i32, cxSrc: i32, cySrc: i32, pRcWBounds: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).Render(@ptrCast(*const IPicture2, self), hDC, x, y, cx, cy, xSrc, ySrc, cxSrc, cySrc, pRcWBounds); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_set_hPal(self: *const T, hPal: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).set_hPal(@ptrCast(*const IPicture2, self), hPal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_get_CurDC(self: *const T, phDC: ?*?HDC) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).get_CurDC(@ptrCast(*const IPicture2, self), phDC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_SelectPicture(self: *const T, hDCIn: ?HDC, phDCOut: ?*?HDC, phBmpOut: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).SelectPicture(@ptrCast(*const IPicture2, self), hDCIn, phDCOut, phBmpOut); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_get_KeepOriginalFormat(self: *const T, pKeep: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).get_KeepOriginalFormat(@ptrCast(*const IPicture2, self), pKeep); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_put_KeepOriginalFormat(self: *const T, keep: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).put_KeepOriginalFormat(@ptrCast(*const IPicture2, self), keep); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_PictureChanged(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).PictureChanged(@ptrCast(*const IPicture2, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_SaveAsFile(self: *const T, pStream: ?*IStream, fSaveMemCopy: BOOL, pCbSize: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).SaveAsFile(@ptrCast(*const IPicture2, self), pStream, fSaveMemCopy, pCbSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_get_Attributes(self: *const T, pDwAttr: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).get_Attributes(@ptrCast(*const IPicture2, self), pDwAttr); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IFontEventsDisp_Value = @import("../zig.zig").Guid.initString("4ef6100a-af88-11d0-9846-00c04fc29993"); pub const IID_IFontEventsDisp = &IID_IFontEventsDisp_Value; pub const IFontEventsDisp = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IFontDisp_Value = @import("../zig.zig").Guid.initString("bef6e003-a874-101a-8bba-00aa00300cab"); pub const IID_IFontDisp = &IID_IFontDisp_Value; pub const IFontDisp = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IPictureDisp_Value = @import("../zig.zig").Guid.initString("7bf80981-bf32-101a-8bbb-00aa00300cab"); pub const IID_IPictureDisp = &IID_IPictureDisp_Value; pub const IPictureDisp = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleInPlaceObjectWindowless_Value = @import("../zig.zig").Guid.initString("1c2056cc-5ef4-101b-8bc8-00aa003e3b29"); pub const IID_IOleInPlaceObjectWindowless = &IID_IOleInPlaceObjectWindowless_Value; pub const IOleInPlaceObjectWindowless = extern struct { pub const VTable = extern struct { base: IOleInPlaceObject.VTable, OnWindowMessage: fn( self: *const IOleInPlaceObjectWindowless, msg: u32, wParam: WPARAM, lParam: LPARAM, plResult: ?*LRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDropTarget: fn( self: *const IOleInPlaceObjectWindowless, ppDropTarget: ?*?*IDropTarget, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleInPlaceObject.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceObjectWindowless_OnWindowMessage(self: *const T, msg: u32, wParam: WPARAM, lParam: LPARAM, plResult: ?*LRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceObjectWindowless.VTable, self.vtable).OnWindowMessage(@ptrCast(*const IOleInPlaceObjectWindowless, self), msg, wParam, lParam, plResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceObjectWindowless_GetDropTarget(self: *const T, ppDropTarget: ?*?*IDropTarget) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceObjectWindowless.VTable, self.vtable).GetDropTarget(@ptrCast(*const IOleInPlaceObjectWindowless, self), ppDropTarget); } };} pub usingnamespace MethodMixin(@This()); }; pub const ACTIVATEFLAGS = enum(i32) { S = 1, }; pub const ACTIVATE_WINDOWLESS = ACTIVATEFLAGS.S; // TODO: this type is limited to platform 'windows5.0' const IID_IOleInPlaceSiteEx_Value = @import("../zig.zig").Guid.initString("9c2cad80-3424-11cf-b670-00aa004cd6d8"); pub const IID_IOleInPlaceSiteEx = &IID_IOleInPlaceSiteEx_Value; pub const IOleInPlaceSiteEx = extern struct { pub const VTable = extern struct { base: IOleInPlaceSite.VTable, OnInPlaceActivateEx: fn( self: *const IOleInPlaceSiteEx, pfNoRedraw: ?*BOOL, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnInPlaceDeactivateEx: fn( self: *const IOleInPlaceSiteEx, fNoRedraw: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RequestUIActivate: fn( self: *const IOleInPlaceSiteEx, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleInPlaceSite.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteEx_OnInPlaceActivateEx(self: *const T, pfNoRedraw: ?*BOOL, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteEx.VTable, self.vtable).OnInPlaceActivateEx(@ptrCast(*const IOleInPlaceSiteEx, self), pfNoRedraw, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteEx_OnInPlaceDeactivateEx(self: *const T, fNoRedraw: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteEx.VTable, self.vtable).OnInPlaceDeactivateEx(@ptrCast(*const IOleInPlaceSiteEx, self), fNoRedraw); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteEx_RequestUIActivate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteEx.VTable, self.vtable).RequestUIActivate(@ptrCast(*const IOleInPlaceSiteEx, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const OLEDCFLAGS = enum(i32) { NODRAW = 1, PAINTBKGND = 2, OFFSCREEN = 4, }; pub const OLEDC_NODRAW = OLEDCFLAGS.NODRAW; pub const OLEDC_PAINTBKGND = OLEDCFLAGS.PAINTBKGND; pub const OLEDC_OFFSCREEN = OLEDCFLAGS.OFFSCREEN; // TODO: this type is limited to platform 'windows5.0' const IID_IOleInPlaceSiteWindowless_Value = @import("../zig.zig").Guid.initString("922eada0-3424-11cf-b670-00aa004cd6d8"); pub const IID_IOleInPlaceSiteWindowless = &IID_IOleInPlaceSiteWindowless_Value; pub const IOleInPlaceSiteWindowless = extern struct { pub const VTable = extern struct { base: IOleInPlaceSiteEx.VTable, CanWindowlessActivate: fn( self: *const IOleInPlaceSiteWindowless, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCapture: fn( self: *const IOleInPlaceSiteWindowless, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCapture: fn( self: *const IOleInPlaceSiteWindowless, fCapture: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFocus: fn( self: *const IOleInPlaceSiteWindowless, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetFocus: fn( self: *const IOleInPlaceSiteWindowless, fFocus: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDC: fn( self: *const IOleInPlaceSiteWindowless, pRect: ?*RECT, grfFlags: u32, phDC: ?*?HDC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReleaseDC: fn( self: *const IOleInPlaceSiteWindowless, hDC: ?HDC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InvalidateRect: fn( self: *const IOleInPlaceSiteWindowless, pRect: ?*RECT, fErase: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InvalidateRgn: fn( self: *const IOleInPlaceSiteWindowless, hRGN: ?HRGN, fErase: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ScrollRect: fn( self: *const IOleInPlaceSiteWindowless, dx: i32, dy: i32, pRectScroll: ?*RECT, pRectClip: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AdjustRect: fn( self: *const IOleInPlaceSiteWindowless, prc: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnDefWindowMessage: fn( self: *const IOleInPlaceSiteWindowless, msg: u32, wParam: WPARAM, lParam: LPARAM, plResult: ?*LRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleInPlaceSiteEx.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_CanWindowlessActivate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).CanWindowlessActivate(@ptrCast(*const IOleInPlaceSiteWindowless, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_GetCapture(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).GetCapture(@ptrCast(*const IOleInPlaceSiteWindowless, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_SetCapture(self: *const T, fCapture: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).SetCapture(@ptrCast(*const IOleInPlaceSiteWindowless, self), fCapture); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_GetFocus(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).GetFocus(@ptrCast(*const IOleInPlaceSiteWindowless, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_SetFocus(self: *const T, fFocus: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).SetFocus(@ptrCast(*const IOleInPlaceSiteWindowless, self), fFocus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_GetDC(self: *const T, pRect: ?*RECT, grfFlags: u32, phDC: ?*?HDC) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).GetDC(@ptrCast(*const IOleInPlaceSiteWindowless, self), pRect, grfFlags, phDC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_ReleaseDC(self: *const T, hDC: ?HDC) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).ReleaseDC(@ptrCast(*const IOleInPlaceSiteWindowless, self), hDC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_InvalidateRect(self: *const T, pRect: ?*RECT, fErase: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).InvalidateRect(@ptrCast(*const IOleInPlaceSiteWindowless, self), pRect, fErase); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_InvalidateRgn(self: *const T, hRGN: ?HRGN, fErase: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).InvalidateRgn(@ptrCast(*const IOleInPlaceSiteWindowless, self), hRGN, fErase); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_ScrollRect(self: *const T, dx: i32, dy: i32, pRectScroll: ?*RECT, pRectClip: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).ScrollRect(@ptrCast(*const IOleInPlaceSiteWindowless, self), dx, dy, pRectScroll, pRectClip); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_AdjustRect(self: *const T, prc: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).AdjustRect(@ptrCast(*const IOleInPlaceSiteWindowless, self), prc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_OnDefWindowMessage(self: *const T, msg: u32, wParam: WPARAM, lParam: LPARAM, plResult: ?*LRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).OnDefWindowMessage(@ptrCast(*const IOleInPlaceSiteWindowless, self), msg, wParam, lParam, plResult); } };} pub usingnamespace MethodMixin(@This()); }; pub const VIEWSTATUS = enum(i32) { OPAQUE = 1, SOLIDBKGND = 2, DVASPECTOPAQUE = 4, DVASPECTTRANSPARENT = 8, SURFACE = 16, @"3DSURFACE" = 32, }; pub const VIEWSTATUS_OPAQUE = VIEWSTATUS.OPAQUE; pub const VIEWSTATUS_SOLIDBKGND = VIEWSTATUS.SOLIDBKGND; pub const VIEWSTATUS_DVASPECTOPAQUE = VIEWSTATUS.DVASPECTOPAQUE; pub const VIEWSTATUS_DVASPECTTRANSPARENT = VIEWSTATUS.DVASPECTTRANSPARENT; pub const VIEWSTATUS_SURFACE = VIEWSTATUS.SURFACE; pub const VIEWSTATUS_3DSURFACE = VIEWSTATUS.@"3DSURFACE"; pub const HITRESULT = enum(i32) { OUTSIDE = 0, TRANSPARENT = 1, CLOSE = 2, HIT = 3, }; pub const HITRESULT_OUTSIDE = HITRESULT.OUTSIDE; pub const HITRESULT_TRANSPARENT = HITRESULT.TRANSPARENT; pub const HITRESULT_CLOSE = HITRESULT.CLOSE; pub const HITRESULT_HIT = HITRESULT.HIT; pub const DVASPECT2 = enum(i32) { OPAQUE = 16, TRANSPARENT = 32, }; pub const DVASPECT_OPAQUE = DVASPECT2.OPAQUE; pub const DVASPECT_TRANSPARENT = DVASPECT2.TRANSPARENT; pub const ExtentInfo = extern struct { cb: u32, dwExtentMode: u32, sizelProposed: SIZE, }; pub const ExtentMode = enum(i32) { CONTENT = 0, INTEGRAL = 1, }; pub const DVEXTENT_CONTENT = ExtentMode.CONTENT; pub const DVEXTENT_INTEGRAL = ExtentMode.INTEGRAL; pub const AspectInfoFlag = enum(i32) { E = 1, }; pub const DVASPECTINFOFLAG_CANOPTIMIZE = AspectInfoFlag.E; pub const AspectInfo = extern struct { cb: u32, dwFlags: u32, }; // TODO: this type is limited to platform 'windows5.0' const IID_IViewObjectEx_Value = @import("../zig.zig").Guid.initString("3af24292-0c96-11ce-a0cf-00aa00600ab8"); pub const IID_IViewObjectEx = &IID_IViewObjectEx_Value; pub const IViewObjectEx = extern struct { pub const VTable = extern struct { base: IViewObject2.VTable, GetRect: fn( self: *const IViewObjectEx, dwAspect: u32, pRect: ?*RECTL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetViewStatus: fn( self: *const IViewObjectEx, pdwStatus: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, QueryHitPoint: fn( self: *const IViewObjectEx, dwAspect: u32, pRectBounds: ?*RECT, ptlLoc: POINT, lCloseHint: i32, pHitResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, QueryHitRect: fn( self: *const IViewObjectEx, dwAspect: u32, pRectBounds: ?*RECT, pRectLoc: ?*RECT, lCloseHint: i32, pHitResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetNaturalExtent: fn( self: *const IViewObjectEx, dwAspect: DVASPECT, lindex: i32, ptd: ?*DVTARGETDEVICE, hicTargetDev: ?HDC, pExtentInfo: ?*ExtentInfo, pSizel: ?*SIZE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IViewObject2.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObjectEx_GetRect(self: *const T, dwAspect: u32, pRect: ?*RECTL) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObjectEx.VTable, self.vtable).GetRect(@ptrCast(*const IViewObjectEx, self), dwAspect, pRect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObjectEx_GetViewStatus(self: *const T, pdwStatus: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObjectEx.VTable, self.vtable).GetViewStatus(@ptrCast(*const IViewObjectEx, self), pdwStatus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObjectEx_QueryHitPoint(self: *const T, dwAspect: u32, pRectBounds: ?*RECT, ptlLoc: POINT, lCloseHint: i32, pHitResult: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObjectEx.VTable, self.vtable).QueryHitPoint(@ptrCast(*const IViewObjectEx, self), dwAspect, pRectBounds, ptlLoc, lCloseHint, pHitResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObjectEx_QueryHitRect(self: *const T, dwAspect: u32, pRectBounds: ?*RECT, pRectLoc: ?*RECT, lCloseHint: i32, pHitResult: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObjectEx.VTable, self.vtable).QueryHitRect(@ptrCast(*const IViewObjectEx, self), dwAspect, pRectBounds, pRectLoc, lCloseHint, pHitResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObjectEx_GetNaturalExtent(self: *const T, dwAspect: DVASPECT, lindex: i32, ptd: ?*DVTARGETDEVICE, hicTargetDev: ?HDC, pExtentInfo: ?*ExtentInfo, pSizel: ?*SIZE) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObjectEx.VTable, self.vtable).GetNaturalExtent(@ptrCast(*const IViewObjectEx, self), dwAspect, lindex, ptd, hicTargetDev, pExtentInfo, pSizel); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleUndoUnit_Value = @import("../zig.zig").Guid.initString("894ad3b0-ef97-11ce-9bc9-00aa00608e01"); pub const IID_IOleUndoUnit = &IID_IOleUndoUnit_Value; pub const IOleUndoUnit = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Do: fn( self: *const IOleUndoUnit, pUndoManager: ?*IOleUndoManager, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDescription: fn( self: *const IOleUndoUnit, pBstr: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUnitType: fn( self: *const IOleUndoUnit, pClsid: ?*Guid, plID: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnNextAdd: fn( self: *const IOleUndoUnit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoUnit_Do(self: *const T, pUndoManager: ?*IOleUndoManager) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoUnit.VTable, self.vtable).Do(@ptrCast(*const IOleUndoUnit, self), pUndoManager); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoUnit_GetDescription(self: *const T, pBstr: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoUnit.VTable, self.vtable).GetDescription(@ptrCast(*const IOleUndoUnit, self), pBstr); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoUnit_GetUnitType(self: *const T, pClsid: ?*Guid, plID: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoUnit.VTable, self.vtable).GetUnitType(@ptrCast(*const IOleUndoUnit, self), pClsid, plID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoUnit_OnNextAdd(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoUnit.VTable, self.vtable).OnNextAdd(@ptrCast(*const IOleUndoUnit, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleParentUndoUnit_Value = @import("../zig.zig").Guid.initString("a1faf330-ef97-11ce-9bc9-00aa00608e01"); pub const IID_IOleParentUndoUnit = &IID_IOleParentUndoUnit_Value; pub const IOleParentUndoUnit = extern struct { pub const VTable = extern struct { base: IOleUndoUnit.VTable, Open: fn( self: *const IOleParentUndoUnit, pPUU: ?*IOleParentUndoUnit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Close: fn( self: *const IOleParentUndoUnit, pPUU: ?*IOleParentUndoUnit, fCommit: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Add: fn( self: *const IOleParentUndoUnit, pUU: ?*IOleUndoUnit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FindUnit: fn( self: *const IOleParentUndoUnit, pUU: ?*IOleUndoUnit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetParentState: fn( self: *const IOleParentUndoUnit, pdwState: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleUndoUnit.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleParentUndoUnit_Open(self: *const T, pPUU: ?*IOleParentUndoUnit) callconv(.Inline) HRESULT { return @ptrCast(*const IOleParentUndoUnit.VTable, self.vtable).Open(@ptrCast(*const IOleParentUndoUnit, self), pPUU); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleParentUndoUnit_Close(self: *const T, pPUU: ?*IOleParentUndoUnit, fCommit: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleParentUndoUnit.VTable, self.vtable).Close(@ptrCast(*const IOleParentUndoUnit, self), pPUU, fCommit); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleParentUndoUnit_Add(self: *const T, pUU: ?*IOleUndoUnit) callconv(.Inline) HRESULT { return @ptrCast(*const IOleParentUndoUnit.VTable, self.vtable).Add(@ptrCast(*const IOleParentUndoUnit, self), pUU); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleParentUndoUnit_FindUnit(self: *const T, pUU: ?*IOleUndoUnit) callconv(.Inline) HRESULT { return @ptrCast(*const IOleParentUndoUnit.VTable, self.vtable).FindUnit(@ptrCast(*const IOleParentUndoUnit, self), pUU); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleParentUndoUnit_GetParentState(self: *const T, pdwState: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleParentUndoUnit.VTable, self.vtable).GetParentState(@ptrCast(*const IOleParentUndoUnit, self), pdwState); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IEnumOleUndoUnits_Value = @import("../zig.zig").Guid.initString("b3e7c340-ef97-11ce-9bc9-00aa00608e01"); pub const IID_IEnumOleUndoUnits = &IID_IEnumOleUndoUnits_Value; pub const IEnumOleUndoUnits = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumOleUndoUnits, cElt: u32, rgElt: [*]?*IOleUndoUnit, pcEltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumOleUndoUnits, cElt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumOleUndoUnits, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumOleUndoUnits, ppEnum: ?*?*IEnumOleUndoUnits, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOleUndoUnits_Next(self: *const T, cElt: u32, rgElt: [*]?*IOleUndoUnit, pcEltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOleUndoUnits.VTable, self.vtable).Next(@ptrCast(*const IEnumOleUndoUnits, self), cElt, rgElt, pcEltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOleUndoUnits_Skip(self: *const T, cElt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOleUndoUnits.VTable, self.vtable).Skip(@ptrCast(*const IEnumOleUndoUnits, self), cElt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOleUndoUnits_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOleUndoUnits.VTable, self.vtable).Reset(@ptrCast(*const IEnumOleUndoUnits, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOleUndoUnits_Clone(self: *const T, ppEnum: ?*?*IEnumOleUndoUnits) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOleUndoUnits.VTable, self.vtable).Clone(@ptrCast(*const IEnumOleUndoUnits, self), ppEnum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleUndoManager_Value = @import("../zig.zig").Guid.initString("d001f200-ef97-11ce-9bc9-00aa00608e01"); pub const IID_IOleUndoManager = &IID_IOleUndoManager_Value; pub const IOleUndoManager = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Open: fn( self: *const IOleUndoManager, pPUU: ?*IOleParentUndoUnit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Close: fn( self: *const IOleUndoManager, pPUU: ?*IOleParentUndoUnit, fCommit: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Add: fn( self: *const IOleUndoManager, pUU: ?*IOleUndoUnit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetOpenParentState: fn( self: *const IOleUndoManager, pdwState: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DiscardFrom: fn( self: *const IOleUndoManager, pUU: ?*IOleUndoUnit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UndoTo: fn( self: *const IOleUndoManager, pUU: ?*IOleUndoUnit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RedoTo: fn( self: *const IOleUndoManager, pUU: ?*IOleUndoUnit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumUndoable: fn( self: *const IOleUndoManager, ppEnum: ?*?*IEnumOleUndoUnits, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumRedoable: fn( self: *const IOleUndoManager, ppEnum: ?*?*IEnumOleUndoUnits, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLastUndoDescription: fn( self: *const IOleUndoManager, pBstr: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLastRedoDescription: fn( self: *const IOleUndoManager, pBstr: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Enable: fn( self: *const IOleUndoManager, fEnable: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_Open(self: *const T, pPUU: ?*IOleParentUndoUnit) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).Open(@ptrCast(*const IOleUndoManager, self), pPUU); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_Close(self: *const T, pPUU: ?*IOleParentUndoUnit, fCommit: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).Close(@ptrCast(*const IOleUndoManager, self), pPUU, fCommit); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_Add(self: *const T, pUU: ?*IOleUndoUnit) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).Add(@ptrCast(*const IOleUndoManager, self), pUU); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_GetOpenParentState(self: *const T, pdwState: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).GetOpenParentState(@ptrCast(*const IOleUndoManager, self), pdwState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_DiscardFrom(self: *const T, pUU: ?*IOleUndoUnit) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).DiscardFrom(@ptrCast(*const IOleUndoManager, self), pUU); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_UndoTo(self: *const T, pUU: ?*IOleUndoUnit) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).UndoTo(@ptrCast(*const IOleUndoManager, self), pUU); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_RedoTo(self: *const T, pUU: ?*IOleUndoUnit) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).RedoTo(@ptrCast(*const IOleUndoManager, self), pUU); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_EnumUndoable(self: *const T, ppEnum: ?*?*IEnumOleUndoUnits) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).EnumUndoable(@ptrCast(*const IOleUndoManager, self), ppEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_EnumRedoable(self: *const T, ppEnum: ?*?*IEnumOleUndoUnits) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).EnumRedoable(@ptrCast(*const IOleUndoManager, self), ppEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_GetLastUndoDescription(self: *const T, pBstr: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).GetLastUndoDescription(@ptrCast(*const IOleUndoManager, self), pBstr); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_GetLastRedoDescription(self: *const T, pBstr: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).GetLastRedoDescription(@ptrCast(*const IOleUndoManager, self), pBstr); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_Enable(self: *const T, fEnable: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).Enable(@ptrCast(*const IOleUndoManager, self), fEnable); } };} pub usingnamespace MethodMixin(@This()); }; pub const POINTERINACTIVE = enum(i32) { ACTIVATEONENTRY = 1, DEACTIVATEONLEAVE = 2, ACTIVATEONDRAG = 4, }; pub const POINTERINACTIVE_ACTIVATEONENTRY = POINTERINACTIVE.ACTIVATEONENTRY; pub const POINTERINACTIVE_DEACTIVATEONLEAVE = POINTERINACTIVE.DEACTIVATEONLEAVE; pub const POINTERINACTIVE_ACTIVATEONDRAG = POINTERINACTIVE.ACTIVATEONDRAG; // TODO: this type is limited to platform 'windows5.0' const IID_IPointerInactive_Value = @import("../zig.zig").Guid.initString("55980ba0-35aa-11cf-b671-00aa004cd6d8"); pub const IID_IPointerInactive = &IID_IPointerInactive_Value; pub const IPointerInactive = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetActivationPolicy: fn( self: *const IPointerInactive, pdwPolicy: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnInactiveMouseMove: fn( self: *const IPointerInactive, pRectBounds: ?*RECT, x: i32, y: i32, grfKeyState: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnInactiveSetCursor: fn( self: *const IPointerInactive, pRectBounds: ?*RECT, x: i32, y: i32, dwMouseMsg: u32, fSetAlways: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPointerInactive_GetActivationPolicy(self: *const T, pdwPolicy: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPointerInactive.VTable, self.vtable).GetActivationPolicy(@ptrCast(*const IPointerInactive, self), pdwPolicy); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPointerInactive_OnInactiveMouseMove(self: *const T, pRectBounds: ?*RECT, x: i32, y: i32, grfKeyState: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPointerInactive.VTable, self.vtable).OnInactiveMouseMove(@ptrCast(*const IPointerInactive, self), pRectBounds, x, y, grfKeyState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPointerInactive_OnInactiveSetCursor(self: *const T, pRectBounds: ?*RECT, x: i32, y: i32, dwMouseMsg: u32, fSetAlways: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPointerInactive.VTable, self.vtable).OnInactiveSetCursor(@ptrCast(*const IPointerInactive, self), pRectBounds, x, y, dwMouseMsg, fSetAlways); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IObjectWithSite_Value = @import("../zig.zig").Guid.initString("fc4801a3-2ba9-11cf-a229-00aa003d7352"); pub const IID_IObjectWithSite = &IID_IObjectWithSite_Value; pub const IObjectWithSite = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetSite: fn( self: *const IObjectWithSite, pUnkSite: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSite: fn( self: *const IObjectWithSite, riid: ?*const Guid, ppvSite: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IObjectWithSite_SetSite(self: *const T, pUnkSite: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IObjectWithSite.VTable, self.vtable).SetSite(@ptrCast(*const IObjectWithSite, self), pUnkSite); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IObjectWithSite_GetSite(self: *const T, riid: ?*const Guid, ppvSite: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IObjectWithSite.VTable, self.vtable).GetSite(@ptrCast(*const IObjectWithSite, self), riid, ppvSite); } };} pub usingnamespace MethodMixin(@This()); }; pub const CALPOLESTR = extern struct { cElems: u32, pElems: ?*?PWSTR, }; pub const CADWORD = extern struct { cElems: u32, pElems: ?*u32, }; // TODO: this type is limited to platform 'windows5.0' const IID_IPerPropertyBrowsing_Value = @import("../zig.zig").Guid.initString("376bd3aa-3845-101b-84ed-08002b2ec713"); pub const IID_IPerPropertyBrowsing = &IID_IPerPropertyBrowsing_Value; pub const IPerPropertyBrowsing = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetDisplayString: fn( self: *const IPerPropertyBrowsing, dispID: i32, pBstr: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MapPropertyToPage: fn( self: *const IPerPropertyBrowsing, dispID: i32, pClsid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPredefinedStrings: fn( self: *const IPerPropertyBrowsing, dispID: i32, pCaStringsOut: ?*CALPOLESTR, pCaCookiesOut: ?*CADWORD, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPredefinedValue: fn( self: *const IPerPropertyBrowsing, dispID: i32, dwCookie: u32, pVarOut: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPerPropertyBrowsing_GetDisplayString(self: *const T, dispID: i32, pBstr: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPerPropertyBrowsing.VTable, self.vtable).GetDisplayString(@ptrCast(*const IPerPropertyBrowsing, self), dispID, pBstr); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPerPropertyBrowsing_MapPropertyToPage(self: *const T, dispID: i32, pClsid: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IPerPropertyBrowsing.VTable, self.vtable).MapPropertyToPage(@ptrCast(*const IPerPropertyBrowsing, self), dispID, pClsid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPerPropertyBrowsing_GetPredefinedStrings(self: *const T, dispID: i32, pCaStringsOut: ?*CALPOLESTR, pCaCookiesOut: ?*CADWORD) callconv(.Inline) HRESULT { return @ptrCast(*const IPerPropertyBrowsing.VTable, self.vtable).GetPredefinedStrings(@ptrCast(*const IPerPropertyBrowsing, self), dispID, pCaStringsOut, pCaCookiesOut); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPerPropertyBrowsing_GetPredefinedValue(self: *const T, dispID: i32, dwCookie: u32, pVarOut: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IPerPropertyBrowsing.VTable, self.vtable).GetPredefinedValue(@ptrCast(*const IPerPropertyBrowsing, self), dispID, dwCookie, pVarOut); } };} pub usingnamespace MethodMixin(@This()); }; pub const PROPBAG2_TYPE = enum(i32) { UNDEFINED = 0, DATA = 1, URL = 2, OBJECT = 3, STREAM = 4, STORAGE = 5, MONIKER = 6, }; pub const PROPBAG2_TYPE_UNDEFINED = PROPBAG2_TYPE.UNDEFINED; pub const PROPBAG2_TYPE_DATA = PROPBAG2_TYPE.DATA; pub const PROPBAG2_TYPE_URL = PROPBAG2_TYPE.URL; pub const PROPBAG2_TYPE_OBJECT = PROPBAG2_TYPE.OBJECT; pub const PROPBAG2_TYPE_STREAM = PROPBAG2_TYPE.STREAM; pub const PROPBAG2_TYPE_STORAGE = PROPBAG2_TYPE.STORAGE; pub const PROPBAG2_TYPE_MONIKER = PROPBAG2_TYPE.MONIKER; pub const PROPBAG2 = extern struct { dwType: u32, vt: u16, cfType: u16, dwHint: u32, pstrName: ?PWSTR, clsid: Guid, }; const IID_IPropertyBag2_Value = @import("../zig.zig").Guid.initString("22f55882-280b-11d0-a8a9-00a0c90c2004"); pub const IID_IPropertyBag2 = &IID_IPropertyBag2_Value; pub const IPropertyBag2 = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Read: fn( self: *const IPropertyBag2, cProperties: u32, pPropBag: [*]PROPBAG2, pErrLog: ?*IErrorLog, pvarValue: [*]VARIANT, phrError: [*]HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Write: fn( self: *const IPropertyBag2, cProperties: u32, pPropBag: [*]PROPBAG2, pvarValue: [*]VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CountProperties: fn( self: *const IPropertyBag2, pcProperties: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPropertyInfo: fn( self: *const IPropertyBag2, iProperty: u32, cProperties: u32, pPropBag: [*]PROPBAG2, pcProperties: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, LoadObject: fn( self: *const IPropertyBag2, pstrName: ?[*:0]const u16, dwHint: u32, pUnkObject: ?*IUnknown, pErrLog: ?*IErrorLog, ) 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 IPropertyBag2_Read(self: *const T, cProperties: u32, pPropBag: [*]PROPBAG2, pErrLog: ?*IErrorLog, pvarValue: [*]VARIANT, phrError: [*]HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyBag2.VTable, self.vtable).Read(@ptrCast(*const IPropertyBag2, self), cProperties, pPropBag, pErrLog, pvarValue, phrError); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyBag2_Write(self: *const T, cProperties: u32, pPropBag: [*]PROPBAG2, pvarValue: [*]VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyBag2.VTable, self.vtable).Write(@ptrCast(*const IPropertyBag2, self), cProperties, pPropBag, pvarValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyBag2_CountProperties(self: *const T, pcProperties: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyBag2.VTable, self.vtable).CountProperties(@ptrCast(*const IPropertyBag2, self), pcProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyBag2_GetPropertyInfo(self: *const T, iProperty: u32, cProperties: u32, pPropBag: [*]PROPBAG2, pcProperties: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyBag2.VTable, self.vtable).GetPropertyInfo(@ptrCast(*const IPropertyBag2, self), iProperty, cProperties, pPropBag, pcProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyBag2_LoadObject(self: *const T, pstrName: ?[*:0]const u16, dwHint: u32, pUnkObject: ?*IUnknown, pErrLog: ?*IErrorLog) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyBag2.VTable, self.vtable).LoadObject(@ptrCast(*const IPropertyBag2, self), pstrName, dwHint, pUnkObject, pErrLog); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPersistPropertyBag2_Value = @import("../zig.zig").Guid.initString("22f55881-280b-11d0-a8a9-00a0c90c2004"); pub const IID_IPersistPropertyBag2 = &IID_IPersistPropertyBag2_Value; pub const IPersistPropertyBag2 = extern struct { pub const VTable = extern struct { base: IPersist.VTable, InitNew: fn( self: *const IPersistPropertyBag2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Load: fn( self: *const IPersistPropertyBag2, pPropBag: ?*IPropertyBag2, pErrLog: ?*IErrorLog, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Save: fn( self: *const IPersistPropertyBag2, pPropBag: ?*IPropertyBag2, fClearDirty: BOOL, fSaveAllProperties: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsDirty: fn( self: *const IPersistPropertyBag2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IPersist.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistPropertyBag2_InitNew(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistPropertyBag2.VTable, self.vtable).InitNew(@ptrCast(*const IPersistPropertyBag2, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistPropertyBag2_Load(self: *const T, pPropBag: ?*IPropertyBag2, pErrLog: ?*IErrorLog) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistPropertyBag2.VTable, self.vtable).Load(@ptrCast(*const IPersistPropertyBag2, self), pPropBag, pErrLog); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistPropertyBag2_Save(self: *const T, pPropBag: ?*IPropertyBag2, fClearDirty: BOOL, fSaveAllProperties: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistPropertyBag2.VTable, self.vtable).Save(@ptrCast(*const IPersistPropertyBag2, self), pPropBag, fClearDirty, fSaveAllProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistPropertyBag2_IsDirty(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistPropertyBag2.VTable, self.vtable).IsDirty(@ptrCast(*const IPersistPropertyBag2, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IAdviseSinkEx_Value = @import("../zig.zig").Guid.initString("3af24290-0c96-11ce-a0cf-00aa00600ab8"); pub const IID_IAdviseSinkEx = &IID_IAdviseSinkEx_Value; pub const IAdviseSinkEx = extern struct { pub const VTable = extern struct { base: IAdviseSink.VTable, OnViewStatusChange: fn( self: *const IAdviseSinkEx, dwViewStatus: u32, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IAdviseSink.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAdviseSinkEx_OnViewStatusChange(self: *const T, dwViewStatus: u32) callconv(.Inline) void { return @ptrCast(*const IAdviseSinkEx.VTable, self.vtable).OnViewStatusChange(@ptrCast(*const IAdviseSinkEx, self), dwViewStatus); } };} pub usingnamespace MethodMixin(@This()); }; pub const QACONTAINERFLAGS = enum(i32) { SHOWHATCHING = 1, SHOWGRABHANDLES = 2, USERMODE = 4, DISPLAYASDEFAULT = 8, UIDEAD = 16, AUTOCLIP = 32, MESSAGEREFLECT = 64, SUPPORTSMNEMONICS = 128, }; pub const QACONTAINER_SHOWHATCHING = QACONTAINERFLAGS.SHOWHATCHING; pub const QACONTAINER_SHOWGRABHANDLES = QACONTAINERFLAGS.SHOWGRABHANDLES; pub const QACONTAINER_USERMODE = QACONTAINERFLAGS.USERMODE; pub const QACONTAINER_DISPLAYASDEFAULT = QACONTAINERFLAGS.DISPLAYASDEFAULT; pub const QACONTAINER_UIDEAD = QACONTAINERFLAGS.UIDEAD; pub const QACONTAINER_AUTOCLIP = QACONTAINERFLAGS.AUTOCLIP; pub const QACONTAINER_MESSAGEREFLECT = QACONTAINERFLAGS.MESSAGEREFLECT; pub const QACONTAINER_SUPPORTSMNEMONICS = QACONTAINERFLAGS.SUPPORTSMNEMONICS; pub const QACONTAINER = extern struct { cbSize: u32, pClientSite: ?*IOleClientSite, pAdviseSink: ?*IAdviseSinkEx, pPropertyNotifySink: ?*IPropertyNotifySink, pUnkEventSink: ?*IUnknown, dwAmbientFlags: u32, colorFore: u32, colorBack: u32, pFont: ?*IFont, pUndoMgr: ?*IOleUndoManager, dwAppearance: u32, lcid: i32, hpal: ?HPALETTE, pBindHost: ?*IBindHost, pOleControlSite: ?*IOleControlSite, pServiceProvider: ?*IServiceProvider, }; pub const QACONTROL = extern struct { cbSize: u32, dwMiscStatus: u32, dwViewStatus: u32, dwEventCookie: u32, dwPropNotifyCookie: u32, dwPointerActivationPolicy: u32, }; // TODO: this type is limited to platform 'windows5.0' const IID_IQuickActivate_Value = @import("../zig.zig").Guid.initString("cf51ed10-62fe-11cf-bf86-00a0c9034836"); pub const IID_IQuickActivate = &IID_IQuickActivate_Value; pub const IQuickActivate = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, QuickActivate: fn( self: *const IQuickActivate, pQaContainer: ?*QACONTAINER, pQaControl: ?*QACONTROL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetContentExtent: fn( self: *const IQuickActivate, pSizel: ?*SIZE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetContentExtent: fn( self: *const IQuickActivate, pSizel: ?*SIZE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IQuickActivate_QuickActivate(self: *const T, pQaContainer: ?*QACONTAINER, pQaControl: ?*QACONTROL) callconv(.Inline) HRESULT { return @ptrCast(*const IQuickActivate.VTable, self.vtable).QuickActivate(@ptrCast(*const IQuickActivate, self), pQaContainer, pQaControl); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IQuickActivate_SetContentExtent(self: *const T, pSizel: ?*SIZE) callconv(.Inline) HRESULT { return @ptrCast(*const IQuickActivate.VTable, self.vtable).SetContentExtent(@ptrCast(*const IQuickActivate, self), pSizel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IQuickActivate_GetContentExtent(self: *const T, pSizel: ?*SIZE) callconv(.Inline) HRESULT { return @ptrCast(*const IQuickActivate.VTable, self.vtable).GetContentExtent(@ptrCast(*const IQuickActivate, self), pSizel); } };} pub usingnamespace MethodMixin(@This()); }; pub const OCPFIPARAMS = extern struct { cbStructSize: u32, hWndOwner: ?HWND, x: i32, y: i32, lpszCaption: ?[*:0]const u16, cObjects: u32, lplpUnk: ?*?*IUnknown, cPages: u32, lpPages: ?*Guid, lcid: u32, dispidInitialProperty: i32, }; pub const FONTDESC = extern struct { cbSizeofstruct: u32, lpstrName: ?PWSTR, cySize: CY, sWeight: i16, sCharset: i16, fItalic: BOOL, fUnderline: BOOL, fStrikethrough: BOOL, }; pub const PICTDESC = extern struct { cbSizeofstruct: u32, picType: u32, Anonymous: extern union { bmp: extern struct { hbitmap: ?HBITMAP, hpal: ?HPALETTE, }, wmf: extern struct { hmeta: ?HMETAFILE, xExt: i32, yExt: i32, }, icon: extern struct { hicon: ?HICON, }, emf: extern struct { hemf: ?HENHMETAFILE, }, }, }; pub const OLE_TRISTATE = enum(i32) { Unchecked = 0, Checked = 1, Gray = 2, }; pub const triUnchecked = OLE_TRISTATE.Unchecked; pub const triChecked = OLE_TRISTATE.Checked; pub const triGray = OLE_TRISTATE.Gray; const IID_IVBGetControl_Value = @import("../zig.zig").Guid.initString("40a050a0-3c31-101b-a82e-08002b2b2337"); pub const IID_IVBGetControl = &IID_IVBGetControl_Value; pub const IVBGetControl = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, EnumControls: fn( self: *const IVBGetControl, dwOleContF: OLECONTF, dwWhich: ENUM_CONTROLS_WHICH_FLAGS, ppenumUnk: ?*?*IEnumUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IVBGetControl_EnumControls(self: *const T, dwOleContF: OLECONTF, dwWhich: ENUM_CONTROLS_WHICH_FLAGS, ppenumUnk: ?*?*IEnumUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IVBGetControl.VTable, self.vtable).EnumControls(@ptrCast(*const IVBGetControl, self), dwOleContF, dwWhich, ppenumUnk); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IGetOleObject_Value = @import("../zig.zig").Guid.initString("8a701da0-4feb-101b-a82e-08002b2b2337"); pub const IID_IGetOleObject = &IID_IGetOleObject_Value; pub const IGetOleObject = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetOleObject: fn( self: *const IGetOleObject, riid: ?*const Guid, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetOleObject_GetOleObject(self: *const T, riid: ?*const Guid, ppvObj: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IGetOleObject.VTable, self.vtable).GetOleObject(@ptrCast(*const IGetOleObject, self), riid, ppvObj); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IVBFormat_Value = @import("../zig.zig").Guid.initString("9849fd60-3768-101b-8d72-ae6164ffe3cf"); pub const IID_IVBFormat = &IID_IVBFormat_Value; pub const IVBFormat = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Format: fn( self: *const IVBFormat, vData: ?*VARIANT, bstrFormat: ?BSTR, lpBuffer: ?*c_void, cb: u16, lcid: i32, sFirstDayOfWeek: i16, sFirstWeekOfYear: u16, rcb: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IVBFormat_Format(self: *const T, vData: ?*VARIANT, bstrFormat: ?BSTR, lpBuffer: ?*c_void, cb: u16, lcid: i32, sFirstDayOfWeek: i16, sFirstWeekOfYear: u16, rcb: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const IVBFormat.VTable, self.vtable).Format(@ptrCast(*const IVBFormat, self), vData, bstrFormat, lpBuffer, cb, lcid, sFirstDayOfWeek, sFirstWeekOfYear, rcb); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IGetVBAObject_Value = @import("../zig.zig").Guid.initString("91733a60-3f4c-101b-a3f6-00aa0034e4e9"); pub const IID_IGetVBAObject = &IID_IGetVBAObject_Value; pub const IGetVBAObject = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetObject: fn( self: *const IGetVBAObject, riid: ?*const Guid, ppvObj: ?*?*c_void, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetVBAObject_GetObject(self: *const T, riid: ?*const Guid, ppvObj: ?*?*c_void, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IGetVBAObject.VTable, self.vtable).GetObject(@ptrCast(*const IGetVBAObject, self), riid, ppvObj, dwReserved); } };} pub usingnamespace MethodMixin(@This()); }; pub const DOCMISC = enum(i32) { CANCREATEMULTIPLEVIEWS = 1, SUPPORTCOMPLEXRECTANGLES = 2, CANTOPENEDIT = 4, NOFILESUPPORT = 8, }; pub const DOCMISC_CANCREATEMULTIPLEVIEWS = DOCMISC.CANCREATEMULTIPLEVIEWS; pub const DOCMISC_SUPPORTCOMPLEXRECTANGLES = DOCMISC.SUPPORTCOMPLEXRECTANGLES; pub const DOCMISC_CANTOPENEDIT = DOCMISC.CANTOPENEDIT; pub const DOCMISC_NOFILESUPPORT = DOCMISC.NOFILESUPPORT; // TODO: this type is limited to platform 'windows5.0' const IID_IOleDocument_Value = @import("../zig.zig").Guid.initString("b722bcc5-4e68-101b-a2bc-00aa00404770"); pub const IID_IOleDocument = &IID_IOleDocument_Value; pub const IOleDocument = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateView: fn( self: *const IOleDocument, pIPSite: ?*IOleInPlaceSite, pstm: ?*IStream, dwReserved: u32, ppView: ?*?*IOleDocumentView, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDocMiscStatus: fn( self: *const IOleDocument, pdwStatus: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumViews: fn( self: *const IOleDocument, ppEnum: ?*?*IEnumOleDocumentViews, ppView: ?*?*IOleDocumentView, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocument_CreateView(self: *const T, pIPSite: ?*IOleInPlaceSite, pstm: ?*IStream, dwReserved: u32, ppView: ?*?*IOleDocumentView) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocument.VTable, self.vtable).CreateView(@ptrCast(*const IOleDocument, self), pIPSite, pstm, dwReserved, ppView); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocument_GetDocMiscStatus(self: *const T, pdwStatus: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocument.VTable, self.vtable).GetDocMiscStatus(@ptrCast(*const IOleDocument, self), pdwStatus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocument_EnumViews(self: *const T, ppEnum: ?*?*IEnumOleDocumentViews, ppView: ?*?*IOleDocumentView) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocument.VTable, self.vtable).EnumViews(@ptrCast(*const IOleDocument, self), ppEnum, ppView); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleDocumentSite_Value = @import("../zig.zig").Guid.initString("b722bcc7-4e68-101b-a2bc-00aa00404770"); pub const IID_IOleDocumentSite = &IID_IOleDocumentSite_Value; pub const IOleDocumentSite = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ActivateMe: fn( self: *const IOleDocumentSite, pViewToActivate: ?*IOleDocumentView, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentSite_ActivateMe(self: *const T, pViewToActivate: ?*IOleDocumentView) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentSite.VTable, self.vtable).ActivateMe(@ptrCast(*const IOleDocumentSite, self), pViewToActivate); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleDocumentView_Value = @import("../zig.zig").Guid.initString("b722bcc6-4e68-101b-a2bc-00aa00404770"); pub const IID_IOleDocumentView = &IID_IOleDocumentView_Value; pub const IOleDocumentView = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetInPlaceSite: fn( self: *const IOleDocumentView, pIPSite: ?*IOleInPlaceSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInPlaceSite: fn( self: *const IOleDocumentView, ppIPSite: ?*?*IOleInPlaceSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDocument: fn( self: *const IOleDocumentView, ppunk: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetRect: fn( self: *const IOleDocumentView, prcView: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRect: fn( self: *const IOleDocumentView, prcView: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetRectComplex: fn( self: *const IOleDocumentView, prcView: ?*RECT, prcHScroll: ?*RECT, prcVScroll: ?*RECT, prcSizeBox: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Show: fn( self: *const IOleDocumentView, fShow: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UIActivate: fn( self: *const IOleDocumentView, fUIActivate: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Open: fn( self: *const IOleDocumentView, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CloseView: fn( self: *const IOleDocumentView, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SaveViewState: fn( self: *const IOleDocumentView, pstm: ?*IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ApplyViewState: fn( self: *const IOleDocumentView, pstm: ?*IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IOleDocumentView, pIPSiteNew: ?*IOleInPlaceSite, ppViewNew: ?*?*IOleDocumentView, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_SetInPlaceSite(self: *const T, pIPSite: ?*IOleInPlaceSite) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).SetInPlaceSite(@ptrCast(*const IOleDocumentView, self), pIPSite); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_GetInPlaceSite(self: *const T, ppIPSite: ?*?*IOleInPlaceSite) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).GetInPlaceSite(@ptrCast(*const IOleDocumentView, self), ppIPSite); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_GetDocument(self: *const T, ppunk: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).GetDocument(@ptrCast(*const IOleDocumentView, self), ppunk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_SetRect(self: *const T, prcView: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).SetRect(@ptrCast(*const IOleDocumentView, self), prcView); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_GetRect(self: *const T, prcView: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).GetRect(@ptrCast(*const IOleDocumentView, self), prcView); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_SetRectComplex(self: *const T, prcView: ?*RECT, prcHScroll: ?*RECT, prcVScroll: ?*RECT, prcSizeBox: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).SetRectComplex(@ptrCast(*const IOleDocumentView, self), prcView, prcHScroll, prcVScroll, prcSizeBox); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_Show(self: *const T, fShow: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).Show(@ptrCast(*const IOleDocumentView, self), fShow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_UIActivate(self: *const T, fUIActivate: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).UIActivate(@ptrCast(*const IOleDocumentView, self), fUIActivate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_Open(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).Open(@ptrCast(*const IOleDocumentView, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_CloseView(self: *const T, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).CloseView(@ptrCast(*const IOleDocumentView, self), dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_SaveViewState(self: *const T, pstm: ?*IStream) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).SaveViewState(@ptrCast(*const IOleDocumentView, self), pstm); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_ApplyViewState(self: *const T, pstm: ?*IStream) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).ApplyViewState(@ptrCast(*const IOleDocumentView, self), pstm); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_Clone(self: *const T, pIPSiteNew: ?*IOleInPlaceSite, ppViewNew: ?*?*IOleDocumentView) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).Clone(@ptrCast(*const IOleDocumentView, self), pIPSiteNew, ppViewNew); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IEnumOleDocumentViews_Value = @import("../zig.zig").Guid.initString("b722bcc8-4e68-101b-a2bc-00aa00404770"); pub const IID_IEnumOleDocumentViews = &IID_IEnumOleDocumentViews_Value; pub const IEnumOleDocumentViews = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumOleDocumentViews, cViews: u32, rgpView: ?*?*IOleDocumentView, pcFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumOleDocumentViews, cViews: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumOleDocumentViews, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumOleDocumentViews, ppEnum: ?*?*IEnumOleDocumentViews, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOleDocumentViews_Next(self: *const T, cViews: u32, rgpView: ?*?*IOleDocumentView, pcFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOleDocumentViews.VTable, self.vtable).Next(@ptrCast(*const IEnumOleDocumentViews, self), cViews, rgpView, pcFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOleDocumentViews_Skip(self: *const T, cViews: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOleDocumentViews.VTable, self.vtable).Skip(@ptrCast(*const IEnumOleDocumentViews, self), cViews); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOleDocumentViews_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOleDocumentViews.VTable, self.vtable).Reset(@ptrCast(*const IEnumOleDocumentViews, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOleDocumentViews_Clone(self: *const T, ppEnum: ?*?*IEnumOleDocumentViews) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOleDocumentViews.VTable, self.vtable).Clone(@ptrCast(*const IEnumOleDocumentViews, self), ppEnum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IContinueCallback_Value = @import("../zig.zig").Guid.initString("b722bcca-4e68-101b-a2bc-00aa00404770"); pub const IID_IContinueCallback = &IID_IContinueCallback_Value; pub const IContinueCallback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, FContinue: fn( self: *const IContinueCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FContinuePrinting: fn( self: *const IContinueCallback, nCntPrinted: i32, nCurPage: i32, pwszPrintStatus: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IContinueCallback_FContinue(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IContinueCallback.VTable, self.vtable).FContinue(@ptrCast(*const IContinueCallback, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IContinueCallback_FContinuePrinting(self: *const T, nCntPrinted: i32, nCurPage: i32, pwszPrintStatus: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IContinueCallback.VTable, self.vtable).FContinuePrinting(@ptrCast(*const IContinueCallback, self), nCntPrinted, nCurPage, pwszPrintStatus); } };} pub usingnamespace MethodMixin(@This()); }; pub const PRINTFLAG = enum(u32) { MAYBOTHERUSER = 1, PROMPTUSER = 2, USERMAYCHANGEPRINTER = 4, RECOMPOSETODEVICE = 8, DONTACTUALLYPRINT = 16, FORCEPROPERTIES = 32, PRINTTOFILE = 64, _, pub fn initFlags(o: struct { MAYBOTHERUSER: u1 = 0, PROMPTUSER: u1 = 0, USERMAYCHANGEPRINTER: u1 = 0, RECOMPOSETODEVICE: u1 = 0, DONTACTUALLYPRINT: u1 = 0, FORCEPROPERTIES: u1 = 0, PRINTTOFILE: u1 = 0, }) PRINTFLAG { return @intToEnum(PRINTFLAG, (if (o.MAYBOTHERUSER == 1) @enumToInt(PRINTFLAG.MAYBOTHERUSER) else 0) | (if (o.PROMPTUSER == 1) @enumToInt(PRINTFLAG.PROMPTUSER) else 0) | (if (o.USERMAYCHANGEPRINTER == 1) @enumToInt(PRINTFLAG.USERMAYCHANGEPRINTER) else 0) | (if (o.RECOMPOSETODEVICE == 1) @enumToInt(PRINTFLAG.RECOMPOSETODEVICE) else 0) | (if (o.DONTACTUALLYPRINT == 1) @enumToInt(PRINTFLAG.DONTACTUALLYPRINT) else 0) | (if (o.FORCEPROPERTIES == 1) @enumToInt(PRINTFLAG.FORCEPROPERTIES) else 0) | (if (o.PRINTTOFILE == 1) @enumToInt(PRINTFLAG.PRINTTOFILE) else 0) ); } }; pub const PRINTFLAG_MAYBOTHERUSER = PRINTFLAG.MAYBOTHERUSER; pub const PRINTFLAG_PROMPTUSER = PRINTFLAG.PROMPTUSER; pub const PRINTFLAG_USERMAYCHANGEPRINTER = PRINTFLAG.USERMAYCHANGEPRINTER; pub const PRINTFLAG_RECOMPOSETODEVICE = PRINTFLAG.RECOMPOSETODEVICE; pub const PRINTFLAG_DONTACTUALLYPRINT = PRINTFLAG.DONTACTUALLYPRINT; pub const PRINTFLAG_FORCEPROPERTIES = PRINTFLAG.FORCEPROPERTIES; pub const PRINTFLAG_PRINTTOFILE = PRINTFLAG.PRINTTOFILE; pub const PAGERANGE = extern struct { nFromPage: i32, nToPage: i32, }; pub const PAGESET = extern struct { cbStruct: u32, fOddPages: BOOL, fEvenPages: BOOL, cPageRange: u32, rgPages: [1]PAGERANGE, }; // TODO: this type is limited to platform 'windows5.0' const IID_IPrint_Value = @import("../zig.zig").Guid.initString("b722bcc9-4e68-101b-a2bc-00aa00404770"); pub const IID_IPrint = &IID_IPrint_Value; pub const IPrint = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetInitialPageNum: fn( self: *const IPrint, nFirstPage: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPageInfo: fn( self: *const IPrint, pnFirstPage: ?*i32, pcPages: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Print: fn( self: *const IPrint, grfFlags: u32, pptd: ?*?*DVTARGETDEVICE, ppPageSet: ?*?*PAGESET, pstgmOptions: ?*STGMEDIUM, pcallback: ?*IContinueCallback, nFirstPage: i32, pcPagesPrinted: ?*i32, pnLastPage: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrint_SetInitialPageNum(self: *const T, nFirstPage: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPrint.VTable, self.vtable).SetInitialPageNum(@ptrCast(*const IPrint, self), nFirstPage); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrint_GetPageInfo(self: *const T, pnFirstPage: ?*i32, pcPages: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPrint.VTable, self.vtable).GetPageInfo(@ptrCast(*const IPrint, self), pnFirstPage, pcPages); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrint_Print(self: *const T, grfFlags: u32, pptd: ?*?*DVTARGETDEVICE, ppPageSet: ?*?*PAGESET, pstgmOptions: ?*STGMEDIUM, pcallback: ?*IContinueCallback, nFirstPage: i32, pcPagesPrinted: ?*i32, pnLastPage: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPrint.VTable, self.vtable).Print(@ptrCast(*const IPrint, self), grfFlags, pptd, ppPageSet, pstgmOptions, pcallback, nFirstPage, pcPagesPrinted, pnLastPage); } };} pub usingnamespace MethodMixin(@This()); }; pub const OLECMDF = enum(i32) { SUPPORTED = 1, ENABLED = 2, LATCHED = 4, NINCHED = 8, INVISIBLE = 16, DEFHIDEONCTXTMENU = 32, }; pub const OLECMDF_SUPPORTED = OLECMDF.SUPPORTED; pub const OLECMDF_ENABLED = OLECMDF.ENABLED; pub const OLECMDF_LATCHED = OLECMDF.LATCHED; pub const OLECMDF_NINCHED = OLECMDF.NINCHED; pub const OLECMDF_INVISIBLE = OLECMDF.INVISIBLE; pub const OLECMDF_DEFHIDEONCTXTMENU = OLECMDF.DEFHIDEONCTXTMENU; pub const OLECMD = extern struct { cmdID: u32, cmdf: u32, }; pub const OLECMDTEXT = extern struct { cmdtextf: u32, cwActual: u32, cwBuf: u32, rgwz: [1]u16, }; pub const OLECMDTEXTF = enum(i32) { NONE = 0, NAME = 1, STATUS = 2, }; pub const OLECMDTEXTF_NONE = OLECMDTEXTF.NONE; pub const OLECMDTEXTF_NAME = OLECMDTEXTF.NAME; pub const OLECMDTEXTF_STATUS = OLECMDTEXTF.STATUS; pub const OLECMDEXECOPT = enum(i32) { DODEFAULT = 0, PROMPTUSER = 1, DONTPROMPTUSER = 2, SHOWHELP = 3, }; pub const OLECMDEXECOPT_DODEFAULT = OLECMDEXECOPT.DODEFAULT; pub const OLECMDEXECOPT_PROMPTUSER = OLECMDEXECOPT.PROMPTUSER; pub const OLECMDEXECOPT_DONTPROMPTUSER = OLECMDEXECOPT.DONTPROMPTUSER; pub const OLECMDEXECOPT_SHOWHELP = OLECMDEXECOPT.SHOWHELP; pub const OLECMDID = enum(i32) { OPEN = 1, NEW = 2, SAVE = 3, SAVEAS = 4, SAVECOPYAS = 5, PRINT = 6, PRINTPREVIEW = 7, PAGESETUP = 8, SPELL = 9, PROPERTIES = 10, CUT = 11, COPY = 12, PASTE = 13, PASTESPECIAL = 14, UNDO = 15, REDO = 16, SELECTALL = 17, CLEARSELECTION = 18, ZOOM = 19, GETZOOMRANGE = 20, UPDATECOMMANDS = 21, REFRESH = 22, STOP = 23, HIDETOOLBARS = 24, SETPROGRESSMAX = 25, SETPROGRESSPOS = 26, SETPROGRESSTEXT = 27, SETTITLE = 28, SETDOWNLOADSTATE = 29, STOPDOWNLOAD = 30, ONTOOLBARACTIVATED = 31, FIND = 32, DELETE = 33, HTTPEQUIV = 34, HTTPEQUIV_DONE = 35, ENABLE_INTERACTION = 36, ONUNLOAD = 37, PROPERTYBAG2 = 38, PREREFRESH = 39, SHOWSCRIPTERROR = 40, SHOWMESSAGE = 41, SHOWFIND = 42, SHOWPAGESETUP = 43, SHOWPRINT = 44, CLOSE = 45, ALLOWUILESSSAVEAS = 46, DONTDOWNLOADCSS = 47, UPDATEPAGESTATUS = 48, PRINT2 = 49, PRINTPREVIEW2 = 50, SETPRINTTEMPLATE = 51, GETPRINTTEMPLATE = 52, PAGEACTIONBLOCKED = 55, PAGEACTIONUIQUERY = 56, FOCUSVIEWCONTROLS = 57, FOCUSVIEWCONTROLSQUERY = 58, SHOWPAGEACTIONMENU = 59, ADDTRAVELENTRY = 60, UPDATETRAVELENTRY = 61, UPDATEBACKFORWARDSTATE = 62, OPTICAL_ZOOM = 63, OPTICAL_GETZOOMRANGE = 64, WINDOWSTATECHANGED = 65, ACTIVEXINSTALLSCOPE = 66, UPDATETRAVELENTRY_DATARECOVERY = 67, SHOWTASKDLG = 68, POPSTATEEVENT = 69, VIEWPORT_MODE = 70, LAYOUT_VIEWPORT_WIDTH = 71, VISUAL_VIEWPORT_EXCLUDE_BOTTOM = 72, USER_OPTICAL_ZOOM = 73, PAGEAVAILABLE = 74, GETUSERSCALABLE = 75, UPDATE_CARET = 76, ENABLE_VISIBILITY = 77, MEDIA_PLAYBACK = 78, SETFAVICON = 79, SET_HOST_FULLSCREENMODE = 80, EXITFULLSCREEN = 81, SCROLLCOMPLETE = 82, ONBEFOREUNLOAD = 83, SHOWMESSAGE_BLOCKABLE = 84, SHOWTASKDLG_BLOCKABLE = 85, }; pub const OLECMDID_OPEN = OLECMDID.OPEN; pub const OLECMDID_NEW = OLECMDID.NEW; pub const OLECMDID_SAVE = OLECMDID.SAVE; pub const OLECMDID_SAVEAS = OLECMDID.SAVEAS; pub const OLECMDID_SAVECOPYAS = OLECMDID.SAVECOPYAS; pub const OLECMDID_PRINT = OLECMDID.PRINT; pub const OLECMDID_PRINTPREVIEW = OLECMDID.PRINTPREVIEW; pub const OLECMDID_PAGESETUP = OLECMDID.PAGESETUP; pub const OLECMDID_SPELL = OLECMDID.SPELL; pub const OLECMDID_PROPERTIES = OLECMDID.PROPERTIES; pub const OLECMDID_CUT = OLECMDID.CUT; pub const OLECMDID_COPY = OLECMDID.COPY; pub const OLECMDID_PASTE = OLECMDID.PASTE; pub const OLECMDID_PASTESPECIAL = OLECMDID.PASTESPECIAL; pub const OLECMDID_UNDO = OLECMDID.UNDO; pub const OLECMDID_REDO = OLECMDID.REDO; pub const OLECMDID_SELECTALL = OLECMDID.SELECTALL; pub const OLECMDID_CLEARSELECTION = OLECMDID.CLEARSELECTION; pub const OLECMDID_ZOOM = OLECMDID.ZOOM; pub const OLECMDID_GETZOOMRANGE = OLECMDID.GETZOOMRANGE; pub const OLECMDID_UPDATECOMMANDS = OLECMDID.UPDATECOMMANDS; pub const OLECMDID_REFRESH = OLECMDID.REFRESH; pub const OLECMDID_STOP = OLECMDID.STOP; pub const OLECMDID_HIDETOOLBARS = OLECMDID.HIDETOOLBARS; pub const OLECMDID_SETPROGRESSMAX = OLECMDID.SETPROGRESSMAX; pub const OLECMDID_SETPROGRESSPOS = OLECMDID.SETPROGRESSPOS; pub const OLECMDID_SETPROGRESSTEXT = OLECMDID.SETPROGRESSTEXT; pub const OLECMDID_SETTITLE = OLECMDID.SETTITLE; pub const OLECMDID_SETDOWNLOADSTATE = OLECMDID.SETDOWNLOADSTATE; pub const OLECMDID_STOPDOWNLOAD = OLECMDID.STOPDOWNLOAD; pub const OLECMDID_ONTOOLBARACTIVATED = OLECMDID.ONTOOLBARACTIVATED; pub const OLECMDID_FIND = OLECMDID.FIND; pub const OLECMDID_DELETE = OLECMDID.DELETE; pub const OLECMDID_HTTPEQUIV = OLECMDID.HTTPEQUIV; pub const OLECMDID_HTTPEQUIV_DONE = OLECMDID.HTTPEQUIV_DONE; pub const OLECMDID_ENABLE_INTERACTION = OLECMDID.ENABLE_INTERACTION; pub const OLECMDID_ONUNLOAD = OLECMDID.ONUNLOAD; pub const OLECMDID_PROPERTYBAG2 = OLECMDID.PROPERTYBAG2; pub const OLECMDID_PREREFRESH = OLECMDID.PREREFRESH; pub const OLECMDID_SHOWSCRIPTERROR = OLECMDID.SHOWSCRIPTERROR; pub const OLECMDID_SHOWMESSAGE = OLECMDID.SHOWMESSAGE; pub const OLECMDID_SHOWFIND = OLECMDID.SHOWFIND; pub const OLECMDID_SHOWPAGESETUP = OLECMDID.SHOWPAGESETUP; pub const OLECMDID_SHOWPRINT = OLECMDID.SHOWPRINT; pub const OLECMDID_CLOSE = OLECMDID.CLOSE; pub const OLECMDID_ALLOWUILESSSAVEAS = OLECMDID.ALLOWUILESSSAVEAS; pub const OLECMDID_DONTDOWNLOADCSS = OLECMDID.DONTDOWNLOADCSS; pub const OLECMDID_UPDATEPAGESTATUS = OLECMDID.UPDATEPAGESTATUS; pub const OLECMDID_PRINT2 = OLECMDID.PRINT2; pub const OLECMDID_PRINTPREVIEW2 = OLECMDID.PRINTPREVIEW2; pub const OLECMDID_SETPRINTTEMPLATE = OLECMDID.SETPRINTTEMPLATE; pub const OLECMDID_GETPRINTTEMPLATE = OLECMDID.GETPRINTTEMPLATE; pub const OLECMDID_PAGEACTIONBLOCKED = OLECMDID.PAGEACTIONBLOCKED; pub const OLECMDID_PAGEACTIONUIQUERY = OLECMDID.PAGEACTIONUIQUERY; pub const OLECMDID_FOCUSVIEWCONTROLS = OLECMDID.FOCUSVIEWCONTROLS; pub const OLECMDID_FOCUSVIEWCONTROLSQUERY = OLECMDID.FOCUSVIEWCONTROLSQUERY; pub const OLECMDID_SHOWPAGEACTIONMENU = OLECMDID.SHOWPAGEACTIONMENU; pub const OLECMDID_ADDTRAVELENTRY = OLECMDID.ADDTRAVELENTRY; pub const OLECMDID_UPDATETRAVELENTRY = OLECMDID.UPDATETRAVELENTRY; pub const OLECMDID_UPDATEBACKFORWARDSTATE = OLECMDID.UPDATEBACKFORWARDSTATE; pub const OLECMDID_OPTICAL_ZOOM = OLECMDID.OPTICAL_ZOOM; pub const OLECMDID_OPTICAL_GETZOOMRANGE = OLECMDID.OPTICAL_GETZOOMRANGE; pub const OLECMDID_WINDOWSTATECHANGED = OLECMDID.WINDOWSTATECHANGED; pub const OLECMDID_ACTIVEXINSTALLSCOPE = OLECMDID.ACTIVEXINSTALLSCOPE; pub const OLECMDID_UPDATETRAVELENTRY_DATARECOVERY = OLECMDID.UPDATETRAVELENTRY_DATARECOVERY; pub const OLECMDID_SHOWTASKDLG = OLECMDID.SHOWTASKDLG; pub const OLECMDID_POPSTATEEVENT = OLECMDID.POPSTATEEVENT; pub const OLECMDID_VIEWPORT_MODE = OLECMDID.VIEWPORT_MODE; pub const OLECMDID_LAYOUT_VIEWPORT_WIDTH = OLECMDID.LAYOUT_VIEWPORT_WIDTH; pub const OLECMDID_VISUAL_VIEWPORT_EXCLUDE_BOTTOM = OLECMDID.VISUAL_VIEWPORT_EXCLUDE_BOTTOM; pub const OLECMDID_USER_OPTICAL_ZOOM = OLECMDID.USER_OPTICAL_ZOOM; pub const OLECMDID_PAGEAVAILABLE = OLECMDID.PAGEAVAILABLE; pub const OLECMDID_GETUSERSCALABLE = OLECMDID.GETUSERSCALABLE; pub const OLECMDID_UPDATE_CARET = OLECMDID.UPDATE_CARET; pub const OLECMDID_ENABLE_VISIBILITY = OLECMDID.ENABLE_VISIBILITY; pub const OLECMDID_MEDIA_PLAYBACK = OLECMDID.MEDIA_PLAYBACK; pub const OLECMDID_SETFAVICON = OLECMDID.SETFAVICON; pub const OLECMDID_SET_HOST_FULLSCREENMODE = OLECMDID.SET_HOST_FULLSCREENMODE; pub const OLECMDID_EXITFULLSCREEN = OLECMDID.EXITFULLSCREEN; pub const OLECMDID_SCROLLCOMPLETE = OLECMDID.SCROLLCOMPLETE; pub const OLECMDID_ONBEFOREUNLOAD = OLECMDID.ONBEFOREUNLOAD; pub const OLECMDID_SHOWMESSAGE_BLOCKABLE = OLECMDID.SHOWMESSAGE_BLOCKABLE; pub const OLECMDID_SHOWTASKDLG_BLOCKABLE = OLECMDID.SHOWTASKDLG_BLOCKABLE; pub const MEDIAPLAYBACK_STATE = enum(i32) { RESUME = 0, PAUSE = 1, PAUSE_AND_SUSPEND = 2, RESUME_FROM_SUSPEND = 3, }; pub const MEDIAPLAYBACK_RESUME = MEDIAPLAYBACK_STATE.RESUME; pub const MEDIAPLAYBACK_PAUSE = MEDIAPLAYBACK_STATE.PAUSE; pub const MEDIAPLAYBACK_PAUSE_AND_SUSPEND = MEDIAPLAYBACK_STATE.PAUSE_AND_SUSPEND; pub const MEDIAPLAYBACK_RESUME_FROM_SUSPEND = MEDIAPLAYBACK_STATE.RESUME_FROM_SUSPEND; pub const IGNOREMIME = enum(i32) { PROMPT = 1, TEXT = 2, }; pub const IGNOREMIME_PROMPT = IGNOREMIME.PROMPT; pub const IGNOREMIME_TEXT = IGNOREMIME.TEXT; pub const WPCSETTING = enum(i32) { LOGGING_ENABLED = 1, FILEDOWNLOAD_BLOCKED = 2, }; pub const WPCSETTING_LOGGING_ENABLED = WPCSETTING.LOGGING_ENABLED; pub const WPCSETTING_FILEDOWNLOAD_BLOCKED = WPCSETTING.FILEDOWNLOAD_BLOCKED; // TODO: this type is limited to platform 'windows5.0' const IID_IOleCommandTarget_Value = @import("../zig.zig").Guid.initString("b722bccb-4e68-101b-a2bc-00aa00404770"); pub const IID_IOleCommandTarget = &IID_IOleCommandTarget_Value; pub const IOleCommandTarget = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, QueryStatus: fn( self: *const IOleCommandTarget, pguidCmdGroup: ?*const Guid, cCmds: u32, prgCmds: ?*OLECMD, pCmdText: ?*OLECMDTEXT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Exec: fn( self: *const IOleCommandTarget, pguidCmdGroup: ?*const Guid, nCmdID: u32, nCmdexecopt: u32, pvaIn: ?*VARIANT, pvaOut: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleCommandTarget_QueryStatus(self: *const T, pguidCmdGroup: ?*const Guid, cCmds: u32, prgCmds: ?*OLECMD, pCmdText: ?*OLECMDTEXT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCommandTarget.VTable, self.vtable).QueryStatus(@ptrCast(*const IOleCommandTarget, self), pguidCmdGroup, cCmds, prgCmds, pCmdText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleCommandTarget_Exec(self: *const T, pguidCmdGroup: ?*const Guid, nCmdID: u32, nCmdexecopt: u32, pvaIn: ?*VARIANT, pvaOut: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCommandTarget.VTable, self.vtable).Exec(@ptrCast(*const IOleCommandTarget, self), pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); } };} pub usingnamespace MethodMixin(@This()); }; pub const OLECMDID_REFRESHFLAG = enum(i32) { NORMAL = 0, IFEXPIRED = 1, CONTINUE = 2, COMPLETELY = 3, NO_CACHE = 4, RELOAD = 5, LEVELMASK = 255, CLEARUSERINPUT = 4096, PROMPTIFOFFLINE = 8192, THROUGHSCRIPT = 16384, SKIPBEFOREUNLOADEVENT = 32768, PAGEACTION_ACTIVEXINSTALL = 65536, PAGEACTION_FILEDOWNLOAD = 131072, PAGEACTION_LOCALMACHINE = 262144, PAGEACTION_POPUPWINDOW = 524288, PAGEACTION_PROTLOCKDOWNLOCALMACHINE = 1048576, PAGEACTION_PROTLOCKDOWNTRUSTED = 2097152, PAGEACTION_PROTLOCKDOWNINTRANET = 4194304, PAGEACTION_PROTLOCKDOWNINTERNET = 8388608, PAGEACTION_PROTLOCKDOWNRESTRICTED = 16777216, PAGEACTION_MIXEDCONTENT = 33554432, PAGEACTION_INVALID_CERT = 67108864, PAGEACTION_ALLOW_VERSION = 134217728, }; pub const OLECMDIDF_REFRESH_NORMAL = OLECMDID_REFRESHFLAG.NORMAL; pub const OLECMDIDF_REFRESH_IFEXPIRED = OLECMDID_REFRESHFLAG.IFEXPIRED; pub const OLECMDIDF_REFRESH_CONTINUE = OLECMDID_REFRESHFLAG.CONTINUE; pub const OLECMDIDF_REFRESH_COMPLETELY = OLECMDID_REFRESHFLAG.COMPLETELY; pub const OLECMDIDF_REFRESH_NO_CACHE = OLECMDID_REFRESHFLAG.NO_CACHE; pub const OLECMDIDF_REFRESH_RELOAD = OLECMDID_REFRESHFLAG.RELOAD; pub const OLECMDIDF_REFRESH_LEVELMASK = OLECMDID_REFRESHFLAG.LEVELMASK; pub const OLECMDIDF_REFRESH_CLEARUSERINPUT = OLECMDID_REFRESHFLAG.CLEARUSERINPUT; pub const OLECMDIDF_REFRESH_PROMPTIFOFFLINE = OLECMDID_REFRESHFLAG.PROMPTIFOFFLINE; pub const OLECMDIDF_REFRESH_THROUGHSCRIPT = OLECMDID_REFRESHFLAG.THROUGHSCRIPT; pub const OLECMDIDF_REFRESH_SKIPBEFOREUNLOADEVENT = OLECMDID_REFRESHFLAG.SKIPBEFOREUNLOADEVENT; pub const OLECMDIDF_REFRESH_PAGEACTION_ACTIVEXINSTALL = OLECMDID_REFRESHFLAG.PAGEACTION_ACTIVEXINSTALL; pub const OLECMDIDF_REFRESH_PAGEACTION_FILEDOWNLOAD = OLECMDID_REFRESHFLAG.PAGEACTION_FILEDOWNLOAD; pub const OLECMDIDF_REFRESH_PAGEACTION_LOCALMACHINE = OLECMDID_REFRESHFLAG.PAGEACTION_LOCALMACHINE; pub const OLECMDIDF_REFRESH_PAGEACTION_POPUPWINDOW = OLECMDID_REFRESHFLAG.PAGEACTION_POPUPWINDOW; pub const OLECMDIDF_REFRESH_PAGEACTION_PROTLOCKDOWNLOCALMACHINE = OLECMDID_REFRESHFLAG.PAGEACTION_PROTLOCKDOWNLOCALMACHINE; pub const OLECMDIDF_REFRESH_PAGEACTION_PROTLOCKDOWNTRUSTED = OLECMDID_REFRESHFLAG.PAGEACTION_PROTLOCKDOWNTRUSTED; pub const OLECMDIDF_REFRESH_PAGEACTION_PROTLOCKDOWNINTRANET = OLECMDID_REFRESHFLAG.PAGEACTION_PROTLOCKDOWNINTRANET; pub const OLECMDIDF_REFRESH_PAGEACTION_PROTLOCKDOWNINTERNET = OLECMDID_REFRESHFLAG.PAGEACTION_PROTLOCKDOWNINTERNET; pub const OLECMDIDF_REFRESH_PAGEACTION_PROTLOCKDOWNRESTRICTED = OLECMDID_REFRESHFLAG.PAGEACTION_PROTLOCKDOWNRESTRICTED; pub const OLECMDIDF_REFRESH_PAGEACTION_MIXEDCONTENT = OLECMDID_REFRESHFLAG.PAGEACTION_MIXEDCONTENT; pub const OLECMDIDF_REFRESH_PAGEACTION_INVALID_CERT = OLECMDID_REFRESHFLAG.PAGEACTION_INVALID_CERT; pub const OLECMDIDF_REFRESH_PAGEACTION_ALLOW_VERSION = OLECMDID_REFRESHFLAG.PAGEACTION_ALLOW_VERSION; pub const OLECMDID_PAGEACTIONFLAG = enum(i32) { FILEDOWNLOAD = 1, ACTIVEXINSTALL = 2, ACTIVEXTRUSTFAIL = 4, ACTIVEXUSERDISABLE = 8, ACTIVEXDISALLOW = 16, ACTIVEXUNSAFE = 32, POPUPWINDOW = 64, LOCALMACHINE = 128, MIMETEXTPLAIN = 256, SCRIPTNAVIGATE = 512, // SCRIPTNAVIGATE_ACTIVEXINSTALL = 512, this enum value conflicts with SCRIPTNAVIGATE PROTLOCKDOWNLOCALMACHINE = 1024, PROTLOCKDOWNTRUSTED = 2048, PROTLOCKDOWNINTRANET = 4096, PROTLOCKDOWNINTERNET = 8192, PROTLOCKDOWNRESTRICTED = 16384, PROTLOCKDOWNDENY = 32768, POPUPALLOWED = 65536, SCRIPTPROMPT = 131072, ACTIVEXUSERAPPROVAL = 262144, MIXEDCONTENT = 524288, INVALID_CERT = 1048576, INTRANETZONEREQUEST = 2097152, XSSFILTERED = 4194304, SPOOFABLEIDNHOST = 8388608, ACTIVEX_EPM_INCOMPATIBLE = 16777216, SCRIPTNAVIGATE_ACTIVEXUSERAPPROVAL = 33554432, WPCBLOCKED = 67108864, WPCBLOCKED_ACTIVEX = 134217728, EXTENSION_COMPAT_BLOCKED = 268435456, NORESETACTIVEX = 536870912, GENERIC_STATE = 1073741824, RESET = -2147483648, }; pub const OLECMDIDF_PAGEACTION_FILEDOWNLOAD = OLECMDID_PAGEACTIONFLAG.FILEDOWNLOAD; pub const OLECMDIDF_PAGEACTION_ACTIVEXINSTALL = OLECMDID_PAGEACTIONFLAG.ACTIVEXINSTALL; pub const OLECMDIDF_PAGEACTION_ACTIVEXTRUSTFAIL = OLECMDID_PAGEACTIONFLAG.ACTIVEXTRUSTFAIL; pub const OLECMDIDF_PAGEACTION_ACTIVEXUSERDISABLE = OLECMDID_PAGEACTIONFLAG.ACTIVEXUSERDISABLE; pub const OLECMDIDF_PAGEACTION_ACTIVEXDISALLOW = OLECMDID_PAGEACTIONFLAG.ACTIVEXDISALLOW; pub const OLECMDIDF_PAGEACTION_ACTIVEXUNSAFE = OLECMDID_PAGEACTIONFLAG.ACTIVEXUNSAFE; pub const OLECMDIDF_PAGEACTION_POPUPWINDOW = OLECMDID_PAGEACTIONFLAG.POPUPWINDOW; pub const OLECMDIDF_PAGEACTION_LOCALMACHINE = OLECMDID_PAGEACTIONFLAG.LOCALMACHINE; pub const OLECMDIDF_PAGEACTION_MIMETEXTPLAIN = OLECMDID_PAGEACTIONFLAG.MIMETEXTPLAIN; pub const OLECMDIDF_PAGEACTION_SCRIPTNAVIGATE = OLECMDID_PAGEACTIONFLAG.SCRIPTNAVIGATE; pub const OLECMDIDF_PAGEACTION_SCRIPTNAVIGATE_ACTIVEXINSTALL = OLECMDID_PAGEACTIONFLAG.SCRIPTNAVIGATE; pub const OLECMDIDF_PAGEACTION_PROTLOCKDOWNLOCALMACHINE = OLECMDID_PAGEACTIONFLAG.PROTLOCKDOWNLOCALMACHINE; pub const OLECMDIDF_PAGEACTION_PROTLOCKDOWNTRUSTED = OLECMDID_PAGEACTIONFLAG.PROTLOCKDOWNTRUSTED; pub const OLECMDIDF_PAGEACTION_PROTLOCKDOWNINTRANET = OLECMDID_PAGEACTIONFLAG.PROTLOCKDOWNINTRANET; pub const OLECMDIDF_PAGEACTION_PROTLOCKDOWNINTERNET = OLECMDID_PAGEACTIONFLAG.PROTLOCKDOWNINTERNET; pub const OLECMDIDF_PAGEACTION_PROTLOCKDOWNRESTRICTED = OLECMDID_PAGEACTIONFLAG.PROTLOCKDOWNRESTRICTED; pub const OLECMDIDF_PAGEACTION_PROTLOCKDOWNDENY = OLECMDID_PAGEACTIONFLAG.PROTLOCKDOWNDENY; pub const OLECMDIDF_PAGEACTION_POPUPALLOWED = OLECMDID_PAGEACTIONFLAG.POPUPALLOWED; pub const OLECMDIDF_PAGEACTION_SCRIPTPROMPT = OLECMDID_PAGEACTIONFLAG.SCRIPTPROMPT; pub const OLECMDIDF_PAGEACTION_ACTIVEXUSERAPPROVAL = OLECMDID_PAGEACTIONFLAG.ACTIVEXUSERAPPROVAL; pub const OLECMDIDF_PAGEACTION_MIXEDCONTENT = OLECMDID_PAGEACTIONFLAG.MIXEDCONTENT; pub const OLECMDIDF_PAGEACTION_INVALID_CERT = OLECMDID_PAGEACTIONFLAG.INVALID_CERT; pub const OLECMDIDF_PAGEACTION_INTRANETZONEREQUEST = OLECMDID_PAGEACTIONFLAG.INTRANETZONEREQUEST; pub const OLECMDIDF_PAGEACTION_XSSFILTERED = OLECMDID_PAGEACTIONFLAG.XSSFILTERED; pub const OLECMDIDF_PAGEACTION_SPOOFABLEIDNHOST = OLECMDID_PAGEACTIONFLAG.SPOOFABLEIDNHOST; pub const OLECMDIDF_PAGEACTION_ACTIVEX_EPM_INCOMPATIBLE = OLECMDID_PAGEACTIONFLAG.ACTIVEX_EPM_INCOMPATIBLE; pub const OLECMDIDF_PAGEACTION_SCRIPTNAVIGATE_ACTIVEXUSERAPPROVAL = OLECMDID_PAGEACTIONFLAG.SCRIPTNAVIGATE_ACTIVEXUSERAPPROVAL; pub const OLECMDIDF_PAGEACTION_WPCBLOCKED = OLECMDID_PAGEACTIONFLAG.WPCBLOCKED; pub const OLECMDIDF_PAGEACTION_WPCBLOCKED_ACTIVEX = OLECMDID_PAGEACTIONFLAG.WPCBLOCKED_ACTIVEX; pub const OLECMDIDF_PAGEACTION_EXTENSION_COMPAT_BLOCKED = OLECMDID_PAGEACTIONFLAG.EXTENSION_COMPAT_BLOCKED; pub const OLECMDIDF_PAGEACTION_NORESETACTIVEX = OLECMDID_PAGEACTIONFLAG.NORESETACTIVEX; pub const OLECMDIDF_PAGEACTION_GENERIC_STATE = OLECMDID_PAGEACTIONFLAG.GENERIC_STATE; pub const OLECMDIDF_PAGEACTION_RESET = OLECMDID_PAGEACTIONFLAG.RESET; pub const OLECMDID_BROWSERSTATEFLAG = enum(i32) { EXTENSIONSOFF = 1, IESECURITY = 2, PROTECTEDMODE_OFF = 4, RESET = 8, REQUIRESACTIVEX = 16, DESKTOPHTMLDIALOG = 32, BLOCKEDVERSION = 64, }; pub const OLECMDIDF_BROWSERSTATE_EXTENSIONSOFF = OLECMDID_BROWSERSTATEFLAG.EXTENSIONSOFF; pub const OLECMDIDF_BROWSERSTATE_IESECURITY = OLECMDID_BROWSERSTATEFLAG.IESECURITY; pub const OLECMDIDF_BROWSERSTATE_PROTECTEDMODE_OFF = OLECMDID_BROWSERSTATEFLAG.PROTECTEDMODE_OFF; pub const OLECMDIDF_BROWSERSTATE_RESET = OLECMDID_BROWSERSTATEFLAG.RESET; pub const OLECMDIDF_BROWSERSTATE_REQUIRESACTIVEX = OLECMDID_BROWSERSTATEFLAG.REQUIRESACTIVEX; pub const OLECMDIDF_BROWSERSTATE_DESKTOPHTMLDIALOG = OLECMDID_BROWSERSTATEFLAG.DESKTOPHTMLDIALOG; pub const OLECMDIDF_BROWSERSTATE_BLOCKEDVERSION = OLECMDID_BROWSERSTATEFLAG.BLOCKEDVERSION; pub const OLECMDID_OPTICAL_ZOOMFLAG = enum(i32) { NOPERSIST = 1, NOLAYOUT = 16, NOTRANSIENT = 32, RELOADFORNEWTAB = 64, }; pub const OLECMDIDF_OPTICAL_ZOOM_NOPERSIST = OLECMDID_OPTICAL_ZOOMFLAG.NOPERSIST; pub const OLECMDIDF_OPTICAL_ZOOM_NOLAYOUT = OLECMDID_OPTICAL_ZOOMFLAG.NOLAYOUT; pub const OLECMDIDF_OPTICAL_ZOOM_NOTRANSIENT = OLECMDID_OPTICAL_ZOOMFLAG.NOTRANSIENT; pub const OLECMDIDF_OPTICAL_ZOOM_RELOADFORNEWTAB = OLECMDID_OPTICAL_ZOOMFLAG.RELOADFORNEWTAB; pub const PAGEACTION_UI = enum(i32) { DEFAULT = 0, MODAL = 1, MODELESS = 2, SILENT = 3, }; pub const PAGEACTION_UI_DEFAULT = PAGEACTION_UI.DEFAULT; pub const PAGEACTION_UI_MODAL = PAGEACTION_UI.MODAL; pub const PAGEACTION_UI_MODELESS = PAGEACTION_UI.MODELESS; pub const PAGEACTION_UI_SILENT = PAGEACTION_UI.SILENT; pub const OLECMDID_WINDOWSTATE_FLAG = enum(i32) { USERVISIBLE = 1, ENABLED = 2, USERVISIBLE_VALID = 65536, ENABLED_VALID = 131072, }; pub const OLECMDIDF_WINDOWSTATE_USERVISIBLE = OLECMDID_WINDOWSTATE_FLAG.USERVISIBLE; pub const OLECMDIDF_WINDOWSTATE_ENABLED = OLECMDID_WINDOWSTATE_FLAG.ENABLED; pub const OLECMDIDF_WINDOWSTATE_USERVISIBLE_VALID = OLECMDID_WINDOWSTATE_FLAG.USERVISIBLE_VALID; pub const OLECMDIDF_WINDOWSTATE_ENABLED_VALID = OLECMDID_WINDOWSTATE_FLAG.ENABLED_VALID; pub const OLECMDID_VIEWPORT_MODE_FLAG = enum(i32) { FIXED_LAYOUT_WIDTH = 1, EXCLUDE_VISUAL_BOTTOM = 2, FIXED_LAYOUT_WIDTH_VALID = 65536, EXCLUDE_VISUAL_BOTTOM_VALID = 131072, }; pub const OLECMDIDF_VIEWPORTMODE_FIXED_LAYOUT_WIDTH = OLECMDID_VIEWPORT_MODE_FLAG.FIXED_LAYOUT_WIDTH; pub const OLECMDIDF_VIEWPORTMODE_EXCLUDE_VISUAL_BOTTOM = OLECMDID_VIEWPORT_MODE_FLAG.EXCLUDE_VISUAL_BOTTOM; pub const OLECMDIDF_VIEWPORTMODE_FIXED_LAYOUT_WIDTH_VALID = OLECMDID_VIEWPORT_MODE_FLAG.FIXED_LAYOUT_WIDTH_VALID; pub const OLECMDIDF_VIEWPORTMODE_EXCLUDE_VISUAL_BOTTOM_VALID = OLECMDID_VIEWPORT_MODE_FLAG.EXCLUDE_VISUAL_BOTTOM_VALID; const IID_IZoomEvents_Value = @import("../zig.zig").Guid.initString("41b68150-904c-4e17-a0ba-a438182e359d"); pub const IID_IZoomEvents = &IID_IZoomEvents_Value; pub const IZoomEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnZoomPercentChanged: fn( self: *const IZoomEvents, ulZoomPercent: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IZoomEvents_OnZoomPercentChanged(self: *const T, ulZoomPercent: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IZoomEvents.VTable, self.vtable).OnZoomPercentChanged(@ptrCast(*const IZoomEvents, self), ulZoomPercent); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IProtectFocus_Value = @import("../zig.zig").Guid.initString("d81f90a3-8156-44f7-ad28-5abb87003274"); pub const IID_IProtectFocus = &IID_IProtectFocus_Value; pub const IProtectFocus = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AllowFocusChange: fn( self: *const IProtectFocus, pfAllow: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IProtectFocus_AllowFocusChange(self: *const T, pfAllow: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IProtectFocus.VTable, self.vtable).AllowFocusChange(@ptrCast(*const IProtectFocus, self), pfAllow); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IProtectedModeMenuServices_Value = @import("../zig.zig").Guid.initString("73c105ee-9dff-4a07-b83c-7eff290c266e"); pub const IID_IProtectedModeMenuServices = &IID_IProtectedModeMenuServices_Value; pub const IProtectedModeMenuServices = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateMenu: fn( self: *const IProtectedModeMenuServices, phMenu: ?*?HMENU, ) callconv(@import("std").os.windows.WINAPI) HRESULT, LoadMenu: fn( self: *const IProtectedModeMenuServices, pszModuleName: ?[*:0]const u16, pszMenuName: ?[*:0]const u16, phMenu: ?*?HMENU, ) callconv(@import("std").os.windows.WINAPI) HRESULT, LoadMenuID: fn( self: *const IProtectedModeMenuServices, pszModuleName: ?[*:0]const u16, wResourceID: u16, phMenu: ?*?HMENU, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IProtectedModeMenuServices_CreateMenu(self: *const T, phMenu: ?*?HMENU) callconv(.Inline) HRESULT { return @ptrCast(*const IProtectedModeMenuServices.VTable, self.vtable).CreateMenu(@ptrCast(*const IProtectedModeMenuServices, self), phMenu); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IProtectedModeMenuServices_LoadMenu(self: *const T, pszModuleName: ?[*:0]const u16, pszMenuName: ?[*:0]const u16, phMenu: ?*?HMENU) callconv(.Inline) HRESULT { return @ptrCast(*const IProtectedModeMenuServices.VTable, self.vtable).LoadMenu(@ptrCast(*const IProtectedModeMenuServices, self), pszModuleName, pszMenuName, phMenu); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IProtectedModeMenuServices_LoadMenuID(self: *const T, pszModuleName: ?[*:0]const u16, wResourceID: u16, phMenu: ?*?HMENU) callconv(.Inline) HRESULT { return @ptrCast(*const IProtectedModeMenuServices.VTable, self.vtable).LoadMenuID(@ptrCast(*const IProtectedModeMenuServices, self), pszModuleName, wResourceID, phMenu); } };} pub usingnamespace MethodMixin(@This()); }; pub const LPFNOLEUIHOOK = fn( param0: ?HWND, param1: u32, param2: WPARAM, param3: LPARAM, ) callconv(@import("std").os.windows.WINAPI) u32; pub const OLEUIINSERTOBJECTW = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u16, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u16, hResource: ?HRSRC, clsid: Guid, lpszFile: ?PWSTR, cchFile: u32, cClsidExclude: u32, lpClsidExclude: ?*Guid, iid: Guid, oleRender: u32, lpFormatEtc: ?*FORMATETC, lpIOleClientSite: ?*IOleClientSite, lpIStorage: ?*IStorage, ppvObj: ?*?*c_void, sc: i32, hMetaPict: isize, }; pub const OLEUIINSERTOBJECTA = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u8, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u8, hResource: ?HRSRC, clsid: Guid, lpszFile: ?PSTR, cchFile: u32, cClsidExclude: u32, lpClsidExclude: ?*Guid, iid: Guid, oleRender: u32, lpFormatEtc: ?*FORMATETC, lpIOleClientSite: ?*IOleClientSite, lpIStorage: ?*IStorage, ppvObj: ?*?*c_void, sc: i32, hMetaPict: isize, }; pub const OLEUIPASTEFLAG = enum(i32) { ENABLEICON = 2048, PASTEONLY = 0, PASTE = 512, LINKANYTYPE = 1024, LINKTYPE1 = 1, LINKTYPE2 = 2, LINKTYPE3 = 4, LINKTYPE4 = 8, LINKTYPE5 = 16, LINKTYPE6 = 32, LINKTYPE7 = 64, LINKTYPE8 = 128, }; pub const OLEUIPASTE_ENABLEICON = OLEUIPASTEFLAG.ENABLEICON; pub const OLEUIPASTE_PASTEONLY = OLEUIPASTEFLAG.PASTEONLY; pub const OLEUIPASTE_PASTE = OLEUIPASTEFLAG.PASTE; pub const OLEUIPASTE_LINKANYTYPE = OLEUIPASTEFLAG.LINKANYTYPE; pub const OLEUIPASTE_LINKTYPE1 = OLEUIPASTEFLAG.LINKTYPE1; pub const OLEUIPASTE_LINKTYPE2 = OLEUIPASTEFLAG.LINKTYPE2; pub const OLEUIPASTE_LINKTYPE3 = OLEUIPASTEFLAG.LINKTYPE3; pub const OLEUIPASTE_LINKTYPE4 = OLEUIPASTEFLAG.LINKTYPE4; pub const OLEUIPASTE_LINKTYPE5 = OLEUIPASTEFLAG.LINKTYPE5; pub const OLEUIPASTE_LINKTYPE6 = OLEUIPASTEFLAG.LINKTYPE6; pub const OLEUIPASTE_LINKTYPE7 = OLEUIPASTEFLAG.LINKTYPE7; pub const OLEUIPASTE_LINKTYPE8 = OLEUIPASTEFLAG.LINKTYPE8; pub const OLEUIPASTEENTRYW = extern struct { fmtetc: FORMATETC, lpstrFormatName: ?[*:0]const u16, lpstrResultText: ?[*:0]const u16, dwFlags: u32, dwScratchSpace: u32, }; pub const OLEUIPASTEENTRYA = extern struct { fmtetc: FORMATETC, lpstrFormatName: ?[*:0]const u8, lpstrResultText: ?[*:0]const u8, dwFlags: u32, dwScratchSpace: u32, }; pub const OLEUIPASTESPECIALW = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u16, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u16, hResource: ?HRSRC, lpSrcDataObj: ?*IDataObject, arrPasteEntries: ?*OLEUIPASTEENTRYW, cPasteEntries: i32, arrLinkTypes: ?*u32, cLinkTypes: i32, cClsidExclude: u32, lpClsidExclude: ?*Guid, nSelectedIndex: i32, fLink: BOOL, hMetaPict: isize, sizel: SIZE, }; pub const OLEUIPASTESPECIALA = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u8, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u8, hResource: ?HRSRC, lpSrcDataObj: ?*IDataObject, arrPasteEntries: ?*OLEUIPASTEENTRYA, cPasteEntries: i32, arrLinkTypes: ?*u32, cLinkTypes: i32, cClsidExclude: u32, lpClsidExclude: ?*Guid, nSelectedIndex: i32, fLink: BOOL, hMetaPict: isize, sizel: SIZE, }; // TODO: this type is limited to platform 'windows5.0' pub const IOleUILinkContainerW = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetNextLink: fn( self: *const IOleUILinkContainerW, dwLink: u32, ) callconv(@import("std").os.windows.WINAPI) u32, SetLinkUpdateOptions: fn( self: *const IOleUILinkContainerW, dwLink: u32, dwUpdateOpt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLinkUpdateOptions: fn( self: *const IOleUILinkContainerW, dwLink: u32, lpdwUpdateOpt: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetLinkSource: fn( self: *const IOleUILinkContainerW, dwLink: u32, lpszDisplayName: ?PWSTR, lenFileName: u32, pchEaten: ?*u32, fValidateSource: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLinkSource: fn( self: *const IOleUILinkContainerW, dwLink: u32, lplpszDisplayName: ?*?PWSTR, lplenFileName: ?*u32, lplpszFullLinkType: ?*?PWSTR, lplpszShortLinkType: ?*?PWSTR, lpfSourceAvailable: ?*BOOL, lpfIsSelected: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OpenLinkSource: fn( self: *const IOleUILinkContainerW, dwLink: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UpdateLink: fn( self: *const IOleUILinkContainerW, dwLink: u32, fErrorMessage: BOOL, fReserved: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CancelLink: fn( self: *const IOleUILinkContainerW, dwLink: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerW_GetNextLink(self: *const T, dwLink: u32) callconv(.Inline) u32 { return @ptrCast(*const IOleUILinkContainerW.VTable, self.vtable).GetNextLink(@ptrCast(*const IOleUILinkContainerW, self), dwLink); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerW_SetLinkUpdateOptions(self: *const T, dwLink: u32, dwUpdateOpt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerW.VTable, self.vtable).SetLinkUpdateOptions(@ptrCast(*const IOleUILinkContainerW, self), dwLink, dwUpdateOpt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerW_GetLinkUpdateOptions(self: *const T, dwLink: u32, lpdwUpdateOpt: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerW.VTable, self.vtable).GetLinkUpdateOptions(@ptrCast(*const IOleUILinkContainerW, self), dwLink, lpdwUpdateOpt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerW_SetLinkSource(self: *const T, dwLink: u32, lpszDisplayName: ?PWSTR, lenFileName: u32, pchEaten: ?*u32, fValidateSource: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerW.VTable, self.vtable).SetLinkSource(@ptrCast(*const IOleUILinkContainerW, self), dwLink, lpszDisplayName, lenFileName, pchEaten, fValidateSource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerW_GetLinkSource(self: *const T, dwLink: u32, lplpszDisplayName: ?*?PWSTR, lplenFileName: ?*u32, lplpszFullLinkType: ?*?PWSTR, lplpszShortLinkType: ?*?PWSTR, lpfSourceAvailable: ?*BOOL, lpfIsSelected: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerW.VTable, self.vtable).GetLinkSource(@ptrCast(*const IOleUILinkContainerW, self), dwLink, lplpszDisplayName, lplenFileName, lplpszFullLinkType, lplpszShortLinkType, lpfSourceAvailable, lpfIsSelected); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerW_OpenLinkSource(self: *const T, dwLink: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerW.VTable, self.vtable).OpenLinkSource(@ptrCast(*const IOleUILinkContainerW, self), dwLink); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerW_UpdateLink(self: *const T, dwLink: u32, fErrorMessage: BOOL, fReserved: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerW.VTable, self.vtable).UpdateLink(@ptrCast(*const IOleUILinkContainerW, self), dwLink, fErrorMessage, fReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerW_CancelLink(self: *const T, dwLink: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerW.VTable, self.vtable).CancelLink(@ptrCast(*const IOleUILinkContainerW, self), dwLink); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' pub const IOleUILinkContainerA = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetNextLink: fn( self: *const IOleUILinkContainerA, dwLink: u32, ) callconv(@import("std").os.windows.WINAPI) u32, SetLinkUpdateOptions: fn( self: *const IOleUILinkContainerA, dwLink: u32, dwUpdateOpt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLinkUpdateOptions: fn( self: *const IOleUILinkContainerA, dwLink: u32, lpdwUpdateOpt: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetLinkSource: fn( self: *const IOleUILinkContainerA, dwLink: u32, lpszDisplayName: ?PSTR, lenFileName: u32, pchEaten: ?*u32, fValidateSource: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLinkSource: fn( self: *const IOleUILinkContainerA, dwLink: u32, lplpszDisplayName: ?*?PSTR, lplenFileName: ?*u32, lplpszFullLinkType: ?*?PSTR, lplpszShortLinkType: ?*?PSTR, lpfSourceAvailable: ?*BOOL, lpfIsSelected: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OpenLinkSource: fn( self: *const IOleUILinkContainerA, dwLink: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UpdateLink: fn( self: *const IOleUILinkContainerA, dwLink: u32, fErrorMessage: BOOL, fReserved: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CancelLink: fn( self: *const IOleUILinkContainerA, dwLink: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerA_GetNextLink(self: *const T, dwLink: u32) callconv(.Inline) u32 { return @ptrCast(*const IOleUILinkContainerA.VTable, self.vtable).GetNextLink(@ptrCast(*const IOleUILinkContainerA, self), dwLink); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerA_SetLinkUpdateOptions(self: *const T, dwLink: u32, dwUpdateOpt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerA.VTable, self.vtable).SetLinkUpdateOptions(@ptrCast(*const IOleUILinkContainerA, self), dwLink, dwUpdateOpt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerA_GetLinkUpdateOptions(self: *const T, dwLink: u32, lpdwUpdateOpt: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerA.VTable, self.vtable).GetLinkUpdateOptions(@ptrCast(*const IOleUILinkContainerA, self), dwLink, lpdwUpdateOpt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerA_SetLinkSource(self: *const T, dwLink: u32, lpszDisplayName: ?PSTR, lenFileName: u32, pchEaten: ?*u32, fValidateSource: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerA.VTable, self.vtable).SetLinkSource(@ptrCast(*const IOleUILinkContainerA, self), dwLink, lpszDisplayName, lenFileName, pchEaten, fValidateSource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerA_GetLinkSource(self: *const T, dwLink: u32, lplpszDisplayName: ?*?PSTR, lplenFileName: ?*u32, lplpszFullLinkType: ?*?PSTR, lplpszShortLinkType: ?*?PSTR, lpfSourceAvailable: ?*BOOL, lpfIsSelected: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerA.VTable, self.vtable).GetLinkSource(@ptrCast(*const IOleUILinkContainerA, self), dwLink, lplpszDisplayName, lplenFileName, lplpszFullLinkType, lplpszShortLinkType, lpfSourceAvailable, lpfIsSelected); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerA_OpenLinkSource(self: *const T, dwLink: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerA.VTable, self.vtable).OpenLinkSource(@ptrCast(*const IOleUILinkContainerA, self), dwLink); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerA_UpdateLink(self: *const T, dwLink: u32, fErrorMessage: BOOL, fReserved: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerA.VTable, self.vtable).UpdateLink(@ptrCast(*const IOleUILinkContainerA, self), dwLink, fErrorMessage, fReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerA_CancelLink(self: *const T, dwLink: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerA.VTable, self.vtable).CancelLink(@ptrCast(*const IOleUILinkContainerA, self), dwLink); } };} pub usingnamespace MethodMixin(@This()); }; pub const OLEUIEDITLINKSW = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u16, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u16, hResource: ?HRSRC, lpOleUILinkContainer: ?*IOleUILinkContainerW, }; pub const OLEUIEDITLINKSA = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u8, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u8, hResource: ?HRSRC, lpOleUILinkContainer: ?*IOleUILinkContainerA, }; pub const OLEUICHANGEICONW = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u16, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u16, hResource: ?HRSRC, hMetaPict: isize, clsid: Guid, szIconExe: [260]u16, cchIconExe: i32, }; pub const OLEUICHANGEICONA = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u8, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u8, hResource: ?HRSRC, hMetaPict: isize, clsid: Guid, szIconExe: [260]CHAR, cchIconExe: i32, }; pub const OLEUICONVERTW = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u16, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u16, hResource: ?HRSRC, clsid: Guid, clsidConvertDefault: Guid, clsidActivateDefault: Guid, clsidNew: Guid, dvAspect: u32, wFormat: u16, fIsLinkedObject: BOOL, hMetaPict: isize, lpszUserType: ?PWSTR, fObjectsIconChanged: BOOL, lpszDefLabel: ?PWSTR, cClsidExclude: u32, lpClsidExclude: ?*Guid, }; pub const OLEUICONVERTA = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u8, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u8, hResource: ?HRSRC, clsid: Guid, clsidConvertDefault: Guid, clsidActivateDefault: Guid, clsidNew: Guid, dvAspect: u32, wFormat: u16, fIsLinkedObject: BOOL, hMetaPict: isize, lpszUserType: ?PSTR, fObjectsIconChanged: BOOL, lpszDefLabel: ?PSTR, cClsidExclude: u32, lpClsidExclude: ?*Guid, }; pub const OLEUIBUSYW = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u16, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u16, hResource: ?HRSRC, hTask: ?HTASK, lphWndDialog: ?*?HWND, }; pub const OLEUIBUSYA = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u8, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u8, hResource: ?HRSRC, hTask: ?HTASK, lphWndDialog: ?*?HWND, }; pub const OLEUICHANGESOURCEW = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u16, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u16, hResource: ?HRSRC, lpOFN: ?*OPENFILENAMEW, dwReserved1: [4]u32, lpOleUILinkContainer: ?*IOleUILinkContainerW, dwLink: u32, lpszDisplayName: ?PWSTR, nFileLength: u32, lpszFrom: ?PWSTR, lpszTo: ?PWSTR, }; pub const OLEUICHANGESOURCEA = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u8, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u8, hResource: ?HRSRC, lpOFN: ?*OPENFILENAMEA, dwReserved1: [4]u32, lpOleUILinkContainer: ?*IOleUILinkContainerA, dwLink: u32, lpszDisplayName: ?PSTR, nFileLength: u32, lpszFrom: ?PSTR, lpszTo: ?PSTR, }; // TODO: this type is limited to platform 'windows5.0' pub const IOleUIObjInfoW = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetObjectInfo: fn( self: *const IOleUIObjInfoW, dwObject: u32, lpdwObjSize: ?*u32, lplpszLabel: ?*?PWSTR, lplpszType: ?*?PWSTR, lplpszShortType: ?*?PWSTR, lplpszLocation: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConvertInfo: fn( self: *const IOleUIObjInfoW, dwObject: u32, lpClassID: ?*Guid, lpwFormat: ?*u16, lpConvertDefaultClassID: ?*Guid, lplpClsidExclude: ?*?*Guid, lpcClsidExclude: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ConvertObject: fn( self: *const IOleUIObjInfoW, dwObject: u32, clsidNew: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetViewInfo: fn( self: *const IOleUIObjInfoW, dwObject: u32, phMetaPict: ?*isize, pdvAspect: ?*u32, pnCurrentScale: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetViewInfo: fn( self: *const IOleUIObjInfoW, dwObject: u32, hMetaPict: isize, dvAspect: u32, nCurrentScale: i32, bRelativeToOrig: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUIObjInfoW_GetObjectInfo(self: *const T, dwObject: u32, lpdwObjSize: ?*u32, lplpszLabel: ?*?PWSTR, lplpszType: ?*?PWSTR, lplpszShortType: ?*?PWSTR, lplpszLocation: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoW.VTable, self.vtable).GetObjectInfo(@ptrCast(*const IOleUIObjInfoW, self), dwObject, lpdwObjSize, lplpszLabel, lplpszType, lplpszShortType, lplpszLocation); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUIObjInfoW_GetConvertInfo(self: *const T, dwObject: u32, lpClassID: ?*Guid, lpwFormat: ?*u16, lpConvertDefaultClassID: ?*Guid, lplpClsidExclude: ?*?*Guid, lpcClsidExclude: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoW.VTable, self.vtable).GetConvertInfo(@ptrCast(*const IOleUIObjInfoW, self), dwObject, lpClassID, lpwFormat, lpConvertDefaultClassID, lplpClsidExclude, lpcClsidExclude); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUIObjInfoW_ConvertObject(self: *const T, dwObject: u32, clsidNew: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoW.VTable, self.vtable).ConvertObject(@ptrCast(*const IOleUIObjInfoW, self), dwObject, clsidNew); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUIObjInfoW_GetViewInfo(self: *const T, dwObject: u32, phMetaPict: ?*isize, pdvAspect: ?*u32, pnCurrentScale: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoW.VTable, self.vtable).GetViewInfo(@ptrCast(*const IOleUIObjInfoW, self), dwObject, phMetaPict, pdvAspect, pnCurrentScale); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUIObjInfoW_SetViewInfo(self: *const T, dwObject: u32, hMetaPict: isize, dvAspect: u32, nCurrentScale: i32, bRelativeToOrig: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoW.VTable, self.vtable).SetViewInfo(@ptrCast(*const IOleUIObjInfoW, self), dwObject, hMetaPict, dvAspect, nCurrentScale, bRelativeToOrig); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' pub const IOleUIObjInfoA = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetObjectInfo: fn( self: *const IOleUIObjInfoA, dwObject: u32, lpdwObjSize: ?*u32, lplpszLabel: ?*?PSTR, lplpszType: ?*?PSTR, lplpszShortType: ?*?PSTR, lplpszLocation: ?*?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConvertInfo: fn( self: *const IOleUIObjInfoA, dwObject: u32, lpClassID: ?*Guid, lpwFormat: ?*u16, lpConvertDefaultClassID: ?*Guid, lplpClsidExclude: ?*?*Guid, lpcClsidExclude: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ConvertObject: fn( self: *const IOleUIObjInfoA, dwObject: u32, clsidNew: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetViewInfo: fn( self: *const IOleUIObjInfoA, dwObject: u32, phMetaPict: ?*isize, pdvAspect: ?*u32, pnCurrentScale: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetViewInfo: fn( self: *const IOleUIObjInfoA, dwObject: u32, hMetaPict: isize, dvAspect: u32, nCurrentScale: i32, bRelativeToOrig: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUIObjInfoA_GetObjectInfo(self: *const T, dwObject: u32, lpdwObjSize: ?*u32, lplpszLabel: ?*?PSTR, lplpszType: ?*?PSTR, lplpszShortType: ?*?PSTR, lplpszLocation: ?*?PSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoA.VTable, self.vtable).GetObjectInfo(@ptrCast(*const IOleUIObjInfoA, self), dwObject, lpdwObjSize, lplpszLabel, lplpszType, lplpszShortType, lplpszLocation); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUIObjInfoA_GetConvertInfo(self: *const T, dwObject: u32, lpClassID: ?*Guid, lpwFormat: ?*u16, lpConvertDefaultClassID: ?*Guid, lplpClsidExclude: ?*?*Guid, lpcClsidExclude: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoA.VTable, self.vtable).GetConvertInfo(@ptrCast(*const IOleUIObjInfoA, self), dwObject, lpClassID, lpwFormat, lpConvertDefaultClassID, lplpClsidExclude, lpcClsidExclude); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUIObjInfoA_ConvertObject(self: *const T, dwObject: u32, clsidNew: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoA.VTable, self.vtable).ConvertObject(@ptrCast(*const IOleUIObjInfoA, self), dwObject, clsidNew); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUIObjInfoA_GetViewInfo(self: *const T, dwObject: u32, phMetaPict: ?*isize, pdvAspect: ?*u32, pnCurrentScale: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoA.VTable, self.vtable).GetViewInfo(@ptrCast(*const IOleUIObjInfoA, self), dwObject, phMetaPict, pdvAspect, pnCurrentScale); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUIObjInfoA_SetViewInfo(self: *const T, dwObject: u32, hMetaPict: isize, dvAspect: u32, nCurrentScale: i32, bRelativeToOrig: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoA.VTable, self.vtable).SetViewInfo(@ptrCast(*const IOleUIObjInfoA, self), dwObject, hMetaPict, dvAspect, nCurrentScale, bRelativeToOrig); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' pub const IOleUILinkInfoW = extern struct { pub const VTable = extern struct { base: IOleUILinkContainerW.VTable, GetLastUpdate: fn( self: *const IOleUILinkInfoW, dwLink: u32, lpLastUpdate: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleUILinkContainerW.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkInfoW_GetLastUpdate(self: *const T, dwLink: u32, lpLastUpdate: ?*FILETIME) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkInfoW.VTable, self.vtable).GetLastUpdate(@ptrCast(*const IOleUILinkInfoW, self), dwLink, lpLastUpdate); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' pub const IOleUILinkInfoA = extern struct { pub const VTable = extern struct { base: IOleUILinkContainerA.VTable, GetLastUpdate: fn( self: *const IOleUILinkInfoA, dwLink: u32, lpLastUpdate: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleUILinkContainerA.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkInfoA_GetLastUpdate(self: *const T, dwLink: u32, lpLastUpdate: ?*FILETIME) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkInfoA.VTable, self.vtable).GetLastUpdate(@ptrCast(*const IOleUILinkInfoA, self), dwLink, lpLastUpdate); } };} pub usingnamespace MethodMixin(@This()); }; pub const OLEUIGNRLPROPSW = extern struct { cbStruct: u32, dwFlags: u32, dwReserved1: [2]u32, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, dwReserved2: [3]u32, lpOP: ?*OLEUIOBJECTPROPSW, }; pub const OLEUIGNRLPROPSA = extern struct { cbStruct: u32, dwFlags: u32, dwReserved1: [2]u32, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, dwReserved2: [3]u32, lpOP: ?*OLEUIOBJECTPROPSA, }; pub const OLEUIVIEWPROPSW = extern struct { cbStruct: u32, dwFlags: u32, dwReserved1: [2]u32, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, dwReserved2: [3]u32, lpOP: ?*OLEUIOBJECTPROPSW, nScaleMin: i32, nScaleMax: i32, }; pub const OLEUIVIEWPROPSA = extern struct { cbStruct: u32, dwFlags: u32, dwReserved1: [2]u32, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, dwReserved2: [3]u32, lpOP: ?*OLEUIOBJECTPROPSA, nScaleMin: i32, nScaleMax: i32, }; pub const OLEUILINKPROPSW = extern struct { cbStruct: u32, dwFlags: u32, dwReserved1: [2]u32, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, dwReserved2: [3]u32, lpOP: ?*OLEUIOBJECTPROPSW, }; pub const OLEUILINKPROPSA = extern struct { cbStruct: u32, dwFlags: u32, dwReserved1: [2]u32, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, dwReserved2: [3]u32, lpOP: ?*OLEUIOBJECTPROPSA, }; pub const OLEUIOBJECTPROPSW = extern struct { cbStruct: u32, dwFlags: u32, lpPS: ?*PROPSHEETHEADERW_V2, dwObject: u32, lpObjInfo: ?*IOleUIObjInfoW, dwLink: u32, lpLinkInfo: ?*IOleUILinkInfoW, lpGP: ?*OLEUIGNRLPROPSW, lpVP: ?*OLEUIVIEWPROPSW, lpLP: ?*OLEUILINKPROPSW, }; pub const OLEUIOBJECTPROPSA = extern struct { cbStruct: u32, dwFlags: u32, lpPS: ?*PROPSHEETHEADERA_V2, dwObject: u32, lpObjInfo: ?*IOleUIObjInfoA, dwLink: u32, lpLinkInfo: ?*IOleUILinkInfoA, lpGP: ?*OLEUIGNRLPROPSA, lpVP: ?*OLEUIVIEWPROPSA, lpLP: ?*OLEUILINKPROPSA, }; // TODO: this type is limited to platform 'windows5.0' const IID_IEnumGUID_Value = @import("../zig.zig").Guid.initString("0002e000-0000-0000-c000-000000000046"); pub const IID_IEnumGUID = &IID_IEnumGUID_Value; pub const IEnumGUID = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumGUID, celt: u32, rgelt: [*]Guid, pceltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumGUID, celt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumGUID, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumGUID, ppenum: ?*?*IEnumGUID, ) 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 IEnumGUID_Next(self: *const T, celt: u32, rgelt: [*]Guid, pceltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumGUID.VTable, self.vtable).Next(@ptrCast(*const IEnumGUID, self), celt, rgelt, pceltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumGUID_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumGUID.VTable, self.vtable).Skip(@ptrCast(*const IEnumGUID, self), celt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumGUID_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumGUID.VTable, self.vtable).Reset(@ptrCast(*const IEnumGUID, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumGUID_Clone(self: *const T, ppenum: ?*?*IEnumGUID) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumGUID.VTable, self.vtable).Clone(@ptrCast(*const IEnumGUID, self), ppenum); } };} pub usingnamespace MethodMixin(@This()); }; pub const CATEGORYINFO = extern struct { catid: Guid, lcid: u32, szDescription: [128]u16, }; // TODO: this type is limited to platform 'windows5.0' const IID_IEnumCATEGORYINFO_Value = @import("../zig.zig").Guid.initString("0002e011-0000-0000-c000-000000000046"); pub const IID_IEnumCATEGORYINFO = &IID_IEnumCATEGORYINFO_Value; pub const IEnumCATEGORYINFO = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumCATEGORYINFO, celt: u32, rgelt: [*]CATEGORYINFO, pceltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumCATEGORYINFO, celt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumCATEGORYINFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumCATEGORYINFO, ppenum: ?*?*IEnumCATEGORYINFO, ) 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 IEnumCATEGORYINFO_Next(self: *const T, celt: u32, rgelt: [*]CATEGORYINFO, pceltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumCATEGORYINFO.VTable, self.vtable).Next(@ptrCast(*const IEnumCATEGORYINFO, self), celt, rgelt, pceltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumCATEGORYINFO_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumCATEGORYINFO.VTable, self.vtable).Skip(@ptrCast(*const IEnumCATEGORYINFO, self), celt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumCATEGORYINFO_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumCATEGORYINFO.VTable, self.vtable).Reset(@ptrCast(*const IEnumCATEGORYINFO, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumCATEGORYINFO_Clone(self: *const T, ppenum: ?*?*IEnumCATEGORYINFO) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumCATEGORYINFO.VTable, self.vtable).Clone(@ptrCast(*const IEnumCATEGORYINFO, self), ppenum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ICatRegister_Value = @import("../zig.zig").Guid.initString("0002e012-0000-0000-c000-000000000046"); pub const IID_ICatRegister = &IID_ICatRegister_Value; pub const ICatRegister = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, RegisterCategories: fn( self: *const ICatRegister, cCategories: u32, rgCategoryInfo: [*]CATEGORYINFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnRegisterCategories: fn( self: *const ICatRegister, cCategories: u32, rgcatid: [*]Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterClassImplCategories: fn( self: *const ICatRegister, rclsid: ?*const Guid, cCategories: u32, rgcatid: [*]Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnRegisterClassImplCategories: fn( self: *const ICatRegister, rclsid: ?*const Guid, cCategories: u32, rgcatid: [*]Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterClassReqCategories: fn( self: *const ICatRegister, rclsid: ?*const Guid, cCategories: u32, rgcatid: [*]Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnRegisterClassReqCategories: fn( self: *const ICatRegister, rclsid: ?*const Guid, cCategories: u32, rgcatid: [*]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 ICatRegister_RegisterCategories(self: *const T, cCategories: u32, rgCategoryInfo: [*]CATEGORYINFO) callconv(.Inline) HRESULT { return @ptrCast(*const ICatRegister.VTable, self.vtable).RegisterCategories(@ptrCast(*const ICatRegister, self), cCategories, rgCategoryInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICatRegister_UnRegisterCategories(self: *const T, cCategories: u32, rgcatid: [*]Guid) callconv(.Inline) HRESULT { return @ptrCast(*const ICatRegister.VTable, self.vtable).UnRegisterCategories(@ptrCast(*const ICatRegister, self), cCategories, rgcatid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICatRegister_RegisterClassImplCategories(self: *const T, rclsid: ?*const Guid, cCategories: u32, rgcatid: [*]Guid) callconv(.Inline) HRESULT { return @ptrCast(*const ICatRegister.VTable, self.vtable).RegisterClassImplCategories(@ptrCast(*const ICatRegister, self), rclsid, cCategories, rgcatid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICatRegister_UnRegisterClassImplCategories(self: *const T, rclsid: ?*const Guid, cCategories: u32, rgcatid: [*]Guid) callconv(.Inline) HRESULT { return @ptrCast(*const ICatRegister.VTable, self.vtable).UnRegisterClassImplCategories(@ptrCast(*const ICatRegister, self), rclsid, cCategories, rgcatid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICatRegister_RegisterClassReqCategories(self: *const T, rclsid: ?*const Guid, cCategories: u32, rgcatid: [*]Guid) callconv(.Inline) HRESULT { return @ptrCast(*const ICatRegister.VTable, self.vtable).RegisterClassReqCategories(@ptrCast(*const ICatRegister, self), rclsid, cCategories, rgcatid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICatRegister_UnRegisterClassReqCategories(self: *const T, rclsid: ?*const Guid, cCategories: u32, rgcatid: [*]Guid) callconv(.Inline) HRESULT { return @ptrCast(*const ICatRegister.VTable, self.vtable).UnRegisterClassReqCategories(@ptrCast(*const ICatRegister, self), rclsid, cCategories, rgcatid); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ICatInformation_Value = @import("../zig.zig").Guid.initString("0002e013-0000-0000-c000-000000000046"); pub const IID_ICatInformation = &IID_ICatInformation_Value; pub const ICatInformation = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, EnumCategories: fn( self: *const ICatInformation, lcid: u32, ppenumCategoryInfo: ?*?*IEnumCATEGORYINFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCategoryDesc: fn( self: *const ICatInformation, rcatid: ?*Guid, lcid: u32, pszDesc: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumClassesOfCategories: fn( self: *const ICatInformation, cImplemented: u32, rgcatidImpl: [*]const Guid, cRequired: u32, rgcatidReq: [*]const Guid, ppenumClsid: ?*?*IEnumGUID, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsClassOfCategories: fn( self: *const ICatInformation, rclsid: ?*const Guid, cImplemented: u32, rgcatidImpl: [*]const Guid, cRequired: u32, rgcatidReq: [*]const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumImplCategoriesOfClass: fn( self: *const ICatInformation, rclsid: ?*const Guid, ppenumCatid: ?*?*IEnumGUID, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumReqCategoriesOfClass: fn( self: *const ICatInformation, rclsid: ?*const Guid, ppenumCatid: ?*?*IEnumGUID, ) 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 ICatInformation_EnumCategories(self: *const T, lcid: u32, ppenumCategoryInfo: ?*?*IEnumCATEGORYINFO) callconv(.Inline) HRESULT { return @ptrCast(*const ICatInformation.VTable, self.vtable).EnumCategories(@ptrCast(*const ICatInformation, self), lcid, ppenumCategoryInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICatInformation_GetCategoryDesc(self: *const T, rcatid: ?*Guid, lcid: u32, pszDesc: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICatInformation.VTable, self.vtable).GetCategoryDesc(@ptrCast(*const ICatInformation, self), rcatid, lcid, pszDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICatInformation_EnumClassesOfCategories(self: *const T, cImplemented: u32, rgcatidImpl: [*]const Guid, cRequired: u32, rgcatidReq: [*]const Guid, ppenumClsid: ?*?*IEnumGUID) callconv(.Inline) HRESULT { return @ptrCast(*const ICatInformation.VTable, self.vtable).EnumClassesOfCategories(@ptrCast(*const ICatInformation, self), cImplemented, rgcatidImpl, cRequired, rgcatidReq, ppenumClsid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICatInformation_IsClassOfCategories(self: *const T, rclsid: ?*const Guid, cImplemented: u32, rgcatidImpl: [*]const Guid, cRequired: u32, rgcatidReq: [*]const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const ICatInformation.VTable, self.vtable).IsClassOfCategories(@ptrCast(*const ICatInformation, self), rclsid, cImplemented, rgcatidImpl, cRequired, rgcatidReq); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICatInformation_EnumImplCategoriesOfClass(self: *const T, rclsid: ?*const Guid, ppenumCatid: ?*?*IEnumGUID) callconv(.Inline) HRESULT { return @ptrCast(*const ICatInformation.VTable, self.vtable).EnumImplCategoriesOfClass(@ptrCast(*const ICatInformation, self), rclsid, ppenumCatid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICatInformation_EnumReqCategoriesOfClass(self: *const T, rclsid: ?*const Guid, ppenumCatid: ?*?*IEnumGUID) callconv(.Inline) HRESULT { return @ptrCast(*const ICatInformation.VTable, self.vtable).EnumReqCategoriesOfClass(@ptrCast(*const ICatInformation, self), rclsid, ppenumCatid); } };} pub usingnamespace MethodMixin(@This()); }; pub const CALLFRAMEINFO = extern struct { iMethod: u32, fHasInValues: BOOL, fHasInOutValues: BOOL, fHasOutValues: BOOL, fDerivesFromIDispatch: BOOL, cInInterfacesMax: i32, cInOutInterfacesMax: i32, cOutInterfacesMax: i32, cTopLevelInInterfaces: i32, iid: Guid, cMethod: u32, cParams: u32, }; pub const CALLFRAMEPARAMINFO = extern struct { fIn: BOOLEAN, fOut: BOOLEAN, stackOffset: u32, cbParam: u32, }; pub const CALLFRAME_COPY = enum(i32) { NESTED = 1, INDEPENDENT = 2, }; pub const CALLFRAME_COPY_NESTED = CALLFRAME_COPY.NESTED; pub const CALLFRAME_COPY_INDEPENDENT = CALLFRAME_COPY.INDEPENDENT; pub const CALLFRAME_FREE = enum(i32) { NONE = 0, IN = 1, INOUT = 2, OUT = 4, TOP_INOUT = 8, TOP_OUT = 16, ALL = 31, }; pub const CALLFRAME_FREE_NONE = CALLFRAME_FREE.NONE; pub const CALLFRAME_FREE_IN = CALLFRAME_FREE.IN; pub const CALLFRAME_FREE_INOUT = CALLFRAME_FREE.INOUT; pub const CALLFRAME_FREE_OUT = CALLFRAME_FREE.OUT; pub const CALLFRAME_FREE_TOP_INOUT = CALLFRAME_FREE.TOP_INOUT; pub const CALLFRAME_FREE_TOP_OUT = CALLFRAME_FREE.TOP_OUT; pub const CALLFRAME_FREE_ALL = CALLFRAME_FREE.ALL; pub const CALLFRAME_NULL = enum(i32) { NONE = 0, INOUT = 2, OUT = 4, ALL = 6, }; pub const CALLFRAME_NULL_NONE = CALLFRAME_NULL.NONE; pub const CALLFRAME_NULL_INOUT = CALLFRAME_NULL.INOUT; pub const CALLFRAME_NULL_OUT = CALLFRAME_NULL.OUT; pub const CALLFRAME_NULL_ALL = CALLFRAME_NULL.ALL; pub const CALLFRAME_WALK = enum(i32) { IN = 1, INOUT = 2, OUT = 4, }; pub const CALLFRAME_WALK_IN = CALLFRAME_WALK.IN; pub const CALLFRAME_WALK_INOUT = CALLFRAME_WALK.INOUT; pub const CALLFRAME_WALK_OUT = CALLFRAME_WALK.OUT; pub const CALLFRAME_MARSHALCONTEXT = extern struct { fIn: BOOLEAN, dwDestContext: u32, pvDestContext: ?*c_void, punkReserved: ?*IUnknown, guidTransferSyntax: Guid, }; // TODO: this type is limited to platform 'windows5.0' const IID_ICallFrame_Value = @import("../zig.zig").Guid.initString("d573b4b0-894e-11d2-b8b6-00c04fb9618a"); pub const IID_ICallFrame = &IID_ICallFrame_Value; pub const ICallFrame = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetInfo: fn( self: *const ICallFrame, pInfo: ?*CALLFRAMEINFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIIDAndMethod: fn( self: *const ICallFrame, pIID: ?*Guid, piMethod: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetNames: fn( self: *const ICallFrame, pwszInterface: ?*?PWSTR, pwszMethod: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStackLocation: fn( self: *const ICallFrame, ) callconv(@import("std").os.windows.WINAPI) ?*c_void, SetStackLocation: fn( self: *const ICallFrame, pvStack: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) void, SetReturnValue: fn( self: *const ICallFrame, hr: HRESULT, ) callconv(@import("std").os.windows.WINAPI) void, GetReturnValue: fn( self: *const ICallFrame, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetParamInfo: fn( self: *const ICallFrame, iparam: u32, pInfo: ?*CALLFRAMEPARAMINFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetParam: fn( self: *const ICallFrame, iparam: u32, pvar: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetParam: fn( self: *const ICallFrame, iparam: u32, pvar: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Copy: fn( self: *const ICallFrame, copyControl: CALLFRAME_COPY, pWalker: ?*ICallFrameWalker, ppFrame: ?*?*ICallFrame, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Free: fn( self: *const ICallFrame, pframeArgsDest: ?*ICallFrame, pWalkerDestFree: ?*ICallFrameWalker, pWalkerCopy: ?*ICallFrameWalker, freeFlags: u32, pWalkerFree: ?*ICallFrameWalker, nullFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FreeParam: fn( self: *const ICallFrame, iparam: u32, freeFlags: u32, pWalkerFree: ?*ICallFrameWalker, nullFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, WalkFrame: fn( self: *const ICallFrame, walkWhat: u32, pWalker: ?*ICallFrameWalker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMarshalSizeMax: fn( self: *const ICallFrame, pmshlContext: ?*CALLFRAME_MARSHALCONTEXT, mshlflags: MSHLFLAGS, pcbBufferNeeded: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Marshal: fn( self: *const ICallFrame, pmshlContext: ?*CALLFRAME_MARSHALCONTEXT, mshlflags: MSHLFLAGS, pBuffer: [*]u8, cbBuffer: u32, pcbBufferUsed: ?*u32, pdataRep: ?*u32, prpcFlags: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unmarshal: fn( self: *const ICallFrame, pBuffer: [*]u8, cbBuffer: u32, dataRep: u32, pcontext: ?*CALLFRAME_MARSHALCONTEXT, pcbUnmarshalled: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReleaseMarshalData: fn( self: *const ICallFrame, pBuffer: [*]u8, cbBuffer: u32, ibFirstRelease: u32, dataRep: u32, pcontext: ?*CALLFRAME_MARSHALCONTEXT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Invoke: fn( self: *const ICallFrame, pvReceiver: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrame_GetInfo(self: *const T, pInfo: ?*CALLFRAMEINFO) callconv(.Inline) HRESULT { return @ptrCast(*const ICallFrame.VTable, self.vtable).GetInfo(@ptrCast(*const ICallFrame, self), pInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrame_GetIIDAndMethod(self: *const T, pIID: ?*Guid, piMethod: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICallFrame.VTable, self.vtable).GetIIDAndMethod(@ptrCast(*const ICallFrame, self), pIID, piMethod); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrame_GetNames(self: *const T, pwszInterface: ?*?PWSTR, pwszMethod: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICallFrame.VTable, self.vtable).GetNames(@ptrCast(*const ICallFrame, self), pwszInterface, pwszMethod); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrame_GetStackLocation(self: *const T) callconv(.Inline) ?*c_void { return @ptrCast(*const ICallFrame.VTable, self.vtable).GetStackLocation(@ptrCast(*const ICallFrame, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrame_SetStackLocation(self: *const T, pvStack: ?*c_void) callconv(.Inline) void { return @ptrCast(*const ICallFrame.VTable, self.vtable).SetStackLocation(@ptrCast(*const ICallFrame, self), pvStack); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrame_SetReturnValue(self: *const T, hr: HRESULT) callconv(.Inline) void { return @ptrCast(*const ICallFrame.VTable, self.vtable).SetReturnValue(@ptrCast(*const ICallFrame, self), hr); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrame_GetReturnValue(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ICallFrame.VTable, self.vtable).GetReturnValue(@ptrCast(*const ICallFrame, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrame_GetParamInfo(self: *const T, iparam: u32, pInfo: ?*CALLFRAMEPARAMINFO) callconv(.Inline) HRESULT { return @ptrCast(*const ICallFrame.VTable, self.vtable).GetParamInfo(@ptrCast(*const ICallFrame, self), iparam, pInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrame_SetParam(self: *const T, iparam: u32, pvar: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ICallFrame.VTable, self.vtable).SetParam(@ptrCast(*const ICallFrame, self), iparam, pvar); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrame_GetParam(self: *const T, iparam: u32, pvar: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ICallFrame.VTable, self.vtable).GetParam(@ptrCast(*const ICallFrame, self), iparam, pvar); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrame_Copy(self: *const T, copyControl: CALLFRAME_COPY, pWalker: ?*ICallFrameWalker, ppFrame: ?*?*ICallFrame) callconv(.Inline) HRESULT { return @ptrCast(*const ICallFrame.VTable, self.vtable).Copy(@ptrCast(*const ICallFrame, self), copyControl, pWalker, ppFrame); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrame_Free(self: *const T, pframeArgsDest: ?*ICallFrame, pWalkerDestFree: ?*ICallFrameWalker, pWalkerCopy: ?*ICallFrameWalker, freeFlags: u32, pWalkerFree: ?*ICallFrameWalker, nullFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICallFrame.VTable, self.vtable).Free(@ptrCast(*const ICallFrame, self), pframeArgsDest, pWalkerDestFree, pWalkerCopy, freeFlags, pWalkerFree, nullFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrame_FreeParam(self: *const T, iparam: u32, freeFlags: u32, pWalkerFree: ?*ICallFrameWalker, nullFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICallFrame.VTable, self.vtable).FreeParam(@ptrCast(*const ICallFrame, self), iparam, freeFlags, pWalkerFree, nullFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrame_WalkFrame(self: *const T, walkWhat: u32, pWalker: ?*ICallFrameWalker) callconv(.Inline) HRESULT { return @ptrCast(*const ICallFrame.VTable, self.vtable).WalkFrame(@ptrCast(*const ICallFrame, self), walkWhat, pWalker); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrame_GetMarshalSizeMax(self: *const T, pmshlContext: ?*CALLFRAME_MARSHALCONTEXT, mshlflags: MSHLFLAGS, pcbBufferNeeded: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICallFrame.VTable, self.vtable).GetMarshalSizeMax(@ptrCast(*const ICallFrame, self), pmshlContext, mshlflags, pcbBufferNeeded); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrame_Marshal(self: *const T, pmshlContext: ?*CALLFRAME_MARSHALCONTEXT, mshlflags: MSHLFLAGS, pBuffer: [*]u8, cbBuffer: u32, pcbBufferUsed: ?*u32, pdataRep: ?*u32, prpcFlags: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICallFrame.VTable, self.vtable).Marshal(@ptrCast(*const ICallFrame, self), pmshlContext, mshlflags, pBuffer, cbBuffer, pcbBufferUsed, pdataRep, prpcFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrame_Unmarshal(self: *const T, pBuffer: [*]u8, cbBuffer: u32, dataRep: u32, pcontext: ?*CALLFRAME_MARSHALCONTEXT, pcbUnmarshalled: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICallFrame.VTable, self.vtable).Unmarshal(@ptrCast(*const ICallFrame, self), pBuffer, cbBuffer, dataRep, pcontext, pcbUnmarshalled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrame_ReleaseMarshalData(self: *const T, pBuffer: [*]u8, cbBuffer: u32, ibFirstRelease: u32, dataRep: u32, pcontext: ?*CALLFRAME_MARSHALCONTEXT) callconv(.Inline) HRESULT { return @ptrCast(*const ICallFrame.VTable, self.vtable).ReleaseMarshalData(@ptrCast(*const ICallFrame, self), pBuffer, cbBuffer, ibFirstRelease, dataRep, pcontext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrame_Invoke(self: *const T, pvReceiver: ?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const ICallFrame.VTable, self.vtable).Invoke(@ptrCast(*const ICallFrame, self), pvReceiver); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ICallIndirect_Value = @import("../zig.zig").Guid.initString("d573b4b1-894e-11d2-b8b6-00c04fb9618a"); pub const IID_ICallIndirect = &IID_ICallIndirect_Value; pub const ICallIndirect = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CallIndirect: fn( self: *const ICallIndirect, phrReturn: ?*HRESULT, iMethod: u32, pvArgs: ?*c_void, cbArgs: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMethodInfo: fn( self: *const ICallIndirect, iMethod: u32, pInfo: ?*CALLFRAMEINFO, pwszMethod: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStackSize: fn( self: *const ICallIndirect, iMethod: u32, cbArgs: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIID: fn( self: *const ICallIndirect, piid: ?*Guid, pfDerivesFromIDispatch: ?*BOOL, pcMethod: ?*u32, pwszInterface: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallIndirect_CallIndirect(self: *const T, phrReturn: ?*HRESULT, iMethod: u32, pvArgs: ?*c_void, cbArgs: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICallIndirect.VTable, self.vtable).CallIndirect(@ptrCast(*const ICallIndirect, self), phrReturn, iMethod, pvArgs, cbArgs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallIndirect_GetMethodInfo(self: *const T, iMethod: u32, pInfo: ?*CALLFRAMEINFO, pwszMethod: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICallIndirect.VTable, self.vtable).GetMethodInfo(@ptrCast(*const ICallIndirect, self), iMethod, pInfo, pwszMethod); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallIndirect_GetStackSize(self: *const T, iMethod: u32, cbArgs: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICallIndirect.VTable, self.vtable).GetStackSize(@ptrCast(*const ICallIndirect, self), iMethod, cbArgs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallIndirect_GetIID(self: *const T, piid: ?*Guid, pfDerivesFromIDispatch: ?*BOOL, pcMethod: ?*u32, pwszInterface: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICallIndirect.VTable, self.vtable).GetIID(@ptrCast(*const ICallIndirect, self), piid, pfDerivesFromIDispatch, pcMethod, pwszInterface); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ICallInterceptor_Value = @import("../zig.zig").Guid.initString("60c7ca75-896d-11d2-b8b6-00c04fb9618a"); pub const IID_ICallInterceptor = &IID_ICallInterceptor_Value; pub const ICallInterceptor = extern struct { pub const VTable = extern struct { base: ICallIndirect.VTable, RegisterSink: fn( self: *const ICallInterceptor, psink: ?*ICallFrameEvents, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRegisteredSink: fn( self: *const ICallInterceptor, ppsink: ?*?*ICallFrameEvents, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ICallIndirect.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallInterceptor_RegisterSink(self: *const T, psink: ?*ICallFrameEvents) callconv(.Inline) HRESULT { return @ptrCast(*const ICallInterceptor.VTable, self.vtable).RegisterSink(@ptrCast(*const ICallInterceptor, self), psink); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallInterceptor_GetRegisteredSink(self: *const T, ppsink: ?*?*ICallFrameEvents) callconv(.Inline) HRESULT { return @ptrCast(*const ICallInterceptor.VTable, self.vtable).GetRegisteredSink(@ptrCast(*const ICallInterceptor, self), ppsink); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ICallFrameEvents_Value = @import("../zig.zig").Guid.initString("fd5e0843-fc91-11d0-97d7-00c04fb9618a"); pub const IID_ICallFrameEvents = &IID_ICallFrameEvents_Value; pub const ICallFrameEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnCall: fn( self: *const ICallFrameEvents, pFrame: ?*ICallFrame, ) 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 ICallFrameEvents_OnCall(self: *const T, pFrame: ?*ICallFrame) callconv(.Inline) HRESULT { return @ptrCast(*const ICallFrameEvents.VTable, self.vtable).OnCall(@ptrCast(*const ICallFrameEvents, self), pFrame); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ICallUnmarshal_Value = @import("../zig.zig").Guid.initString("5333b003-2e42-11d2-b89d-00c04fb9618a"); pub const IID_ICallUnmarshal = &IID_ICallUnmarshal_Value; pub const ICallUnmarshal = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Unmarshal: fn( self: *const ICallUnmarshal, iMethod: u32, pBuffer: [*]u8, cbBuffer: u32, fForceBufferCopy: BOOL, dataRep: u32, pcontext: ?*CALLFRAME_MARSHALCONTEXT, pcbUnmarshalled: ?*u32, ppFrame: ?*?*ICallFrame, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReleaseMarshalData: fn( self: *const ICallUnmarshal, iMethod: u32, pBuffer: [*]u8, cbBuffer: u32, ibFirstRelease: u32, dataRep: u32, pcontext: ?*CALLFRAME_MARSHALCONTEXT, ) 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 ICallUnmarshal_Unmarshal(self: *const T, iMethod: u32, pBuffer: [*]u8, cbBuffer: u32, fForceBufferCopy: BOOL, dataRep: u32, pcontext: ?*CALLFRAME_MARSHALCONTEXT, pcbUnmarshalled: ?*u32, ppFrame: ?*?*ICallFrame) callconv(.Inline) HRESULT { return @ptrCast(*const ICallUnmarshal.VTable, self.vtable).Unmarshal(@ptrCast(*const ICallUnmarshal, self), iMethod, pBuffer, cbBuffer, fForceBufferCopy, dataRep, pcontext, pcbUnmarshalled, ppFrame); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallUnmarshal_ReleaseMarshalData(self: *const T, iMethod: u32, pBuffer: [*]u8, cbBuffer: u32, ibFirstRelease: u32, dataRep: u32, pcontext: ?*CALLFRAME_MARSHALCONTEXT) callconv(.Inline) HRESULT { return @ptrCast(*const ICallUnmarshal.VTable, self.vtable).ReleaseMarshalData(@ptrCast(*const ICallUnmarshal, self), iMethod, pBuffer, cbBuffer, ibFirstRelease, dataRep, pcontext); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ICallFrameWalker_Value = @import("../zig.zig").Guid.initString("08b23919-392d-11d2-b8a4-00c04fb9618a"); pub const IID_ICallFrameWalker = &IID_ICallFrameWalker_Value; pub const ICallFrameWalker = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnWalkInterface: fn( self: *const ICallFrameWalker, iid: ?*const Guid, ppvInterface: ?*?*c_void, fIn: BOOL, fOut: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICallFrameWalker_OnWalkInterface(self: *const T, iid: ?*const Guid, ppvInterface: ?*?*c_void, fIn: BOOL, fOut: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ICallFrameWalker.VTable, self.vtable).OnWalkInterface(@ptrCast(*const ICallFrameWalker, self), iid, ppvInterface, fIn, fOut); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IInterfaceRelated_Value = @import("../zig.zig").Guid.initString("d1fb5a79-7706-11d1-adba-00c04fc2adc0"); pub const IID_IInterfaceRelated = &IID_IInterfaceRelated_Value; pub const IInterfaceRelated = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetIID: fn( self: *const IInterfaceRelated, iid: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIID: fn( self: *const IInterfaceRelated, piid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInterfaceRelated_SetIID(self: *const T, iid: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IInterfaceRelated.VTable, self.vtable).SetIID(@ptrCast(*const IInterfaceRelated, self), iid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInterfaceRelated_GetIID(self: *const T, piid: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IInterfaceRelated.VTable, self.vtable).GetIID(@ptrCast(*const IInterfaceRelated, self), piid); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IMessageDispatcher_Value = @import("../zig.zig").Guid.initString("f5f84c8f-cfd0-4cd6-b66b-c5d26ff1689d"); pub const IID_IMessageDispatcher = &IID_IMessageDispatcher_Value; pub const IMessageDispatcher = extern struct { pub const VTable = extern struct { base: IInspectable.VTable, PumpMessages: fn( self: *const IMessageDispatcher, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IInspectable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMessageDispatcher_PumpMessages(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IMessageDispatcher.VTable, self.vtable).PumpMessages(@ptrCast(*const IMessageDispatcher, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const ComCallData = extern struct { dwDispid: u32, dwReserved: u32, pUserDefined: ?*c_void, }; pub const PFNCONTEXTCALL = fn( pParam: ?*ComCallData, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' const IID_IContextCallback_Value = @import("../zig.zig").Guid.initString("000001da-0000-0000-c000-000000000046"); pub const IID_IContextCallback = &IID_IContextCallback_Value; pub const IContextCallback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ContextCallback: fn( self: *const IContextCallback, pfnCallback: ?PFNCONTEXTCALL, pParam: ?*ComCallData, riid: ?*const Guid, iMethod: i32, pUnk: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IContextCallback_ContextCallback(self: *const T, pfnCallback: ?PFNCONTEXTCALL, pParam: ?*ComCallData, riid: ?*const Guid, iMethod: i32, pUnk: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IContextCallback.VTable, self.vtable).ContextCallback(@ptrCast(*const IContextCallback, self), pfnCallback, pParam, riid, iMethod, pUnk); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IEventPublisher_Value = @import("../zig.zig").Guid.initString("e341516b-2e32-11d1-9964-00c04fbbb345"); pub const IID_IEventPublisher = &IID_IEventPublisher_Value; pub const IEventPublisher = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PublisherID: fn( self: *const IEventPublisher, pbstrPublisherID: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_PublisherID: fn( self: *const IEventPublisher, bstrPublisherID: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PublisherName: fn( self: *const IEventPublisher, pbstrPublisherName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_PublisherName: fn( self: *const IEventPublisher, bstrPublisherName: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PublisherType: fn( self: *const IEventPublisher, pbstrPublisherType: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_PublisherType: fn( self: *const IEventPublisher, bstrPublisherType: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_OwnerSID: fn( self: *const IEventPublisher, pbstrOwnerSID: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_OwnerSID: fn( self: *const IEventPublisher, bstrOwnerSID: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Description: fn( self: *const IEventPublisher, pbstrDescription: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Description: fn( self: *const IEventPublisher, bstrDescription: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDefaultProperty: fn( self: *const IEventPublisher, bstrPropertyName: ?BSTR, propertyValue: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PutDefaultProperty: fn( self: *const IEventPublisher, bstrPropertyName: ?BSTR, propertyValue: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveDefaultProperty: fn( self: *const IEventPublisher, bstrPropertyName: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDefaultPropertyCollection: fn( self: *const IEventPublisher, collection: ?*?*IEventObjectCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventPublisher_get_PublisherID(self: *const T, pbstrPublisherID: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEventPublisher.VTable, self.vtable).get_PublisherID(@ptrCast(*const IEventPublisher, self), pbstrPublisherID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventPublisher_put_PublisherID(self: *const T, bstrPublisherID: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEventPublisher.VTable, self.vtable).put_PublisherID(@ptrCast(*const IEventPublisher, self), bstrPublisherID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventPublisher_get_PublisherName(self: *const T, pbstrPublisherName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEventPublisher.VTable, self.vtable).get_PublisherName(@ptrCast(*const IEventPublisher, self), pbstrPublisherName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventPublisher_put_PublisherName(self: *const T, bstrPublisherName: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEventPublisher.VTable, self.vtable).put_PublisherName(@ptrCast(*const IEventPublisher, self), bstrPublisherName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventPublisher_get_PublisherType(self: *const T, pbstrPublisherType: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEventPublisher.VTable, self.vtable).get_PublisherType(@ptrCast(*const IEventPublisher, self), pbstrPublisherType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventPublisher_put_PublisherType(self: *const T, bstrPublisherType: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEventPublisher.VTable, self.vtable).put_PublisherType(@ptrCast(*const IEventPublisher, self), bstrPublisherType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventPublisher_get_OwnerSID(self: *const T, pbstrOwnerSID: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEventPublisher.VTable, self.vtable).get_OwnerSID(@ptrCast(*const IEventPublisher, self), pbstrOwnerSID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventPublisher_put_OwnerSID(self: *const T, bstrOwnerSID: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEventPublisher.VTable, self.vtable).put_OwnerSID(@ptrCast(*const IEventPublisher, self), bstrOwnerSID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventPublisher_get_Description(self: *const T, pbstrDescription: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEventPublisher.VTable, self.vtable).get_Description(@ptrCast(*const IEventPublisher, self), pbstrDescription); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventPublisher_put_Description(self: *const T, bstrDescription: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEventPublisher.VTable, self.vtable).put_Description(@ptrCast(*const IEventPublisher, self), bstrDescription); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventPublisher_GetDefaultProperty(self: *const T, bstrPropertyName: ?BSTR, propertyValue: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IEventPublisher.VTable, self.vtable).GetDefaultProperty(@ptrCast(*const IEventPublisher, self), bstrPropertyName, propertyValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventPublisher_PutDefaultProperty(self: *const T, bstrPropertyName: ?BSTR, propertyValue: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IEventPublisher.VTable, self.vtable).PutDefaultProperty(@ptrCast(*const IEventPublisher, self), bstrPropertyName, propertyValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventPublisher_RemoveDefaultProperty(self: *const T, bstrPropertyName: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEventPublisher.VTable, self.vtable).RemoveDefaultProperty(@ptrCast(*const IEventPublisher, self), bstrPropertyName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventPublisher_GetDefaultPropertyCollection(self: *const T, collection: ?*?*IEventObjectCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IEventPublisher.VTable, self.vtable).GetDefaultPropertyCollection(@ptrCast(*const IEventPublisher, self), collection); } };} pub usingnamespace MethodMixin(@This()); }; pub const EOC_ChangeType = enum(i32) { NewObject = 0, ModifiedObject = 1, DeletedObject = 2, }; pub const EOC_NewObject = EOC_ChangeType.NewObject; pub const EOC_ModifiedObject = EOC_ChangeType.ModifiedObject; pub const EOC_DeletedObject = EOC_ChangeType.DeletedObject; // TODO: this type is limited to platform 'windows5.0' const IID_IEventProperty_Value = @import("../zig.zig").Guid.initString("da538ee2-f4de-11d1-b6bb-00805fc79216"); pub const IID_IEventProperty = &IID_IEventProperty_Value; pub const IEventProperty = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const IEventProperty, propertyName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Name: fn( self: *const IEventProperty, propertyName: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Value: fn( self: *const IEventProperty, propertyValue: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Value: fn( self: *const IEventProperty, propertyValue: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventProperty_get_Name(self: *const T, propertyName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEventProperty.VTable, self.vtable).get_Name(@ptrCast(*const IEventProperty, self), propertyName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventProperty_put_Name(self: *const T, propertyName: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEventProperty.VTable, self.vtable).put_Name(@ptrCast(*const IEventProperty, self), propertyName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventProperty_get_Value(self: *const T, propertyValue: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IEventProperty.VTable, self.vtable).get_Value(@ptrCast(*const IEventProperty, self), propertyValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventProperty_put_Value(self: *const T, propertyValue: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IEventProperty.VTable, self.vtable).put_Value(@ptrCast(*const IEventProperty, self), propertyValue); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IAccessibilityDockingServiceCallback_Value = @import("../zig.zig").Guid.initString("157733fd-a592-42e5-b594-248468c5a81b"); pub const IID_IAccessibilityDockingServiceCallback = &IID_IAccessibilityDockingServiceCallback_Value; pub const IAccessibilityDockingServiceCallback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Undocked: fn( self: *const IAccessibilityDockingServiceCallback, undockReason: UNDOCK_REASON, ) 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 IAccessibilityDockingServiceCallback_Undocked(self: *const T, undockReason: UNDOCK_REASON) callconv(.Inline) HRESULT { return @ptrCast(*const IAccessibilityDockingServiceCallback.VTable, self.vtable).Undocked(@ptrCast(*const IAccessibilityDockingServiceCallback, self), undockReason); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IAccessibilityDockingService_Value = @import("../zig.zig").Guid.initString("8849dc22-cedf-4c95-998d-051419dd3f76"); pub const IID_IAccessibilityDockingService = &IID_IAccessibilityDockingService_Value; pub const IAccessibilityDockingService = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetAvailableSize: fn( self: *const IAccessibilityDockingService, hMonitor: ?HMONITOR, pcxFixed: ?*u32, pcyMax: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DockWindow: fn( self: *const IAccessibilityDockingService, hwnd: ?HWND, hMonitor: ?HMONITOR, cyRequested: u32, pCallback: ?*IAccessibilityDockingServiceCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UndockWindow: fn( self: *const IAccessibilityDockingService, hwnd: ?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAccessibilityDockingService_GetAvailableSize(self: *const T, hMonitor: ?HMONITOR, pcxFixed: ?*u32, pcyMax: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAccessibilityDockingService.VTable, self.vtable).GetAvailableSize(@ptrCast(*const IAccessibilityDockingService, self), hMonitor, pcxFixed, pcyMax); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAccessibilityDockingService_DockWindow(self: *const T, hwnd: ?HWND, hMonitor: ?HMONITOR, cyRequested: u32, pCallback: ?*IAccessibilityDockingServiceCallback) callconv(.Inline) HRESULT { return @ptrCast(*const IAccessibilityDockingService.VTable, self.vtable).DockWindow(@ptrCast(*const IAccessibilityDockingService, self), hwnd, hMonitor, cyRequested, pCallback); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAccessibilityDockingService_UndockWindow(self: *const T, hwnd: ?HWND) callconv(.Inline) HRESULT { return @ptrCast(*const IAccessibilityDockingService.VTable, self.vtable).UndockWindow(@ptrCast(*const IAccessibilityDockingService, self), hwnd); } };} pub usingnamespace MethodMixin(@This()); }; pub const COINIT = enum(u32) { APARTMENTTHREADED = 2, MULTITHREADED = 0, DISABLE_OLE1DDE = 4, SPEED_OVER_MEMORY = 8, _, pub fn initFlags(o: struct { APARTMENTTHREADED: u1 = 0, MULTITHREADED: u1 = 0, DISABLE_OLE1DDE: u1 = 0, SPEED_OVER_MEMORY: u1 = 0, }) COINIT { return @intToEnum(COINIT, (if (o.APARTMENTTHREADED == 1) @enumToInt(COINIT.APARTMENTTHREADED) else 0) | (if (o.MULTITHREADED == 1) @enumToInt(COINIT.MULTITHREADED) else 0) | (if (o.DISABLE_OLE1DDE == 1) @enumToInt(COINIT.DISABLE_OLE1DDE) else 0) | (if (o.SPEED_OVER_MEMORY == 1) @enumToInt(COINIT.SPEED_OVER_MEMORY) else 0) ); } }; pub const COINIT_APARTMENTTHREADED = COINIT.APARTMENTTHREADED; pub const COINIT_MULTITHREADED = COINIT.MULTITHREADED; pub const COINIT_DISABLE_OLE1DDE = COINIT.DISABLE_OLE1DDE; pub const COINIT_SPEED_OVER_MEMORY = COINIT.SPEED_OVER_MEMORY; pub const COMSD = enum(i32) { LAUNCHPERMISSIONS = 0, ACCESSPERMISSIONS = 1, LAUNCHRESTRICTIONS = 2, ACCESSRESTRICTIONS = 3, }; pub const SD_LAUNCHPERMISSIONS = COMSD.LAUNCHPERMISSIONS; pub const SD_ACCESSPERMISSIONS = COMSD.ACCESSPERMISSIONS; pub const SD_LAUNCHRESTRICTIONS = COMSD.LAUNCHRESTRICTIONS; pub const SD_ACCESSRESTRICTIONS = COMSD.ACCESSRESTRICTIONS; //-------------------------------------------------------------------------------- // Section: Functions (359) //-------------------------------------------------------------------------------- pub extern "OLE32" fn CLIPFORMAT_UserSize( param0: ?*u32, param1: u32, param2: ?*u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLE32" fn CLIPFORMAT_UserMarshal( param0: ?*u32, param1: ?*u8, param2: ?*u16, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn CLIPFORMAT_UserUnmarshal( param0: ?*u32, param1: [*:0]u8, param2: ?*u16, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn CLIPFORMAT_UserFree( param0: ?*u32, param1: ?*u16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLE32" fn HBITMAP_UserSize( param0: ?*u32, param1: u32, param2: ?*?HBITMAP, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLE32" fn HBITMAP_UserMarshal( param0: ?*u32, param1: ?*u8, param2: ?*?HBITMAP, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HBITMAP_UserUnmarshal( param0: ?*u32, param1: [*:0]u8, param2: ?*?HBITMAP, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HBITMAP_UserFree( param0: ?*u32, param1: ?*?HBITMAP, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLE32" fn HDC_UserSize( param0: ?*u32, param1: u32, param2: ?*?HDC, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLE32" fn HDC_UserMarshal( param0: ?*u32, param1: ?*u8, param2: ?*?HDC, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HDC_UserUnmarshal( param0: ?*u32, param1: [*:0]u8, param2: ?*?HDC, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HDC_UserFree( param0: ?*u32, param1: ?*?HDC, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLE32" fn HICON_UserSize( param0: ?*u32, param1: u32, param2: ?*?HICON, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLE32" fn HICON_UserMarshal( param0: ?*u32, param1: ?*u8, param2: ?*?HICON, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HICON_UserUnmarshal( param0: ?*u32, param1: [*:0]u8, param2: ?*?HICON, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HICON_UserFree( param0: ?*u32, param1: ?*?HICON, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "ole32" fn SNB_UserSize( param0: ?*u32, param1: u32, param2: ?*?*?*u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "ole32" fn SNB_UserMarshal( param0: ?*u32, param1: ?*u8, param2: ?*?*?*u16, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "ole32" fn SNB_UserUnmarshal( param0: ?*u32, param1: [*:0]u8, param2: ?*?*?*u16, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "ole32" fn SNB_UserFree( param0: ?*u32, param1: ?*?*?*u16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLE32" fn CLIPFORMAT_UserSize64( param0: ?*u32, param1: u32, param2: ?*u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLE32" fn CLIPFORMAT_UserMarshal64( param0: ?*u32, param1: ?*u8, param2: ?*u16, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn CLIPFORMAT_UserUnmarshal64( param0: ?*u32, param1: [*:0]u8, param2: ?*u16, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn CLIPFORMAT_UserFree64( param0: ?*u32, param1: ?*u16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLE32" fn HBITMAP_UserSize64( param0: ?*u32, param1: u32, param2: ?*?HBITMAP, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLE32" fn HBITMAP_UserMarshal64( param0: ?*u32, param1: ?*u8, param2: ?*?HBITMAP, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HBITMAP_UserUnmarshal64( param0: ?*u32, param1: [*:0]u8, param2: ?*?HBITMAP, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HBITMAP_UserFree64( param0: ?*u32, param1: ?*?HBITMAP, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLE32" fn HDC_UserSize64( param0: ?*u32, param1: u32, param2: ?*?HDC, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLE32" fn HDC_UserMarshal64( param0: ?*u32, param1: ?*u8, param2: ?*?HDC, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HDC_UserUnmarshal64( param0: ?*u32, param1: [*:0]u8, param2: ?*?HDC, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HDC_UserFree64( param0: ?*u32, param1: ?*?HDC, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLE32" fn HICON_UserSize64( param0: ?*u32, param1: u32, param2: ?*?HICON, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLE32" fn HICON_UserMarshal64( param0: ?*u32, param1: ?*u8, param2: ?*?HICON, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HICON_UserUnmarshal64( param0: ?*u32, param1: [*:0]u8, param2: ?*?HICON, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HICON_UserFree64( param0: ?*u32, param1: ?*?HICON, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "ole32" fn SNB_UserSize64( param0: ?*u32, param1: u32, param2: ?*?*?*u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "ole32" fn SNB_UserMarshal64( param0: ?*u32, param1: ?*u8, param2: ?*?*?*u16, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "ole32" fn SNB_UserUnmarshal64( param0: ?*u32, param1: [*:0]u8, param2: ?*?*?*u16, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "ole32" fn SNB_UserFree64( param0: ?*u32, param1: ?*?*?*u16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLE32" fn HACCEL_UserSize( param0: ?*u32, param1: u32, param2: ?*?HACCEL, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLE32" fn HACCEL_UserMarshal( param0: ?*u32, param1: ?*u8, param2: ?*?HACCEL, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HACCEL_UserUnmarshal( param0: ?*u32, param1: [*:0]u8, param2: ?*?HACCEL, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HACCEL_UserFree( param0: ?*u32, param1: ?*?HACCEL, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLE32" fn HGLOBAL_UserSize( param0: ?*u32, param1: u32, param2: ?*isize, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLE32" fn HGLOBAL_UserMarshal( param0: ?*u32, param1: ?*u8, param2: ?*isize, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HGLOBAL_UserUnmarshal( param0: ?*u32, param1: [*:0]u8, param2: ?*isize, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HGLOBAL_UserFree( param0: ?*u32, param1: ?*isize, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLE32" fn HMENU_UserSize( param0: ?*u32, param1: u32, param2: ?*?HMENU, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLE32" fn HMENU_UserMarshal( param0: ?*u32, param1: ?*u8, param2: ?*?HMENU, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HMENU_UserUnmarshal( param0: ?*u32, param1: [*:0]u8, param2: ?*?HMENU, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HMENU_UserFree( param0: ?*u32, param1: ?*?HMENU, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLE32" fn HACCEL_UserSize64( param0: ?*u32, param1: u32, param2: ?*?HACCEL, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLE32" fn HACCEL_UserMarshal64( param0: ?*u32, param1: ?*u8, param2: ?*?HACCEL, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HACCEL_UserUnmarshal64( param0: ?*u32, param1: [*:0]u8, param2: ?*?HACCEL, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HACCEL_UserFree64( param0: ?*u32, param1: ?*?HACCEL, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLE32" fn HGLOBAL_UserSize64( param0: ?*u32, param1: u32, param2: ?*isize, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLE32" fn HGLOBAL_UserMarshal64( param0: ?*u32, param1: ?*u8, param2: ?*isize, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HGLOBAL_UserUnmarshal64( param0: ?*u32, param1: [*:0]u8, param2: ?*isize, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HGLOBAL_UserFree64( param0: ?*u32, param1: ?*isize, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLE32" fn HMENU_UserSize64( param0: ?*u32, param1: u32, param2: ?*?HMENU, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLE32" fn HMENU_UserMarshal64( param0: ?*u32, param1: ?*u8, param2: ?*?HMENU, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HMENU_UserUnmarshal64( param0: ?*u32, param1: [*:0]u8, param2: ?*?HMENU, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HMENU_UserFree64( param0: ?*u32, param1: ?*?HMENU, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "urlmon" fn CreateURLMoniker( pMkCtx: ?*IMoniker, szURL: ?[*:0]const u16, ppmk: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CreateURLMonikerEx( pMkCtx: ?*IMoniker, szURL: ?[*:0]const u16, ppmk: ?*?*IMoniker, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn GetClassURL( szURL: ?[*:0]const u16, pClsID: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "urlmon" fn CreateAsyncBindCtx( reserved: u32, pBSCb: ?*IBindStatusCallback, pEFetc: ?*IEnumFORMATETC, ppBC: ?*?*IBindCtx, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CreateURLMonikerEx2( pMkCtx: ?*IMoniker, pUri: ?*IUri, ppmk: ?*?*IMoniker, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CreateAsyncBindCtxEx( pbc: ?*IBindCtx, dwOptions: u32, pBSCb: ?*IBindStatusCallback, pEnum: ?*IEnumFORMATETC, ppBC: ?*?*IBindCtx, reserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn MkParseDisplayNameEx( pbc: ?*IBindCtx, szDisplayName: ?[*:0]const u16, pchEaten: ?*u32, ppmk: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn RegisterBindStatusCallback( pBC: ?*IBindCtx, pBSCb: ?*IBindStatusCallback, ppBSCBPrev: ?*?*IBindStatusCallback, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn RevokeBindStatusCallback( pBC: ?*IBindCtx, pBSCb: ?*IBindStatusCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn GetClassFileOrMime( pBC: ?*IBindCtx, szFilename: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 3? pBuffer: ?*c_void, cbSize: u32, szMime: ?[*:0]const u16, dwReserved: u32, pclsid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn IsValidURL( pBC: ?*IBindCtx, szURL: ?[*:0]const u16, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CoGetClassObjectFromURL( rCLASSID: ?*const Guid, szCODE: ?[*:0]const u16, dwFileVersionMS: u32, dwFileVersionLS: u32, szTYPE: ?[*:0]const u16, pBindCtx: ?*IBindCtx, dwClsContext: CLSCTX, pvReserved: ?*c_void, riid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn IEInstallScope( pdwScope: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn FaultInIEFeature( hWnd: ?HWND, pClassSpec: ?*uCLSSPEC, pQuery: ?*QUERYCONTEXT, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn GetComponentIDFromCLSSPEC( pClassspec: ?*uCLSSPEC, ppszComponentID: ?*?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn IsAsyncMoniker( pmk: ?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn RegisterMediaTypes( ctypes: u32, rgszTypes: [*]const ?[*:0]const u8, rgcfTypes: [*:0]u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn FindMediaType( rgszTypes: ?[*:0]const u8, rgcfTypes: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "urlmon" fn CreateFormatEnumerator( cfmtetc: u32, rgfmtetc: [*]FORMATETC, ppenumfmtetc: ?*?*IEnumFORMATETC, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn RegisterFormatEnumerator( pBC: ?*IBindCtx, pEFetc: ?*IEnumFORMATETC, reserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn RevokeFormatEnumerator( pBC: ?*IBindCtx, pEFetc: ?*IEnumFORMATETC, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn RegisterMediaTypeClass( pBC: ?*IBindCtx, ctypes: u32, rgszTypes: [*]const ?[*:0]const u8, rgclsID: [*]Guid, reserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn FindMediaTypeClass( pBC: ?*IBindCtx, szType: ?[*:0]const u8, pclsID: ?*Guid, reserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn UrlMkSetSessionOption( dwOption: u32, // TODO: what to do with BytesParamIndex 2? pBuffer: ?*c_void, dwBufferLength: u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn UrlMkGetSessionOption( dwOption: u32, // TODO: what to do with BytesParamIndex 2? pBuffer: ?*c_void, dwBufferLength: u32, pdwBufferLengthOut: ?*u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn FindMimeFromData( pBC: ?*IBindCtx, pwzUrl: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 3? pBuffer: ?*c_void, cbSize: u32, pwzMimeProposed: ?[*:0]const u16, dwMimeFlags: u32, ppwzMimeOut: ?*?PWSTR, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn ObtainUserAgentString( dwOption: u32, pszUAOut: [*:0]u8, cbSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CompareSecurityIds( pbSecurityId1: [*:0]u8, dwLen1: u32, pbSecurityId2: [*:0]u8, dwLen2: u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CompatFlagsFromClsid( pclsid: ?*Guid, pdwCompatFlags: ?*u32, pdwMiscStatusFlags: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn SetAccessForIEAppContainer( hObject: ?HANDLE, ieObjectType: IEObjectType, dwAccessMask: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "URLMON" fn CreateUri( pwzURI: ?[*:0]const u16, dwFlags: URI_CREATE_FLAGS, dwReserved: usize, ppURI: ?*?*IUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "URLMON" fn CreateUriWithFragment( pwzURI: ?[*:0]const u16, pwzFragment: ?[*:0]const u16, dwFlags: u32, dwReserved: usize, ppURI: ?*?*IUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CreateUriFromMultiByteString( pszANSIInputUri: ?[*:0]const u8, dwEncodingFlags: u32, dwCodePage: u32, dwCreateFlags: u32, dwReserved: usize, ppUri: ?*?*IUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "URLMON" fn CreateIUriBuilder( pIUri: ?*IUri, dwFlags: u32, dwReserved: usize, ppIUriBuilder: ?*?*IUriBuilder, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn HlinkSimpleNavigateToString( szTarget: ?[*:0]const u16, szLocation: ?[*:0]const u16, szTargetFrameName: ?[*:0]const u16, pUnk: ?*IUnknown, pbc: ?*IBindCtx, param5: ?*IBindStatusCallback, grfHLNF: u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn HlinkSimpleNavigateToMoniker( pmkTarget: ?*IMoniker, szLocation: ?[*:0]const u16, szTargetFrameName: ?[*:0]const u16, pUnk: ?*IUnknown, pbc: ?*IBindCtx, param5: ?*IBindStatusCallback, grfHLNF: u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn URLOpenStreamA( param0: ?*IUnknown, param1: ?[*:0]const u8, param2: u32, param3: ?*IBindStatusCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn URLOpenStreamW( param0: ?*IUnknown, param1: ?[*:0]const u16, param2: u32, param3: ?*IBindStatusCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn URLOpenPullStreamA( param0: ?*IUnknown, param1: ?[*:0]const u8, param2: u32, param3: ?*IBindStatusCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn URLOpenPullStreamW( param0: ?*IUnknown, param1: ?[*:0]const u16, param2: u32, param3: ?*IBindStatusCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn URLDownloadToFileA( param0: ?*IUnknown, param1: ?[*:0]const u8, param2: ?[*:0]const u8, param3: u32, param4: ?*IBindStatusCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn URLDownloadToFileW( param0: ?*IUnknown, param1: ?[*:0]const u16, param2: ?[*:0]const u16, param3: u32, param4: ?*IBindStatusCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn URLDownloadToCacheFileA( param0: ?*IUnknown, param1: ?[*:0]const u8, param2: [*:0]u8, cchFileName: u32, param4: u32, param5: ?*IBindStatusCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn URLDownloadToCacheFileW( param0: ?*IUnknown, param1: ?[*:0]const u16, param2: [*:0]u16, cchFileName: u32, param4: u32, param5: ?*IBindStatusCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn URLOpenBlockingStreamA( param0: ?*IUnknown, param1: ?[*:0]const u8, param2: ?*?*IStream, param3: u32, param4: ?*IBindStatusCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn URLOpenBlockingStreamW( param0: ?*IUnknown, param1: ?[*:0]const u16, param2: ?*?*IStream, param3: u32, param4: ?*IBindStatusCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn HlinkGoBack( pUnk: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn HlinkGoForward( pUnk: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn HlinkNavigateString( pUnk: ?*IUnknown, szTarget: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn HlinkNavigateMoniker( pUnk: ?*IUnknown, pmkTarget: ?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CoInternetParseUrl( pwzUrl: ?[*:0]const u16, ParseAction: PARSEACTION, dwFlags: u32, pszResult: [*:0]u16, cchResult: u32, pcchResult: ?*u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CoInternetParseIUri( pIUri: ?*IUri, ParseAction: PARSEACTION, dwFlags: u32, pwzResult: [*:0]u16, cchResult: u32, pcchResult: ?*u32, dwReserved: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CoInternetCombineUrl( pwzBaseUrl: ?[*:0]const u16, pwzRelativeUrl: ?[*:0]const u16, dwCombineFlags: u32, pszResult: [*:0]u16, cchResult: u32, pcchResult: ?*u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CoInternetCombineUrlEx( pBaseUri: ?*IUri, pwzRelativeUrl: ?[*:0]const u16, dwCombineFlags: u32, ppCombinedUri: ?*?*IUri, dwReserved: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CoInternetCombineIUri( pBaseUri: ?*IUri, pRelativeUri: ?*IUri, dwCombineFlags: u32, ppCombinedUri: ?*?*IUri, dwReserved: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CoInternetCompareUrl( pwzUrl1: ?[*:0]const u16, pwzUrl2: ?[*:0]const u16, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CoInternetGetProtocolFlags( pwzUrl: ?[*:0]const u16, pdwFlags: ?*u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CoInternetQueryInfo( pwzUrl: ?[*:0]const u16, QueryOptions: QUERYOPTION, dwQueryFlags: u32, // TODO: what to do with BytesParamIndex 4? pvBuffer: ?*c_void, cbBuffer: u32, pcbBuffer: ?*u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CoInternetGetSession( dwSessionMode: u32, ppIInternetSession: ?*?*IInternetSession, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CoInternetGetSecurityUrl( pwszUrl: ?[*:0]const u16, ppwszSecUrl: ?*?PWSTR, psuAction: PSUACTION, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CoInternetGetSecurityUrlEx( pUri: ?*IUri, ppSecUri: ?*?*IUri, psuAction: PSUACTION, dwReserved: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CoInternetSetFeatureEnabled( FeatureEntry: INTERNETFEATURELIST, dwFlags: u32, fEnable: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CoInternetIsFeatureEnabled( FeatureEntry: INTERNETFEATURELIST, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CoInternetIsFeatureEnabledForUrl( FeatureEntry: INTERNETFEATURELIST, dwFlags: u32, szURL: ?[*:0]const u16, pSecMgr: ?*IInternetSecurityManager, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CoInternetIsFeatureEnabledForIUri( FeatureEntry: INTERNETFEATURELIST, dwFlags: u32, pIUri: ?*IUri, pSecMgr: ?*IInternetSecurityManagerEx2, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CoInternetIsFeatureZoneElevationEnabled( szFromURL: ?[*:0]const u16, szToURL: ?[*:0]const u16, pSecMgr: ?*IInternetSecurityManager, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CopyStgMedium( pcstgmedSrc: ?*const STGMEDIUM, pstgmedDest: ?*STGMEDIUM, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CopyBindInfo( pcbiSrc: ?*const BINDINFO, pbiDest: ?*BINDINFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn ReleaseBindInfo( pbindinfo: ?*BINDINFO, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "urlmon" fn IEGetUserPrivateNamespaceName( ) callconv(@import("std").os.windows.WINAPI) ?PWSTR; pub extern "urlmon" fn CoInternetCreateSecurityManager( pSP: ?*IServiceProvider, ppSM: ?*?*IInternetSecurityManager, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn CoInternetCreateZoneManager( pSP: ?*IServiceProvider, ppZM: ?*?*IInternetZoneManager, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn GetSoftwareUpdateInfo( szDistUnit: ?[*:0]const u16, psdi: ?*SOFTDISTINFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn SetSoftwareUpdateAdvertisementState( szDistUnit: ?[*:0]const u16, dwAdState: u32, dwAdvertisedVersionMS: u32, dwAdvertisedVersionLS: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "urlmon" fn IsLoggingEnabledA( pszUrl: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "urlmon" fn IsLoggingEnabledW( pwszUrl: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "urlmon" fn WriteHitLogging( lpLogginginfo: ?*HIT_LOGGING_INFO, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CreateDataAdviseHolder( ppDAHolder: ?*?*IDataAdviseHolder, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "ole32" fn OleBuildVersion( ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleInitialize( pvReserved: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleUninitialize( ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleQueryLinkFromData( pSrcDataObject: ?*IDataObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleQueryCreateFromData( pSrcDataObject: ?*IDataObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleCreate( rclsid: ?*const Guid, riid: ?*const Guid, renderopt: u32, pFormatEtc: ?*FORMATETC, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleCreateEx( rclsid: ?*const Guid, riid: ?*const Guid, dwFlags: u32, renderopt: u32, cFormats: u32, rgAdvf: ?*u32, rgFormatEtc: ?*FORMATETC, lpAdviseSink: ?*IAdviseSink, rgdwConnection: ?*u32, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleCreateFromData( pSrcDataObj: ?*IDataObject, riid: ?*const Guid, renderopt: u32, pFormatEtc: ?*FORMATETC, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleCreateFromDataEx( pSrcDataObj: ?*IDataObject, riid: ?*const Guid, dwFlags: u32, renderopt: u32, cFormats: u32, rgAdvf: ?*u32, rgFormatEtc: ?*FORMATETC, lpAdviseSink: ?*IAdviseSink, rgdwConnection: ?*u32, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleCreateLinkFromData( pSrcDataObj: ?*IDataObject, riid: ?*const Guid, renderopt: u32, pFormatEtc: ?*FORMATETC, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleCreateLinkFromDataEx( pSrcDataObj: ?*IDataObject, riid: ?*const Guid, dwFlags: u32, renderopt: u32, cFormats: u32, rgAdvf: ?*u32, rgFormatEtc: ?*FORMATETC, lpAdviseSink: ?*IAdviseSink, rgdwConnection: ?*u32, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleCreateStaticFromData( pSrcDataObj: ?*IDataObject, iid: ?*const Guid, renderopt: u32, pFormatEtc: ?*FORMATETC, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleCreateLink( pmkLinkSrc: ?*IMoniker, riid: ?*const Guid, renderopt: u32, lpFormatEtc: ?*FORMATETC, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleCreateLinkEx( pmkLinkSrc: ?*IMoniker, riid: ?*const Guid, dwFlags: u32, renderopt: u32, cFormats: u32, rgAdvf: ?*u32, rgFormatEtc: ?*FORMATETC, lpAdviseSink: ?*IAdviseSink, rgdwConnection: ?*u32, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleCreateLinkToFile( lpszFileName: ?[*:0]const u16, riid: ?*const Guid, renderopt: u32, lpFormatEtc: ?*FORMATETC, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleCreateLinkToFileEx( lpszFileName: ?[*:0]const u16, riid: ?*const Guid, dwFlags: u32, renderopt: u32, cFormats: u32, rgAdvf: ?*u32, rgFormatEtc: ?*FORMATETC, lpAdviseSink: ?*IAdviseSink, rgdwConnection: ?*u32, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleCreateFromFile( rclsid: ?*const Guid, lpszFileName: ?[*:0]const u16, riid: ?*const Guid, renderopt: u32, lpFormatEtc: ?*FORMATETC, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleCreateFromFileEx( rclsid: ?*const Guid, lpszFileName: ?[*:0]const u16, riid: ?*const Guid, dwFlags: u32, renderopt: u32, cFormats: u32, rgAdvf: ?*u32, rgFormatEtc: ?*FORMATETC, lpAdviseSink: ?*IAdviseSink, rgdwConnection: ?*u32, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleLoad( pStg: ?*IStorage, riid: ?*const Guid, pClientSite: ?*IOleClientSite, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleSave( pPS: ?*IPersistStorage, pStg: ?*IStorage, fSameAsLoad: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleLoadFromStream( pStm: ?*IStream, iidInterface: ?*const Guid, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleSaveToStream( pPStm: ?*IPersistStream, pStm: ?*IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleSetContainedObject( pUnknown: ?*IUnknown, fContained: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleNoteObjectVisible( pUnknown: ?*IUnknown, fVisible: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn RegisterDragDrop( hwnd: ?HWND, pDropTarget: ?*IDropTarget, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn RevokeDragDrop( hwnd: ?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn DoDragDrop( pDataObj: ?*IDataObject, pDropSource: ?*IDropSource, dwOKEffects: u32, pdwEffect: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleSetClipboard( pDataObj: ?*IDataObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleGetClipboard( ppDataObj: ?*?*IDataObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "ole32" fn OleGetClipboardWithEnterpriseInfo( dataObject: ?*?*IDataObject, dataEnterpriseId: ?*?PWSTR, sourceDescription: ?*?PWSTR, targetDescription: ?*?PWSTR, dataDescription: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleFlushClipboard( ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleIsCurrentClipboard( pDataObj: ?*IDataObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleCreateMenuDescriptor( hmenuCombined: ?HMENU, lpMenuWidths: ?*OleMenuGroupWidths, ) callconv(@import("std").os.windows.WINAPI) isize; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleSetMenuDescriptor( holemenu: isize, hwndFrame: ?HWND, hwndActiveObject: ?HWND, lpFrame: ?*IOleInPlaceFrame, lpActiveObj: ?*IOleInPlaceActiveObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleDestroyMenuDescriptor( holemenu: isize, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleTranslateAccelerator( lpFrame: ?*IOleInPlaceFrame, lpFrameInfo: ?*OIFI, lpmsg: ?*MSG, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleDuplicateData( hSrc: ?HANDLE, cfFormat: u16, uiFlags: u32, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleDraw( pUnknown: ?*IUnknown, dwAspect: u32, hdcDraw: ?HDC, lprcBounds: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleRun( pUnknown: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleIsRunning( pObject: ?*IOleObject, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleLockRunning( pUnknown: ?*IUnknown, fLock: BOOL, fLastUnlockCloses: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn ReleaseStgMedium( param0: ?*STGMEDIUM, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CreateOleAdviseHolder( ppOAHolder: ?*?*IOleAdviseHolder, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleCreateDefaultHandler( clsid: ?*const Guid, pUnkOuter: ?*IUnknown, riid: ?*const Guid, lplpObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleCreateEmbeddingHelper( clsid: ?*const Guid, pUnkOuter: ?*IUnknown, flags: u32, pCF: ?*IClassFactory, riid: ?*const Guid, lplpObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn IsAccelerator( hAccel: ?HACCEL, cAccelEntries: i32, lpMsg: ?*MSG, lpwCmd: ?*u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleGetIconOfFile( lpszPath: ?PWSTR, fUseFileAsLabel: BOOL, ) callconv(@import("std").os.windows.WINAPI) isize; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleGetIconOfClass( rclsid: ?*const Guid, lpszLabel: ?PWSTR, fUseTypeAsLabel: BOOL, ) callconv(@import("std").os.windows.WINAPI) isize; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleMetafilePictFromIconAndLabel( hIcon: ?HICON, lpszLabel: ?PWSTR, lpszSourceFile: ?PWSTR, iIconIndex: u32, ) callconv(@import("std").os.windows.WINAPI) isize; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleRegGetUserType( clsid: ?*const Guid, dwFormOfType: u32, pszUserType: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleRegGetMiscStatus( clsid: ?*const Guid, dwAspect: u32, pdwStatus: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleRegEnumFormatEtc( clsid: ?*const Guid, dwDirection: u32, ppenum: ?*?*IEnumFORMATETC, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleRegEnumVerbs( clsid: ?*const Guid, ppenum: ?*?*IEnumOLEVERB, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleDoAutoConvert( pStg: ?*IStorage, pClsidNew: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleGetAutoConvert( clsidOld: ?*const Guid, pClsidNew: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleSetAutoConvert( clsidOld: ?*const Guid, clsidNew: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoGetMalloc( dwMemContext: u32, ppMalloc: ?*?*IMalloc, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoUninitialize( ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoGetCurrentProcess( ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoInitializeEx( pvReserved: ?*c_void, dwCoInit: COINIT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoGetCallerTID( lpdwTID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoGetCurrentLogicalThreadId( pguid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoGetContextToken( pToken: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows6.1' pub extern "OLE32" fn CoGetApartmentType( pAptType: ?*APTTYPE, pAptQualifier: ?*APTTYPEQUALIFIER, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLE32" fn CoIncrementMTAUsage( pCookie: ?*CO_MTA_USAGE_COOKIE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLE32" fn CoDecrementMTAUsage( Cookie: CO_MTA_USAGE_COOKIE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows8.0' pub extern "OLE32" fn CoAllowUnmarshalerCLSID( clsid: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoGetObjectContext( riid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoGetClassObject( rclsid: ?*const Guid, dwClsContext: CLSCTX, pvReserved: ?*c_void, riid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoRegisterClassObject( rclsid: ?*const Guid, pUnk: ?*IUnknown, dwClsContext: CLSCTX, flags: u32, lpdwRegister: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoRevokeClassObject( dwRegister: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoResumeClassObjects( ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoSuspendClassObjects( ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoAddRefServerProcess( ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoReleaseServerProcess( ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoGetPSClsid( riid: ?*const Guid, pClsid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoRegisterPSClsid( riid: ?*const Guid, rclsid: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoRegisterSurrogate( pSurrogate: ?*ISurrogate, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoGetMarshalSizeMax( pulSize: ?*u32, riid: ?*const Guid, pUnk: ?*IUnknown, dwDestContext: u32, pvDestContext: ?*c_void, mshlflags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoMarshalInterface( pStm: ?*IStream, riid: ?*const Guid, pUnk: ?*IUnknown, dwDestContext: u32, pvDestContext: ?*c_void, mshlflags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoUnmarshalInterface( pStm: ?*IStream, riid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoMarshalHresult( pstm: ?*IStream, hresult: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoUnmarshalHresult( pstm: ?*IStream, phresult: ?*HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoReleaseMarshalData( pStm: ?*IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoDisconnectObject( pUnk: ?*IUnknown, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoLockObjectExternal( pUnk: ?*IUnknown, fLock: BOOL, fLastUnlockReleases: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoGetStandardMarshal( riid: ?*const Guid, pUnk: ?*IUnknown, dwDestContext: u32, pvDestContext: ?*c_void, mshlflags: u32, ppMarshal: ?*?*IMarshal, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoGetStdMarshalEx( pUnkOuter: ?*IUnknown, smexflags: u32, ppUnkInner: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoIsHandlerConnected( pUnk: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoMarshalInterThreadInterfaceInStream( riid: ?*const Guid, pUnk: ?*IUnknown, ppStm: ?*?*IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoGetInterfaceAndReleaseStream( pStm: ?*IStream, iid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoCreateFreeThreadedMarshaler( punkOuter: ?*IUnknown, ppunkMarshal: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoFreeUnusedLibraries( ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "OLE32" fn CoFreeUnusedLibrariesEx( dwUnloadDelay: u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "OLE32" fn CoDisconnectContext( dwTimeout: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoInitializeSecurity( pSecDesc: ?*SECURITY_DESCRIPTOR, cAuthSvc: i32, asAuthSvc: ?[*]SOLE_AUTHENTICATION_SERVICE, pReserved1: ?*c_void, dwAuthnLevel: RPC_C_AUTHN_LEVEL, dwImpLevel: RPC_C_IMP_LEVEL, pAuthList: ?*c_void, dwCapabilities: EOLE_AUTHENTICATION_CAPABILITIES, pReserved3: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoGetCallContext( riid: ?*const Guid, ppInterface: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoQueryProxyBlanket( pProxy: ?*IUnknown, pwAuthnSvc: ?*u32, pAuthzSvc: ?*u32, pServerPrincName: ?*?PWSTR, pAuthnLevel: ?*u32, pImpLevel: ?*u32, pAuthInfo: ?*?*c_void, pCapabilites: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoSetProxyBlanket( pProxy: ?*IUnknown, dwAuthnSvc: u32, dwAuthzSvc: u32, pServerPrincName: ?PWSTR, dwAuthnLevel: RPC_C_AUTHN_LEVEL, dwImpLevel: RPC_C_IMP_LEVEL, pAuthInfo: ?*c_void, dwCapabilities: EOLE_AUTHENTICATION_CAPABILITIES, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoCopyProxy( pProxy: ?*IUnknown, ppCopy: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoQueryClientBlanket( pAuthnSvc: ?*u32, pAuthzSvc: ?*u32, pServerPrincName: ?*?PWSTR, pAuthnLevel: ?*u32, pImpLevel: ?*u32, pPrivs: ?*?*c_void, pCapabilities: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoImpersonateClient( ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoRevertToSelf( ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoQueryAuthenticationServices( pcAuthSvc: ?*u32, asAuthSvc: ?*?*SOLE_AUTHENTICATION_SERVICE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoSwitchCallContext( pNewObject: ?*IUnknown, ppOldObject: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoCreateInstance( rclsid: ?*const Guid, pUnkOuter: ?*IUnknown, dwClsContext: CLSCTX, riid: *const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoCreateInstanceEx( Clsid: ?*const Guid, punkOuter: ?*IUnknown, dwClsCtx: CLSCTX, pServerInfo: ?*COSERVERINFO, dwCount: u32, pResults: [*]MULTI_QI, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows8.0' pub extern "OLE32" fn CoCreateInstanceFromApp( Clsid: ?*const Guid, punkOuter: ?*IUnknown, dwClsCtx: CLSCTX, reserved: ?*c_void, dwCount: u32, pResults: [*]MULTI_QI, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "OLE32" fn CoRegisterActivationFilter( pActivationFilter: ?*IActivationFilter, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoGetCancelObject( dwThreadId: u32, iid: ?*const Guid, ppUnk: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoSetCancelObject( pUnk: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoCancelCall( dwThreadId: u32, ulTimeout: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoTestCancel( ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoEnableCallCancellation( pReserved: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoDisableCallCancellation( pReserved: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn StringFromCLSID( rclsid: ?*const Guid, lplpsz: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CLSIDFromString( lpsz: ?[*:0]const u16, pclsid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn StringFromIID( rclsid: ?*const Guid, lplpsz: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn IIDFromString( lpsz: ?[*:0]const u16, lpiid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn ProgIDFromCLSID( clsid: ?*const Guid, lplpszProgID: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CLSIDFromProgID( lpszProgID: ?[*:0]const u16, lpclsid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn StringFromGUID2( rguid: ?*const Guid, lpsz: [*:0]u16, cchMax: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoCreateGuid( pguid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoWaitForMultipleHandles( dwFlags: u32, dwTimeout: u32, cHandles: u32, pHandles: [*]?HANDLE, lpdwindex: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLE32" fn CoWaitForMultipleObjects( dwFlags: u32, dwTimeout: u32, cHandles: u32, pHandles: [*]const ?HANDLE, lpdwindex: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoGetTreatAsClass( clsidOld: ?*const Guid, pClsidNew: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "OLE32" fn CoInvalidateRemoteMachineBindings( pszMachineName: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoTaskMemAlloc( cb: usize, ) callconv(@import("std").os.windows.WINAPI) ?*c_void; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoTaskMemRealloc( pv: ?*c_void, cb: usize, ) callconv(@import("std").os.windows.WINAPI) ?*c_void; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoTaskMemFree( pv: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoFileTimeNow( lpFileTime: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CLSIDFromProgIDEx( lpszProgID: ?[*:0]const u16, lpclsid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLE32" fn CoRegisterDeviceCatalog( deviceInstanceId: ?[*:0]const u16, cookie: ?*CO_DEVICE_CATALOG_COOKIE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLE32" fn CoRevokeDeviceCatalog( cookie: CO_DEVICE_CATALOG_COOKIE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLE32" fn HPALETTE_UserSize( param0: ?*u32, param1: u32, param2: ?*?HPALETTE, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLE32" fn HPALETTE_UserMarshal( param0: ?*u32, param1: ?*u8, param2: ?*?HPALETTE, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HPALETTE_UserUnmarshal( param0: ?*u32, param1: [*:0]u8, param2: ?*?HPALETTE, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HPALETTE_UserFree( param0: ?*u32, param1: ?*?HPALETTE, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLE32" fn HRGN_UserSize( param0: ?*u32, param1: u32, param2: ?*?HRGN, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLE32" fn HRGN_UserMarshal( param0: ?*u32, param1: ?*u8, param2: ?*?HRGN, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HRGN_UserUnmarshal( param0: ?*u32, param1: [*:0]u8, param2: ?*?HRGN, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HRGN_UserFree( param0: ?*u32, param1: ?*?HRGN, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLE32" fn HPALETTE_UserSize64( param0: ?*u32, param1: u32, param2: ?*?HPALETTE, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLE32" fn HPALETTE_UserMarshal64( param0: ?*u32, param1: ?*u8, param2: ?*?HPALETTE, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HPALETTE_UserUnmarshal64( param0: ?*u32, param1: [*:0]u8, param2: ?*?HPALETTE, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HPALETTE_UserFree64( param0: ?*u32, param1: ?*?HPALETTE, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.0' pub extern "OLEAUT32" fn OleCreatePropertyFrame( hwndOwner: ?HWND, x: u32, y: u32, lpszCaption: ?[*:0]const u16, cObjects: u32, ppUnk: ?*?*IUnknown, cPages: u32, pPageClsID: ?*Guid, lcid: u32, dwReserved: u32, pvReserved: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLEAUT32" fn OleCreatePropertyFrameIndirect( lpParams: ?*OCPFIPARAMS, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLEAUT32" fn OleTranslateColor( clr: u32, hpal: ?HPALETTE, lpcolorref: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLEAUT32" fn OleCreateFontIndirect( lpFontDesc: ?*FONTDESC, riid: ?*const Guid, lplpvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLEAUT32" fn OleCreatePictureIndirect( lpPictDesc: ?*PICTDESC, riid: ?*const Guid, fOwn: BOOL, lplpvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLEAUT32" fn OleLoadPicture( lpstream: ?*IStream, lSize: i32, fRunmode: BOOL, riid: ?*const Guid, lplpvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLEAUT32" fn OleLoadPictureEx( lpstream: ?*IStream, lSize: i32, fRunmode: BOOL, riid: ?*const Guid, xSizeDesired: u32, ySizeDesired: u32, dwFlags: u32, lplpvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLEAUT32" fn OleLoadPicturePath( szURLorPath: ?PWSTR, punkCaller: ?*IUnknown, dwReserved: u32, clrReserved: u32, riid: ?*const Guid, ppvRet: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLEAUT32" fn OleIconToCursor( hinstExe: ?HINSTANCE, hIcon: ?HICON, ) callconv(@import("std").os.windows.WINAPI) ?HCURSOR; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIAddVerbMenuW( lpOleObj: ?*IOleObject, lpszShortType: ?[*:0]const u16, hMenu: ?HMENU, uPos: u32, uIDVerbMin: u32, uIDVerbMax: u32, bAddConvert: BOOL, idConvert: u32, lphMenu: ?*?HMENU, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIAddVerbMenuA( lpOleObj: ?*IOleObject, lpszShortType: ?[*:0]const u8, hMenu: ?HMENU, uPos: u32, uIDVerbMin: u32, uIDVerbMax: u32, bAddConvert: BOOL, idConvert: u32, lphMenu: ?*?HMENU, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIInsertObjectW( param0: ?*OLEUIINSERTOBJECTW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIInsertObjectA( param0: ?*OLEUIINSERTOBJECTA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIPasteSpecialW( param0: ?*OLEUIPASTESPECIALW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIPasteSpecialA( param0: ?*OLEUIPASTESPECIALA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIEditLinksW( param0: ?*OLEUIEDITLINKSW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIEditLinksA( param0: ?*OLEUIEDITLINKSA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIChangeIconW( param0: ?*OLEUICHANGEICONW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIChangeIconA( param0: ?*OLEUICHANGEICONA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIConvertW( param0: ?*OLEUICONVERTW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIConvertA( param0: ?*OLEUICONVERTA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUICanConvertOrActivateAs( rClsid: ?*const Guid, fIsLinkedObject: BOOL, wFormat: u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIBusyW( param0: ?*OLEUIBUSYW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIBusyA( param0: ?*OLEUIBUSYA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIChangeSourceW( param0: ?*OLEUICHANGESOURCEW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIChangeSourceA( param0: ?*OLEUICHANGESOURCEA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIObjectPropertiesW( param0: ?*OLEUIOBJECTPROPSW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIObjectPropertiesA( param0: ?*OLEUIOBJECTPROPSA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIPromptUserW( nTemplate: i32, hwndParent: ?HWND, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIPromptUserA( nTemplate: i32, hwndParent: ?HWND, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIUpdateLinksW( lpOleUILinkCntr: ?*IOleUILinkContainerW, hwndParent: ?HWND, lpszTitle: ?PWSTR, cLinks: i32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIUpdateLinksA( lpOleUILinkCntr: ?*IOleUILinkContainerA, hwndParent: ?HWND, lpszTitle: ?PSTR, cLinks: i32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn CoGetInterceptor( iidIntercepted: ?*const Guid, punkOuter: ?*IUnknown, iid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "ole32" fn CoGetInterceptorFromTypeInfo( iidIntercepted: ?*const Guid, punkOuter: ?*IUnknown, typeInfo: ?*ITypeInfo, iid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "ole32" fn CoSetMessageDispatcher( pMessageDispatcher: ?*IMessageDispatcher, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "ole32" fn CoHandlePriorityEventsFromMessagePump( ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoInitialize( pvReserved: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoRegisterMallocSpy( pMallocSpy: ?*IMallocSpy, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoRevokeMallocSpy( ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "OLE32" fn CoRegisterInitializeSpy( pSpy: ?*IInitializeSpy, puliCookie: ?*ULARGE_INTEGER, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoRevokeInitializeSpy( uliCookie: ULARGE_INTEGER, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoGetSystemSecurityPermissions( comSDType: COMSD, ppSD: ?*?*SECURITY_DESCRIPTOR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoLoadLibrary( lpszLibName: ?PWSTR, bAutoFree: BOOL, ) callconv(@import("std").os.windows.WINAPI) ?HINSTANCE; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoFreeLibrary( hInst: ?HINSTANCE, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoFreeAllLibraries( ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoGetInstanceFromFile( pServerInfo: ?*COSERVERINFO, pClsid: ?*Guid, punkOuter: ?*IUnknown, dwClsCtx: CLSCTX, grfMode: u32, pwszName: ?PWSTR, dwCount: u32, pResults: [*]MULTI_QI, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoGetInstanceFromIStorage( pServerInfo: ?*COSERVERINFO, pClsid: ?*Guid, punkOuter: ?*IUnknown, dwClsCtx: CLSCTX, pstg: ?*IStorage, dwCount: u32, pResults: [*]MULTI_QI, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoAllowSetForegroundWindow( pUnk: ?*IUnknown, lpvReserved: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn CoIsOle1Class( rclsid: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoFileTimeToDosDateTime( lpFileTime: ?*FILETIME, lpDosDate: ?*u16, lpDosTime: ?*u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoDosDateTimeToFileTime( nDosDate: u16, nDosTime: u16, lpFileTime: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoRegisterMessageFilter( lpMessageFilter: ?*IMessageFilter, lplpMessageFilter: ?*?*IMessageFilter, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "ole32" fn CoRegisterChannelHook( ExtensionUuid: ?*const Guid, pChannelHook: ?*IChannelHook, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoTreatAsClass( clsidOld: ?*const Guid, clsidNew: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CreateDataCache( pUnkOuter: ?*IUnknown, rclsid: ?*const Guid, iid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "ole32" fn CoInstall( pbc: ?*IBindCtx, dwFlags: u32, pClassSpec: ?*uCLSSPEC, pQuery: ?*QUERYCONTEXT, pszCodeBase: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn BindMoniker( pmk: ?*IMoniker, grfOpt: u32, iidResult: ?*const Guid, ppvResult: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoGetObject( pszName: ?[*:0]const u16, pBindOptions: ?*BIND_OPTS, riid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn MkParseDisplayName( pbc: ?*IBindCtx, szUserName: ?[*:0]const u16, pchEaten: ?*u32, ppmk: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn MonikerRelativePathTo( pmkSrc: ?*IMoniker, pmkDest: ?*IMoniker, ppmkRelPath: ?*?*IMoniker, dwReserved: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn MonikerCommonPrefixWith( pmkThis: ?*IMoniker, pmkOther: ?*IMoniker, ppmkCommon: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CreateBindCtx( reserved: u32, ppbc: ?*?*IBindCtx, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CreateGenericComposite( pmkFirst: ?*IMoniker, pmkRest: ?*IMoniker, ppmkComposite: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn GetClassFile( szFilename: ?[*:0]const u16, pclsid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CreateClassMoniker( rclsid: ?*const Guid, ppmk: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CreateFileMoniker( lpszPathName: ?[*:0]const u16, ppmk: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CreateItemMoniker( lpszDelim: ?[*:0]const u16, lpszItem: ?[*:0]const u16, ppmk: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CreateAntiMoniker( ppmk: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CreatePointerMoniker( punk: ?*IUnknown, ppmk: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CreateObjrefMoniker( punk: ?*IUnknown, ppmk: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn GetRunningObjectTable( reserved: u32, pprot: ?*?*IRunningObjectTable, ) callconv(@import("std").os.windows.WINAPI) HRESULT; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (32) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { pub const OLEUIINSERTOBJECT = thismodule.OLEUIINSERTOBJECTA; pub const OLEUIPASTEENTRY = thismodule.OLEUIPASTEENTRYA; pub const OLEUIPASTESPECIAL = thismodule.OLEUIPASTESPECIALA; pub const IOleUILinkContainer = thismodule.IOleUILinkContainerA; pub const OLEUIEDITLINKS = thismodule.OLEUIEDITLINKSA; pub const OLEUICHANGEICON = thismodule.OLEUICHANGEICONA; pub const OLEUICONVERT = thismodule.OLEUICONVERTA; pub const OLEUIBUSY = thismodule.OLEUIBUSYA; pub const OLEUICHANGESOURCE = thismodule.OLEUICHANGESOURCEA; pub const IOleUIObjInfo = thismodule.IOleUIObjInfoA; pub const IOleUILinkInfo = thismodule.IOleUILinkInfoA; pub const OLEUIGNRLPROPS = thismodule.OLEUIGNRLPROPSA; pub const OLEUIVIEWPROPS = thismodule.OLEUIVIEWPROPSA; pub const OLEUILINKPROPS = thismodule.OLEUILINKPROPSA; pub const OLEUIOBJECTPROPS = thismodule.OLEUIOBJECTPROPSA; pub const URLOpenStream = thismodule.URLOpenStreamA; pub const URLOpenPullStream = thismodule.URLOpenPullStreamA; pub const URLDownloadToFile = thismodule.URLDownloadToFileA; pub const URLDownloadToCacheFile = thismodule.URLDownloadToCacheFileA; pub const URLOpenBlockingStream = thismodule.URLOpenBlockingStreamA; pub const IsLoggingEnabled = thismodule.IsLoggingEnabledA; pub const OleUIAddVerbMenu = thismodule.OleUIAddVerbMenuA; pub const OleUIInsertObject = thismodule.OleUIInsertObjectA; pub const OleUIPasteSpecial = thismodule.OleUIPasteSpecialA; pub const OleUIEditLinks = thismodule.OleUIEditLinksA; pub const OleUIChangeIcon = thismodule.OleUIChangeIconA; pub const OleUIConvert = thismodule.OleUIConvertA; pub const OleUIBusy = thismodule.OleUIBusyA; pub const OleUIChangeSource = thismodule.OleUIChangeSourceA; pub const OleUIObjectProperties = thismodule.OleUIObjectPropertiesA; pub const OleUIPromptUser = thismodule.OleUIPromptUserA; pub const OleUIUpdateLinks = thismodule.OleUIUpdateLinksA; }, .wide => struct { pub const OLEUIINSERTOBJECT = thismodule.OLEUIINSERTOBJECTW; pub const OLEUIPASTEENTRY = thismodule.OLEUIPASTEENTRYW; pub const OLEUIPASTESPECIAL = thismodule.OLEUIPASTESPECIALW; pub const IOleUILinkContainer = thismodule.IOleUILinkContainerW; pub const OLEUIEDITLINKS = thismodule.OLEUIEDITLINKSW; pub const OLEUICHANGEICON = thismodule.OLEUICHANGEICONW; pub const OLEUICONVERT = thismodule.OLEUICONVERTW; pub const OLEUIBUSY = thismodule.OLEUIBUSYW; pub const OLEUICHANGESOURCE = thismodule.OLEUICHANGESOURCEW; pub const IOleUIObjInfo = thismodule.IOleUIObjInfoW; pub const IOleUILinkInfo = thismodule.IOleUILinkInfoW; pub const OLEUIGNRLPROPS = thismodule.OLEUIGNRLPROPSW; pub const OLEUIVIEWPROPS = thismodule.OLEUIVIEWPROPSW; pub const OLEUILINKPROPS = thismodule.OLEUILINKPROPSW; pub const OLEUIOBJECTPROPS = thismodule.OLEUIOBJECTPROPSW; pub const URLOpenStream = thismodule.URLOpenStreamW; pub const URLOpenPullStream = thismodule.URLOpenPullStreamW; pub const URLDownloadToFile = thismodule.URLDownloadToFileW; pub const URLDownloadToCacheFile = thismodule.URLDownloadToCacheFileW; pub const URLOpenBlockingStream = thismodule.URLOpenBlockingStreamW; pub const IsLoggingEnabled = thismodule.IsLoggingEnabledW; pub const OleUIAddVerbMenu = thismodule.OleUIAddVerbMenuW; pub const OleUIInsertObject = thismodule.OleUIInsertObjectW; pub const OleUIPasteSpecial = thismodule.OleUIPasteSpecialW; pub const OleUIEditLinks = thismodule.OleUIEditLinksW; pub const OleUIChangeIcon = thismodule.OleUIChangeIconW; pub const OleUIConvert = thismodule.OleUIConvertW; pub const OleUIBusy = thismodule.OleUIBusyW; pub const OleUIChangeSource = thismodule.OleUIChangeSourceW; pub const OleUIObjectProperties = thismodule.OleUIObjectPropertiesW; pub const OleUIPromptUser = thismodule.OleUIPromptUserW; pub const OleUIUpdateLinks = thismodule.OleUIUpdateLinksW; }, .unspecified => if (@import("builtin").is_test) struct { pub const OLEUIINSERTOBJECT = *opaque{}; pub const OLEUIPASTEENTRY = *opaque{}; pub const OLEUIPASTESPECIAL = *opaque{}; pub const IOleUILinkContainer = *opaque{}; pub const OLEUIEDITLINKS = *opaque{}; pub const OLEUICHANGEICON = *opaque{}; pub const OLEUICONVERT = *opaque{}; pub const OLEUIBUSY = *opaque{}; pub const OLEUICHANGESOURCE = *opaque{}; pub const IOleUIObjInfo = *opaque{}; pub const IOleUILinkInfo = *opaque{}; pub const OLEUIGNRLPROPS = *opaque{}; pub const OLEUIVIEWPROPS = *opaque{}; pub const OLEUILINKPROPS = *opaque{}; pub const OLEUIOBJECTPROPS = *opaque{}; pub const URLOpenStream = *opaque{}; pub const URLOpenPullStream = *opaque{}; pub const URLDownloadToFile = *opaque{}; pub const URLDownloadToCacheFile = *opaque{}; pub const URLOpenBlockingStream = *opaque{}; pub const IsLoggingEnabled = *opaque{}; pub const OleUIAddVerbMenu = *opaque{}; pub const OleUIInsertObject = *opaque{}; pub const OleUIPasteSpecial = *opaque{}; pub const OleUIEditLinks = *opaque{}; pub const OleUIChangeIcon = *opaque{}; pub const OleUIConvert = *opaque{}; pub const OleUIBusy = *opaque{}; pub const OleUIChangeSource = *opaque{}; pub const OleUIObjectProperties = *opaque{}; pub const OleUIPromptUser = *opaque{}; pub const OleUIUpdateLinks = *opaque{}; } else struct { pub const OLEUIINSERTOBJECT = @compileError("'OLEUIINSERTOBJECT' requires that UNICODE be set to true or false in the root module"); pub const OLEUIPASTEENTRY = @compileError("'OLEUIPASTEENTRY' requires that UNICODE be set to true or false in the root module"); pub const OLEUIPASTESPECIAL = @compileError("'OLEUIPASTESPECIAL' requires that UNICODE be set to true or false in the root module"); pub const IOleUILinkContainer = @compileError("'IOleUILinkContainer' requires that UNICODE be set to true or false in the root module"); pub const OLEUIEDITLINKS = @compileError("'OLEUIEDITLINKS' requires that UNICODE be set to true or false in the root module"); pub const OLEUICHANGEICON = @compileError("'OLEUICHANGEICON' requires that UNICODE be set to true or false in the root module"); pub const OLEUICONVERT = @compileError("'OLEUICONVERT' requires that UNICODE be set to true or false in the root module"); pub const OLEUIBUSY = @compileError("'OLEUIBUSY' requires that UNICODE be set to true or false in the root module"); pub const OLEUICHANGESOURCE = @compileError("'OLEUICHANGESOURCE' requires that UNICODE be set to true or false in the root module"); pub const IOleUIObjInfo = @compileError("'IOleUIObjInfo' requires that UNICODE be set to true or false in the root module"); pub const IOleUILinkInfo = @compileError("'IOleUILinkInfo' requires that UNICODE be set to true or false in the root module"); pub const OLEUIGNRLPROPS = @compileError("'OLEUIGNRLPROPS' requires that UNICODE be set to true or false in the root module"); pub const OLEUIVIEWPROPS = @compileError("'OLEUIVIEWPROPS' requires that UNICODE be set to true or false in the root module"); pub const OLEUILINKPROPS = @compileError("'OLEUILINKPROPS' requires that UNICODE be set to true or false in the root module"); pub const OLEUIOBJECTPROPS = @compileError("'OLEUIOBJECTPROPS' requires that UNICODE be set to true or false in the root module"); pub const URLOpenStream = @compileError("'URLOpenStream' requires that UNICODE be set to true or false in the root module"); pub const URLOpenPullStream = @compileError("'URLOpenPullStream' requires that UNICODE be set to true or false in the root module"); pub const URLDownloadToFile = @compileError("'URLDownloadToFile' requires that UNICODE be set to true or false in the root module"); pub const URLDownloadToCacheFile = @compileError("'URLDownloadToCacheFile' requires that UNICODE be set to true or false in the root module"); pub const URLOpenBlockingStream = @compileError("'URLOpenBlockingStream' requires that UNICODE be set to true or false in the root module"); pub const IsLoggingEnabled = @compileError("'IsLoggingEnabled' requires that UNICODE be set to true or false in the root module"); pub const OleUIAddVerbMenu = @compileError("'OleUIAddVerbMenu' requires that UNICODE be set to true or false in the root module"); pub const OleUIInsertObject = @compileError("'OleUIInsertObject' requires that UNICODE be set to true or false in the root module"); pub const OleUIPasteSpecial = @compileError("'OleUIPasteSpecial' requires that UNICODE be set to true or false in the root module"); pub const OleUIEditLinks = @compileError("'OleUIEditLinks' requires that UNICODE be set to true or false in the root module"); pub const OleUIChangeIcon = @compileError("'OleUIChangeIcon' requires that UNICODE be set to true or false in the root module"); pub const OleUIConvert = @compileError("'OleUIConvert' requires that UNICODE be set to true or false in the root module"); pub const OleUIBusy = @compileError("'OleUIBusy' requires that UNICODE be set to true or false in the root module"); pub const OleUIChangeSource = @compileError("'OleUIChangeSource' requires that UNICODE be set to true or false in the root module"); pub const OleUIObjectProperties = @compileError("'OleUIObjectProperties' requires that UNICODE be set to true or false in the root module"); pub const OleUIPromptUser = @compileError("'OleUIPromptUser' requires that UNICODE be set to true or false in the root module"); pub const OleUIUpdateLinks = @compileError("'OleUIUpdateLinks' requires that UNICODE be set to true or false in the root module"); }, }; //-------------------------------------------------------------------------------- // Section: Imports (67) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BOOL = @import("../foundation.zig").BOOL; const BOOLEAN = @import("../foundation.zig").BOOLEAN; const BSTR = @import("../foundation.zig").BSTR; const CHAR = @import("../system/system_services.zig").CHAR; const CY = @import("../system/system_services.zig").CY; const FILETIME = @import("../foundation.zig").FILETIME; const HACCEL = @import("../ui/windows_and_messaging.zig").HACCEL; const HANDLE = @import("../foundation.zig").HANDLE; const HANDLE_PTR = @import("../system/system_services.zig").HANDLE_PTR; const HBITMAP = @import("../graphics/gdi.zig").HBITMAP; const HCURSOR = @import("../ui/windows_and_messaging.zig").HCURSOR; const HDC = @import("../graphics/gdi.zig").HDC; const HENHMETAFILE = @import("../graphics/gdi.zig").HENHMETAFILE; const HFONT = @import("../graphics/gdi.zig").HFONT; const HICON = @import("../ui/windows_and_messaging.zig").HICON; const HINSTANCE = @import("../foundation.zig").HINSTANCE; const HMENU = @import("../ui/windows_and_messaging.zig").HMENU; const HMETAFILE = @import("../graphics/gdi.zig").HMETAFILE; const HMONITOR = @import("../graphics/gdi.zig").HMONITOR; const HPALETTE = @import("../graphics/gdi.zig").HPALETTE; const HRESULT = @import("../foundation.zig").HRESULT; const HRGN = @import("../graphics/gdi.zig").HRGN; const HRSRC = @import("../system/library_loader.zig").HRSRC; const HTASK = @import("../media/audio/core_audio.zig").HTASK; const HWND = @import("../foundation.zig").HWND; const IDispatch = @import("../system/ole_automation.zig").IDispatch; const IErrorLog = @import("../system/ole_automation.zig").IErrorLog; const IEventObjectCollection = @import("../system/component_services.zig").IEventObjectCollection; const IInspectable = @import("../system/win_rt.zig").IInspectable; const IPropertyBag = @import("../system/ole_automation.zig").IPropertyBag; const IServiceProvider = @import("../system/system_services.zig").IServiceProvider; const IStorage = @import("../storage/structured_storage.zig").IStorage; const IStream = @import("../storage/structured_storage.zig").IStream; const ITypeInfo = @import("../system/ole_automation.zig").ITypeInfo; const IXMLElement = @import("../data/xml/ms_xml.zig").IXMLElement; const LARGE_INTEGER = @import("../system/system_services.zig").LARGE_INTEGER; const LOGPALETTE = @import("../graphics/gdi.zig").LOGPALETTE; const LPARAM = @import("../foundation.zig").LPARAM; const LRESULT = @import("../foundation.zig").LRESULT; const MSG = @import("../ui/windows_and_messaging.zig").MSG; const OPENFILENAMEA = @import("../ui/windows_and_messaging.zig").OPENFILENAMEA; const OPENFILENAMEW = @import("../ui/windows_and_messaging.zig").OPENFILENAMEW; const POINT = @import("../foundation.zig").POINT; const POINTL = @import("../foundation.zig").POINTL; const PROPSHEETHEADERA_V2 = @import("../ui/controls.zig").PROPSHEETHEADERA_V2; const PROPSHEETHEADERW_V2 = @import("../ui/controls.zig").PROPSHEETHEADERW_V2; const PSTR = @import("../foundation.zig").PSTR; const PWSTR = @import("../foundation.zig").PWSTR; const RECT = @import("../foundation.zig").RECT; const RECTL = @import("../foundation.zig").RECTL; const SECURITY_ATTRIBUTES = @import("../security.zig").SECURITY_ATTRIBUTES; const SECURITY_DESCRIPTOR = @import("../security.zig").SECURITY_DESCRIPTOR; const SIZE = @import("../foundation.zig").SIZE; const SOFTDISTINFO = @import("../ui/shell.zig").SOFTDISTINFO; const SYSTEMTIME = @import("../foundation.zig").SYSTEMTIME; const TEXTMETRICW = @import("../graphics/gdi.zig").TEXTMETRICW; const uCLSSPEC = @import("../system/system_services.zig").uCLSSPEC; const ULARGE_INTEGER = @import("../system/system_services.zig").ULARGE_INTEGER; const UNDOCK_REASON = @import("../ui/shell.zig").UNDOCK_REASON; const userHBITMAP = @import("../system/system_services.zig").userHBITMAP; const userHENHMETAFILE = @import("../system/system_services.zig").userHENHMETAFILE; const userHGLOBAL = @import("../system/system_services.zig").userHGLOBAL; const userHMETAFILEPICT = @import("../system/system_services.zig").userHMETAFILEPICT; const userHPALETTE = @import("../system/system_services.zig").userHPALETTE; const VARIANT = @import("../system/ole_automation.zig").VARIANT; const WPARAM = @import("../foundation.zig").WPARAM; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "LPFNGETCLASSOBJECT")) { _ = LPFNGETCLASSOBJECT; } if (@hasDecl(@This(), "LPFNCANUNLOADNOW")) { _ = LPFNCANUNLOADNOW; } if (@hasDecl(@This(), "LPFNOLEUIHOOK")) { _ = LPFNOLEUIHOOK; } if (@hasDecl(@This(), "PFNCONTEXTCALL")) { _ = PFNCONTEXTCALL; } @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
deps/zigwin32/win32/system/com.zig
const std = @import("std"); const fmt = std.fmt; const fs = std.fs; const log = std.log; const mem = std.mem; const Allocator = mem.Allocator; const Release = @import("release.zig").Release; pub fn add(allocator: Allocator, rel: Release) !void { if (mem.eql(u8, rel.distribution, "none")) return error.DistributionError else try erlsrv(allocator, "add", rel); } pub fn remove(allocator: Allocator, rel: Release) !void { try erlsrv(allocator, "remove", rel); } pub fn start(allocator: Allocator, rel: Release) !void { try erlsrv(allocator, "start", rel); } pub fn stop(allocator: Allocator, rel: Release) !void { try erlsrv(allocator, "stop", rel); } pub fn list(allocator: Allocator, rel: Release) !void { try erlsrv(allocator, "list", rel); } pub fn help(allocator: Allocator, rel: Release) !void { try erlsrv(allocator, "help", rel); } fn erlsrv(allocator: Allocator, command: []const u8, rel: Release) !void { const erlsrv_path = try erlsrvPath(allocator, rel); const argv = blk: { if (mem.eql(u8, command, "add")) { break :blk ([_][]const u8{ erlsrv_path, "add", try fmt.allocPrint(allocator, "{s}_{s}", .{ rel.name, rel.name }), try fmt.allocPrint(allocator, "-{s}", .{rel.distribution}), rel.node, "-env", try fmt.allocPrint(allocator, "RELEASE_ROOT={s}", .{rel.root}), "-env", try fmt.allocPrint(allocator, "RELEASE_NAME={s}", .{rel.name}), "-env", try fmt.allocPrint(allocator, "RELEASE_VSN={s}", .{rel.vsn}), "-env", try fmt.allocPrint(allocator, "RELEASE_MODE={s}", .{rel.mode}), "-env", try fmt.allocPrint(allocator, "RELEASE_COOKIE={s}", .{rel.cookie}), "-env", try fmt.allocPrint(allocator, "RELEASE_NODE={s}", .{rel.node}), "-env", try fmt.allocPrint(allocator, "RELEASE_VM_ARGS={s}", .{rel.vm_args}), "-env", try fmt.allocPrint(allocator, "RELEASE_TMP={s}", .{rel.tmp}), "-env", try fmt.allocPrint(allocator, "RELEASE_SYS_CONFIG={s}", .{rel.sys_config}), "-args", try fmt.allocPrint( allocator, "-setcookie {s} -config {s} -mode {s} -boot {s}\\start -boot_var RELEASE_LIB {s}\\lib -args_file {s}\\vm.args", .{ rel.cookie, rel.sys_config, rel.mode, rel.vsn_dir, rel.root, rel.vsn_dir, }, ), })[0..]; } else if (mem.eql(u8, command, "list") or mem.eql(u8, command, "help")) { break :blk ([_][]const u8{ erlsrv_path, command })[0..]; } else { break :blk ([_][]const u8{ erlsrv_path, command, try fmt.allocPrint(allocator, "{s}_{s}", .{ rel.name, rel.name }), })[0..]; } }; const child_proc = try std.ChildProcess.init(argv, allocator); child_proc.stdin_behavior = .Inherit; child_proc.stdout_behavior = .Inherit; _ = try child_proc.spawnAndWait(); } fn erlsrvPath(allocator: Allocator, rel: Release) ![]const u8 { const erts_dir = try fmt.allocPrint(allocator, "erts-{s}", .{rel.erts_vsn}); const erts_path = try fs.path.resolve(allocator, &[_][]const u8{ rel.root, erts_dir }); if (pathExists(erts_path)) return try fs.path.join(allocator, &[_][]const u8{ erts_path, "bin", "erlsrv.exe" }); return "erlsrv.exe"; } fn pathExists(path: []const u8) bool { std.fs.cwd().access(path, .{}) catch return false; return true; }
src/service.zig
const std = @import("std"); const builtin = @import("builtin"); const app = @import("app"); const assert = std.debug.assert; const fd_t = std.os.fd_t; const pid_t = std.os.pid_t; // Here we reproduce the data from the zig standard library so that this file can be // compiled by older zig versions. pub const Measurement = struct { median: u64, mean: u64, min: u64, max: u64, fn compute(all_samples: []Sample, comptime field: []const u8) Measurement { const S = struct { fn order(context: void, a: Sample, b: Sample) bool { _ = context; return a.wall_time < b.wall_time; } }; // Remove the 2 outliers, always according to wall_time. std.sort.sort(Sample, all_samples, {}, S.order); const samples = all_samples[1 .. all_samples.len - 1]; // Compute stats var total: u64 = 0; var min: u64 = std.math.maxInt(u64); var max: u64 = 0; for (samples) |s| { const v = @field(s, field); total += v; if (v < min) min = v; if (v > max) max = v; } return .{ .median = @field(samples[samples.len / 2], field), .mean = total / samples.len, .min = min, .max = max, }; } }; pub const Results = union(enum) { fail: anyerror, ok: struct { samples_taken: usize, wall_time: Measurement, utime: Measurement, stime: Measurement, cpu_cycles: Measurement, instructions: Measurement, cache_references: Measurement, cache_misses: Measurement, branch_misses: Measurement, maxrss: usize, }, }; const Sample = struct { wall_time: u64, utime: u64, stime: u64, cpu_cycles: u64, instructions: u64, cache_references: u64, cache_misses: u64, branch_misses: u64, }; fn timeval_to_ns(tv: timeval) u64 { const ns_per_us = std.time.ns_per_s / std.time.us_per_s; return @bitCast(usize, tv.tv_sec) * std.time.ns_per_s + @bitCast(usize, tv.tv_usec) * ns_per_us; } fn readPerfFd(fd: fd_t) usize { var result: usize = 0; const n = std.os.read(fd, std.mem.asBytes(&result)) catch |err| { std.debug.panic("unable to read perf fd: {s}\n", .{@errorName(err)}); }; assert(n == @sizeOf(usize)); return result; } var samples_buf: [1000000]Sample = undefined; const max_nano_seconds = std.time.ns_per_s * 5; const PerfMeasurement = struct { name: []const u8, config: PERF.COUNT.HW, }; const perf_measurements = [_]PerfMeasurement{ .{ .name = "cpu_cycles", .config = PERF.COUNT.HW.CPU_CYCLES }, .{ .name = "instructions", .config = PERF.COUNT.HW.INSTRUCTIONS }, .{ .name = "cache_references", .config = PERF.COUNT.HW.CACHE_REFERENCES }, .{ .name = "cache_misses", .config = PERF.COUNT.HW.CACHE_MISSES }, .{ .name = "branch_misses", .config = PERF.COUNT.HW.BRANCH_MISSES }, }; var perf_fds = [1]fd_t{-1} ** perf_measurements.len; pub fn bench(options: Options, comptime func: anytype, args: anytype) Results { const rusage_who: i32 = if (options.use_child_process) rusage.CHILDREN else rusage.SELF; const flags: u64 = if (options.use_child_process) (1 << 0) | // disabled (1 << 5) | // exclude_kernel (1 << 6) | // exclude_hv (1 << 1) | // inherit (1 << 12) | // enable_on_exec 0 else (1 << 0) | // disabled (1 << 5) | // exclude_kernel (1 << 6) | // exclude_hv 0; var sample_index: usize = 0; const timer = std.time.Timer.start() catch @panic("need timer to work"); const first_start = timer.read(); while ((sample_index < 3 or (timer.read() - first_start) < max_nano_seconds) and sample_index < samples_buf.len) { // Set up perf measurements. for (perf_measurements) |measurement, i| { var attr: perf_event_attr = .{ .type = PERF.TYPE.HARDWARE, .config = @enumToInt(measurement.config), .flags = flags, }; perf_fds[i] = perf_event_open(&attr, 0, -1, perf_fds[0], PERF.FLAG.FD_CLOEXEC) catch |err| { std.debug.panic("unable to open perf event: {s}\n", .{@errorName(err)}); }; } if (options.clear_zig_cache) { std.fs.cwd().deleteTree("zig-cache") catch |err| { std.debug.panic("unable to delete zig-cache: {s}", .{@errorName(err)}); }; } if (options.use_child_process) { _ = std.os.linux.ioctl(perf_fds[0], PERF.EVENT_IOC.DISABLE, PERF.IOC_FLAG_GROUP); } _ = std.os.linux.ioctl(perf_fds[0], PERF.EVENT_IOC.RESET, PERF.IOC_FLAG_GROUP); const start_rusage = std.os.getrusage(rusage_who); const start = timer.read(); if (!options.use_child_process) { _ = std.os.linux.ioctl(perf_fds[0], PERF.EVENT_IOC.ENABLE, PERF.IOC_FLAG_GROUP); } const result = @call(.{}, func, args); _ = std.os.linux.ioctl(perf_fds[0], PERF.EVENT_IOC.DISABLE, PERF.IOC_FLAG_GROUP); const end = timer.read(); const end_rusage = std.os.getrusage(rusage_who); result catch |err| { return .{ .fail = err }; }; samples_buf[sample_index] = .{ .wall_time = end - start, .utime = timeval_to_ns(end_rusage.utime) - timeval_to_ns(start_rusage.utime), .stime = timeval_to_ns(end_rusage.stime) - timeval_to_ns(start_rusage.stime), .cpu_cycles = readPerfFd(perf_fds[0]), .instructions = readPerfFd(perf_fds[1]), .cache_references = readPerfFd(perf_fds[2]), .cache_misses = readPerfFd(perf_fds[3]), .branch_misses = readPerfFd(perf_fds[4]), }; for (perf_measurements) |_, i| { std.os.close(perf_fds[i]); perf_fds[i] = -1; } sample_index += 1; } const all_samples = samples_buf[0..sample_index]; const wall_time = Measurement.compute(all_samples, "wall_time"); const utime = Measurement.compute(all_samples, "utime"); const stime = Measurement.compute(all_samples, "stime"); const cpu_cycles = Measurement.compute(all_samples, "cpu_cycles"); const instructions = Measurement.compute(all_samples, "instructions"); const cache_references = Measurement.compute(all_samples, "cache_references"); const cache_misses = Measurement.compute(all_samples, "cache_misses"); const branch_misses = Measurement.compute(all_samples, "branch_misses"); const final_rusage = std.os.getrusage(rusage_who); return .{ .ok = .{ .samples_taken = all_samples.len, .wall_time = wall_time, .utime = utime, .stime = stime, .cpu_cycles = cpu_cycles, .instructions = instructions, .cache_references = cache_references, .cache_misses = cache_misses, .branch_misses = branch_misses, .maxrss = @bitCast(usize, final_rusage.maxrss), }, }; } pub const Options = struct { zig_exe: []const u8, clear_zig_cache: bool = false, use_child_process: bool = false, pub fn useChildProcess(options: *Options) void { options.use_child_process = true; } }; var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{}; pub fn main() !void { const gpa = if (builtin.link_libc) std.heap.c_allocator else general_purpose_allocator.allocator(); var options: Options = .{ .zig_exe = std.mem.sliceTo(std.os.argv[1], 0), }; const context = try app.setup(gpa, &options); const results = bench(options, app.run, .{ gpa, context }); try std.json.stringify(results, std.json.StringifyOptions{}, std.io.getStdOut().writer()); } pub fn exec( gpa: std.mem.Allocator, argv: []const []const u8, options: struct { cwd: ?[]const u8 = null, stdin_behavior: std.ChildProcess.StdIo = .Inherit, stdout_behavior: std.ChildProcess.StdIo = .Inherit, stderr_behavior: std.ChildProcess.StdIo = .Inherit, }, ) !void { const child = try std.ChildProcess.init(argv, gpa); defer child.deinit(); child.stdin_behavior = options.stdin_behavior; child.stdout_behavior = options.stdout_behavior; child.stderr_behavior = options.stderr_behavior; child.cwd = options.cwd; const term = try child.spawnAndWait(); switch (term) { .Exited => |code| { if (code != 0) { return error.ChildProcessBadExitCode; } }, else => { return error.ChildProcessCrashed; }, } } comptime { assert(@sizeOf(perf_event_attr) == 112); } pub const perf_event_attr = extern struct { /// Major type: hardware/software/tracepoint/etc. type: PERF.TYPE = undefined, /// Size of the attr structure, for fwd/bwd compat. size: u32 = @sizeOf(perf_event_attr), /// Type specific configuration information. config: u64 = 0, sample_period_or_freq: u64 = 0, sample_type: u64 = 0, read_format: u64 = 0, flags: u64 = 0, //flags: packed struct { // /// off by default // disabled: bool = false, // /// children inherit it // inherit: bool = false, // /// must always be on PMU // pinned: bool = false, // /// only group on PMU // exclusive: bool = false, // /// don't count user // exclude_user: bool = false, // /// ditto kernel // exclude_kernel: bool = false, // /// ditto hypervisor // exclude_hv: bool = false, // /// don't count when idle // exclude_idle: bool = false, // /// include mmap data // mmap: bool = false, // /// include comm data // comm: bool = false, // /// use freq, not period // freq: bool = false, // /// per task counts // inherit_stat: bool = false, // /// next exec enables // enable_on_exec: bool = false, // /// trace fork/exit // task: bool = false, // /// wakeup_watermark // watermark: bool = false, // /// precise_ip: // /// // /// 0 - SAMPLE_IP can have arbitrary skid // /// 1 - SAMPLE_IP must have constant skid // /// 2 - SAMPLE_IP requested to have 0 skid // /// 3 - SAMPLE_IP must have 0 skid // /// // /// See also PERF_RECORD_MISC_EXACT_IP // /// skid constraint // precise_ip: u2 = 0, // /// non-exec mmap data // mmap_data: bool = false, // /// sample_type all events // sample_id_all: bool = false, // /// don't count in host // exclude_host: bool = false, // /// don't count in guest // exclude_guest: bool = false, // /// exclude kernel callchains // exclude_callchain_kernel: bool = false, // /// exclude user callchains // exclude_callchain_user: bool = false, // /// include mmap with inode data // mmap2: bool = false, // /// flag comm events that are due to an exec // comm_exec: bool = false, // /// use @clockid for time fields // use_clockid: bool = false, // /// context switch data // context_switch: bool = false, // /// Write ring buffer from end to beginning // write_backward: bool = false, // /// include namespaces data // namespaces: bool = false, // __reserved_1: u35 = 0, //} = .{}, /// wakeup every n events, or /// bytes before wakeup wakeup_events_or_watermark: u32 = 0, bp_type: u32 = 0, /// This field is also used for: /// bp_addr /// kprobe_func for perf_kprobe /// uprobe_path for perf_uprobe config1: u64 = 0, /// This field is also used for: /// bp_len /// kprobe_addr when kprobe_func == null /// probe_offset for perf_[k,u]probe config2: u64 = 0, /// enum perf_branch_sample_type branch_sample_type: u64 = 0, /// Defines set of user regs to dump on samples. /// See asm/perf_regs.h for details. sample_regs_user: u64 = 0, /// Defines size of the user stack to dump on samples. sample_stack_user: u32 = 0, clockid: i32 = 0, /// Defines set of regs to dump for each sample /// state captured on: /// - precise = 0: PMU interrupt /// - precise > 0: sampled instruction /// /// See asm/perf_regs.h for details. sample_regs_intr: u64 = 0, /// Wakeup watermark for AUX area aux_watermark: u32 = 0, sample_max_stack: u16 = 0, /// Align to u64 __reserved_2: u16 = 0, }; pub const PERF = struct { pub const TYPE = enum(u32) { HARDWARE, SOFTWARE, TRACEPOINT, HW_CACHE, RAW, BREAKPOINT, MAX, }; pub const COUNT = struct { pub const HW = enum(u32) { CPU_CYCLES, INSTRUCTIONS, CACHE_REFERENCES, CACHE_MISSES, BRANCH_INSTRUCTIONS, BRANCH_MISSES, BUS_CYCLES, STALLED_CYCLES_FRONTEND, STALLED_CYCLES_BACKEND, REF_CPU_CYCLES, MAX, pub const CACHE = enum(u32) { L1D, L1I, LL, DTLB, ITLB, BPU, NODE, MAX, pub const OP = enum(u32) { READ, WRITE, PREFETCH, MAX, }; pub const RESULT = enum(u32) { ACCESS, MISS, MAX, }; }; }; pub const SW = enum(u32) { CPU_CLOCK, TASK_CLOCK, PAGE_FAULTS, CONTEXT_SWITCHES, CPU_MIGRATIONS, PAGE_FAULTS_MIN, PAGE_FAULTS_MAJ, ALIGNMENT_FAULTS, EMULATION_FAULTS, DUMMY, BPF_OUTPUT, MAX, }; }; pub const SAMPLE = struct { pub const IP = 1; pub const TID = 2; pub const TIME = 4; pub const ADDR = 8; pub const READ = 16; pub const CALLCHAIN = 32; pub const ID = 64; pub const CPU = 128; pub const PERIOD = 256; pub const STREAM_ID = 512; pub const RAW = 1024; pub const BRANCH_STACK = 2048; pub const REGS_USER = 4096; pub const STACK_USER = 8192; pub const WEIGHT = 16384; pub const DATA_SRC = 32768; pub const IDENTIFIER = 65536; pub const TRANSACTION = 131072; pub const REGS_INTR = 262144; pub const PHYS_ADDR = 524288; pub const MAX = 1048576; pub const BRANCH = struct { pub const USER = 1 << 0; pub const KERNEL = 1 << 1; pub const HV = 1 << 2; pub const ANY = 1 << 3; pub const ANY_CALL = 1 << 4; pub const ANY_RETURN = 1 << 5; pub const IND_CALL = 1 << 6; pub const ABORT_TX = 1 << 7; pub const IN_TX = 1 << 8; pub const NO_TX = 1 << 9; pub const COND = 1 << 10; pub const CALL_STACK = 1 << 11; pub const IND_JUMP = 1 << 12; pub const CALL = 1 << 13; pub const NO_FLAGS = 1 << 14; pub const NO_CYCLES = 1 << 15; pub const TYPE_SAVE = 1 << 16; pub const MAX = 1 << 17; }; }; pub const FLAG = struct { pub const FD_NO_GROUP = 1 << 0; pub const FD_OUTPUT = 1 << 1; pub const PID_CGROUP = 1 << 2; pub const FD_CLOEXEC = 1 << 3; }; pub const EVENT_IOC = struct { pub const ENABLE = 9216; pub const DISABLE = 9217; pub const REFRESH = 9218; pub const RESET = 9219; pub const PERIOD = 1074275332; pub const SET_OUTPUT = 9221; pub const SET_FILTER = 1074275334; pub const SET_BPF = 1074013192; pub const PAUSE_OUTPUT = 1074013193; pub const QUERY_BPF = 3221758986; pub const MODIFY_ATTRIBUTES = 1074275339; }; pub const IOC_FLAG_GROUP = 1; }; pub const timeval = std.os.timeval; pub const rusage = extern struct { utime: timeval, stime: timeval, maxrss: isize, ixrss: isize, idrss: isize, isrss: isize, minflt: isize, majflt: isize, nswap: isize, inblock: isize, oublock: isize, msgsnd: isize, msgrcv: isize, nsignals: isize, nvcsw: isize, nivcsw: isize, __reserved: [16]isize = [1]isize{0} ** 16, pub const SELF = 0; pub const CHILDREN = -1; pub const THREAD = 1; }; pub const PerfEventOpenError = error{ /// Returned if the perf_event_attr size value is too small (smaller /// than PERF_ATTR_SIZE_VER0), too big (larger than the page size), /// or larger than the kernel supports and the extra bytes are not /// zero. When E2BIG is returned, the perf_event_attr size field is /// overwritten by the kernel to be the size of the structure it was /// expecting. TooBig, /// Returned when the requested event requires CAP_SYS_ADMIN permis‐ /// sions (or a more permissive perf_event paranoid setting). Some /// common cases where an unprivileged process may encounter this /// error: attaching to a process owned by a different user; moni‐ /// toring all processes on a given CPU (i.e., specifying the pid /// argument as -1); and not setting exclude_kernel when the para‐ /// noid setting requires it. /// Also: /// Returned on many (but not all) architectures when an unsupported /// exclude_hv, exclude_idle, exclude_user, or exclude_kernel set‐ /// ting is specified. /// It can also happen, as with EACCES, when the requested event re‐ /// quires CAP_SYS_ADMIN permissions (or a more permissive /// perf_event paranoid setting). This includes setting a break‐ /// point on a kernel address, and (since Linux 3.13) setting a ker‐ /// nel function-trace tracepoint. PermissionDenied, /// Returned if another event already has exclusive access to the /// PMU. DeviceBusy, /// Each opened event uses one file descriptor. If a large number /// of events are opened, the per-process limit on the number of /// open file descriptors will be reached, and no more events can be /// created. ProcessResources, EventRequiresUnsupportedCpuFeature, /// Returned if you try to add more breakpoint /// events than supported by the hardware. TooManyBreakpoints, /// Returned if PERF_SAMPLE_STACK_USER is set in sample_type and it /// is not supported by hardware. SampleStackNotSupported, /// Returned if an event requiring a specific hardware feature is /// requested but there is no hardware support. This includes re‐ /// questing low-skid events if not supported, branch tracing if it /// is not available, sampling if no PMU interrupt is available, and /// branch stacks for software events. EventNotSupported, /// Returned if PERF_SAMPLE_CALLCHAIN is requested and sam‐ /// ple_max_stack is larger than the maximum specified in /// /proc/sys/kernel/perf_event_max_stack. SampleMaxStackOverflow, /// Returned if attempting to attach to a process that does not exist. ProcessNotFound, Unexpected, }; pub fn perf_event_open( attr: *perf_event_attr, pid: pid_t, cpu: i32, group_fd: fd_t, flags: usize, ) PerfEventOpenError!fd_t { const rc = system.perf_event_open(attr, pid, cpu, group_fd, flags); switch (std.os.errno(rc)) { .SUCCESS => return @intCast(fd_t, rc), .@"2BIG" => return error.TooBig, .ACCES => return error.PermissionDenied, .BADF => unreachable, // group_fd file descriptor is not valid. .BUSY => return error.DeviceBusy, .FAULT => unreachable, // Segmentation fault. .INVAL => unreachable, // Bad attr settings. .INTR => unreachable, // Mixed perf and ftrace handling for a uprobe. .MFILE => return error.ProcessResources, .NODEV => return error.EventRequiresUnsupportedCpuFeature, .NOENT => unreachable, // Invalid type setting. .NOSPC => return error.TooManyBreakpoints, .NOSYS => return error.SampleStackNotSupported, .OPNOTSUPP => return error.EventNotSupported, .OVERFLOW => return error.SampleMaxStackOverflow, .PERM => return error.PermissionDenied, .SRCH => return error.ProcessNotFound, else => return error.Unexpected, } } pub const system = struct { pub fn perf_event_open( attr: *perf_event_attr, pid: pid_t, cpu: i32, group_fd: fd_t, flags: usize, ) usize { return std.os.linux.syscall5( .perf_event_open, @ptrToInt(attr), @bitCast(usize, @as(isize, pid)), @bitCast(usize, @as(isize, cpu)), @bitCast(usize, @as(isize, group_fd)), flags, ); } };
bench.zig
use @import("index.zig"); pub extern "kernel32" stdcallcc fn CancelIoEx(hFile: HANDLE, lpOverlapped: LPOVERLAPPED) BOOL; pub extern "kernel32" stdcallcc fn CloseHandle(hObject: HANDLE) BOOL; pub extern "kernel32" stdcallcc fn CreateDirectoryW(lpPathName: [*]const u16, lpSecurityAttributes: ?*SECURITY_ATTRIBUTES) BOOL; pub extern "kernel32" stdcallcc fn CreateFileW( lpFileName: [*]const u16, // TODO null terminated pointer type dwDesiredAccess: DWORD, dwShareMode: DWORD, lpSecurityAttributes: ?LPSECURITY_ATTRIBUTES, dwCreationDisposition: DWORD, dwFlagsAndAttributes: DWORD, hTemplateFile: ?HANDLE, ) HANDLE; pub extern "kernel32" stdcallcc fn CreatePipe( hReadPipe: *HANDLE, hWritePipe: *HANDLE, lpPipeAttributes: *const SECURITY_ATTRIBUTES, nSize: DWORD, ) BOOL; pub extern "kernel32" stdcallcc fn CreateProcessW( lpApplicationName: ?LPWSTR, lpCommandLine: LPWSTR, lpProcessAttributes: ?*SECURITY_ATTRIBUTES, lpThreadAttributes: ?*SECURITY_ATTRIBUTES, bInheritHandles: BOOL, dwCreationFlags: DWORD, lpEnvironment: ?*c_void, lpCurrentDirectory: ?LPWSTR, lpStartupInfo: *STARTUPINFOW, lpProcessInformation: *PROCESS_INFORMATION, ) BOOL; pub extern "kernel32" stdcallcc fn CreateSymbolicLinkW(lpSymlinkFileName: [*]const u16, lpTargetFileName: [*]const u16, dwFlags: DWORD) BOOLEAN; pub extern "kernel32" stdcallcc fn CreateIoCompletionPort(FileHandle: HANDLE, ExistingCompletionPort: ?HANDLE, CompletionKey: ULONG_PTR, NumberOfConcurrentThreads: DWORD) ?HANDLE; pub extern "kernel32" stdcallcc fn CreateThread(lpThreadAttributes: ?LPSECURITY_ATTRIBUTES, dwStackSize: SIZE_T, lpStartAddress: LPTHREAD_START_ROUTINE, lpParameter: ?LPVOID, dwCreationFlags: DWORD, lpThreadId: ?LPDWORD) ?HANDLE; pub extern "kernel32" stdcallcc fn DeleteFileW(lpFileName: [*]const u16) BOOL; pub extern "kernel32" stdcallcc fn ExitProcess(exit_code: UINT) noreturn; pub extern "kernel32" stdcallcc fn FindFirstFileW(lpFileName: [*]const u16, lpFindFileData: *WIN32_FIND_DATAW) HANDLE; pub extern "kernel32" stdcallcc fn FindClose(hFindFile: HANDLE) BOOL; pub extern "kernel32" stdcallcc fn FindNextFileW(hFindFile: HANDLE, lpFindFileData: *WIN32_FIND_DATAW) BOOL; pub extern "kernel32" stdcallcc fn FreeEnvironmentStringsW(penv: [*]u16) BOOL; pub extern "kernel32" stdcallcc fn GetCommandLineA() LPSTR; pub extern "kernel32" stdcallcc fn GetConsoleMode(in_hConsoleHandle: HANDLE, out_lpMode: *DWORD) BOOL; pub extern "kernel32" stdcallcc fn GetConsoleScreenBufferInfo(hConsoleOutput: HANDLE, lpConsoleScreenBufferInfo: *CONSOLE_SCREEN_BUFFER_INFO) BOOL; pub extern "kernel32" stdcallcc fn GetCurrentDirectoryW(nBufferLength: DWORD, lpBuffer: ?[*]WCHAR) DWORD; pub extern "kernel32" stdcallcc fn GetCurrentThread() HANDLE; pub extern "kernel32" stdcallcc fn GetCurrentThreadId() DWORD; pub extern "kernel32" stdcallcc fn GetEnvironmentStringsW() ?[*]u16; pub extern "kernel32" stdcallcc fn GetEnvironmentVariableW(lpName: LPWSTR, lpBuffer: LPWSTR, nSize: DWORD) DWORD; pub extern "kernel32" stdcallcc fn GetExitCodeProcess(hProcess: HANDLE, lpExitCode: *DWORD) BOOL; pub extern "kernel32" stdcallcc fn GetFileSizeEx(hFile: HANDLE, lpFileSize: *LARGE_INTEGER) BOOL; pub extern "kernel32" stdcallcc fn GetFileAttributesW(lpFileName: [*]const WCHAR) DWORD; pub extern "kernel32" stdcallcc fn GetModuleFileNameW(hModule: ?HMODULE, lpFilename: [*]u16, nSize: DWORD) DWORD; pub extern "kernel32" stdcallcc fn GetModuleHandleW(lpModuleName: ?[*]const WCHAR) HMODULE; pub extern "kernel32" stdcallcc fn GetLastError() DWORD; pub extern "kernel32" stdcallcc fn GetFileInformationByHandleEx( in_hFile: HANDLE, in_FileInformationClass: FILE_INFO_BY_HANDLE_CLASS, out_lpFileInformation: *c_void, in_dwBufferSize: DWORD, ) BOOL; pub extern "kernel32" stdcallcc fn GetFinalPathNameByHandleW( hFile: HANDLE, lpszFilePath: [*]u16, cchFilePath: DWORD, dwFlags: DWORD, ) DWORD; pub extern "kernel32" stdcallcc fn GetOverlappedResult(hFile: HANDLE, lpOverlapped: *OVERLAPPED, lpNumberOfBytesTransferred: *DWORD, bWait: BOOL) BOOL; pub extern "kernel32" stdcallcc fn GetProcessHeap() ?HANDLE; pub extern "kernel32" stdcallcc fn GetQueuedCompletionStatus(CompletionPort: HANDLE, lpNumberOfBytesTransferred: LPDWORD, lpCompletionKey: *ULONG_PTR, lpOverlapped: *?*OVERLAPPED, dwMilliseconds: DWORD) BOOL; pub extern "kernel32" stdcallcc fn GetSystemInfo(lpSystemInfo: *SYSTEM_INFO) void; pub extern "kernel32" stdcallcc fn GetSystemTimeAsFileTime(*FILETIME) void; pub extern "kernel32" stdcallcc fn HeapCreate(flOptions: DWORD, dwInitialSize: SIZE_T, dwMaximumSize: SIZE_T) ?HANDLE; pub extern "kernel32" stdcallcc fn HeapDestroy(hHeap: HANDLE) BOOL; pub extern "kernel32" stdcallcc fn HeapReAlloc(hHeap: HANDLE, dwFlags: DWORD, lpMem: *c_void, dwBytes: SIZE_T) ?*c_void; pub extern "kernel32" stdcallcc fn HeapSize(hHeap: HANDLE, dwFlags: DWORD, lpMem: *const c_void) SIZE_T; pub extern "kernel32" stdcallcc fn HeapCompact(hHeap: HANDLE, dwFlags: DWORD) SIZE_T; pub extern "kernel32" stdcallcc fn HeapSummary(hHeap: HANDLE, dwFlags: DWORD, lpSummary: LPHEAP_SUMMARY) BOOL; pub extern "kernel32" stdcallcc fn GetStdHandle(in_nStdHandle: DWORD) ?HANDLE; pub extern "kernel32" stdcallcc fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T) ?*c_void; pub extern "kernel32" stdcallcc fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: *c_void) BOOL; pub extern "kernel32" stdcallcc fn HeapValidate(hHeap: HANDLE, dwFlags: DWORD, lpMem: ?*const c_void) BOOL; pub extern "kernel32" stdcallcc fn MoveFileExW( lpExistingFileName: [*]const u16, lpNewFileName: [*]const u16, dwFlags: DWORD, ) BOOL; pub extern "kernel32" stdcallcc fn PostQueuedCompletionStatus(CompletionPort: HANDLE, dwNumberOfBytesTransferred: DWORD, dwCompletionKey: ULONG_PTR, lpOverlapped: ?*OVERLAPPED) BOOL; pub extern "kernel32" stdcallcc fn QueryPerformanceCounter(lpPerformanceCount: *LARGE_INTEGER) BOOL; pub extern "kernel32" stdcallcc fn QueryPerformanceFrequency(lpFrequency: *LARGE_INTEGER) BOOL; pub extern "kernel32" stdcallcc fn ReadDirectoryChangesW( hDirectory: HANDLE, lpBuffer: [*]align(@alignOf(FILE_NOTIFY_INFORMATION)) u8, nBufferLength: DWORD, bWatchSubtree: BOOL, dwNotifyFilter: DWORD, lpBytesReturned: ?*DWORD, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE, ) BOOL; pub extern "kernel32" stdcallcc fn ReadFile( in_hFile: HANDLE, out_lpBuffer: [*]u8, in_nNumberOfBytesToRead: DWORD, out_lpNumberOfBytesRead: ?*DWORD, in_out_lpOverlapped: ?*OVERLAPPED, ) BOOL; pub extern "kernel32" stdcallcc fn RemoveDirectoryW(lpPathName: [*]const u16) BOOL; pub extern "kernel32" stdcallcc fn SetConsoleTextAttribute(hConsoleOutput: HANDLE, wAttributes: WORD) BOOL; pub extern "kernel32" stdcallcc fn SetFilePointerEx( in_fFile: HANDLE, in_liDistanceToMove: LARGE_INTEGER, out_opt_ldNewFilePointer: ?*LARGE_INTEGER, in_dwMoveMethod: DWORD, ) BOOL; pub extern "kernel32" stdcallcc fn SetHandleInformation(hObject: HANDLE, dwMask: DWORD, dwFlags: DWORD) BOOL; pub extern "kernel32" stdcallcc fn Sleep(dwMilliseconds: DWORD) void; pub extern "kernel32" stdcallcc fn TerminateProcess(hProcess: HANDLE, uExitCode: UINT) BOOL; pub extern "kernel32" stdcallcc fn WaitForSingleObject(hHandle: HANDLE, dwMilliseconds: DWORD) DWORD; pub extern "kernel32" stdcallcc fn WriteFile( in_hFile: HANDLE, in_lpBuffer: [*]const u8, in_nNumberOfBytesToWrite: DWORD, out_lpNumberOfBytesWritten: ?*DWORD, in_out_lpOverlapped: ?*OVERLAPPED, ) BOOL; pub extern "kernel32" stdcallcc fn WriteFileEx(hFile: HANDLE, lpBuffer: [*]const u8, nNumberOfBytesToWrite: DWORD, lpOverlapped: LPOVERLAPPED, lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE) BOOL; pub extern "kernel32" stdcallcc fn LoadLibraryW(lpLibFileName: [*]const u16) ?HMODULE; pub extern "kernel32" stdcallcc fn GetProcAddress(hModule: HMODULE, lpProcName: [*]const u8) ?FARPROC; pub extern "kernel32" stdcallcc fn FreeLibrary(hModule: HMODULE) BOOL; pub const FILE_NOTIFY_INFORMATION = extern struct { NextEntryOffset: DWORD, Action: DWORD, FileNameLength: DWORD, FileName: [1]WCHAR, }; pub const FILE_ACTION_ADDED = 0x00000001; pub const FILE_ACTION_REMOVED = 0x00000002; pub const FILE_ACTION_MODIFIED = 0x00000003; pub const FILE_ACTION_RENAMED_OLD_NAME = 0x00000004; pub const FILE_ACTION_RENAMED_NEW_NAME = 0x00000005; pub const LPOVERLAPPED_COMPLETION_ROUTINE = ?extern fn (DWORD, DWORD, *OVERLAPPED) void; pub const FILE_LIST_DIRECTORY = 1; pub const FILE_NOTIFY_CHANGE_CREATION = 64; pub const FILE_NOTIFY_CHANGE_SIZE = 8; pub const FILE_NOTIFY_CHANGE_SECURITY = 256; pub const FILE_NOTIFY_CHANGE_LAST_ACCESS = 32; pub const FILE_NOTIFY_CHANGE_LAST_WRITE = 16; pub const FILE_NOTIFY_CHANGE_DIR_NAME = 2; pub const FILE_NOTIFY_CHANGE_FILE_NAME = 1; pub const FILE_NOTIFY_CHANGE_ATTRIBUTES = 4; pub const CONSOLE_SCREEN_BUFFER_INFO = extern struct { dwSize: COORD, dwCursorPosition: COORD, wAttributes: WORD, srWindow: SMALL_RECT, dwMaximumWindowSize: COORD, }; pub const FOREGROUND_BLUE = 1; pub const FOREGROUND_GREEN = 2; pub const FOREGROUND_RED = 4; pub const FOREGROUND_INTENSITY = 8;
std/os/windows/kernel32.zig
pub const E = enum(u16) { /// No error occurred. /// Same code used for `NSROK`. SUCCESS = 0, /// Operation not permitted PERM = 1, /// No such file or directory NOENT = 2, /// No such process SRCH = 3, /// Interrupted system call INTR = 4, /// I/O error IO = 5, /// No such device or address NXIO = 6, /// Arg list too long @"2BIG" = 7, /// Exec format error NOEXEC = 8, /// Bad file number BADF = 9, /// No child processes CHILD = 10, /// Try again /// Also means: WOULDBLOCK: operation would block AGAIN = 11, /// Out of memory NOMEM = 12, /// Permission denied ACCES = 13, /// Bad address FAULT = 14, /// Block device required NOTBLK = 15, /// Device or resource busy BUSY = 16, /// File exists EXIST = 17, /// Cross-device link XDEV = 18, /// No such device NODEV = 19, /// Not a directory NOTDIR = 20, /// Is a directory ISDIR = 21, /// Invalid argument INVAL = 22, /// File table overflow NFILE = 23, /// Too many open files MFILE = 24, /// Not a typewriter NOTTY = 25, /// Text file busy TXTBSY = 26, /// File too large FBIG = 27, /// No space left on device NOSPC = 28, /// Illegal seek SPIPE = 29, /// Read-only file system ROFS = 30, /// Too many links MLINK = 31, /// Broken pipe PIPE = 32, /// Math argument out of domain of func DOM = 33, /// Math result not representable RANGE = 34, /// Resource deadlock would occur DEADLK = 35, /// File name too long NAMETOOLONG = 36, /// No record locks available NOLCK = 37, /// Function not implemented NOSYS = 38, /// Directory not empty NOTEMPTY = 39, /// Too many symbolic links encountered LOOP = 40, /// No message of desired type NOMSG = 42, /// Identifier removed IDRM = 43, /// Channel number out of range CHRNG = 44, /// Level 2 not synchronized L2NSYNC = 45, /// Level 3 halted L3HLT = 46, /// Level 3 reset L3RST = 47, /// Link number out of range LNRNG = 48, /// Protocol driver not attached UNATCH = 49, /// No CSI structure available NOCSI = 50, /// Level 2 halted L2HLT = 51, /// Invalid exchange BADE = 52, /// Invalid request descriptor BADR = 53, /// Exchange full XFULL = 54, /// No anode NOANO = 55, /// Invalid request code BADRQC = 56, /// Invalid slot BADSLT = 57, /// Bad font file format BFONT = 59, /// Device not a stream NOSTR = 60, /// No data available NODATA = 61, /// Timer expired TIME = 62, /// Out of streams resources NOSR = 63, /// Machine is not on the network NONET = 64, /// Package not installed NOPKG = 65, /// Object is remote REMOTE = 66, /// Link has been severed NOLINK = 67, /// Advertise error ADV = 68, /// Srmount error SRMNT = 69, /// Communication error on send COMM = 70, /// Protocol error PROTO = 71, /// Multihop attempted MULTIHOP = 72, /// RFS specific error DOTDOT = 73, /// Not a data message BADMSG = 74, /// Value too large for defined data type OVERFLOW = 75, /// Name not unique on network NOTUNIQ = 76, /// File descriptor in bad state BADFD = 77, /// Remote address changed REMCHG = 78, /// Can not access a needed shared library LIBACC = 79, /// Accessing a corrupted shared library LIBBAD = 80, /// .lib section in a.out corrupted LIBSCN = 81, /// Attempting to link in too many shared libraries LIBMAX = 82, /// Cannot exec a shared library directly LIBEXEC = 83, /// Illegal byte sequence ILSEQ = 84, /// Interrupted system call should be restarted RESTART = 85, /// Streams pipe error STRPIPE = 86, /// Too many users USERS = 87, /// Socket operation on non-socket NOTSOCK = 88, /// Destination address required DESTADDRREQ = 89, /// Message too long MSGSIZE = 90, /// Protocol wrong type for socket PROTOTYPE = 91, /// Protocol not available NOPROTOOPT = 92, /// Protocol not supported PROTONOSUPPORT = 93, /// Socket type not supported SOCKTNOSUPPORT = 94, /// Operation not supported on transport endpoint /// This code also means `NOTSUP`. OPNOTSUPP = 95, /// Protocol family not supported PFNOSUPPORT = 96, /// Address family not supported by protocol AFNOSUPPORT = 97, /// Address already in use ADDRINUSE = 98, /// Cannot assign requested address ADDRNOTAVAIL = 99, /// Network is down NETDOWN = 100, /// Network is unreachable NETUNREACH = 101, /// Network dropped connection because of reset NETRESET = 102, /// Software caused connection abort CONNABORTED = 103, /// Connection reset by peer CONNRESET = 104, /// No buffer space available NOBUFS = 105, /// Transport endpoint is already connected ISCONN = 106, /// Transport endpoint is not connected NOTCONN = 107, /// Cannot send after transport endpoint shutdown SHUTDOWN = 108, /// Too many references: cannot splice TOOMANYREFS = 109, /// Connection timed out TIMEDOUT = 110, /// Connection refused CONNREFUSED = 111, /// Host is down HOSTDOWN = 112, /// No route to host HOSTUNREACH = 113, /// Operation already in progress ALREADY = 114, /// Operation now in progress INPROGRESS = 115, /// Stale NFS file handle STALE = 116, /// Structure needs cleaning UCLEAN = 117, /// Not a XENIX named type file NOTNAM = 118, /// No XENIX semaphores available NAVAIL = 119, /// Is a named type file ISNAM = 120, /// Remote I/O error REMOTEIO = 121, /// Quota exceeded DQUOT = 122, /// No medium found NOMEDIUM = 123, /// Wrong medium type MEDIUMTYPE = 124, /// Operation canceled CANCELED = 125, /// Required key not available NOKEY = 126, /// Key has expired KEYEXPIRED = 127, /// Key has been revoked KEYREVOKED = 128, /// Key was rejected by service KEYREJECTED = 129, // for robust mutexes /// Owner died OWNERDEAD = 130, /// State not recoverable NOTRECOVERABLE = 131, /// Operation not possible due to RF-kill RFKILL = 132, /// Memory page has hardware error HWPOISON = 133, // nameserver query return codes /// DNS server returned answer with no data NSRNODATA = 160, /// DNS server claims query was misformatted NSRFORMERR = 161, /// DNS server returned general failure NSRSERVFAIL = 162, /// Domain name not found NSRNOTFOUND = 163, /// DNS server does not implement requested operation NSRNOTIMP = 164, /// DNS server refused query NSRREFUSED = 165, /// Misformatted DNS query NSRBADQUERY = 166, /// Misformatted domain name NSRBADNAME = 167, /// Unsupported address family NSRBADFAMILY = 168, /// Misformatted DNS reply NSRBADRESP = 169, /// Could not contact DNS servers NSRCONNREFUSED = 170, /// Timeout while contacting DNS servers NSRTIMEOUT = 171, /// End of file NSROF = 172, /// Error reading file NSRFILE = 173, /// Out of memory NSRNOMEM = 174, /// Application terminated lookup NSRDESTRUCTION = 175, /// Domain name is too long NSRQUERYDOMAINTOOLONG = 176, /// Domain name is too long NSRCNAMELOOP = 177, _, };
lib/std/os/bits/linux/errno/generic.zig
const kernel = @import("kernel.zig"); const Font = kernel.PSF1.Font; const log = kernel.log.scoped(.graphics); const Driver = @This(); const Type = enum(u64) { virtio = 0, }; type: Type, framebuffer: Framebuffer, pub fn draw_char(driver: *Driver, color: Color, point: Point, character: u8) void { const framebuffer = driver.framebuffer.buffer[0 .. driver.framebuffer.width * driver.framebuffer.height]; const font_buffer_char_offset = @intCast(u64, character) * kernel.font.header.char_size; const font_buffer = kernel.font.glyph_buffer[font_buffer_char_offset .. font_buffer_char_offset + kernel.font.header.char_size]; for (font_buffer[0..16]) |font_byte, offset_from_y| { const y = point.y + offset_from_y; var x = point.x; const x_max = point.x + 8; while (x < x_max) : (x += 1) { if (font_byte & (@as(u8, 0b1000_0000) >> @intCast(u3, x - point.x)) != 0) { // TODO: correct the color framebuffer[x + (y * driver.framebuffer.width)] = @bitCast(u32, color); } } } } pub fn draw_string(driver: *Driver, color: Color, string: []const u8) void { const framebuffer = &driver.framebuffer; for (string) |char| { driver.draw_char(color, framebuffer.cursor, char); framebuffer.cursor.x += 8; if (driver.framebuffer.cursor.x + 8 > driver.framebuffer.width) { driver.framebuffer.cursor.x = 0; driver.framebuffer.cursor.y += 16; } } } pub fn draw_horizontal_line(driver: *Driver, line: Line, color: Color) void { kernel.assert(@src(), line.start.y == line.end.y); kernel.assert(@src(), line.start.x < line.end.x); const length = line.end.x - line.start.x; const start_i = line.start.x + (line.start.y * driver.framebuffer.width); for (driver.framebuffer.buffer[start_i .. start_i + length]) |*pixel| { pixel.* = @bitCast(u32, color); } } /// This assumes they are all the same height (start.y and end.y are the same for all of them) pub fn draw_parallel_vertical_lines(driver: *Driver, x_coordinates: []u32, height_start: u32, height_end: u32, color: Color) void { var y_offset = height_start * driver.framebuffer.width; const y_max_offset = height_end * driver.framebuffer.width; while (y_offset < y_max_offset) : (y_offset += driver.framebuffer.width) { for (x_coordinates) |x| { const index = x + y_offset; driver.framebuffer.buffer[index] = @bitCast(u32, color); } } } pub fn draw_rect(driver: *Driver, rect: Rect, color: Color) void { driver.draw_horizontal_line(Line.straight_horizontal(rect.x, rect.y, rect.width), color); driver.draw_parallel_vertical_lines(&[_]u32{ rect.x, rect.x + rect.width }, rect.y, rect.y + rect.height, color); driver.draw_horizontal_line(Line.straight_horizontal(rect.x, rect.y + rect.height, rect.width), color); } pub fn test_draw_rect(driver: *Driver) void { draw_rect(driver, Rect{ .x = 600, .y = 600, .width = 30, .height = 60, }, Color{ .red = 0, .green = 0, .blue = 0, .alpha = 0 }); } pub const Framebuffer = struct { buffer: [*]u32, width: u32, height: u32, cursor: Point, }; pub const Point = struct { x: u32, y: u32, }; pub const Color = struct { red: u8, green: u8, blue: u8, alpha: u8, }; pub const Rect = struct { x: u32, y: u32, width: u32, height: u32, }; pub const Line = struct { start: Point, end: Point, fn straight_horizontal(x_start: u32, y: u32, width: u32) Line { return Line{ .start = Point{ .x = x_start, .y = y }, .end = Point{ .x = x_start + width, .y = y }, }; } fn straight_vertical(x: u32, y_start: u32, height: u32) Line { return Line{ .start = Point{ .x = x, .y = y_start }, .end = Point{ .x = x, .y = y_start + height }, }; } }; pub var drivers: []*Driver = undefined; pub var _drivers_array: [64]*Driver = undefined;
src/kernel/graphics.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const term = @import("term.zig"); const util = @import("util.zig"); const parse = @import("parse/!mod.zig"); /// Use the `parse.Cst.Printer` to print the tree structure of a cst pub fn printCst( allocator: Allocator, cst: parse.Cst, tokens: []const parse.TokenKind, spans: []const parse.SpanData, src: []const u8, ) !void { var printer = parse.Cst.Printer{ .allocator = allocator, .cst = cst, .tokens = tokens, .spans = spans, .src = src, }; try printer.print(); } /// Helper to print a piece of the `src` represented by a `span` fn printLexeme(allocator: Allocator, span: parse.SpanData, src: []const u8) !void { var slice = src[span.start..span.end]; var slice_unesc = try util.unescapeString(allocator, slice); defer allocator.free(slice_unesc); term.print("{s}", .{slice}); } /// Print a list of tokens and their whitespace pub fn printTokens( allocator: Allocator, tokens: std.MultiArrayList(parse.Token).Slice, spans: []const parse.SpanData, src: []const u8, ) !void { const ws_lens = tokens.items(.preceding_whitespace_len); for (tokens.items(.kind)) |kind, i| { const span = spans[i]; const ws_len = ws_lens[i]; const start = span.start - ws_len; const end = span.start; const slice = src[start..end]; const unesc_slice = try util.unescapeString(allocator, slice); defer allocator.free(unesc_slice); if (unesc_slice.len != 0) { term.printAttr(" '{s}'", .{unesc_slice}, .{ .col = .white }); } term.println("", .{}); try printToken(allocator, kind, span, src); } term.println("", .{}); } /// Print a single token and its span pub fn printToken( allocator: Allocator, kind: parse.TokenKind, span: parse.SpanData, src: []const u8, ) !void { var slice = src[span.start..span.end]; var slice_unesc = try util.unescapeString(allocator, slice); defer allocator.free(slice_unesc); const kind_str = try std.fmt.allocPrint(allocator, "{?}", .{kind}); defer allocator.free(kind_str); term.printAttr("{s}", .{kind_str[5..]}, .{ .col = .cyan }); term.printAttr("@{}..{}", .{ span.start, span.end }, .{ .col = .white, .bold = true }); term.printAttr(" '{s}'", .{slice_unesc}, .{ .col = .green }); }
fexc/src/debug.zig
pub const OID_OAssociatedIdentityProviderObject = Guid.initString("98c5a3dd-db68-4f1a-8d2b-9079cdfeaf61"); //-------------------------------------------------------------------------------- // Section: Types (20) //-------------------------------------------------------------------------------- pub const IDENTITY_TYPE = enum(i32) { ALL = 0, ME_ONLY = 1, }; pub const IDENTITIES_ALL = IDENTITY_TYPE.ALL; pub const IDENTITIES_ME_ONLY = IDENTITY_TYPE.ME_ONLY; pub const IdentityUpdateEvent = enum(u32) { ASSOCIATED = 1, DISASSOCIATED = 2, CREATED = 4, IMPORTED = 8, DELETED = 16, PROPCHANGED = 32, CONNECTED = 64, DISCONNECTED = 128, _, pub fn initFlags(o: struct { ASSOCIATED: u1 = 0, DISASSOCIATED: u1 = 0, CREATED: u1 = 0, IMPORTED: u1 = 0, DELETED: u1 = 0, PROPCHANGED: u1 = 0, CONNECTED: u1 = 0, DISCONNECTED: u1 = 0, }) IdentityUpdateEvent { return @intToEnum(IdentityUpdateEvent, (if (o.ASSOCIATED == 1) @enumToInt(IdentityUpdateEvent.ASSOCIATED) else 0) | (if (o.DISASSOCIATED == 1) @enumToInt(IdentityUpdateEvent.DISASSOCIATED) else 0) | (if (o.CREATED == 1) @enumToInt(IdentityUpdateEvent.CREATED) else 0) | (if (o.IMPORTED == 1) @enumToInt(IdentityUpdateEvent.IMPORTED) else 0) | (if (o.DELETED == 1) @enumToInt(IdentityUpdateEvent.DELETED) else 0) | (if (o.PROPCHANGED == 1) @enumToInt(IdentityUpdateEvent.PROPCHANGED) else 0) | (if (o.CONNECTED == 1) @enumToInt(IdentityUpdateEvent.CONNECTED) else 0) | (if (o.DISCONNECTED == 1) @enumToInt(IdentityUpdateEvent.DISCONNECTED) else 0) ); } }; pub const IDENTITY_ASSOCIATED = IdentityUpdateEvent.ASSOCIATED; pub const IDENTITY_DISASSOCIATED = IdentityUpdateEvent.DISASSOCIATED; pub const IDENTITY_CREATED = IdentityUpdateEvent.CREATED; pub const IDENTITY_IMPORTED = IdentityUpdateEvent.IMPORTED; pub const IDENTITY_DELETED = IdentityUpdateEvent.DELETED; pub const IDENTITY_PROPCHANGED = IdentityUpdateEvent.PROPCHANGED; pub const IDENTITY_CONNECTED = IdentityUpdateEvent.CONNECTED; pub const IDENTITY_DISCONNECTED = IdentityUpdateEvent.DISCONNECTED; // TODO: this type is limited to platform 'windows6.1' const IID_IIdentityAdvise_Value = Guid.initString("4e982fed-d14b-440c-b8d6-bb386453d386"); pub const IID_IIdentityAdvise = &IID_IIdentityAdvise_Value; pub const IIdentityAdvise = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, IdentityUpdated: fn( self: *const IIdentityAdvise, dwIdentityUpdateEvents: IdentityUpdateEvent, lpszUniqueID: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdentityAdvise_IdentityUpdated(self: *const T, dwIdentityUpdateEvents: IdentityUpdateEvent, lpszUniqueID: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IIdentityAdvise.VTable, self.vtable).IdentityUpdated(@ptrCast(*const IIdentityAdvise, self), dwIdentityUpdateEvents, lpszUniqueID); } };} pub usingnamespace MethodMixin(@This()); }; const IID_AsyncIIdentityAdvise_Value = Guid.initString("3ab4c8da-d038-4830-8dd9-3253c55a127f"); pub const IID_AsyncIIdentityAdvise = &IID_AsyncIIdentityAdvise_Value; pub const AsyncIIdentityAdvise = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Begin_IdentityUpdated: fn( self: *const AsyncIIdentityAdvise, dwIdentityUpdateEvents: u32, lpszUniqueID: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_IdentityUpdated: fn( self: *const AsyncIIdentityAdvise, ) 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 AsyncIIdentityAdvise_Begin_IdentityUpdated(self: *const T, dwIdentityUpdateEvents: u32, lpszUniqueID: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityAdvise.VTable, self.vtable).Begin_IdentityUpdated(@ptrCast(*const AsyncIIdentityAdvise, self), dwIdentityUpdateEvents, lpszUniqueID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityAdvise_Finish_IdentityUpdated(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityAdvise.VTable, self.vtable).Finish_IdentityUpdated(@ptrCast(*const AsyncIIdentityAdvise, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IIdentityProvider_Value = Guid.initString("0d1b9e0c-e8ba-4f55-a81b-bce934b948f5"); pub const IID_IIdentityProvider = &IID_IIdentityProvider_Value; pub const IIdentityProvider = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetIdentityEnum: fn( self: *const IIdentityProvider, eIdentityType: IDENTITY_TYPE, pFilterkey: ?*const PROPERTYKEY, pFilterPropVarValue: ?*const PROPVARIANT, ppIdentityEnum: ?*?*IEnumUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Create: fn( self: *const IIdentityProvider, lpszUserName: ?[*:0]const u16, ppPropertyStore: ?*?*IPropertyStore, pKeywordsToAdd: ?*const PROPVARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Import: fn( self: *const IIdentityProvider, pPropertyStore: ?*IPropertyStore, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Delete: fn( self: *const IIdentityProvider, lpszUniqueID: ?[*:0]const u16, pKeywordsToDelete: ?*const PROPVARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FindByUniqueID: fn( self: *const IIdentityProvider, lpszUniqueID: ?[*:0]const u16, ppPropertyStore: ?*?*IPropertyStore, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetProviderPropertyStore: fn( self: *const IIdentityProvider, ppPropertyStore: ?*?*IPropertyStore, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Advise: fn( self: *const IIdentityProvider, pIdentityAdvise: ?*IIdentityAdvise, dwIdentityUpdateEvents: IdentityUpdateEvent, pdwCookie: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnAdvise: fn( self: *const IIdentityProvider, dwCookie: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdentityProvider_GetIdentityEnum(self: *const T, eIdentityType: IDENTITY_TYPE, pFilterkey: ?*const PROPERTYKEY, pFilterPropVarValue: ?*const PROPVARIANT, ppIdentityEnum: ?*?*IEnumUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IIdentityProvider.VTable, self.vtable).GetIdentityEnum(@ptrCast(*const IIdentityProvider, self), eIdentityType, pFilterkey, pFilterPropVarValue, ppIdentityEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdentityProvider_Create(self: *const T, lpszUserName: ?[*:0]const u16, ppPropertyStore: ?*?*IPropertyStore, pKeywordsToAdd: ?*const PROPVARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IIdentityProvider.VTable, self.vtable).Create(@ptrCast(*const IIdentityProvider, self), lpszUserName, ppPropertyStore, pKeywordsToAdd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdentityProvider_Import(self: *const T, pPropertyStore: ?*IPropertyStore) callconv(.Inline) HRESULT { return @ptrCast(*const IIdentityProvider.VTable, self.vtable).Import(@ptrCast(*const IIdentityProvider, self), pPropertyStore); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdentityProvider_Delete(self: *const T, lpszUniqueID: ?[*:0]const u16, pKeywordsToDelete: ?*const PROPVARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IIdentityProvider.VTable, self.vtable).Delete(@ptrCast(*const IIdentityProvider, self), lpszUniqueID, pKeywordsToDelete); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdentityProvider_FindByUniqueID(self: *const T, lpszUniqueID: ?[*:0]const u16, ppPropertyStore: ?*?*IPropertyStore) callconv(.Inline) HRESULT { return @ptrCast(*const IIdentityProvider.VTable, self.vtable).FindByUniqueID(@ptrCast(*const IIdentityProvider, self), lpszUniqueID, ppPropertyStore); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdentityProvider_GetProviderPropertyStore(self: *const T, ppPropertyStore: ?*?*IPropertyStore) callconv(.Inline) HRESULT { return @ptrCast(*const IIdentityProvider.VTable, self.vtable).GetProviderPropertyStore(@ptrCast(*const IIdentityProvider, self), ppPropertyStore); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdentityProvider_Advise(self: *const T, pIdentityAdvise: ?*IIdentityAdvise, dwIdentityUpdateEvents: IdentityUpdateEvent, pdwCookie: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IIdentityProvider.VTable, self.vtable).Advise(@ptrCast(*const IIdentityProvider, self), pIdentityAdvise, dwIdentityUpdateEvents, pdwCookie); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdentityProvider_UnAdvise(self: *const T, dwCookie: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IIdentityProvider.VTable, self.vtable).UnAdvise(@ptrCast(*const IIdentityProvider, self), dwCookie); } };} pub usingnamespace MethodMixin(@This()); }; const IID_AsyncIIdentityProvider_Value = Guid.initString("c6fc9901-c433-4646-8f48-4e4687aae2a0"); pub const IID_AsyncIIdentityProvider = &IID_AsyncIIdentityProvider_Value; pub const AsyncIIdentityProvider = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Begin_GetIdentityEnum: fn( self: *const AsyncIIdentityProvider, eIdentityType: IDENTITY_TYPE, pFilterkey: ?*const PROPERTYKEY, pFilterPropVarValue: ?*const PROPVARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_GetIdentityEnum: fn( self: *const AsyncIIdentityProvider, ppIdentityEnum: ?*?*IEnumUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_Create: fn( self: *const AsyncIIdentityProvider, lpszUserName: ?[*:0]const u16, pKeywordsToAdd: ?*const PROPVARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_Create: fn( self: *const AsyncIIdentityProvider, ppPropertyStore: ?*?*IPropertyStore, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_Import: fn( self: *const AsyncIIdentityProvider, pPropertyStore: ?*IPropertyStore, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_Import: fn( self: *const AsyncIIdentityProvider, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_Delete: fn( self: *const AsyncIIdentityProvider, lpszUniqueID: ?[*:0]const u16, pKeywordsToDelete: ?*const PROPVARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_Delete: fn( self: *const AsyncIIdentityProvider, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_FindByUniqueID: fn( self: *const AsyncIIdentityProvider, lpszUniqueID: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_FindByUniqueID: fn( self: *const AsyncIIdentityProvider, ppPropertyStore: ?*?*IPropertyStore, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_GetProviderPropertyStore: fn( self: *const AsyncIIdentityProvider, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_GetProviderPropertyStore: fn( self: *const AsyncIIdentityProvider, ppPropertyStore: ?*?*IPropertyStore, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_Advise: fn( self: *const AsyncIIdentityProvider, pIdentityAdvise: ?*IIdentityAdvise, dwIdentityUpdateEvents: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_Advise: fn( self: *const AsyncIIdentityProvider, pdwCookie: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_UnAdvise: fn( self: *const AsyncIIdentityProvider, dwCookie: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_UnAdvise: fn( self: *const AsyncIIdentityProvider, ) 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 AsyncIIdentityProvider_Begin_GetIdentityEnum(self: *const T, eIdentityType: IDENTITY_TYPE, pFilterkey: ?*const PROPERTYKEY, pFilterPropVarValue: ?*const PROPVARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityProvider.VTable, self.vtable).Begin_GetIdentityEnum(@ptrCast(*const AsyncIIdentityProvider, self), eIdentityType, pFilterkey, pFilterPropVarValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityProvider_Finish_GetIdentityEnum(self: *const T, ppIdentityEnum: ?*?*IEnumUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityProvider.VTable, self.vtable).Finish_GetIdentityEnum(@ptrCast(*const AsyncIIdentityProvider, self), ppIdentityEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityProvider_Begin_Create(self: *const T, lpszUserName: ?[*:0]const u16, pKeywordsToAdd: ?*const PROPVARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityProvider.VTable, self.vtable).Begin_Create(@ptrCast(*const AsyncIIdentityProvider, self), lpszUserName, pKeywordsToAdd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityProvider_Finish_Create(self: *const T, ppPropertyStore: ?*?*IPropertyStore) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityProvider.VTable, self.vtable).Finish_Create(@ptrCast(*const AsyncIIdentityProvider, self), ppPropertyStore); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityProvider_Begin_Import(self: *const T, pPropertyStore: ?*IPropertyStore) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityProvider.VTable, self.vtable).Begin_Import(@ptrCast(*const AsyncIIdentityProvider, self), pPropertyStore); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityProvider_Finish_Import(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityProvider.VTable, self.vtable).Finish_Import(@ptrCast(*const AsyncIIdentityProvider, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityProvider_Begin_Delete(self: *const T, lpszUniqueID: ?[*:0]const u16, pKeywordsToDelete: ?*const PROPVARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityProvider.VTable, self.vtable).Begin_Delete(@ptrCast(*const AsyncIIdentityProvider, self), lpszUniqueID, pKeywordsToDelete); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityProvider_Finish_Delete(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityProvider.VTable, self.vtable).Finish_Delete(@ptrCast(*const AsyncIIdentityProvider, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityProvider_Begin_FindByUniqueID(self: *const T, lpszUniqueID: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityProvider.VTable, self.vtable).Begin_FindByUniqueID(@ptrCast(*const AsyncIIdentityProvider, self), lpszUniqueID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityProvider_Finish_FindByUniqueID(self: *const T, ppPropertyStore: ?*?*IPropertyStore) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityProvider.VTable, self.vtable).Finish_FindByUniqueID(@ptrCast(*const AsyncIIdentityProvider, self), ppPropertyStore); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityProvider_Begin_GetProviderPropertyStore(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityProvider.VTable, self.vtable).Begin_GetProviderPropertyStore(@ptrCast(*const AsyncIIdentityProvider, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityProvider_Finish_GetProviderPropertyStore(self: *const T, ppPropertyStore: ?*?*IPropertyStore) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityProvider.VTable, self.vtable).Finish_GetProviderPropertyStore(@ptrCast(*const AsyncIIdentityProvider, self), ppPropertyStore); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityProvider_Begin_Advise(self: *const T, pIdentityAdvise: ?*IIdentityAdvise, dwIdentityUpdateEvents: u32) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityProvider.VTable, self.vtable).Begin_Advise(@ptrCast(*const AsyncIIdentityProvider, self), pIdentityAdvise, dwIdentityUpdateEvents); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityProvider_Finish_Advise(self: *const T, pdwCookie: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityProvider.VTable, self.vtable).Finish_Advise(@ptrCast(*const AsyncIIdentityProvider, self), pdwCookie); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityProvider_Begin_UnAdvise(self: *const T, dwCookie: u32) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityProvider.VTable, self.vtable).Begin_UnAdvise(@ptrCast(*const AsyncIIdentityProvider, self), dwCookie); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityProvider_Finish_UnAdvise(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityProvider.VTable, self.vtable).Finish_UnAdvise(@ptrCast(*const AsyncIIdentityProvider, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IAssociatedIdentityProvider_Value = Guid.initString("2af066b3-4cbb-4cba-a798-204b6af68cc0"); pub const IID_IAssociatedIdentityProvider = &IID_IAssociatedIdentityProvider_Value; pub const IAssociatedIdentityProvider = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AssociateIdentity: fn( self: *const IAssociatedIdentityProvider, hwndParent: ?HWND, ppPropertyStore: ?*?*IPropertyStore, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DisassociateIdentity: fn( self: *const IAssociatedIdentityProvider, hwndParent: ?HWND, lpszUniqueID: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ChangeCredential: fn( self: *const IAssociatedIdentityProvider, hwndParent: ?HWND, lpszUniqueID: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssociatedIdentityProvider_AssociateIdentity(self: *const T, hwndParent: ?HWND, ppPropertyStore: ?*?*IPropertyStore) callconv(.Inline) HRESULT { return @ptrCast(*const IAssociatedIdentityProvider.VTable, self.vtable).AssociateIdentity(@ptrCast(*const IAssociatedIdentityProvider, self), hwndParent, ppPropertyStore); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssociatedIdentityProvider_DisassociateIdentity(self: *const T, hwndParent: ?HWND, lpszUniqueID: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IAssociatedIdentityProvider.VTable, self.vtable).DisassociateIdentity(@ptrCast(*const IAssociatedIdentityProvider, self), hwndParent, lpszUniqueID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssociatedIdentityProvider_ChangeCredential(self: *const T, hwndParent: ?HWND, lpszUniqueID: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IAssociatedIdentityProvider.VTable, self.vtable).ChangeCredential(@ptrCast(*const IAssociatedIdentityProvider, self), hwndParent, lpszUniqueID); } };} pub usingnamespace MethodMixin(@This()); }; const IID_AsyncIAssociatedIdentityProvider_Value = Guid.initString("2834d6ed-297e-4e72-8a51-961e86f05152"); pub const IID_AsyncIAssociatedIdentityProvider = &IID_AsyncIAssociatedIdentityProvider_Value; pub const AsyncIAssociatedIdentityProvider = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Begin_AssociateIdentity: fn( self: *const AsyncIAssociatedIdentityProvider, hwndParent: ?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_AssociateIdentity: fn( self: *const AsyncIAssociatedIdentityProvider, ppPropertyStore: ?*?*IPropertyStore, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_DisassociateIdentity: fn( self: *const AsyncIAssociatedIdentityProvider, hwndParent: ?HWND, lpszUniqueID: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_DisassociateIdentity: fn( self: *const AsyncIAssociatedIdentityProvider, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_ChangeCredential: fn( self: *const AsyncIAssociatedIdentityProvider, hwndParent: ?HWND, lpszUniqueID: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_ChangeCredential: fn( self: *const AsyncIAssociatedIdentityProvider, ) 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 AsyncIAssociatedIdentityProvider_Begin_AssociateIdentity(self: *const T, hwndParent: ?HWND) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIAssociatedIdentityProvider.VTable, self.vtable).Begin_AssociateIdentity(@ptrCast(*const AsyncIAssociatedIdentityProvider, self), hwndParent); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIAssociatedIdentityProvider_Finish_AssociateIdentity(self: *const T, ppPropertyStore: ?*?*IPropertyStore) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIAssociatedIdentityProvider.VTable, self.vtable).Finish_AssociateIdentity(@ptrCast(*const AsyncIAssociatedIdentityProvider, self), ppPropertyStore); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIAssociatedIdentityProvider_Begin_DisassociateIdentity(self: *const T, hwndParent: ?HWND, lpszUniqueID: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIAssociatedIdentityProvider.VTable, self.vtable).Begin_DisassociateIdentity(@ptrCast(*const AsyncIAssociatedIdentityProvider, self), hwndParent, lpszUniqueID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIAssociatedIdentityProvider_Finish_DisassociateIdentity(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIAssociatedIdentityProvider.VTable, self.vtable).Finish_DisassociateIdentity(@ptrCast(*const AsyncIAssociatedIdentityProvider, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIAssociatedIdentityProvider_Begin_ChangeCredential(self: *const T, hwndParent: ?HWND, lpszUniqueID: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIAssociatedIdentityProvider.VTable, self.vtable).Begin_ChangeCredential(@ptrCast(*const AsyncIAssociatedIdentityProvider, self), hwndParent, lpszUniqueID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIAssociatedIdentityProvider_Finish_ChangeCredential(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIAssociatedIdentityProvider.VTable, self.vtable).Finish_ChangeCredential(@ptrCast(*const AsyncIAssociatedIdentityProvider, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const IDENTITY_URL = enum(i32) { CREATE_ACCOUNT_WIZARD = 0, SIGN_IN_WIZARD = 1, CHANGE_PASSWORD_WIZARD = 2, IFEXISTS_WIZARD = 3, ACCOUNT_SETTINGS = 4, RESTORE_WIZARD = 5, CONNECT_WIZARD = 6, }; pub const IDENTITY_URL_CREATE_ACCOUNT_WIZARD = IDENTITY_URL.CREATE_ACCOUNT_WIZARD; pub const IDENTITY_URL_SIGN_IN_WIZARD = IDENTITY_URL.SIGN_IN_WIZARD; pub const IDENTITY_URL_CHANGE_PASSWORD_WIZARD = IDENTITY_URL.CHANGE_PASSWORD_WIZARD; pub const IDENTITY_URL_IFEXISTS_WIZARD = IDENTITY_URL.IFEXISTS_WIZARD; pub const IDENTITY_URL_ACCOUNT_SETTINGS = IDENTITY_URL.ACCOUNT_SETTINGS; pub const IDENTITY_URL_RESTORE_WIZARD = IDENTITY_URL.RESTORE_WIZARD; pub const IDENTITY_URL_CONNECT_WIZARD = IDENTITY_URL.CONNECT_WIZARD; pub const ACCOUNT_STATE = enum(i32) { NOT_CONNECTED = 0, CONNECTING = 1, CONNECT_COMPLETED = 2, }; pub const NOT_CONNECTED = ACCOUNT_STATE.NOT_CONNECTED; pub const CONNECTING = ACCOUNT_STATE.CONNECTING; pub const CONNECT_COMPLETED = ACCOUNT_STATE.CONNECT_COMPLETED; // TODO: this type is limited to platform 'windows8.0' const IID_IConnectedIdentityProvider_Value = Guid.initString("b7417b54-e08c-429b-96c8-678d1369ecb1"); pub const IID_IConnectedIdentityProvider = &IID_IConnectedIdentityProvider_Value; pub const IConnectedIdentityProvider = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ConnectIdentity: fn( self: *const IConnectedIdentityProvider, AuthBuffer: [*:0]u8, AuthBufferSize: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DisconnectIdentity: fn( self: *const IConnectedIdentityProvider, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsConnected: fn( self: *const IConnectedIdentityProvider, Connected: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUrl: fn( self: *const IConnectedIdentityProvider, Identifier: IDENTITY_URL, Context: ?*IBindCtx, PostData: ?*VARIANT, Url: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAccountState: fn( self: *const IConnectedIdentityProvider, pState: ?*ACCOUNT_STATE, ) 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 IConnectedIdentityProvider_ConnectIdentity(self: *const T, AuthBuffer: [*:0]u8, AuthBufferSize: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IConnectedIdentityProvider.VTable, self.vtable).ConnectIdentity(@ptrCast(*const IConnectedIdentityProvider, self), AuthBuffer, AuthBufferSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IConnectedIdentityProvider_DisconnectIdentity(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IConnectedIdentityProvider.VTable, self.vtable).DisconnectIdentity(@ptrCast(*const IConnectedIdentityProvider, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IConnectedIdentityProvider_IsConnected(self: *const T, Connected: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IConnectedIdentityProvider.VTable, self.vtable).IsConnected(@ptrCast(*const IConnectedIdentityProvider, self), Connected); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IConnectedIdentityProvider_GetUrl(self: *const T, Identifier: IDENTITY_URL, Context: ?*IBindCtx, PostData: ?*VARIANT, Url: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IConnectedIdentityProvider.VTable, self.vtable).GetUrl(@ptrCast(*const IConnectedIdentityProvider, self), Identifier, Context, PostData, Url); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IConnectedIdentityProvider_GetAccountState(self: *const T, pState: ?*ACCOUNT_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const IConnectedIdentityProvider.VTable, self.vtable).GetAccountState(@ptrCast(*const IConnectedIdentityProvider, self), pState); } };} pub usingnamespace MethodMixin(@This()); }; const IID_AsyncIConnectedIdentityProvider_Value = Guid.initString("9ce55141-bce9-4e15-824d-43d79f512f93"); pub const IID_AsyncIConnectedIdentityProvider = &IID_AsyncIConnectedIdentityProvider_Value; pub const AsyncIConnectedIdentityProvider = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Begin_ConnectIdentity: fn( self: *const AsyncIConnectedIdentityProvider, AuthBuffer: [*:0]u8, AuthBufferSize: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_ConnectIdentity: fn( self: *const AsyncIConnectedIdentityProvider, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_DisconnectIdentity: fn( self: *const AsyncIConnectedIdentityProvider, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_DisconnectIdentity: fn( self: *const AsyncIConnectedIdentityProvider, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_IsConnected: fn( self: *const AsyncIConnectedIdentityProvider, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_IsConnected: fn( self: *const AsyncIConnectedIdentityProvider, Connected: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_GetUrl: fn( self: *const AsyncIConnectedIdentityProvider, Identifier: IDENTITY_URL, Context: ?*IBindCtx, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_GetUrl: fn( self: *const AsyncIConnectedIdentityProvider, PostData: ?*VARIANT, Url: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_GetAccountState: fn( self: *const AsyncIConnectedIdentityProvider, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_GetAccountState: fn( self: *const AsyncIConnectedIdentityProvider, pState: ?*ACCOUNT_STATE, ) 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 AsyncIConnectedIdentityProvider_Begin_ConnectIdentity(self: *const T, AuthBuffer: [*:0]u8, AuthBufferSize: u32) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIConnectedIdentityProvider.VTable, self.vtable).Begin_ConnectIdentity(@ptrCast(*const AsyncIConnectedIdentityProvider, self), AuthBuffer, AuthBufferSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIConnectedIdentityProvider_Finish_ConnectIdentity(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIConnectedIdentityProvider.VTable, self.vtable).Finish_ConnectIdentity(@ptrCast(*const AsyncIConnectedIdentityProvider, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIConnectedIdentityProvider_Begin_DisconnectIdentity(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIConnectedIdentityProvider.VTable, self.vtable).Begin_DisconnectIdentity(@ptrCast(*const AsyncIConnectedIdentityProvider, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIConnectedIdentityProvider_Finish_DisconnectIdentity(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIConnectedIdentityProvider.VTable, self.vtable).Finish_DisconnectIdentity(@ptrCast(*const AsyncIConnectedIdentityProvider, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIConnectedIdentityProvider_Begin_IsConnected(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIConnectedIdentityProvider.VTable, self.vtable).Begin_IsConnected(@ptrCast(*const AsyncIConnectedIdentityProvider, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIConnectedIdentityProvider_Finish_IsConnected(self: *const T, Connected: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIConnectedIdentityProvider.VTable, self.vtable).Finish_IsConnected(@ptrCast(*const AsyncIConnectedIdentityProvider, self), Connected); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIConnectedIdentityProvider_Begin_GetUrl(self: *const T, Identifier: IDENTITY_URL, Context: ?*IBindCtx) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIConnectedIdentityProvider.VTable, self.vtable).Begin_GetUrl(@ptrCast(*const AsyncIConnectedIdentityProvider, self), Identifier, Context); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIConnectedIdentityProvider_Finish_GetUrl(self: *const T, PostData: ?*VARIANT, Url: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIConnectedIdentityProvider.VTable, self.vtable).Finish_GetUrl(@ptrCast(*const AsyncIConnectedIdentityProvider, self), PostData, Url); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIConnectedIdentityProvider_Begin_GetAccountState(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIConnectedIdentityProvider.VTable, self.vtable).Begin_GetAccountState(@ptrCast(*const AsyncIConnectedIdentityProvider, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIConnectedIdentityProvider_Finish_GetAccountState(self: *const T, pState: ?*ACCOUNT_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIConnectedIdentityProvider.VTable, self.vtable).Finish_GetAccountState(@ptrCast(*const AsyncIConnectedIdentityProvider, self), pState); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IIdentityAuthentication_Value = Guid.initString("5e7ef254-979f-43b5-b74e-06e4eb7df0f9"); pub const IID_IIdentityAuthentication = &IID_IIdentityAuthentication_Value; pub const IIdentityAuthentication = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetIdentityCredential: fn( self: *const IIdentityAuthentication, CredBuffer: ?[*:0]u8, CredBufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ValidateIdentityCredential: fn( self: *const IIdentityAuthentication, CredBuffer: [*:0]u8, CredBufferLength: u32, ppIdentityProperties: ?*?*IPropertyStore, ) 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 IIdentityAuthentication_SetIdentityCredential(self: *const T, CredBuffer: ?[*:0]u8, CredBufferLength: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IIdentityAuthentication.VTable, self.vtable).SetIdentityCredential(@ptrCast(*const IIdentityAuthentication, self), CredBuffer, CredBufferLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdentityAuthentication_ValidateIdentityCredential(self: *const T, CredBuffer: [*:0]u8, CredBufferLength: u32, ppIdentityProperties: ?*?*IPropertyStore) callconv(.Inline) HRESULT { return @ptrCast(*const IIdentityAuthentication.VTable, self.vtable).ValidateIdentityCredential(@ptrCast(*const IIdentityAuthentication, self), CredBuffer, CredBufferLength, ppIdentityProperties); } };} pub usingnamespace MethodMixin(@This()); }; const IID_AsyncIIdentityAuthentication_Value = Guid.initString("f9a2f918-feca-4e9c-9633-61cbf13ed34d"); pub const IID_AsyncIIdentityAuthentication = &IID_AsyncIIdentityAuthentication_Value; pub const AsyncIIdentityAuthentication = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Begin_SetIdentityCredential: fn( self: *const AsyncIIdentityAuthentication, CredBuffer: ?[*:0]u8, CredBufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_SetIdentityCredential: fn( self: *const AsyncIIdentityAuthentication, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_ValidateIdentityCredential: fn( self: *const AsyncIIdentityAuthentication, CredBuffer: [*:0]u8, CredBufferLength: u32, ppIdentityProperties: ?*?*IPropertyStore, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_ValidateIdentityCredential: fn( self: *const AsyncIIdentityAuthentication, ppIdentityProperties: ?*?*IPropertyStore, ) 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 AsyncIIdentityAuthentication_Begin_SetIdentityCredential(self: *const T, CredBuffer: ?[*:0]u8, CredBufferLength: u32) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityAuthentication.VTable, self.vtable).Begin_SetIdentityCredential(@ptrCast(*const AsyncIIdentityAuthentication, self), CredBuffer, CredBufferLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityAuthentication_Finish_SetIdentityCredential(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityAuthentication.VTable, self.vtable).Finish_SetIdentityCredential(@ptrCast(*const AsyncIIdentityAuthentication, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityAuthentication_Begin_ValidateIdentityCredential(self: *const T, CredBuffer: [*:0]u8, CredBufferLength: u32, ppIdentityProperties: ?*?*IPropertyStore) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityAuthentication.VTable, self.vtable).Begin_ValidateIdentityCredential(@ptrCast(*const AsyncIIdentityAuthentication, self), CredBuffer, CredBufferLength, ppIdentityProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityAuthentication_Finish_ValidateIdentityCredential(self: *const T, ppIdentityProperties: ?*?*IPropertyStore) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityAuthentication.VTable, self.vtable).Finish_ValidateIdentityCredential(@ptrCast(*const AsyncIIdentityAuthentication, self), ppIdentityProperties); } };} pub usingnamespace MethodMixin(@This()); }; const CLSID_CoClassIdentityStore_Value = Guid.initString("30d49246-d217-465f-b00b-ac9ddd652eb7"); pub const CLSID_CoClassIdentityStore = &CLSID_CoClassIdentityStore_Value; const CLSID_CIdentityProfileHandler_Value = Guid.initString("ecf5bf46-e3b6-449a-b56b-43f58f867814"); pub const CLSID_CIdentityProfileHandler = &CLSID_CIdentityProfileHandler_Value; // TODO: this type is limited to platform 'windows6.1' const IID_IIdentityStore_Value = Guid.initString("df586fa5-6f35-44f1-b209-b38e169772eb"); pub const IID_IIdentityStore = &IID_IIdentityStore_Value; pub const IIdentityStore = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetCount: fn( self: *const IIdentityStore, pdwProviders: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAt: fn( self: *const IIdentityStore, dwProvider: u32, pProvGuid: ?*Guid, ppIdentityProvider: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddToCache: fn( self: *const IIdentityStore, lpszUniqueID: ?[*:0]const u16, ProviderGUID: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ConvertToSid: fn( self: *const IIdentityStore, lpszUniqueID: ?[*:0]const u16, ProviderGUID: ?*const Guid, cbSid: u16, pSid: ?[*:0]u8, pcbRequiredSid: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumerateIdentities: fn( self: *const IIdentityStore, eIdentityType: IDENTITY_TYPE, pFilterkey: ?*const PROPERTYKEY, pFilterPropVarValue: ?*const PROPVARIANT, ppIdentityEnum: ?*?*IEnumUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IIdentityStore, ) 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 IIdentityStore_GetCount(self: *const T, pdwProviders: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IIdentityStore.VTable, self.vtable).GetCount(@ptrCast(*const IIdentityStore, self), pdwProviders); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdentityStore_GetAt(self: *const T, dwProvider: u32, pProvGuid: ?*Guid, ppIdentityProvider: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IIdentityStore.VTable, self.vtable).GetAt(@ptrCast(*const IIdentityStore, self), dwProvider, pProvGuid, ppIdentityProvider); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdentityStore_AddToCache(self: *const T, lpszUniqueID: ?[*:0]const u16, ProviderGUID: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IIdentityStore.VTable, self.vtable).AddToCache(@ptrCast(*const IIdentityStore, self), lpszUniqueID, ProviderGUID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdentityStore_ConvertToSid(self: *const T, lpszUniqueID: ?[*:0]const u16, ProviderGUID: ?*const Guid, cbSid: u16, pSid: ?[*:0]u8, pcbRequiredSid: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const IIdentityStore.VTable, self.vtable).ConvertToSid(@ptrCast(*const IIdentityStore, self), lpszUniqueID, ProviderGUID, cbSid, pSid, pcbRequiredSid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdentityStore_EnumerateIdentities(self: *const T, eIdentityType: IDENTITY_TYPE, pFilterkey: ?*const PROPERTYKEY, pFilterPropVarValue: ?*const PROPVARIANT, ppIdentityEnum: ?*?*IEnumUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IIdentityStore.VTable, self.vtable).EnumerateIdentities(@ptrCast(*const IIdentityStore, self), eIdentityType, pFilterkey, pFilterPropVarValue, ppIdentityEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdentityStore_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IIdentityStore.VTable, self.vtable).Reset(@ptrCast(*const IIdentityStore, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_AsyncIIdentityStore_Value = Guid.initString("eefa1616-48de-4872-aa64-6e6206535a51"); pub const IID_AsyncIIdentityStore = &IID_AsyncIIdentityStore_Value; pub const AsyncIIdentityStore = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Begin_GetCount: fn( self: *const AsyncIIdentityStore, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_GetCount: fn( self: *const AsyncIIdentityStore, pdwProviders: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_GetAt: fn( self: *const AsyncIIdentityStore, dwProvider: u32, pProvGuid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_GetAt: fn( self: *const AsyncIIdentityStore, pProvGuid: ?*Guid, ppIdentityProvider: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_AddToCache: fn( self: *const AsyncIIdentityStore, lpszUniqueID: ?[*:0]const u16, ProviderGUID: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_AddToCache: fn( self: *const AsyncIIdentityStore, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_ConvertToSid: fn( self: *const AsyncIIdentityStore, lpszUniqueID: ?[*:0]const u16, ProviderGUID: ?*const Guid, cbSid: u16, pSid: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_ConvertToSid: fn( self: *const AsyncIIdentityStore, pSid: ?*u8, pcbRequiredSid: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_EnumerateIdentities: fn( self: *const AsyncIIdentityStore, eIdentityType: IDENTITY_TYPE, pFilterkey: ?*const PROPERTYKEY, pFilterPropVarValue: ?*const PROPVARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_EnumerateIdentities: fn( self: *const AsyncIIdentityStore, ppIdentityEnum: ?*?*IEnumUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_Reset: fn( self: *const AsyncIIdentityStore, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_Reset: fn( self: *const AsyncIIdentityStore, ) 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 AsyncIIdentityStore_Begin_GetCount(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityStore.VTable, self.vtable).Begin_GetCount(@ptrCast(*const AsyncIIdentityStore, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityStore_Finish_GetCount(self: *const T, pdwProviders: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityStore.VTable, self.vtable).Finish_GetCount(@ptrCast(*const AsyncIIdentityStore, self), pdwProviders); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityStore_Begin_GetAt(self: *const T, dwProvider: u32, pProvGuid: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityStore.VTable, self.vtable).Begin_GetAt(@ptrCast(*const AsyncIIdentityStore, self), dwProvider, pProvGuid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityStore_Finish_GetAt(self: *const T, pProvGuid: ?*Guid, ppIdentityProvider: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityStore.VTable, self.vtable).Finish_GetAt(@ptrCast(*const AsyncIIdentityStore, self), pProvGuid, ppIdentityProvider); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityStore_Begin_AddToCache(self: *const T, lpszUniqueID: ?[*:0]const u16, ProviderGUID: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityStore.VTable, self.vtable).Begin_AddToCache(@ptrCast(*const AsyncIIdentityStore, self), lpszUniqueID, ProviderGUID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityStore_Finish_AddToCache(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityStore.VTable, self.vtable).Finish_AddToCache(@ptrCast(*const AsyncIIdentityStore, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityStore_Begin_ConvertToSid(self: *const T, lpszUniqueID: ?[*:0]const u16, ProviderGUID: ?*const Guid, cbSid: u16, pSid: ?*u8) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityStore.VTable, self.vtable).Begin_ConvertToSid(@ptrCast(*const AsyncIIdentityStore, self), lpszUniqueID, ProviderGUID, cbSid, pSid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityStore_Finish_ConvertToSid(self: *const T, pSid: ?*u8, pcbRequiredSid: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityStore.VTable, self.vtable).Finish_ConvertToSid(@ptrCast(*const AsyncIIdentityStore, self), pSid, pcbRequiredSid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityStore_Begin_EnumerateIdentities(self: *const T, eIdentityType: IDENTITY_TYPE, pFilterkey: ?*const PROPERTYKEY, pFilterPropVarValue: ?*const PROPVARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityStore.VTable, self.vtable).Begin_EnumerateIdentities(@ptrCast(*const AsyncIIdentityStore, self), eIdentityType, pFilterkey, pFilterPropVarValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityStore_Finish_EnumerateIdentities(self: *const T, ppIdentityEnum: ?*?*IEnumUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityStore.VTable, self.vtable).Finish_EnumerateIdentities(@ptrCast(*const AsyncIIdentityStore, self), ppIdentityEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityStore_Begin_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityStore.VTable, self.vtable).Begin_Reset(@ptrCast(*const AsyncIIdentityStore, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityStore_Finish_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityStore.VTable, self.vtable).Finish_Reset(@ptrCast(*const AsyncIIdentityStore, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IIdentityStoreEx_Value = Guid.initString("f9f9eb98-8f7f-4e38-9577-6980114ce32b"); pub const IID_IIdentityStoreEx = &IID_IIdentityStoreEx_Value; pub const IIdentityStoreEx = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateConnectedIdentity: fn( self: *const IIdentityStoreEx, LocalName: ?[*:0]const u16, ConnectedName: ?[*:0]const u16, ProviderGUID: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteConnectedIdentity: fn( self: *const IIdentityStoreEx, ConnectedName: ?[*:0]const u16, ProviderGUID: ?*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 IIdentityStoreEx_CreateConnectedIdentity(self: *const T, LocalName: ?[*:0]const u16, ConnectedName: ?[*:0]const u16, ProviderGUID: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IIdentityStoreEx.VTable, self.vtable).CreateConnectedIdentity(@ptrCast(*const IIdentityStoreEx, self), LocalName, ConnectedName, ProviderGUID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdentityStoreEx_DeleteConnectedIdentity(self: *const T, ConnectedName: ?[*:0]const u16, ProviderGUID: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IIdentityStoreEx.VTable, self.vtable).DeleteConnectedIdentity(@ptrCast(*const IIdentityStoreEx, self), ConnectedName, ProviderGUID); } };} pub usingnamespace MethodMixin(@This()); }; const IID_AsyncIIdentityStoreEx_Value = Guid.initString("fca3af9a-8a07-4eae-8632-ec3de658a36a"); pub const IID_AsyncIIdentityStoreEx = &IID_AsyncIIdentityStoreEx_Value; pub const AsyncIIdentityStoreEx = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Begin_CreateConnectedIdentity: fn( self: *const AsyncIIdentityStoreEx, LocalName: ?[*:0]const u16, ConnectedName: ?[*:0]const u16, ProviderGUID: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_CreateConnectedIdentity: fn( self: *const AsyncIIdentityStoreEx, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Begin_DeleteConnectedIdentity: fn( self: *const AsyncIIdentityStoreEx, ConnectedName: ?[*:0]const u16, ProviderGUID: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finish_DeleteConnectedIdentity: fn( self: *const AsyncIIdentityStoreEx, ) 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 AsyncIIdentityStoreEx_Begin_CreateConnectedIdentity(self: *const T, LocalName: ?[*:0]const u16, ConnectedName: ?[*:0]const u16, ProviderGUID: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityStoreEx.VTable, self.vtable).Begin_CreateConnectedIdentity(@ptrCast(*const AsyncIIdentityStoreEx, self), LocalName, ConnectedName, ProviderGUID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityStoreEx_Finish_CreateConnectedIdentity(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityStoreEx.VTable, self.vtable).Finish_CreateConnectedIdentity(@ptrCast(*const AsyncIIdentityStoreEx, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityStoreEx_Begin_DeleteConnectedIdentity(self: *const T, ConnectedName: ?[*:0]const u16, ProviderGUID: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityStoreEx.VTable, self.vtable).Begin_DeleteConnectedIdentity(@ptrCast(*const AsyncIIdentityStoreEx, self), ConnectedName, ProviderGUID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn AsyncIIdentityStoreEx_Finish_DeleteConnectedIdentity(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const AsyncIIdentityStoreEx.VTable, self.vtable).Finish_DeleteConnectedIdentity(@ptrCast(*const AsyncIIdentityStoreEx, self)); } };} pub usingnamespace MethodMixin(@This()); }; //-------------------------------------------------------------------------------- // Section: Functions (0) //-------------------------------------------------------------------------------- //-------------------------------------------------------------------------------- // Section: Unicode Aliases (0) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../../../zig.zig").unicode_mode) { .ansi => struct { }, .wide => struct { }, .unspecified => if (@import("builtin").is_test) struct { } else struct { }, }; //-------------------------------------------------------------------------------- // Section: Imports (12) //-------------------------------------------------------------------------------- const Guid = @import("../../../zig.zig").Guid; const BOOL = @import("../../../foundation.zig").BOOL; const HRESULT = @import("../../../foundation.zig").HRESULT; const HWND = @import("../../../foundation.zig").HWND; const IBindCtx = @import("../../../system/com.zig").IBindCtx; const IEnumUnknown = @import("../../../system/com.zig").IEnumUnknown; const IPropertyStore = @import("../../../ui/shell/properties_system.zig").IPropertyStore; const IUnknown = @import("../../../system/com.zig").IUnknown; const PROPERTYKEY = @import("../../../ui/shell/properties_system.zig").PROPERTYKEY; const PROPVARIANT = @import("../../../system/com/structured_storage.zig").PROPVARIANT; const PWSTR = @import("../../../foundation.zig").PWSTR; const VARIANT = @import("../../../system/com.zig").VARIANT; test { @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/security/authentication/identity/provider.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = 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/test/day04.txt"); const Score = struct { value: u64, lastCell: u64, time: u64, }; fn printBoard(board: [5][5]u64) void { print("----\n", .{}); print("{d: >2} {d: >2} {d: >2} {d: >2} {d: >2}\n", .{ board[0][0], board[0][1], board[0][2], board[0][3], board[0][4] }); print("{d: >2} {d: >2} {d: >2} {d: >2} {d: >2}\n", .{ board[1][0], board[1][1], board[1][2], board[1][3], board[1][4] }); print("{d: >2} {d: >2} {d: >2} {d: >2} {d: >2}\n", .{ board[2][0], board[2][1], board[2][2], board[2][3], board[2][4] }); print("{d: >2} {d: >2} {d: >2} {d: >2} {d: >2}\n", .{ board[3][0], board[3][1], board[3][2], board[3][3], board[3][4] }); print("{d: >2} {d: >2} {d: >2} {d: >2} {d: >2}\n", .{ board[4][0], board[4][1], board[4][2], board[4][3], board[4][4] }); print("\n", .{}); } fn scoreBoard(board: [5][5]u64, scores: []u64) Score { var used = [5][5]u64{ [_]u64{ 0, 0, 0, 0, 0 }, [_]u64{ 0, 0, 0, 0, 0 }, [_]u64{ 0, 0, 0, 0, 0 }, [_]u64{ 0, 0, 0, 0, 0 }, [_]u64{ 0, 0, 0, 0, 0 }, }; for (scores) |score, time| { for (board) |row, ridx| { for (row) |cell, cidx| { if (cell != score) continue; used[ridx][cidx] = 1; var idx: u64 = 0; var rowWise: bool = true; var colWise: bool = true; while (idx < 5) { defer idx += 1; if (used[ridx][idx] == 0) colWise = false; if (used[idx][cidx] == 0) rowWise = false; if (!rowWise and !colWise) break; } else { // printBoard(used); var result: u64 = 0; for (board) |row2, ridx2| { for (row2) |cell2, cidx2| { result += (1 - used[ridx2][cidx2]) * cell2; } } return Score{ .value = result * score, .lastCell = score, .time = time, }; } } } } return Score{ .value = 0, .lastCell = 0, .time = 0 }; } pub fn main() !void { var file = try std.fs.cwd().openFile("data/puzzle/day04.txt", .{}); defer file.close(); var data = file.readToEndAlloc(gpa, 1024 * 1024 * 16) catch unreachable; defer gpa.free(data); var lines = tokenize(data, "\r\n"); var scores_str = split(lines.next().?, ","); var scores_list = ArrayList(u64).init(gpa); defer scores_list.deinit(); while (scores_str.next()) |score_str| { var score = parseInt(u64, score_str, 10) catch unreachable; scores_list.append(score) catch unreachable; } const scores = scores_list.items; var board = [5][5]u64{ [_]u64{ 0, 0, 0, 0, 0 }, [_]u64{ 0, 0, 0, 0, 0 }, [_]u64{ 0, 0, 0, 0, 0 }, [_]u64{ 0, 0, 0, 0, 0 }, [_]u64{ 0, 0, 0, 0, 0 }, }; var bestScore: Score = .{ .value = 0, .lastCell = 0, .time = 999999 }; var worstScore: Score = .{ .value = 0, .lastCell = 0, .time = 0 }; while (lines.next()) |test_line| { // Part 1 var line = test_line; var ridx: u64 = 0; while (ridx < 5) { defer ridx += 1; if (ridx != 0) { line = lines.next().?; } var words = split(line, " "); var cidx: u64 = 0; while (cidx < 5) { defer cidx += 1; var word = words.next().?; while (word.len == 0) { word = words.next().?; } board[ridx][cidx] = parseInt(u64, word, 10) catch unreachable; } } var score = scoreBoard(board, scores); if (score.time < bestScore.time) { bestScore = score; } if (score.time > worstScore.time) { worstScore = score; } } print("{} {} {}\n", .{ bestScore.value, bestScore.lastCell, bestScore.time }); print("{} {} {}\n", .{ worstScore.value, worstScore.lastCell, worstScore.time }); } // 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/day04.zig
const std = @import("std"); const heap = std.heap; const mem = std.mem; const fmt = std.fmt; const print = std.debug.print; const file = @embedFile("../input.txt"); const PasswordEntry = struct { first_num: u32, second_num: u32, letter: u8, password: []const u8, }; pub fn main() !void { // Once again, hard coding the size cause I'm cheating var passwords: [1000]PasswordEntry = undefined; var token_iterator = mem.tokenize(file, "\n"); var index: usize = 0; while (token_iterator.next()) |token| { // This honestly feels like a weird way to do it // Basically we're breaking the line on any of the given characters var line_iterator = mem.tokenize(token, "-: "); const first_string = line_iterator.next().?; const second_string = line_iterator.next().?; const letter_string = line_iterator.next().?; const password_string = line_iterator.next().?; passwords[index] = .{ .first_num = try fmt.parseUnsigned(u32, first_string, 10), .second_num = try fmt.parseUnsigned(u32, second_string, 10), .letter = letter_string[0], .password = <PASSWORD>, }; index += 1; } part1(&passwords); part2(&passwords); } fn part1(passwords: []PasswordEntry) void { var valid_count: usize = 0; for (passwords) |entry| { var letter_count: usize = 0; for (entry.password) |char| { if (char == entry.letter) letter_count += 1; } if (letter_count >= entry.first_num and letter_count <= entry.second_num) { valid_count += 1; } } print("part 1 valid passwords: {}\n", .{valid_count}); } fn part2(passwords: []PasswordEntry) void { var valid_count: usize = 0; for (passwords) |entry| { const is_first_position = entry.password[entry.first_num - 1] == entry.letter; const is_second_position = entry.password[entry.second_num - 1] == entry.letter; if ((is_first_position or is_second_position) and !(is_first_position and is_second_position)) { valid_count += 1; } } print("part 2 valid passwords: {}\n", .{valid_count}); }
2020/day02/zig/day2.zig
const std = @import("../std.zig"); const CpuFeature = std.Target.Cpu.Feature; const CpuModel = std.Target.Cpu.Model; pub const Feature = enum { atomctl, bool, coprocessor, debug, density, dfpaccel, div32, esp32s2, esp32s3, exception, extendedl32r, fp, highpriinterrupts, interrupt, loop, mac16, memctl, miscsr, mul32, mul32high, nsa, prid, regprotect, rvector, s32c1i, sext, threadptr, timerint, windowed, }; pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet; pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas; pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny; pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll; pub const all_features = blk: { const len = @typeInfo(Feature).Enum.fields.len; std.debug.assert(len <= CpuFeature.Set.needed_bit_count); var result: [len]CpuFeature = undefined; result[@enumToInt(Feature.atomctl)] = .{ .llvm_name = "atomctl", .description = "Enable Xtensa ATOMCTL option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.bool)] = .{ .llvm_name = "bool", .description = "Enable Xtensa Boolean extension", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.coprocessor)] = .{ .llvm_name = "coprocessor", .description = "Enable Xtensa Coprocessor option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.debug)] = .{ .llvm_name = "debug", .description = "Enable Xtensa Debug option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.density)] = .{ .llvm_name = "density", .description = "Enable Density instructions", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.dfpaccel)] = .{ .llvm_name = "dfpaccel", .description = "Enable Xtensa Double Precision FP acceleration", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.div32)] = .{ .llvm_name = "div32", .description = "Enable Xtensa Div32 option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.esp32s2)] = .{ .llvm_name = "esp32s2", .description = "Support Xtensa esp32-s2 ISA extension", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.esp32s3)] = .{ .llvm_name = "esp32s3", .description = "Support Xtensa esp32-s3 ISA extension", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.exception)] = .{ .llvm_name = "exception", .description = "Enable Xtensa Exception option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.extendedl32r)] = .{ .llvm_name = "extendedl32r", .description = "Enable Xtensa Extended L32R option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.fp)] = .{ .llvm_name = "fp", .description = "Enable Xtensa Single FP instructions", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.highpriinterrupts)] = .{ .llvm_name = "highpriinterrupts", .description = "Enable Xtensa HighPriInterrupts option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.interrupt)] = .{ .llvm_name = "interrupt", .description = "Enable Xtensa Interrupt option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.loop)] = .{ .llvm_name = "loop", .description = "Enable Xtensa Loop extension", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.mac16)] = .{ .llvm_name = "mac16", .description = "Enable Xtensa MAC16 instructions", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.memctl)] = .{ .llvm_name = "memctl", .description = "Enable Xtensa MEMCTL option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.miscsr)] = .{ .llvm_name = "miscsr", .description = "Enable Xtensa Miscellaneous SR option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.mul32)] = .{ .llvm_name = "mul32", .description = "Enable Xtensa Mul32 option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.mul32high)] = .{ .llvm_name = "mul32high", .description = "Enable Xtensa Mul32High option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.nsa)] = .{ .llvm_name = "nsa", .description = "Enable Xtensa NSA option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.prid)] = .{ .llvm_name = "prid", .description = "Enable Xtensa Processor ID option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.regprotect)] = .{ .llvm_name = "regprotect", .description = "Enable Xtensa Region Protection option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.rvector)] = .{ .llvm_name = "rvector", .description = "Enable Xtensa Relocatable Vector option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.s32c1i)] = .{ .llvm_name = "s32c1i", .description = "Enable Xtensa S32C1I option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sext)] = .{ .llvm_name = "sext", .description = "Enable Xtensa Sign Extend option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.threadptr)] = .{ .llvm_name = "threadptr", .description = "Enable Xtensa THREADPTR option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.timerint)] = .{ .llvm_name = "timerint", .description = "Enable Xtensa Timer Interrupt option", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.windowed)] = .{ .llvm_name = "windowed", .description = "Enable Xtensa Windowed Register option", .dependencies = featureSet(&[_]Feature{}), }; const ti = @typeInfo(Feature); for (result) |*elem, i| { elem.index = i; elem.name = ti.Enum.fields[i].name; } break :blk result; }; pub const cpu = struct { pub const esp32 = CpuModel{ .name = "esp32", .llvm_name = "esp32", .features = featureSet(&[_]Feature{ .atomctl, .bool, .coprocessor, .debug, .density, .dfpaccel, .div32, .exception, .fp, .highpriinterrupts, .interrupt, .loop, .mac16, .memctl, .miscsr, .mul32, .mul32high, .nsa, .prid, .regprotect, .rvector, .s32c1i, .sext, .threadptr, .timerint, .windowed, }), }; pub const esp32_s2 = CpuModel{ .name = "esp32_s2", .llvm_name = "esp32-s2", .features = featureSet(&[_]Feature{ .coprocessor, .debug, .density, .div32, .esp32s2, .exception, .highpriinterrupts, .interrupt, .memctl, .miscsr, .mul32, .mul32high, .nsa, .prid, .regprotect, .rvector, .sext, .threadptr, .timerint, .windowed, }), }; pub const esp32_s3 = CpuModel{ .name = "esp32_s3", .llvm_name = "esp32-s3", .features = featureSet(&[_]Feature{ .atomctl, .bool, .coprocessor, .debug, .density, .dfpaccel, .div32, .esp32s3, .exception, .fp, .highpriinterrupts, .interrupt, .loop, .mac16, .memctl, .miscsr, .mul32, .mul32high, .nsa, .prid, .regprotect, .rvector, .s32c1i, .sext, .threadptr, .timerint, .windowed, }), }; pub const esp8266 = CpuModel{ .name = "esp8266", .llvm_name = "esp8266", .features = featureSet(&[_]Feature{ .debug, .density, .exception, .extendedl32r, .highpriinterrupts, .interrupt, .mul32, .nsa, .prid, .regprotect, .rvector, .timerint, }), }; pub const generic = CpuModel{ .name = "generic", .llvm_name = "generic", .features = featureSet(&[_]Feature{}), }; };
lib/std/target/xtensa.zig
pub const traits = struct { pub usingnamespace @import("traits/has_decl.zig"); pub usingnamespace @import("traits/has_decls.zig"); pub usingnamespace @import("traits/has_field.zig"); pub usingnamespace @import("traits/has_fields.zig"); pub usingnamespace @import("traits/has_function.zig"); pub usingnamespace @import("traits/has_functions.zig"); pub usingnamespace @import("traits/is_container.zig"); pub usingnamespace @import("traits/is_extern.zig"); pub usingnamespace @import("traits/is_float.zig"); pub usingnamespace @import("traits/is_function.zig"); pub usingnamespace @import("traits/is_integral.zig"); pub usingnamespace @import("traits/is_packed.zig"); pub usingnamespace @import("traits/is_same.zig"); pub usingnamespace @import("traits/is_signed_integral.zig"); pub usingnamespace @import("traits/is_slice.zig"); pub usingnamespace @import("traits/is_string.zig"); pub usingnamespace @import("traits/is_tuple.zig"); }; const concepts = struct { pub usingnamespace @import("concepts/container.zig"); pub usingnamespace @import("concepts/decl.zig"); pub usingnamespace @import("concepts/extern.zig"); pub usingnamespace @import("concepts/field.zig"); pub usingnamespace @import("concepts/float.zig"); pub usingnamespace @import("concepts/integral.zig"); pub usingnamespace @import("concepts/method.zig"); pub usingnamespace @import("concepts/packed.zig"); pub usingnamespace @import("concepts/same.zig"); pub usingnamespace @import("concepts/signed_integral.zig"); pub usingnamespace @import("concepts/slice.zig"); pub usingnamespace @import("concepts/string.zig"); pub usingnamespace @import("concepts/tuple.zig"); pub usingnamespace @import("concepts/unsigned_integral.zig"); }; pub usingnamespace concepts; pub fn Concept(comptime concept: []const u8, comptime msg: []const u8) fn (anytype) void { const Closure = struct { fn f(results: anytype) void { comptime { concepts.tuple(@TypeOf(results)); for (results) |result| concepts.same(@TypeOf(result), bool); for (results) |result| if (!result) fail(concept, msg); } } }; return Closure.f; } pub fn err(comptime concept: []const u8, comptime msg: []const u8) void { const base = "concept `" ++ concept ++ "` could not be satisfied"; const extra = " (" ++ msg ++ ")"; comptime { switch (msg.len) { 0 => @compileError(base), else => @compileError(base ++ extra), } } } pub fn fail(comptime concept: []const u8, comptime msg: []const u8) void { const base = "concept `" ++ concept ++ "` was not satisfied"; const extra = " (" ++ msg ++ ")"; comptime { switch (msg.len) { 0 => @compileError(base), else => @compileError(base ++ extra), } } } comptime { @import("std").testing.refAllDecls(@This()); }
src/lib.zig
const std = @import("std"); const Target = std.Target; const Version = std.builtin.Version; const mem = std.mem; const log = std.log; const fs = std.fs; pub fn main() !void { var arena_instance = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena_instance.deinit(); const arena = arena_instance.allocator(); const args = try std.process.argsAlloc(arena); const glibc_src_path = args[1]; const stdout = try exec(arena, &.{ "git", "-C", glibc_src_path, "describe", "--tags" }); if (!mem.startsWith(u8, stdout, "glibc-")) { fatal("the git repository provided does not have an official glibc release tag checked out. git describe returned '{s}'", .{stdout}); } const ver = try Version.parse(mem.trimRight(u8, stdout["glibc-".len..], " \n\r")); const search_dir_path = try fs.path.join(arena, &.{ glibc_src_path, "sysdeps" }); const dest_dir_path = try std.fmt.allocPrint(arena, "glibc/{d}.{d}/sysdeps", .{ ver.major, ver.minor, }); var dest_dir = try std.fs.cwd().makeOpenPath(dest_dir_path, .{}); defer dest_dir.close(); var glibc_src_dir = try std.fs.cwd().openDir(search_dir_path, .{ .iterate = true }); defer glibc_src_dir.close(); var walker = try glibc_src_dir.walk(arena); defer walker.deinit(); while (try walker.next()) |entry| { if (!std.mem.endsWith(u8, entry.basename, ".abilist")) continue; if (fs.path.dirname(entry.path)) |dirname| { try dest_dir.makePath(dirname); } try glibc_src_dir.copyFile(entry.path, dest_dir, entry.path, .{}); } } fn fatal(comptime format: []const u8, args: anytype) noreturn { log.err(format, args); std.process.exit(1); } fn exec(arena: mem.Allocator, argv: []const []const u8) ![]const u8 { const child_result = try std.ChildProcess.exec(.{ .allocator = arena, .argv = argv, .max_output_bytes = 200 * 1024 * 1024, }); if (child_result.stderr.len != 0) { fatal("{s}", .{child_result.stderr}); } switch (child_result.term) { .Exited => |code| if (code == 0) return child_result.stdout else { fatal("{s} exited with code {d}", .{ argv[0], code }); }, else => { fatal("{s} crashed", .{argv[0]}); }, } }
collect_abilist_files.zig
const std = @import("std"); const gjk = @import("gjk.zig"); const v = @import("v.zig"); const World = @This(); comptime { @setFloatMode(.Optimized); } allocator: std.mem.Allocator, gravity: v.Vec2 = .{ 0, 0 }, slop: f64 = 0.1, // Distance to which collision must be accurate active: std.MultiArrayList(Object) = .{}, static: std.ArrayListUnmanaged(Collider.Packed) = .{}, vertices: std.ArrayListUnmanaged(v.Vec2) = .{}, /// Free all memory associated with the world pub fn deinit(self: *World) void { self.active.deinit(self.allocator); self.static.deinit(self.allocator); self.vertices.deinit(self.allocator); } pub fn addObject( self: *World, pos: v.Vec2, phys: Object.PhysicalProperties, collider: Collider, ) !void { const coll = try self.addCollider(collider); errdefer self.vertices.items.len -= collider.verts.len; try self.active.append(self.allocator, .{ .pos = pos, .phys = phys, .collider = coll, }); errdefer @compileError("TODO"); } pub fn addStatic(self: *World, collider: Collider) !void { const coll = try self.addCollider(collider); errdefer self.vertices.items.len -= collider.verts.len; try self.static.append(self.allocator, coll); errdefer @compileError("TODO"); } fn addCollider(self: *World, coll: Collider) !Collider.Packed { std.debug.assert(coll.radius > 0); // TODO: Zero radii are not yet supported (GJK would return zero) const vert_start = self.vertices.items.len; try self.vertices.appendSlice(self.allocator, coll.verts); return Collider.Packed{ .radius = coll.radius, .vert_start = @intCast(u32, vert_start), .num_verts = @intCast(u32, coll.verts.len), }; } pub fn colliders(self: *const World) ColliderIterator { return .{ .active = self.active.slice(), .static = self.static.items, .vertices = self.vertices.items, }; } pub const ColliderIterator = struct { active: std.MultiArrayList(Object).Slice, static: []const Collider.Packed, vertices: []const v.Vec2, idx: u32 = 0, pub fn next(self: *ColliderIterator) ?ColliderInfo { if (self.idx < self.active.len) { const coll = self.active.items(.collider)[self.idx]; const pos = self.active.items(.pos)[self.idx]; self.idx += 1; return ColliderInfo{ .kind = .active, .pos = pos, .collider = coll.reify(self.vertices), }; } else if (self.idx < self.active.len + self.static.len) { const coll = self.static[self.idx - self.active.len]; self.idx += 1; return ColliderInfo{ .kind = .static, .pos = v.v(0), .collider = coll.reify(self.vertices), }; } else { return null; } } }; pub const ColliderInfo = struct { kind: enum { active, static }, pos: v.Vec2, collider: Collider, }; pub fn tick(self: World, dt: f64) !void { const active = self.active.slice(); // Apply drag and gravity for (active.items(.vel)) |*vel| { vel.* = v.v(0.99) * vel.* + v.v(dt) * self.gravity; } // Init movement amounts for each object var movement = try self.allocator.alloc(f64, active.len); defer self.allocator.free(movement); std.mem.set(f64, movement, dt); // Init collision list var collisions = std.ArrayList(CollisionResult).init(self.allocator); defer collisions.deinit(); var done = false; while (!done) { done = true; //// Compute collisions and movement // OPTIM: only iterate objects that haven't converged for (active.items(.pos)) |pos, i| { const info = CollisionInfo{ .pos = pos, .collider = active.items(.collider)[i] .reify(self.vertices.items), }; const vel = active.items(.vel)[i]; const move = v.v(movement[i]) * vel; var min_fac: f64 = 1; // TODO: Collide with active objects // Collide with static colliders // TODO: broad phase var collided = false; for (self.static.items) |collider| { const norm = collide(info, .{ .pos = .{ 0, 0 }, .collider = collider.reify(self.vertices.items), }); // Account for radii const r = info.collider.radius + collider.radius; // This is highly reduced and simplified math that offsets the collided face outwards by // the combined radii, then finds the intersection of the movement vector with that line const k = (r * v.mag(norm) - v.mag2(norm)) / v.dot(norm, move); if (k >= 0) { if (k < min_fac) { min_fac = k; } if (k * v.mag2(move) <= self.slop * self.slop) { collided = true; try collisions.append(.{ .norm = norm, .obj = @intCast(u32, i), }); } } } // Advance movement if no collision if (!collided) { const move_fac = 0.95 * min_fac; const move_vec = move * v.v(move_fac); active.items(.pos)[i] += move_vec; movement[i] *= 1 - move_fac; } if (collided or movement[i] > self.slop) { done = false; } } //// Resolve collisions for (collisions.items) |coll| { const vel = &active.items(.vel)[coll.obj]; // Project velocity onto collided face const axis = v.conj(coll.norm); const p = v.dot(axis, vel.*) / v.dot(axis, axis); // Apply projected velocity to body vel.* = axis * v.v(p); } collisions.clearRetainingCapacity(); } } const CollisionResult = struct { norm: v.Vec2, obj: u32, }; /// Check collision between two colliders. Does not account for radii. fn collide(a: CollisionInfo, b: CollisionInfo) v.Vec2 { const S = struct { a: CollisionInfo, b: CollisionInfo, fn support(pair: @This(), d: v.Vec2) v.Vec2 { // Minkowski difference const as = pair.a.collider.support(d) + pair.a.pos; const bs = pair.b.collider.support(-d) + pair.b.pos; return as - bs; } }; return gjk.minimumPoint(S{ .a = a, .b = b }, S.support); } const CollisionInfo = struct { pos: v.Vec2, collider: Collider, }; pub const Object = struct { pos: v.Vec2, vel: v.Vec2 = v.v(0), phys: PhysicalProperties, collider: Collider.Packed, pub const PhysicalProperties = struct { mass: f64 = 1.0, friction: f64 = 0.0, bounce: f64 = 0.0, }; pub const MovementTick = struct { step: v.Vec2, total: v.Vec2, }; }; pub const Collider = struct { radius: f64 = 0.01, verts: []const v.Vec2 = &.{}, /// Returns the furthest vertex in direction d. /// Does not account for radius. fn support(self: Collider, d: v.Vec2) v.Vec2 { // Start by sampling a few points var supp = Support.init(self.verts, 0, d); _ = supp.improve(self.verts, self.verts.len / 4, d); _ = supp.improve(self.verts, self.verts.len / 2, d); _ = supp.improve(self.verts, 3 * self.verts.len / 4, d); // Improve the guess while (supp.climb(self.verts, d)) {} return self.verts[supp.idx]; } const Support = struct { idx: usize, dot: f64, fn init(verts: []const v.Vec2, idx: usize, d: v.Vec2) Support { return .{ .idx = idx, .dot = v.dot(d, verts[idx]), }; } fn improve(supp: *Support, verts: []const v.Vec2, idx: usize, d: v.Vec2) bool { const new = Support.init(verts, idx, d); if (new.dot > supp.dot) { supp.* = new; return true; } else { return false; } } fn climb(supp: *Support, verts: []const v.Vec2, d: v.Vec2) bool { const li = if (supp.idx + 1 >= verts.len) 0 else supp.idx + 1; const ri = if (supp.idx == 0) verts.len - 1 else supp.idx - 1; const l_good = supp.improve(verts, li, d); const r_good = supp.improve(verts, ri, d); return l_good or r_good; } }; pub const Packed = struct { radius: f64, vert_start: u32, num_verts: u32, pub fn reify(self: Packed, verts: []const v.Vec2) Collider { return .{ .radius = self.radius, .verts = verts[self.vert_start .. self.vert_start + self.num_verts], }; } }; };
World.zig
// std lib imports const std = @import("std"); const fs = std.fs; const testing = std.testing; const debug = std.debug.print; pub const log_level: std.log.Level = .debug; // application-specific imports const argparse = @import("argparse.zig"); const config = @import("config.zig"); const Console = @import("console.zig").Console; const httpclient = @import("httpclient.zig"); const io = @import("io.zig"); const kvstore = @import("kvstore.zig"); const Parser = @import("parser.zig").Parser; const pretty = @import("pretty.zig"); const threadpool = @import("threadpool.zig"); const types = @import("types.zig"); const utils = @import("utils.zig"); const Entry = types.Entry; const EntryResult = types.EntryResult; const TestContext = types.TestContext; const HttpMethod = types.HttpMethod; const HttpHeader = types.HttpHeader; const ExtractionEntry = types.ExtractionEntry; const AppArguments = argparse.AppArguments; const expressionExtractor = @import("parser_expressions.zig").expressionExtractor; // To be replacable, e.g. for tests. TODO: Make argument to AppContext pub var httpClientProcessEntry: fn (*Entry, httpclient.ProcessArgs, *EntryResult) anyerror!void = undefined; const initBoundedArray = utils.initBoundedArray; pub const errors = error{ Ok, ParseError, TestFailed, TestsFailed, }; const ExitCode = enum(u8) { Ok = 0, ProcessError = 1, TestsFailed = 2, }; pub fn exit(code: ExitCode) noreturn { std.process.exit(@enumToInt(code)); } pub fn fatal(comptime format: []const u8, args: anytype) noreturn { std.debug.print(format, args); exit(.ProcessError); } const ProcessStatistics = struct { time_total: i64 = 0, time_min: i64 = undefined, time_max: i64 = undefined, time_avg: i64 = undefined, }; const ExecutionStats = struct { num_tests: u64 = 0, num_success: u64 = 0, num_fail: u64 = 0, }; /// Main CLI entry point. Mainly responsible for wrapping mainInner() pub fn main() !void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const aa = arena.allocator(); const args = try std.process.argsAlloc(aa); defer std.process.argsFree(aa, args); if (args.len == 1) { argparse.printHelp(false); std.process.exit(0); } // Set up default handler to process requests httpClientProcessEntry = httpclient.processEntry; var stats = mainInner(aa, args[1..]) catch |e| { fatal("Exited due to failure: {s}\n", .{e}); }; if (stats.num_fail > 0) { exit(.TestsFailed); } exit(.Ok); } /// Main functional starting point - move to AppContext? pub fn mainInner(allocator: std.mem.Allocator, args: [][]const u8) anyerror!ExecutionStats { try httpclient.init(); defer httpclient.deinit(); // Shared variable-buffer between .env-files and -D-arguments var input_vars = kvstore.KvStore{}; // Parse arguments / show help var parsed_args = argparse.parseArgs(args, &input_vars) catch |e| switch (e) { error.OkExit => { return ExecutionStats{}; }, else => { std.debug.print("Invalid arguments.\n", .{}); argparse.printHelp(true); fatal("Exiting.\n", .{}); }, }; // Scrap-buffer to use throughout tests var test_ctx = try allocator.create(TestContext); defer allocator.destroy(test_ctx); // "Global" definitions to be used by main parts of application var stdout = std.io.getStdOut().writer(); var stderr = std.io.getStdErr().writer(); const console = Console.init(.{ .std_writer = if (!parsed_args.silent) stdout else null, .debug_writer = stdout, .verbose_writer = if (!parsed_args.verbose) null else stdout, .error_writer = if (!parsed_args.silent) stderr else null, .colors = parsed_args.colors, }); var app_ctx = try AppContext.create(allocator, console); defer app_ctx.destroy(); // Expand files e.g. if folders are passed console.verbosePrint("Processing input file arguments\n", .{}); argparse.processInputFileArguments(parsed_args.files.buffer.len, &parsed_args.files) catch |e| { fatal("Could not process input file arguments: {s}\n", .{e}); }; if (parsed_args.input_vars_file.constSlice().len > 0) { console.verbosePrint("Attempting to read input variables from: {s}\n", .{parsed_args.input_vars_file.constSlice()}); input_vars = try app_ctx.envFileToKvStore(fs.cwd(), parsed_args.input_vars_file.constSlice()); } var extracted_vars = kvstore.KvStore{}; var stats = ExecutionStats{}; if (parsed_args.playbook_file.constSlice().len > 0) { // Process playbook console.verbosePrint("Got playbook: {s}\n", .{parsed_args.playbook_file.constSlice()}); stats = try app_ctx.processPlaybookFile(parsed_args.playbook_file.constSlice(), &parsed_args, &input_vars, &extracted_vars); } else { // Process regular list of entries stats = try app_ctx.processTestlist(&parsed_args, &input_vars, &extracted_vars); } if (stats.num_fail > 0) { console.errorPrint("Not all tests were successful: {d} of {d} failed\n", .{ stats.num_fail, stats.num_tests }); } return stats; } /// Main structure of the application pub const AppContext = struct { console: Console, parser: Parser, test_ctx: *TestContext, allocator: std.mem.Allocator, // args: *argparse.AppArguments, /// Att! Allocates memory for both self and .test_ctx. Can be freed with .destroy(). pub fn create(allocator: std.mem.Allocator, console: Console) !*AppContext { // Scrap-buffer to use throughout tests var test_ctx = try allocator.create(TestContext); // Construct self var self = try allocator.create(AppContext); self.* = AppContext{ .allocator = allocator, .console = console, .parser = Parser{ .console = &console }, .test_ctx = test_ctx, }; return self; } /// Free any allocated resources owned by this, including self. pub fn destroy(app_ctx: *AppContext) void { app_ctx.allocator.destroy(app_ctx.test_ctx); app_ctx.allocator.destroy(app_ctx); } // Process entry and evaluate results. Returns error-type in case of either parse error, process error or evaluation error pub fn processEntryMain(app_ctx: *AppContext, test_ctx: *TestContext, args: *AppArguments, buf: []const u8, repeats: u32, stats: *ProcessStatistics, line_idx_offset: usize) !void { const console = app_ctx.console; var entry: *Entry = &test_ctx.entry; var result: *EntryResult = &test_ctx.result; try app_ctx.parser.parseContents(buf, entry, line_idx_offset); // TODO: Refactor this to better unify the different call-methods/variants stats.time_max = 0; stats.time_min = std.math.maxInt(i64); if (args.multithreaded and repeats > 1) { console.verbosePrint("Starting multithreaded test ({d} threads working total {d} requests)\n", .{ try std.Thread.getCpuCount(), repeats }); // We start naively, by sharing data, although it's not high-performance optimal, but // it's a starting point from which we can improve once we've identifed all pitfalls const Payload = struct { const Self = @This(); // TODO: Add mutexes stats: *ProcessStatistics, entry: *Entry, result: *EntryResult, args: *const AppArguments, pub fn worker(self: *Self) void { var entry_time_start = std.time.milliTimestamp(); if (httpClientProcessEntry(self.entry, .{ .ssl_insecure = self.args.ssl_insecure, .verbose = self.args.verbose_curl }, self.result)) { if (!isEntrySuccessful(self.entry, self.result)) { self.result.num_fails += 1; self.result.conclusion = false; } else { self.result.conclusion = true; } } else |_| { // Error self.result.num_fails += 1; self.result.conclusion = false; } var entry_time = std.time.milliTimestamp() - entry_time_start; self.stats.time_max = std.math.max(entry_time, self.stats.time_max); self.stats.time_min = std.math.min(entry_time, self.stats.time_min); self.stats.time_total += entry_time; } }; // Setup and execute pool // const coreCount = try std.Thread.getCpuCount(); var pool = threadpool.ThreadPool(Payload, 1000, Payload.worker).init(try std.Thread.getCpuCount()); var i: usize = 0; while (i < repeats) : (i += 1) { try pool.addWork(Payload{ .stats = stats, .entry = entry, .args = args, .result = result, }); } try pool.startAndJoin(); // Can fail if unable to spawn thread, but then we are in trouble anyways // Evaluate results? } else { console.verbosePrint("Starting singlethreaded test ({d} requests)\n", .{repeats}); const time_total_start = std.time.milliTimestamp(); var i: usize = 0; while (i < repeats) : (i += 1) { var entry_time_start = std.time.milliTimestamp(); if (httpClientProcessEntry(entry, .{ .ssl_insecure = args.ssl_insecure, .verbose = args.verbose_curl }, result)) { if (!isEntrySuccessful(entry, result)) { result.num_fails += 1; result.conclusion = false; } else { result.conclusion = true; } } else |_| { // Error result.num_fails += 1; result.conclusion = false; } var entry_time = std.time.milliTimestamp() - entry_time_start; stats.time_max = std.math.max(entry_time, stats.time_max); stats.time_min = std.math.min(entry_time, stats.time_min); } stats.time_total = std.time.milliTimestamp() - time_total_start; } stats.time_avg = @divTrunc(stats.time_total, @intCast(i64, repeats)); } fn extractExtractionEntries(app_ctx: *AppContext, entry: Entry, result: EntryResult, store: *kvstore.KvStore) !void { // Extract to variables for (entry.extraction_entries.constSlice()) |v| { if (expressionExtractor(result.response_first_1mb.constSlice(), v.expression.constSlice())) |expression_result| { // Got match in response body try store.add(v.name.constSlice(), expression_result.result); } else if (expressionExtractor(result.response_headers_first_1mb.constSlice(), v.expression.constSlice())) |expression_result| { // Got match in response headers try store.add(v.name.constSlice(), expression_result.result); } else { app_ctx.console.errorPrint("Could not find match for '{s}={s}'\n", .{ v.name.constSlice(), v.expression.constSlice() }); return error.UnableToExtractExtractionEntry; } } } /// Main do'er to do anything related to orchestrating the execution of the entry, repeats and outputting the results /// Common to both regular flow (entries as arguments) and playbooks fn processAndEvaluateEntryFromBuf(app_ctx: *AppContext, idx: u64, total: u64, entry_name: []const u8, entry_buf: []const u8, args: *AppArguments, input_vars: *kvstore.KvStore, extracted_vars: *kvstore.KvStore, repeats: u32, line_idx_offset: usize) !void { const console = app_ctx.console; var test_ctx = app_ctx.test_ctx; test_ctx.* = .{}; // Reset _ = input_vars; test_ctx.entry.repeats = repeats; // Do var stats: ProcessStatistics = .{}; console.verbosePrint("Processing entry: {s}\n", .{entry_name}); processEntryMain(app_ctx, test_ctx, args, entry_buf, repeats, &stats, line_idx_offset) catch |err| { // TODO: Switch the errors and give helpful output console.errorPrint("{d}/{d}: {s:<64} : Process error {s}\n", .{ idx, total, entry_name, err }); return error.CouldNotProcessEntry; }; var conclusion = test_ctx.result.conclusion; ////////////////////////// // Evaluate results ////////////////////////// // Output neat and tidy output, respectiong args .silent, .data and .verbose if (conclusion) { // Success console.stdPrint("{d}/{d}: {s:<64} : OK (HTTP {d} - {s})\n", .{ idx, total, entry_name, test_ctx.result.response_http_code, httpclient.httpCodeToString(test_ctx.result.response_http_code) }); } else { // Errors console.errorPrint("{d}/{d}: {s:<64} : ERROR (HTTP {d} - {s})\n", .{ idx, total, entry_name, test_ctx.result.response_http_code, httpclient.httpCodeToString(test_ctx.result.response_http_code) }); } // Print stats if (repeats == 1) { console.stdColored(.Dim, " time: {}ms\n", .{stats.time_total}); } else { console.stdColored(.Dim, " {} iterations. {} OK, {} Error\n", .{ repeats, repeats - test_ctx.result.num_fails, test_ctx.result.num_fails }); console.stdColored(.Dim, " time: {}ms/{} iterations [{}ms-{}ms] avg:{}ms\n", .{ stats.time_total, repeats, stats.time_min, stats.time_max, stats.time_avg }); } // Check if test as a total is considered successfull (http code match + optional pattern match requirement) if (conclusion) { // No need to extract if not successful // Failure to extract is a failure to the test try app_ctx.extractExtractionEntries(test_ctx.entry, test_ctx.result, extracted_vars); // Print all stored variables if (args.verbose and extracted_vars.store.slice().len > 0) { console.verbosePrint("Values extracted from response:\n", .{}); console.verbosePrint("-" ** 80 ++ "\n", .{}); for (extracted_vars.store.slice()) |v| { console.verbosePrint("* {s}={s}\n", .{ v.key.constSlice(), v.value.constSlice() }); } console.verbosePrint("-" ** 80 ++ "\n", .{}); } } else { console.stdPrint("{s} {s:<64}\n", .{ test_ctx.entry.method, test_ctx.entry.url.slice() }); if (test_ctx.result.response_http_code != test_ctx.entry.expected_http_code) { console.errorPrint("Expected HTTP '{d} - {s}', got '{d} - {s}'\n", .{ test_ctx.entry.expected_http_code, httpclient.httpCodeToString(test_ctx.entry.expected_http_code), test_ctx.result.response_http_code, httpclient.httpCodeToString(test_ctx.result.response_http_code) }); } if (!test_ctx.result.response_match and test_ctx.entry.expected_response_substring.constSlice().len > 0) { console.errorPrint("Match requirement '{s}' was not successful\n", .{test_ctx.entry.expected_response_substring.constSlice()}); } } // Check for conditions to print response data // If not --silent, it will by default print response upon failed tests // To show response for successful tests: --show-response // TBD: What if we want overrall results, but no data upon failed tests? if ((!conclusion and !args.silent) or args.show_response_data) { // Headers if (test_ctx.result.response_headers_first_1mb.slice().len > 0) { console.stdColored(.Bold, "Incoming headers (up to 1024KB):\n", .{}); console.stdPrint("{s}\n\n", .{std.mem.trimRight(u8, utils.sliceUpTo(u8, test_ctx.result.response_headers_first_1mb.slice(), 0, 1024 * 1024), "\r\n")}); } // Body if (test_ctx.result.response_first_1mb.slice().len > 0) { console.stdColored(.Bold, "Response (up to 1024KB):\n", .{}); if (!args.show_pretty_response_data) { console.debugPrint("{s}\n\n", .{utils.sliceUpTo(u8, test_ctx.result.response_first_1mb.slice(), 0, 1024 * 1024)}); } else if (console.debug_writer) |debug_writer| { try pretty.getPrettyPrinterByContentType(test_ctx.result.response_content_type.slice())(debug_writer, test_ctx.result.response_first_1mb.slice()); } console.stdPrint("\n", .{}); } } if (!conclusion) return error.TestFailed; } fn getNumOfSegmentType(segments: []const Parser.PlaybookSegment, segment_type: Parser.PlaybookSegmentType) u64 { var result: u64 = 0; for (segments) |segment| { if (segment.segment_type == segment_type) result += 1; } return result; } fn processPlaybookFile(app_ctx: *AppContext, playbook_path: []const u8, args: *AppArguments, input_vars: *kvstore.KvStore, extracted_vars: *kvstore.KvStore) !ExecutionStats { var buf_playbook = initBoundedArray(u8, config.MAX_PLAYBOOK_FILE_SIZE); // Att: this must be kept as it is used to look up data from for the segments io.readFile(buf_playbook.buffer.len, playbook_path, &buf_playbook) catch { app_ctx.console.errorPrint("Could not read playbook file: {s}\n", .{playbook_path}); return error.CouldNotReadFile; }; // Playbooks shall resolve file-includes relative to self var playbook_parent_path = io.getParent(playbook_path); return app_ctx.processPlaybookBuf(&buf_playbook, playbook_parent_path, args, input_vars, extracted_vars); } fn processPlaybookBuf(app_ctx: *AppContext, buf_playbook: *std.BoundedArray(u8, config.MAX_PLAYBOOK_FILE_SIZE), playbook_basedir: []const u8, args: *AppArguments, input_vars: *kvstore.KvStore, extracted_vars: *kvstore.KvStore) !ExecutionStats { const console = app_ctx.console; var parser = app_ctx.parser; // Load playbook var buf_scrap = initBoundedArray(u8, 16 * 1024); var buf_test = initBoundedArray(u8, config.MAX_TEST_FILE_SIZE); var segments = initBoundedArray(Parser.PlaybookSegment, 128); try segments.resize(Parser.parsePlaybook(buf_playbook.constSlice(), segments.unusedCapacitySlice())); // Iterate over playbook and act according to each type var num_failed: u64 = 0; var num_processed: u64 = 0; var total_num_tests = getNumOfSegmentType(segments.constSlice(), .TestInclude) + getNumOfSegmentType(segments.constSlice(), .TestRaw); var variables_sets = [_]*kvstore.KvStore{ input_vars, extracted_vars }; const time_start = std.time.milliTimestamp(); // Pass through each item and process according to type for (segments.constSlice()) |segment| { try buf_test.resize(0); console.verbosePrint("Processing segment type: {s}, line: {d}\n", .{ segment.segment_type, segment.line_start }); switch (segment.segment_type) { .Unknown => { unreachable; }, .TestInclude, .TestRaw => { // We got a test. // For file-based tests: read the file to a buffer // For in-playbook tests: copy the contents to buffer // - then from that point on: unified processing num_processed += 1; var name_buf: [128]u8 = undefined; var name_slice: []u8 = undefined; var repeats: u32 = 1; if (segment.segment_type == .TestInclude) { name_slice = try std.fmt.bufPrint(&name_buf, "{s}", .{utils.constSliceUpTo(u8, segment.slice, 0, name_buf.len)}); repeats = segment.meta.TestInclude.repeats; console.verbosePrint("Processing: {s}\n", .{segment.slice}); var full_path = try io.getRealPath(playbook_basedir, segment.slice, buf_scrap.unusedCapacitySlice()); // Load from file and parse io.readFile(buf_test.buffer.len, full_path, &buf_test) catch |e| { parser.parseErrorArg("Could not read file ({s})", .{e}, segment.line_start, 0, buf_test.constSlice(), segment.slice); num_failed += 1; continue; }; } else { // Test raw name_slice = try std.fmt.bufPrint(&name_buf, "Inline segment starting at line: {d}", .{segment.line_start}); try buf_test.appendSlice(segment.slice); } // Expand variables Parser.expandVariablesAndFunctions(buf_test.buffer.len, &buf_test, variables_sets[0..]) catch {}; // Execute the test if (app_ctx.processAndEvaluateEntryFromBuf(num_processed, total_num_tests, name_slice, buf_test.constSlice(), args, input_vars, extracted_vars, repeats, segment.line_start)) { // OK } else |_| { num_failed += 1; if (args.early_quit) { console.errorPrint("Early-quit is active, so aborting further steps\n", .{}); break; } } }, .EnvInclude => { // Load from file and parse console.verbosePrint("Loading env-file: '{s}'\n", .{segment.slice}); var full_path = try io.getRealPath(playbook_basedir, segment.slice, buf_scrap.unusedCapacitySlice()); try input_vars.addFromOther((try app_ctx.envFileToKvStore(fs.cwd(), full_path)), .Fail); }, .EnvRaw => { // Parse key=value directly console.verbosePrint("Loading in-file env at line {d}\n", .{segment.line_start}); try buf_scrap.resize(0); try buf_scrap.appendSlice(segment.slice); // Expand functions Parser.expandVariablesAndFunctions(buf_scrap.buffer.len, &buf_scrap, null) catch {}; try input_vars.addFromBuffer(buf_scrap.constSlice(), .Fail); }, } } console.stdPrint( \\------------------ \\{d}/{d} OK \\------------------ \\FINISHED - total time: {d}s \\ , .{ num_processed - num_failed, total_num_tests, @intToFloat(f64, std.time.milliTimestamp() - time_start) / 1000 }); return ExecutionStats{ .num_tests = num_processed, .num_success = num_processed - num_failed, .num_fail = num_failed, }; } // Regular path for tests passed as arguments fn processTestlist(app_ctx: *AppContext, args: *AppArguments, input_vars: *kvstore.KvStore, extracted_vars: *kvstore.KvStore) !ExecutionStats { const console = app_ctx.console; var buf_testfile = initBoundedArray(u8, config.MAX_TEST_FILE_SIZE); var num_processed: u64 = 0; var num_failed: u64 = 0; const time_start = std.time.milliTimestamp(); // Used to check if we enter a folder var folder_local_vars: kvstore.KvStore = undefined; var current_folder: []const u8 = undefined; var variables_sets = [_]*kvstore.KvStore{ &folder_local_vars, input_vars, extracted_vars }; // Get num of .pi-files in args.files var total_num_tests: u64 = 0; for (args.files.constSlice()) |file| { if (std.mem.endsWith(u8, file.constSlice(), config.FILE_EXT_TEST)) { total_num_tests += 1; } } for (args.files.slice()) |file| { // If new folder: clear folder_local_vars if (!std.mem.eql(u8, current_folder, io.getParent(file.constSlice()))) { folder_local_vars = kvstore.KvStore{}; current_folder = io.getParent(file.constSlice()); } // .env: load if (std.mem.endsWith(u8, file.constSlice(), config.FILE_EXT_ENV)) { console.verbosePrint("Loading .env: {s}\n", .{file.constSlice()}); try folder_local_vars.addFromOther(try app_ctx.envFileToKvStore(fs.cwd(), file.constSlice()), .KeepFirst); } if (!std.mem.endsWith(u8, file.constSlice(), config.FILE_EXT_TEST)) continue; num_processed += 1; ////////////////// // Process ////////////////// io.readFile(buf_testfile.buffer.len, file.constSlice(), &buf_testfile) catch { console.errorPrint("Could not read file: {s}\n", .{file.constSlice()}); num_failed += 1; continue; }; // Expand all variables Parser.expandVariablesAndFunctions(buf_testfile.buffer.len, &buf_testfile, variables_sets[0..]) catch {}; if (app_ctx.processAndEvaluateEntryFromBuf(num_processed, total_num_tests, file.constSlice(), buf_testfile.constSlice(), args, input_vars, extracted_vars, 1, 0)) { // OK } else |_| { num_failed += 1; if (args.early_quit) { console.errorPrint("Early-quit is active, so aborting further tests\n", .{}); break; } } if (args.delay > 0) { console.verbosePrint("Delaying next test with {}ms\n", .{args.delay}); std.time.sleep(args.delay * 1000000); } } console.stdPrint( \\------------------ \\{d}/{d} OK \\------------------ \\FINISHED - total time: {d}s \\ , .{ num_processed - num_failed, total_num_tests, @intToFloat(f64, std.time.milliTimestamp() - time_start) / 1000 }); return ExecutionStats{ .num_tests = num_processed, .num_success = num_processed - num_failed, .num_fail = num_failed, }; } pub fn envFileToKvStore(app_ctx: *AppContext, dir: fs.Dir, path: []const u8) !kvstore.KvStore { var tmpbuf = initBoundedArray(u8, config.MAX_ENV_FILE_SIZE); io.readFileRel(tmpbuf.buffer.len, dir, path, &tmpbuf) catch { app_ctx.console.errorPrint("Could not read .env-file: {s}\n", .{path}); return error.CouldNotReadFile; }; // Expand functions try Parser.expandVariablesAndFunctions(tmpbuf.buffer.len, &tmpbuf, null); return try kvstore.KvStore.fromBuffer(tmpbuf.constSlice()); } }; // Standalone functions fn isEntrySuccessful(entry: *Entry, result: *EntryResult) bool { if (entry.expected_response_substring.constSlice().len > 0 and std.mem.indexOf(u8, result.response_first_1mb.constSlice(), entry.expected_response_substring.constSlice()) == null) { result.response_match = false; return false; } result.response_match = true; if (entry.expected_http_code != 0 and entry.expected_http_code != result.response_http_code) return false; return true; } test "envFileToKvStore" { var app_ctx = try AppContext.create(std.testing.allocator, Console.initNull()); defer app_ctx.destroy(); var store = try app_ctx.envFileToKvStore(fs.cwd(), "testdata/env"); try testing.expect(store.count() == 2); try testing.expectEqualStrings("value", store.get("key").?); try testing.expectEqualStrings("dabba", store.get("abba").?); } test "extracted variables shall be expanded in next test" { var allocator = std.testing.allocator; var buf_test1 = try allocator.create(std.BoundedArray(u8, config.MAX_TEST_FILE_SIZE)); defer allocator.destroy(buf_test1); buf_test1.* = try std.BoundedArray(u8, config.MAX_TEST_FILE_SIZE).fromSlice( \\> GET https://some.url/api/step1 \\< 0 \\MYVAR=token:"()" [0..]); var buf_test2 = try allocator.create(std.BoundedArray(u8, config.MAX_TEST_FILE_SIZE)); defer allocator.destroy(buf_test2); buf_test2.* = try std.BoundedArray(u8, config.MAX_TEST_FILE_SIZE).fromSlice( \\> GET https://some.url/api/step2 \\-- \\MYVAR={{MYVAR}} \\< 0 [0..]); var app_ctx = try AppContext.create(std.testing.allocator, Console.initNull()); defer app_ctx.destroy(); var args = AppArguments{}; var input_vars = kvstore.KvStore{}; var extracted_vars = kvstore.KvStore{}; var variables_sets = [_]*kvstore.KvStore{ &input_vars, &extracted_vars }; // Mock httpclient, this can be generalized for multiple tests const HttpClientOverrides = struct { pub fn step1(_: *Entry, _: httpclient.ProcessArgs, result: *EntryResult) !void { try result.response_first_1mb.resize(0); try result.response_first_1mb.appendSlice( \\token:"<PASSWORD>" [0..]); } }; // Handle step 1 var oldProcess = httpClientProcessEntry; httpClientProcessEntry = HttpClientOverrides.step1; Parser.expandVariablesAndFunctions(buf_test1.buffer.len, buf_test1, variables_sets[0..]) catch {}; try app_ctx.processAndEvaluateEntryFromBuf(1, 2, "step1"[0..], buf_test1.constSlice(), &args, &input_vars, &extracted_vars, 1, 0); try testing.expect(extracted_vars.slice().len == 1); // Handle step 2 Parser.expandVariablesAndFunctions(buf_test2.buffer.len, buf_test2, variables_sets[0..]) catch {}; try testing.expect(std.mem.indexOf(u8, buf_test2.constSlice(), "{{MYVAR}}") == null); try testing.expect(std.mem.indexOf(u8, buf_test2.constSlice(), "MYVAR={{MYVAR}}") == null); try testing.expect(std.mem.indexOf(u8, buf_test2.constSlice(), "MYVAR=123123") != null); httpClientProcessEntry = oldProcess; }
src/main.zig
const std = @import("std"); const Registry = @import("registry.zig").Registry; const Entity = @import("registry.zig").Entity; pub const Actor = struct { registry: *Registry, entity: Entity = undefined, pub fn init(registry: *Registry) Actor { var reg = registry; return .{ .registry = registry, .entity = reg.create(), }; } pub fn deinit(self: *Actor) void { self.registry.destroy(self.entity); } pub fn add(self: *Actor, value: anytype) void { self.registry.add(self.entity, value); } pub fn addTyped(self: *Actor, comptime T: type, value: T) void { self.registry.addTyped(T, self.entity, value); } pub fn remove(self: *Actor, comptime T: type) void { self.registry.remove(T, self.entity); } pub fn has(self: *Actor, comptime T: type) bool { return self.registry.has(T, self.entity); } pub fn get(self: *Actor, comptime T: type) *T { return self.registry.get(T, self.entity); } pub fn tryGet(self: *Actor, comptime T: type) ?*T { return self.registry.tryGet(T, self.entity); } }; test "actor" { var reg = Registry.init(std.testing.allocator); defer reg.deinit(); var actor = Actor.init(&reg); defer actor.deinit(); std.debug.assert(!actor.has(f32)); actor.addTyped(f32, 67.45); if (actor.tryGet(f32)) |val| { try std.testing.expectEqual(val.*, 67.45); } actor.addTyped(u64, 8888); try std.testing.expectEqual(actor.get(u64).*, 8888); std.debug.assert(actor.has(u64)); actor.remove(u64); std.debug.assert(!actor.has(u64)); } test "actor structs" { const Velocity = struct { x: f32, y: f32 }; const Position = struct { x: f32 = 0, y: f32 = 0 }; var reg = Registry.init(std.testing.allocator); defer reg.deinit(); var actor = Actor.init(&reg); defer actor.deinit(); actor.add(Velocity{ .x = 5, .y = 10 }); actor.add(Position{}); var vel = actor.get(Velocity); var pos = actor.get(Position); pos.*.x += vel.x; pos.*.y += vel.y; try std.testing.expectEqual(actor.get(Position).*.x, 5); try std.testing.expectEqual(actor.get(Position).*.y, 10); }
src/ecs/actor.zig
const c = @import("c.zig").c; // must be in sync with GLFW C constants in modifier group, search for "@defgroup mods Modifier key flags" /// A bitmask of all key modifiers pub const Mods = packed struct { shift: bool = false, control: bool = false, alt: bool = false, super: bool = false, caps_lock: bool = false, num_lock: bool = false, _reserved: u2 = 0, inline fn verifyIntType(comptime IntType: type) void { comptime { switch (@typeInfo(IntType)) { .Int => {}, else => @compileError("Int was not of int type"), } } } pub inline fn toInt(self: Mods, comptime IntType: type) IntType { verifyIntType(IntType); return @intCast(IntType, @bitCast(u8, self)); } pub inline fn fromInt(flags: anytype) Mods { verifyIntType(@TypeOf(flags)); return @bitCast(Mods, @intCast(u8, flags)); } }; /// Holds all GLFW mod values in their raw form. pub const RawMods = struct { /// If this bit is set one or more Shift keys were held down. pub const shift = c.GLFW_MOD_SHIFT; /// If this bit is set one or more Control keys were held down. pub const control = c.GLFW_MOD_CONTROL; /// If this bit is set one or more Alt keys were held down. pub const alt = c.GLFW_MOD_ALT; /// If this bit is set one or more Super keys were held down. pub const super = c.GLFW_MOD_SUPER; /// If this bit is set the Caps Lock key is enabled and the glfw.lock_key_mods input mode is set. pub const caps_lock = c.GLFW_MOD_CAPS_LOCK; /// If this bit is set the Num Lock key is enabled and the glfw.lock_key_mods input mode is set. pub const num_lock = c.GLFW_MOD_NUM_LOCK; }; test "shift int to bitmask" { const std = @import("std"); const int_mod = RawMods.shift; const mod = Mods.fromInt(int_mod); try std.testing.expect(mod.shift == true); try std.testing.expect(mod.control == false); try std.testing.expect(mod.alt == false); try std.testing.expect(mod.super == false); try std.testing.expect(mod.caps_lock == false); try std.testing.expect(mod.num_lock == false); } test "shift int and alt to bitmask" { const std = @import("std"); const int_mod = RawMods.shift | RawMods.alt; const mod = Mods.fromInt(int_mod); try std.testing.expect(mod.shift == true); try std.testing.expect(mod.control == false); try std.testing.expect(mod.alt == true); try std.testing.expect(mod.super == false); try std.testing.expect(mod.caps_lock == false); try std.testing.expect(mod.num_lock == false); } test "super int to bitmask" { const std = @import("std"); const int_mod = RawMods.super; const mod = Mods.fromInt(int_mod); try std.testing.expect(mod.shift == false); try std.testing.expect(mod.control == false); try std.testing.expect(mod.alt == false); try std.testing.expect(mod.super == true); try std.testing.expect(mod.caps_lock == false); try std.testing.expect(mod.num_lock == false); } test "num lock int to bitmask" { const std = @import("std"); const int_mod = RawMods.num_lock; const mod = Mods.fromInt(int_mod); try std.testing.expect(mod.shift == false); try std.testing.expect(mod.control == false); try std.testing.expect(mod.alt == false); try std.testing.expect(mod.super == false); try std.testing.expect(mod.caps_lock == false); try std.testing.expect(mod.num_lock == true); } test "all int to bitmask" { const std = @import("std"); const int_mod = RawMods.shift | RawMods.control | RawMods.alt | RawMods.super | RawMods.caps_lock | RawMods.num_lock; const mod = Mods.fromInt(int_mod); try std.testing.expect(mod.shift == true); try std.testing.expect(mod.control == true); try std.testing.expect(mod.alt == true); try std.testing.expect(mod.super == true); try std.testing.expect(mod.caps_lock == true); try std.testing.expect(mod.num_lock == true); } test "shift bitmask to int" { const std = @import("std"); const mod = Mods{ .shift = true }; const int_mod = mod.toInt(c_int); try std.testing.expectEqual(int_mod, RawMods.shift); } test "shift and alt bitmask to int" { const std = @import("std"); const mod = Mods{ .shift = true, .alt = true }; const int_mod = mod.toInt(c_int); try std.testing.expectEqual(int_mod, RawMods.shift | RawMods.alt); } test "all bitmask to int" { const std = @import("std"); const mod = Mods{ .shift = true, .control = true, .alt = true, .super = true, .caps_lock = true, .num_lock = true, }; const int_mod = mod.toInt(c_int); const expected = RawMods.shift | RawMods.control | RawMods.alt | RawMods.super | RawMods.caps_lock | RawMods.num_lock; try std.testing.expectEqual(int_mod, expected); }
glfw/src/mod.zig
const std = @import("std"); const Builder = std.build.Builder; const vma_config = @import("include/vma_config.zig"); pub fn build(b: *Builder) !void { // Standard target options allows the person running `zig build` to choose // what target to build for. Here we do not override the defaults, which // means any target is allowed, and the default is native. Other options // for restricting supported target set are available. const target = b.standardTargetOptions(.{}); // Standard release options allow the person running `zig build` to select // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. const mode = b.standardReleaseOptions(); // Option to override whether shaders are built in debug mode. Defaults to // (mode == .Debug). const debug_shaders = b.option(bool, "debug-shaders", "Set whether shaders are compiled in debug mode") orelse (mode == .Debug); const fractal = addShaderSteps(b, "fractal", debug_shaders); const mesh = addShaderSteps(b, "mesh", debug_shaders); const exe = b.addExecutable("sdltest", "src/main.zig"); exe.setTarget(target); exe.setBuildMode(mode); exe.step.dependOn(fractal); exe.step.dependOn(mesh); try linkSDL(b, exe, target, mode); // Link platform object files if (target.isWindows()) { exe.linkSystemLibrary("lib/win_x64/vulkan-1"); } else { return error.TodoLinkLibrariesForNonWindowsPlatforms; } // Link VMA source directly exe.addCSourceFile("c_src/vma.cpp", getVmaArgs(mode)); exe.addIncludeDir("c_src/vma"); if (target.getAbi() != .msvc) { exe.linkSystemLibrary("c++"); } const vk: std.build.Pkg = .{ .name = "vk", .path = "include/vulkan_core.zig", }; const sdl: std.build.Pkg = .{ .name = "sdl", .path = "include/sdl.zig", .dependencies = &.{ vk }, }; const vma: std.build.Pkg = .{ .name = "vma", .path = "include/vma.zig", .dependencies = &.{ vk }, }; exe.addPackage(vk); exe.addPackage(sdl); exe.addPackage(vma); exe.install(); const run_cmd = exe.run(); run_cmd.step.dependOn(b.getInstallStep()); if (b.args) |args| { run_cmd.addArgs(args); } const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step); } fn addShaderSteps(b: *Builder, name: []const u8, debug: bool) *std.build.Step { const hlsl = b.fmt("shaders/{s}.hlsl", .{name}); const vert_out = b.fmt("src/shader_data/{s}_vert.spv", .{name}); const frag_out = b.fmt("src/shader_data/{s}_frag.spv", .{name}); const vert = DxcCompileShaderStep.createVert(b, hlsl, vert_out); const frag = DxcCompileShaderStep.createFrag(b, hlsl, frag_out); if (debug) { vert.optimization_level = 0; vert.enable_debug_info = true; vert.embed_debug_info = true; frag.optimization_level = 0; frag.enable_debug_info = true; frag.embed_debug_info = true; } const step = b.step(name, b.fmt("Build shaders from {s}", .{hlsl})); step.dependOn(&vert.step); step.dependOn(&frag.step); return step; } fn linkSDL(b: *Builder, step: *std.build.LibExeObjStep, target: std.zig.CrossTarget, mode: std.builtin.Mode) !void { step.addIncludeDir("sdl/include"); step.addIncludeDir("sdl/src/video/khronos"); var c_args = std.ArrayList([]const u8).init(b.allocator); c_args.append("-DHAVE_LIBC") catch unreachable; step.linkLibC(); if (mode == .ReleaseFast) { c_args.append("-DNDEBUG") catch unreachable; } else { c_args.append("-D_DEBUG") catch unreachable; } if (target.isWindows()) { c_args.append("-D_WINDOWS") catch unreachable; } // TODO: There's probably a much better way to do this, building a static // data structure and pulling dirs out of it. var source_files = std.ArrayList([]const u8).init(b.allocator); var source_dirs = std.ArrayList([]const u8).init(b.allocator); source_dirs.appendSlice(&.{ "sdl/src", "sdl/src/atomic", "sdl/src/audio", "sdl/src/cpuinfo", "sdl/src/dynapi", "sdl/src/events", "sdl/src/file", "sdl/src/haptic", "sdl/src/libm", "sdl/src/locale", "sdl/src/misc", "sdl/src/power", "sdl/src/render", "sdl/src/sensor", "sdl/src/stdlib", "sdl/src/thread", "sdl/src/timer", "sdl/src/video", "sdl/src/video/yuv2rgb", }) catch unreachable; source_dirs.appendSlice(try collectChildDirectories(b, "sdl/src/render")) catch unreachable; // TODO: Detect android, can't do this from target alone const android = false; const have_audio = true; const have_filesystem = true; const have_haptic = true; const have_hidapi = true; const have_joystick = true; const have_loadso = true; const have_misc = true; const have_power = true; const have_locale = true; const have_timers = true; const have_sensor = true; const have_threads = true; const have_video = true; if (have_joystick) { source_dirs.append("sdl/src/joystick") catch unreachable; const have_virtual_joystick = true; if (have_virtual_joystick) { source_dirs.append("sdl/src/joystick/virtual") catch unreachable; } if (have_hidapi) { source_dirs.append("sdl/src/joystick/hidapi") catch unreachable; } } if (have_audio) { const dummy_audio = true; const disk_audio = true; if (dummy_audio) { source_dirs.append("sdl/src/audio/dummy") catch unreachable; } if (disk_audio) { source_dirs.append("sdl/src/audio/disk") catch unreachable; } } if (have_video) { const dummy_video = true; const offscreen_video = false; if (dummy_video) { source_dirs.append("sdl/src/video/dummy") catch unreachable; } if (offscreen_video) { source_dirs.append("sdl/src/video/offscreen") catch unreachable; } } if (android) { // TODO: CMakeLists.txt line 964 include ndk sources also. source_dirs.append("sdl/src/core/android") catch unreachable; source_dirs.append("sdl/src/misc/android") catch unreachable; if (have_audio) source_dirs.append("sdl/src/audio/android") catch unreachable; if (have_filesystem) source_dirs.append("sdl/src/filesystem/android") catch unreachable; if (have_haptic) source_dirs.append("sdl/src/haptic/android") catch unreachable; if (have_joystick) source_dirs.append("sdl/src/joystick/android") catch unreachable; if (have_loadso) source_dirs.append("sdl/src/loadso/dlopen") catch unreachable; if (have_power) source_dirs.append("sdl/src/power/android") catch unreachable; if (have_locale) source_dirs.append("sdl/src/locale/android") catch unreachable; if (have_timers) source_dirs.append("sdl/src/timer/unix") catch unreachable; if (have_sensor) source_dirs.append("sdl/src/sensor/android") catch unreachable; if (have_video) { source_dirs.append("sdl/src/video/android") catch unreachable; c_args.append("-DGL_GLEXT_PROTOTYPES") catch unreachable; // TODO: more stuff here } } // TODO: Linux if (target.isWindows()) { source_dirs.appendSlice(&.{ "sdl/src/core/windows", "sdl/src/misc/windows", }) catch unreachable; // TODO: windows store // TODO: directx if (have_audio) { const have_dsound = true; const have_wasapi = true; source_dirs.append("sdl/src/audio/winmm") catch unreachable; if (have_dsound) { source_dirs.append("sdl/src/audio/directsound") catch unreachable; } if (have_wasapi) { source_dirs.append("sdl/src/audio/wasapi") catch unreachable; } } if (have_video) { if (!have_loadso) { std.debug.print("{s}", .{"Error: SDL video requires loadso on windows.\n"}); std.os.exit(-1); } // TODO: Windows store source_dirs.append("sdl/src/video/windows") catch unreachable; // TODO: D3D } if (have_threads) { source_files.appendSlice(&.{ "sdl/src/thread/windows/SDL_sysmutex.c", "sdl/src/thread/windows/SDL_syssem.c", "sdl/src/thread/windows/SDL_systhread.c", "sdl/src/thread/windows/SDL_systls.c", "sdl/src/thread/generic/SDL_syscond.c", }) catch unreachable; } if (have_sensor) { source_dirs.append("sdl/src/sensor/windows") catch unreachable; } if (have_power) { // TODO: windows store source_files.append("sdl/src/power/windows/SDL_syspower.c") catch unreachable; } if (have_locale) { source_dirs.append("sdl/src/locale/windows") catch unreachable; } if (have_filesystem) { // TODO: windows store source_dirs.append("sdl/src/filesystem/windows") catch unreachable; } if (have_timers) { source_dirs.append("sdl/src/timer/windows") catch unreachable; } if (have_loadso) { source_dirs.append("sdl/src/loadso/windows") catch unreachable; } if (have_video) { // TODO: This just sets vars in cmake that aren't used? // Also it's redundant with the check above. } if (have_joystick) { if (have_hidapi) { source_files.append("sdl/src/hidapi/windows/hid.c") catch unreachable; } // TODO: lots of options here source_dirs.append("sdl/src/joystick/windows") catch unreachable; if (have_haptic) { // TODO source_dirs.append("sdl/src/haptic/windows") catch unreachable; } } // Windows DLLs we need // TODO: not needed for windows store step.linkSystemLibrary("Advapi32"); step.linkSystemLibrary("Gdi32"); step.linkSystemLibrary("Imm32"); step.linkSystemLibrary("Ole32"); step.linkSystemLibrary("OleAut32"); step.linkSystemLibrary("SetupAPI"); step.linkSystemLibrary("Shell32"); step.linkSystemLibrary("User32"); step.linkSystemLibrary("Version"); // Api-ms-win-core-version-l1-1-0.dll step.linkSystemLibrary("Winmm"); } // TODO: apple // TODO: haiku // TODO: riscos // dummy files if (!have_joystick) source_dirs.append("sdl/src/joystick/dummy") catch unreachable; if (!have_haptic) source_dirs.append("sdl/src/haptic/dummy") catch unreachable; if (!have_sensor) source_dirs.append("sdl/src/sensor/dummy") catch unreachable; if (!have_loadso) source_dirs.append("sdl/src/loadso/dummy") catch unreachable; if (!have_filesystem) source_dirs.append("sdl/src/filesystem/dummy") catch unreachable; if (!have_locale) source_dirs.append("sdl/src/locale/dummy") catch unreachable; if (!have_misc) source_dirs.append("sdl/src/misc/dummy") catch unreachable; if (!have_threads) source_dirs.append("sdl/src/thread/generic") catch unreachable; if (!have_timers) source_dirs.append("sdl/src/timer/dummy") catch unreachable; for (source_dirs.items) |dir| { source_files.appendSlice(try collectSources(b, dir, ".c")) catch unreachable; } step.addCSourceFiles(source_files.items, c_args.items); } fn collectSources(b: *Builder, path: []const u8, extension: []const u8) ![]const []const u8 { var sources = std.ArrayList([]const u8).init(b.allocator); const dir = try std.fs.cwd().openDir(path, .{ .iterate = true }); var it = dir.iterate(); while (try it.next()) |child| { if (child.kind == .File) { const ext = std.fs.path.extension(child.name); if (std.ascii.eqlIgnoreCase(ext, extension)) { const full_path = std.fs.path.join(b.allocator, &.{path, child.name}) catch unreachable; sources.append(full_path) catch unreachable; } } } return sources.toOwnedSlice(); } fn collectChildDirectories(b: *Builder, path: []const u8) ![]const []const u8 { var dirs = std.ArrayList([]const u8).init(b.allocator); const dir = try std.fs.cwd().openDir(path, .{ .iterate = true }); var it = dir.iterate(); while (try it.next()) |child| { if (child.kind == .Directory) { const full_path = std.fs.path.join(b.allocator, &.{path, child.name}) catch unreachable; dirs.append(full_path) catch unreachable; } } return dirs.toOwnedSlice(); } fn getVmaArgs(mode: std.builtin.Mode) []const []const u8 { const commonArgs = &[_][]const u8 { "-std=c++14" }; const releaseArgs = &[_][]const u8 { } ++ commonArgs ++ comptime getVmaConfigArgs(vma_config.releaseConfig); const debugArgs = &[_][]const u8 { } ++ commonArgs ++ comptime getVmaConfigArgs(vma_config.debugConfig); const args = if (mode == .Debug) debugArgs else releaseArgs; return args; } fn getVmaConfigArgs(comptime config: vma_config.Config) []const []const u8 { comptime { @setEvalBranchQuota(100000); var args: []const []const u8 = &[_][]const u8 { std.fmt.comptimePrint("-DVMA_VULKAN_VERSION={}", .{ config.vulkanVersion }), std.fmt.comptimePrint("-DVMA_DEDICATED_ALLOCATION={}", .{ @boolToInt(config.dedicatedAllocation)}), std.fmt.comptimePrint("-DVMA_BIND_MEMORY2={}", .{ @boolToInt(config.bindMemory2)}), std.fmt.comptimePrint("-DVMA_MEMORY_BUDGET={}", .{ @boolToInt(config.memoryBudget)}), std.fmt.comptimePrint("-DVMA_STATIC_VULKAN_FUNCTIONS={}", .{ @boolToInt(config.staticVulkanFunctions)}), std.fmt.comptimePrint("-DVMA_STATS_STRING_ENABLED={}", .{ @boolToInt(config.statsStringEnabled)}), }; if (config.debugInitializeAllocations) |value| { args = args ++ &[_][]const u8 { std.fmt.comptimePrint( "-DVMA_DEBUG_INITIALIZE_ALLOCATIONS={}", .{ @boolToInt(value) }, ) }; } if (config.debugMargin) |value| { args = args ++ &[_][]const u8 { std.fmt.comptimePrint( "-DVMA_DEBUG_MARGIN={}", .{ value }, ) }; } if (config.debugDetectCorruption) |value| { args = args ++ &[_][]const u8 { std.fmt.comptimePrint( "-DVMA_DEBUG_DETECT_CORRUPTION={}", .{ @boolToInt(value) }, ) }; } if (config.recordingEnabled) |value| { args = args ++ &[_][]const u8 { std.fmt.comptimePrint( "-DVMA_RECORDING_ENABLED={}", .{ @boolToInt(value) }, ) }; } if (config.debugMinBufferImageGranularity) |value| { args = args ++ &[_][]const u8 { std.fmt.comptimePrint( "-DVMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY={}", .{ value }, ) }; } if (config.debugGlobalMutex) |value| { args = args ++ &[_][]const u8 { std.fmt.comptimePrint( "-DVMA_DEBUG_GLOBAL_MUTEX={}", .{ @boolToInt(value) }, ) }; } if (config.useStlContainers) |value| { args = args ++ &[_][]const u8 { std.fmt.comptimePrint( "-DVMA_USE_STL_CONTAINERS={}", .{ @boolToInt(value) }, ) }; } if (config.useStlSharedMutex) |value| { args = args ++ &[_][]const u8 { std.fmt.comptimePrint( "-DVMA_USE_STL_SHARED_MUTEX={}", .{ @boolToInt(value) }, ) }; } return args; } } const DxcCompileShaderStep = struct { step: std.build.Step, builder: *Builder, hlsl_file: []const u8, out_file: []const u8, entry_point: []const u8, profile: Profile = .unspecified, optimization_level: u2 = 3, enable_debug_info: bool = false, embed_debug_info: bool = false, include_reflection: bool = true, pub fn createVert(b: *Builder, hlsl_file: []const u8, out_file: []const u8) *DxcCompileShaderStep { const self = b.allocator.create(@This()) catch unreachable; self.* = .{ .step = std.build.Step.init(.Custom, hlsl_file, b.allocator, make), .builder = b, .hlsl_file = b.dupePath(hlsl_file), .out_file = b.dupePath(out_file), .entry_point = "vert", .profile = .vs_6_0, }; return self; } pub fn createFrag(b: *Builder, hlsl_file: []const u8, out_file: []const u8) *DxcCompileShaderStep { const self = b.allocator.create(@This()) catch unreachable; self.* = .{ .step = std.build.Step.init(.Custom, hlsl_file, b.allocator, make), .builder = b, .hlsl_file = b.dupePath(hlsl_file), .out_file = b.dupePath(out_file), .entry_point = "frag", .profile = .ps_6_0, }; return self; } pub fn make(step: *std.build.Step) anyerror!void { const self = @fieldParentPtr(@This(), "step", step); const b = self.builder; // dxc doesn't do mkdirs so we need to. if (std.fs.path.dirname(self.out_file)) |dir| { try std.fs.cwd().makePath(dir); } var args = std.ArrayList([]const u8).init(b.allocator); defer args.deinit(); args.append("dxc") catch unreachable; if (self.profile != .none) { args.append("-T") catch unreachable; args.append(@tagName(self.profile)) catch unreachable; } args.append("-E") catch unreachable; args.append(self.entry_point) catch unreachable; args.append(b.fmt("-O{d}", .{self.optimization_level})) catch unreachable; if (self.enable_debug_info) args.append("-Zi") catch unreachable; if (self.embed_debug_info) args.append("-Qembed_debug") catch unreachable; if (self.include_reflection) args.append("-fspv-reflect") catch unreachable; args.append("-spirv") catch unreachable; args.append(self.hlsl_file) catch unreachable; args.append("-Fo") catch unreachable; args.append(self.out_file) catch unreachable; _ = try self.builder.execFromStep(args.items, &self.step); } pub const Profile = enum { none, ps_6_0, ps_6_1, ps_6_2, ps_6_3, ps_6_4, ps_6_5, ps_6_6, vs_6_0, vs_6_1, vs_6_2, vs_6_3, vs_6_4, vs_6_5, vs_6_6, gs_6_0, gs_6_1, gs_6_2, gs_6_3, gs_6_4, gs_6_5, gs_6_6, hs_6_0, hs_6_1, hs_6_2, hs_6_3, hs_6_4, hs_6_5, hs_6_6, ds_6_0, ds_6_1, ds_6_2, ds_6_3, ds_6_4, ds_6_5, ds_6_6, cs_6_0, cs_6_1, cs_6_2, cs_6_3, cs_6_4, cs_6_5, cs_6_6, lib_6_1, lib_6_2, lib_6_3, lib_6_4, lib_6_5, lib_6_6, ms_6_5, ms_6_6, as_6_5, as_6_6, }; };
build.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const StringHashMap = std.StringHashMap; const AutoHashMap = std.AutoHashMap; const ArrayList = std.ArrayList; const assert = std.debug.assert; const nfa = struct { pub const SymbolKind = enum { epsilon, char, }; pub const Symbol = u8; // pub const Symbol = union(SymbolKind) { // epsilon, // char: u8, // }; pub const StateLabelCap: usize = 10; pub const State = struct { accepting: bool, id: usize, label_buf: [StateLabelCap]u8, label: []u8, pub fn labelPrint(self: *@This(), comptime fmt: []const u8, args: anytype) std.fmt.BufPrintError!void { self.label = try std.fmt.bufPrint(&self.label_buf, fmt, args); } }; pub const SymbolTransitionKey = struct { from: usize, symbol: Symbol, }; pub const EpsilonTransitionKey = struct { from: usize, }; pub const TransitionValue = ArrayList(usize); pub const NFA = struct { in: usize, out: usize, }; pub const Graph = struct { allocator: *Allocator, states: ArrayList(State), transitions: AutoHashMap(SymbolTransitionKey, TransitionValue), e_transitions: AutoHashMap(EpsilonTransitionKey, TransitionValue), nfa: NFA, pub fn init(allocator: *Allocator) @This() { return @This() { .allocator = allocator, .states = ArrayList(State).init(allocator), .transitions = AutoHashMap(SymbolTransitionKey, TransitionValue).init(allocator), .e_transitions = AutoHashMap(EpsilonTransitionKey, TransitionValue).init(allocator), .nfa = NFA{.in = 0, .out = 0}, }; } pub fn deinit(self: *@This()) void { self.e_transitions.deinit(); self.transitions.deinit(); self.states.deinit(); } pub fn addState(self: *@This(), accepting: bool) usize { var new_state = State { .accepting = accepting, .id = self.states.items.len, .label_buf = [_]u8{0} ** StateLabelCap, .label = undefined, }; new_state.labelPrint("S{}", .{new_state.id}) catch unreachable; self.states.append(new_state) catch @panic("out of memory"); return self.states.items.len - 1; } pub inline fn getState(self: *@This(), state_id: usize) *State { assert(state_id < self.states.items.len); return &self.states.items[state_id]; } pub fn addSymbolTransition(self: *@This(), from: usize, symbol: Symbol, to: usize) void { const key = SymbolTransitionKey { .from = from, .symbol = symbol }; var result = self.transitions.getOrPut(key) catch @panic("out of memory"); if (result.found_existing) { result.entry.value.append(to) catch @panic("out of memory"); } else { result.entry.value = TransitionValue.initCapacity(self.allocator, 1) catch @panic("out of memory"); result.entry.value.appendAssumeCapacity(to); } } pub fn addEpsilonTransition(self: *@This(), from: usize, to: usize) void { const key = EpsilonTransitionKey{ .from = from }; var result = self.e_transitions.getOrPut(key) catch @panic("out of memory"); if (result.found_existing) { result.entry.value.append(to) catch @panic("out of memory"); } else { result.entry.value = TransitionValue.initCapacity(self.allocator, 1) catch @panic("out of memory"); result.entry.value.appendAssumeCapacity(to); } } pub fn char(self: *@This(), c: Symbol) NFA { const s0 = self.addState(false); const s1 = self.addState(true); self.addSymbolTransition(s0, c, s1); return NFA { .in = s0, .out = s1, }; } pub fn epsilon(self: *@This()) NFA { const s0: usize = self.addState(false); const s1: usize = self.addState(true); self.addEpsilonTransition(s0, s1); return NFA { .in = s0, .out = s1, }; } pub fn concat(self: *@This(), a: NFA, b: NFA) NFA { self.addEpsilonTransition(a.out, b.in); self.getState(a.out).accepting = false; self.getState(b.out).accepting = true; return NFA { .in = a.in, .out = b.out, }; } pub fn disjunction(self: *@This(), a: NFA, b: NFA) NFA { const start: usize = self.addState(false); const end: usize = self.addState(true); self.addEpsilonTransition(start, a.in); self.addEpsilonTransition(start, b.in); self.addEpsilonTransition(a.out, end); self.addEpsilonTransition(b.out, end); self.getState(a.out).accepting = false; self.getState(b.out).accepting = false; return NFA { .in = start, .out = end, }; } pub fn zeroOrMore(self: *@This(), a: NFA) NFA { // zero... self.addEpsilonTransition(a.in, a.out); // or more... self.addEpsilonTransition(a.out, a.in); return a; } pub fn oneOrMore(self: *@This(), a: NFA) NFA { // one: ok already // or more... self.addEpsilonTransition(a.out, a.in); return a; } pub fn optional(self: *@This(), a: NFA) NFA { self.addEpsilonTransition(a.in, a.out); return a; } pub fn range(self: *@This(), from: Symbol, to: Symbol) NFA { assert(from <= to); // 2 states: [A, B]; 1 transition: A -(from)-> B const resulting = self.char(from); // start from the next transition var i: Symbol = from + 1; // loop over inclusive range while (i <= to) : (i += 1) { self.addSymbolTransition(resulting.in, i, resulting.out); } return resulting; } }; }; const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; const expectEqualStrings = std.testing.expectEqualStrings; test "nfa: basics" { const s: nfa.Symbol = 'a'; var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); const allocator: *Allocator = &arena.allocator; var g: nfa.Graph = nfa.Graph.init(allocator); const s0: usize = g.addState(false); expectEqual(s0, 0); expect(!g.getState(s0).accepting); expectEqual(g.getState(s0).id, s0); expectEqualStrings(g.getState(s0).label, "S0"); const s1: usize = g.addState(true); expectEqual(s1, 1); expect(g.getState(s1).accepting); expectEqual(g.getState(s1).id, s1); expectEqualStrings(g.getState(s1).label, "S1"); g.addSymbolTransition(s0, 'a', s1); g.addEpsilonTransition(s1, s0); expectEqual(@as(usize, 2), g.states.items.len); expectEqual(@as(usize, 1), g.transitions.count()); expectEqual(@as(usize, 1), g.e_transitions.count()); } test "nfa: elementary machines: char" { var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); const allocator: *Allocator = &arena.allocator; var g: nfa.Graph = nfa.Graph.init(allocator); const s: nfa.Symbol = 'a'; const a = g.char(s); // state expectations expectEqual(@as(usize, 2), g.states.items.len); expect(!g.getState(a.in).accepting); expect(g.getState(a.out).accepting); // symbol transitions expectations expectEqual(@as(usize, 1), g.transitions.count()); var transitions_iter = g.transitions.iterator(); const transition = transitions_iter.next(); expect(transition != null); expectEqual(a.in, transition.?.key.from); expectEqual(s, transition.?.key.symbol); expectEqual(@as(usize, 1), transition.?.value.items.len); expectEqual(a.out, transition.?.value.items[0]); // epsilon transitions expectations expectEqual(@as(usize, 0), g.e_transitions.count()); } test "nfa: elementary machines: epsilon" { var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); const allocator: *Allocator = &arena.allocator; var g: nfa.Graph = nfa.Graph.init(allocator); const e = g.epsilon(); // state expectations expectEqual(@as(usize, 2), g.states.items.len); expect(!g.getState(e.in).accepting); expect(g.getState(e.out).accepting); // symbol transitions expectations expectEqual(@as(usize, 0), g.transitions.count()); // epsilon transitions expectations expectEqual(@as(usize, 1), g.e_transitions.count()); var e_transitions_iter = g.e_transitions.iterator(); const e_transition = e_transitions_iter.next(); expect(e_transition != null); expectEqual(e.in, e_transition.?.key.from); expectEqual(@as(usize, 1), e_transition.?.value.items.len); expectEqual(e.out, e_transition.?.value.items[0]); } test "nfa: elementary operators: concat" { var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); const allocator: *Allocator = &arena.allocator; var g: nfa.Graph = nfa.Graph.init(allocator); const a = g.char('a'); const b = g.char('b'); const ab = g.concat(a, b); // states expectations expectEqual(@as(usize, 4), g.states.items.len); expect(!g.getState(a.in).accepting); expect(!g.getState(a.out).accepting); expect(!g.getState(b.in).accepting); expect(g.getState(b.out).accepting); expect(!g.getState(ab.in).accepting); expect(g.getState(ab.out).accepting); expectEqual(a.in, ab.in); expectEqual(b.out, ab.out); // symbol transitions expectations expectEqual(@as(usize, 2), g.transitions.count()); // epsilon transitions expectations expectEqual(@as(usize, 1), g.e_transitions.count()); var e_transitions_iter = g.e_transitions.iterator(); const e_transition = e_transitions_iter.next(); expect(e_transition != null); expectEqual(a.out, e_transition.?.key.from); expectEqual(@as(usize, 1), e_transition.?.value.items.len); expectEqual(b.in, e_transition.?.value.items[0]); } test "nfa: elementary operators: disjunction (op: '|')" { var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); const allocator: *Allocator = &arena.allocator; var g: nfa.Graph = nfa.Graph.init(allocator); const a = g.char('a'); const b = g.char('b'); const a_or_b = g.disjunction(a, b); // states expectations expectEqual(@as(usize, 6), g.states.items.len); expect(!g.getState(a.in).accepting); expect(!g.getState(a.out).accepting); expect(!g.getState(b.in).accepting); expect(!g.getState(b.out).accepting); expect(!g.getState(a_or_b.in).accepting); expect(g.getState(a_or_b.out).accepting); // symbol transitions expectations expectEqual(@as(usize, 2), g.transitions.count()); // epsilon transitions expectations // 1: key=(a_or_b.in), value=[a.in, b.in] // 2: key=(a.out), value=[a_or_b.out] // 3: key=(b.out), value=[a_or_b.out] expectEqual(@as(usize, 3), g.e_transitions.count()); } test "nfa: elementary operators: zeroOrMore (kleene star) (op: '*')" { var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); const allocator: *Allocator = &arena.allocator; var g: nfa.Graph = nfa.Graph.init(allocator); const a = g.char('a'); const m = g.zeroOrMore(a); // states expectations expectEqual(@as(usize, 2), g.states.items.len); expect(!g.getState(m.in).accepting); expect(g.getState(m.out).accepting); expectEqual(a.in, m.in); expectEqual(a.out, m.out); // symbol transitions expectations expectEqual(@as(usize, 1), g.transitions.count()); // epsilon transitions expectations expectEqual(@as(usize, 2), g.e_transitions.count()); // TODO improve tests by checking the epsilon transitions: // 1: from m.in to m.out // 2: from m.out to m.in } test "nfa: syntatic sugar: oneOrMore (op: '+')" { var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); const allocator: *Allocator = &arena.allocator; var g: nfa.Graph = nfa.Graph.init(allocator); const a = g.char('a'); const m = g.oneOrMore(a); // states expectations expectEqual(@as(usize, 2), g.states.items.len); expect(!g.getState(m.in).accepting); expect(g.getState(m.out).accepting); expectEqual(a.in, m.in); expectEqual(a.out, m.out); // symbol transitions expectations expectEqual(@as(usize, 1), g.transitions.count()); // epsilon transitions expectations expectEqual(@as(usize, 1), g.e_transitions.count()); // TODO improve tests by checking the epsilon transition from m.out to m.in } test "nfa: syntatic sugar: optional (op: '?')" { var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); const allocator: *Allocator = &arena.allocator; var g: nfa.Graph = nfa.Graph.init(allocator); const a = g.char('a'); const m = g.optional(a); // states expectations expectEqual(@as(usize, 2), g.states.items.len); expect(!g.getState(m.in).accepting); expect(g.getState(m.out).accepting); expectEqual(a.in, m.in); expectEqual(a.out, m.out); // symbol transitions expectations expectEqual(@as(usize, 1), g.transitions.count()); // epsilon transitions expectations expectEqual(@as(usize, 1), g.e_transitions.count()); // TODO improve tests by checking the epsilon transition from m.in to m.out } test "nfa: syntatic sugar: range ([X-Y])" { var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); const allocator: *Allocator = &arena.allocator; var g: nfa.Graph = nfa.Graph.init(allocator); const digit = g.range('0', '9'); // states expectations expectEqual(@as(usize, 2), g.states.items.len); expect(!g.getState(digit.in).accepting); expect(g.getState(digit.out).accepting); // symbol transitions expectations expectEqual(@as(usize, 10), g.transitions.count()); // epsilon transitions expectations expectEqual(@as(usize, 0), g.e_transitions.count()); }
automata-theory-building-a-regexp-machine/zig-regex/src/lib.zig
pub const WM_DDE_FIRST = @as(u32, 992); pub const WM_DDE_INITIATE = @as(u32, 992); pub const WM_DDE_TERMINATE = @as(u32, 993); pub const WM_DDE_ADVISE = @as(u32, 994); pub const WM_DDE_UNADVISE = @as(u32, 995); pub const WM_DDE_ACK = @as(u32, 996); pub const WM_DDE_DATA = @as(u32, 997); pub const WM_DDE_REQUEST = @as(u32, 998); pub const WM_DDE_POKE = @as(u32, 999); pub const WM_DDE_EXECUTE = @as(u32, 1000); pub const WM_DDE_LAST = @as(u32, 1000); pub const CADV_LATEACK = @as(u32, 65535); pub const DDE_FACK = @as(u32, 32768); pub const DDE_FBUSY = @as(u32, 16384); pub const DDE_FDEFERUPD = @as(u32, 16384); pub const DDE_FACKREQ = @as(u32, 32768); pub const DDE_FRELEASE = @as(u32, 8192); pub const DDE_FREQUESTED = @as(u32, 4096); pub const DDE_FAPPSTATUS = @as(u32, 255); pub const DDE_FNOTPROCESSED = @as(u32, 0); pub const MSGF_DDEMGR = @as(u32, 32769); pub const CP_WINANSI = @as(i32, 1004); pub const CP_WINUNICODE = @as(i32, 1200); pub const CP_WINNEUTRAL = @as(i32, 1200); pub const XTYPF_NOBLOCK = @as(u32, 2); pub const XTYPF_NODATA = @as(u32, 4); pub const XTYPF_ACKREQ = @as(u32, 8); pub const XCLASS_MASK = @as(u32, 64512); pub const XCLASS_BOOL = @as(u32, 4096); pub const XCLASS_DATA = @as(u32, 8192); pub const XCLASS_FLAGS = @as(u32, 16384); pub const XCLASS_NOTIFICATION = @as(u32, 32768); pub const XTYP_MASK = @as(u32, 240); pub const XTYP_SHIFT = @as(u32, 4); pub const TIMEOUT_ASYNC = @as(u32, 4294967295); pub const QID_SYNC = @as(u32, 4294967295); pub const APPCMD_MASK = @as(i32, 4080); pub const APPCLASS_MASK = @as(i32, 15); pub const HDATA_APPOWNED = @as(u32, 1); pub const DMLERR_NO_ERROR = @as(u32, 0); pub const DMLERR_FIRST = @as(u32, 16384); pub const DMLERR_ADVACKTIMEOUT = @as(u32, 16384); pub const DMLERR_BUSY = @as(u32, 16385); pub const DMLERR_DATAACKTIMEOUT = @as(u32, 16386); pub const DMLERR_DLL_NOT_INITIALIZED = @as(u32, 16387); pub const DMLERR_DLL_USAGE = @as(u32, 16388); pub const DMLERR_EXECACKTIMEOUT = @as(u32, 16389); pub const DMLERR_INVALIDPARAMETER = @as(u32, 16390); pub const DMLERR_LOW_MEMORY = @as(u32, 16391); pub const DMLERR_MEMORY_ERROR = @as(u32, 16392); pub const DMLERR_NOTPROCESSED = @as(u32, 16393); pub const DMLERR_NO_CONV_ESTABLISHED = @as(u32, 16394); pub const DMLERR_POKEACKTIMEOUT = @as(u32, 16395); pub const DMLERR_POSTMSG_FAILED = @as(u32, 16396); pub const DMLERR_REENTRANCY = @as(u32, 16397); pub const DMLERR_SERVER_DIED = @as(u32, 16398); pub const DMLERR_SYS_ERROR = @as(u32, 16399); pub const DMLERR_UNADVACKTIMEOUT = @as(u32, 16400); pub const DMLERR_UNFOUND_QUEUE_ID = @as(u32, 16401); pub const DMLERR_LAST = @as(u32, 16401); pub const MH_CREATE = @as(u32, 1); pub const MH_KEEP = @as(u32, 2); pub const MH_DELETE = @as(u32, 3); pub const MH_CLEANUP = @as(u32, 4); pub const MAX_MONITORS = @as(u32, 4); pub const MF_MASK = @as(u32, 4278190080); //-------------------------------------------------------------------------------- // Section: Types (30) //-------------------------------------------------------------------------------- pub const DDE_ENABLE_CALLBACK_CMD = enum(u32) { ENABLEALL = 0, ENABLEONE = 128, DISABLE = 8, QUERYWAITING = 2, }; pub const EC_ENABLEALL = DDE_ENABLE_CALLBACK_CMD.ENABLEALL; pub const EC_ENABLEONE = DDE_ENABLE_CALLBACK_CMD.ENABLEONE; pub const EC_DISABLE = DDE_ENABLE_CALLBACK_CMD.DISABLE; pub const EC_QUERYWAITING = DDE_ENABLE_CALLBACK_CMD.QUERYWAITING; pub const DDE_INITIALIZE_COMMAND = enum(u32) { APPCLASS_MONITOR = 1, APPCLASS_STANDARD = 0, APPCMD_CLIENTONLY = 16, APPCMD_FILTERINITS = 32, CBF_FAIL_ALLSVRXACTIONS = 258048, CBF_FAIL_ADVISES = 16384, CBF_FAIL_CONNECTIONS = 8192, CBF_FAIL_EXECUTES = 32768, CBF_FAIL_POKES = 65536, CBF_FAIL_REQUESTS = 131072, CBF_FAIL_SELFCONNECTIONS = 4096, CBF_SKIP_ALLNOTIFICATIONS = 3932160, CBF_SKIP_CONNECT_CONFIRMS = 262144, CBF_SKIP_DISCONNECTS = 2097152, CBF_SKIP_REGISTRATIONS = 524288, CBF_SKIP_UNREGISTRATIONS = 1048576, MF_CALLBACKS = 134217728, MF_CONV = 1073741824, MF_ERRORS = 268435456, MF_HSZ_INFO = 16777216, MF_LINKS = 536870912, MF_POSTMSGS = 67108864, MF_SENDMSGS = 33554432, _, pub fn initFlags(o: struct { APPCLASS_MONITOR: u1 = 0, APPCLASS_STANDARD: u1 = 0, APPCMD_CLIENTONLY: u1 = 0, APPCMD_FILTERINITS: u1 = 0, CBF_FAIL_ALLSVRXACTIONS: u1 = 0, CBF_FAIL_ADVISES: u1 = 0, CBF_FAIL_CONNECTIONS: u1 = 0, CBF_FAIL_EXECUTES: u1 = 0, CBF_FAIL_POKES: u1 = 0, CBF_FAIL_REQUESTS: u1 = 0, CBF_FAIL_SELFCONNECTIONS: u1 = 0, CBF_SKIP_ALLNOTIFICATIONS: u1 = 0, CBF_SKIP_CONNECT_CONFIRMS: u1 = 0, CBF_SKIP_DISCONNECTS: u1 = 0, CBF_SKIP_REGISTRATIONS: u1 = 0, CBF_SKIP_UNREGISTRATIONS: u1 = 0, MF_CALLBACKS: u1 = 0, MF_CONV: u1 = 0, MF_ERRORS: u1 = 0, MF_HSZ_INFO: u1 = 0, MF_LINKS: u1 = 0, MF_POSTMSGS: u1 = 0, MF_SENDMSGS: u1 = 0, }) DDE_INITIALIZE_COMMAND { return @intToEnum(DDE_INITIALIZE_COMMAND, (if (o.APPCLASS_MONITOR == 1) @enumToInt(DDE_INITIALIZE_COMMAND.APPCLASS_MONITOR) else 0) | (if (o.APPCLASS_STANDARD == 1) @enumToInt(DDE_INITIALIZE_COMMAND.APPCLASS_STANDARD) else 0) | (if (o.APPCMD_CLIENTONLY == 1) @enumToInt(DDE_INITIALIZE_COMMAND.APPCMD_CLIENTONLY) else 0) | (if (o.APPCMD_FILTERINITS == 1) @enumToInt(DDE_INITIALIZE_COMMAND.APPCMD_FILTERINITS) else 0) | (if (o.CBF_FAIL_ALLSVRXACTIONS == 1) @enumToInt(DDE_INITIALIZE_COMMAND.CBF_FAIL_ALLSVRXACTIONS) else 0) | (if (o.CBF_FAIL_ADVISES == 1) @enumToInt(DDE_INITIALIZE_COMMAND.CBF_FAIL_ADVISES) else 0) | (if (o.CBF_FAIL_CONNECTIONS == 1) @enumToInt(DDE_INITIALIZE_COMMAND.CBF_FAIL_CONNECTIONS) else 0) | (if (o.CBF_FAIL_EXECUTES == 1) @enumToInt(DDE_INITIALIZE_COMMAND.CBF_FAIL_EXECUTES) else 0) | (if (o.CBF_FAIL_POKES == 1) @enumToInt(DDE_INITIALIZE_COMMAND.CBF_FAIL_POKES) else 0) | (if (o.CBF_FAIL_REQUESTS == 1) @enumToInt(DDE_INITIALIZE_COMMAND.CBF_FAIL_REQUESTS) else 0) | (if (o.CBF_FAIL_SELFCONNECTIONS == 1) @enumToInt(DDE_INITIALIZE_COMMAND.CBF_FAIL_SELFCONNECTIONS) else 0) | (if (o.CBF_SKIP_ALLNOTIFICATIONS == 1) @enumToInt(DDE_INITIALIZE_COMMAND.CBF_SKIP_ALLNOTIFICATIONS) else 0) | (if (o.CBF_SKIP_CONNECT_CONFIRMS == 1) @enumToInt(DDE_INITIALIZE_COMMAND.CBF_SKIP_CONNECT_CONFIRMS) else 0) | (if (o.CBF_SKIP_DISCONNECTS == 1) @enumToInt(DDE_INITIALIZE_COMMAND.CBF_SKIP_DISCONNECTS) else 0) | (if (o.CBF_SKIP_REGISTRATIONS == 1) @enumToInt(DDE_INITIALIZE_COMMAND.CBF_SKIP_REGISTRATIONS) else 0) | (if (o.CBF_SKIP_UNREGISTRATIONS == 1) @enumToInt(DDE_INITIALIZE_COMMAND.CBF_SKIP_UNREGISTRATIONS) else 0) | (if (o.MF_CALLBACKS == 1) @enumToInt(DDE_INITIALIZE_COMMAND.MF_CALLBACKS) else 0) | (if (o.MF_CONV == 1) @enumToInt(DDE_INITIALIZE_COMMAND.MF_CONV) else 0) | (if (o.MF_ERRORS == 1) @enumToInt(DDE_INITIALIZE_COMMAND.MF_ERRORS) else 0) | (if (o.MF_HSZ_INFO == 1) @enumToInt(DDE_INITIALIZE_COMMAND.MF_HSZ_INFO) else 0) | (if (o.MF_LINKS == 1) @enumToInt(DDE_INITIALIZE_COMMAND.MF_LINKS) else 0) | (if (o.MF_POSTMSGS == 1) @enumToInt(DDE_INITIALIZE_COMMAND.MF_POSTMSGS) else 0) | (if (o.MF_SENDMSGS == 1) @enumToInt(DDE_INITIALIZE_COMMAND.MF_SENDMSGS) else 0) ); } }; pub const APPCLASS_MONITOR = DDE_INITIALIZE_COMMAND.APPCLASS_MONITOR; pub const APPCLASS_STANDARD = DDE_INITIALIZE_COMMAND.APPCLASS_STANDARD; pub const APPCMD_CLIENTONLY = DDE_INITIALIZE_COMMAND.APPCMD_CLIENTONLY; pub const APPCMD_FILTERINITS = DDE_INITIALIZE_COMMAND.APPCMD_FILTERINITS; pub const CBF_FAIL_ALLSVRXACTIONS = DDE_INITIALIZE_COMMAND.CBF_FAIL_ALLSVRXACTIONS; pub const CBF_FAIL_ADVISES = DDE_INITIALIZE_COMMAND.CBF_FAIL_ADVISES; pub const CBF_FAIL_CONNECTIONS = DDE_INITIALIZE_COMMAND.CBF_FAIL_CONNECTIONS; pub const CBF_FAIL_EXECUTES = DDE_INITIALIZE_COMMAND.CBF_FAIL_EXECUTES; pub const CBF_FAIL_POKES = DDE_INITIALIZE_COMMAND.CBF_FAIL_POKES; pub const CBF_FAIL_REQUESTS = DDE_INITIALIZE_COMMAND.CBF_FAIL_REQUESTS; pub const CBF_FAIL_SELFCONNECTIONS = DDE_INITIALIZE_COMMAND.CBF_FAIL_SELFCONNECTIONS; pub const CBF_SKIP_ALLNOTIFICATIONS = DDE_INITIALIZE_COMMAND.CBF_SKIP_ALLNOTIFICATIONS; pub const CBF_SKIP_CONNECT_CONFIRMS = DDE_INITIALIZE_COMMAND.CBF_SKIP_CONNECT_CONFIRMS; pub const CBF_SKIP_DISCONNECTS = DDE_INITIALIZE_COMMAND.CBF_SKIP_DISCONNECTS; pub const CBF_SKIP_REGISTRATIONS = DDE_INITIALIZE_COMMAND.CBF_SKIP_REGISTRATIONS; pub const CBF_SKIP_UNREGISTRATIONS = DDE_INITIALIZE_COMMAND.CBF_SKIP_UNREGISTRATIONS; pub const MF_CALLBACKS = DDE_INITIALIZE_COMMAND.MF_CALLBACKS; pub const MF_CONV = DDE_INITIALIZE_COMMAND.MF_CONV; pub const MF_ERRORS = DDE_INITIALIZE_COMMAND.MF_ERRORS; pub const MF_HSZ_INFO = DDE_INITIALIZE_COMMAND.MF_HSZ_INFO; pub const MF_LINKS = DDE_INITIALIZE_COMMAND.MF_LINKS; pub const MF_POSTMSGS = DDE_INITIALIZE_COMMAND.MF_POSTMSGS; pub const MF_SENDMSGS = DDE_INITIALIZE_COMMAND.MF_SENDMSGS; pub const DDE_NAME_SERVICE_CMD = enum(u32) { REGISTER = 1, UNREGISTER = 2, FILTERON = 4, FILTEROFF = 8, }; pub const DNS_REGISTER = DDE_NAME_SERVICE_CMD.REGISTER; pub const DNS_UNREGISTER = DDE_NAME_SERVICE_CMD.UNREGISTER; pub const DNS_FILTERON = DDE_NAME_SERVICE_CMD.FILTERON; pub const DNS_FILTEROFF = DDE_NAME_SERVICE_CMD.FILTEROFF; pub const DDE_CLIENT_TRANSACTION_TYPE = enum(u32) { ADVSTART = 4144, ADVSTOP = 32832, EXECUTE = 16464, POKE = 16528, REQUEST = 8368, ADVDATA = 16400, ADVREQ = 8226, CONNECT = 4194, CONNECT_CONFIRM = 32882, DISCONNECT = 32962, MONITOR = 33010, REGISTER = 32930, UNREGISTER = 32978, WILDCONNECT = 8418, XACT_COMPLETE = 32896, }; pub const XTYP_ADVSTART = DDE_CLIENT_TRANSACTION_TYPE.ADVSTART; pub const XTYP_ADVSTOP = DDE_CLIENT_TRANSACTION_TYPE.ADVSTOP; pub const XTYP_EXECUTE = DDE_CLIENT_TRANSACTION_TYPE.EXECUTE; pub const XTYP_POKE = DDE_CLIENT_TRANSACTION_TYPE.POKE; pub const XTYP_REQUEST = DDE_CLIENT_TRANSACTION_TYPE.REQUEST; pub const XTYP_ADVDATA = DDE_CLIENT_TRANSACTION_TYPE.ADVDATA; pub const XTYP_ADVREQ = DDE_CLIENT_TRANSACTION_TYPE.ADVREQ; pub const XTYP_CONNECT = DDE_CLIENT_TRANSACTION_TYPE.CONNECT; pub const XTYP_CONNECT_CONFIRM = DDE_CLIENT_TRANSACTION_TYPE.CONNECT_CONFIRM; pub const XTYP_DISCONNECT = DDE_CLIENT_TRANSACTION_TYPE.DISCONNECT; pub const XTYP_MONITOR = DDE_CLIENT_TRANSACTION_TYPE.MONITOR; pub const XTYP_REGISTER = DDE_CLIENT_TRANSACTION_TYPE.REGISTER; pub const XTYP_UNREGISTER = DDE_CLIENT_TRANSACTION_TYPE.UNREGISTER; pub const XTYP_WILDCONNECT = DDE_CLIENT_TRANSACTION_TYPE.WILDCONNECT; pub const XTYP_XACT_COMPLETE = DDE_CLIENT_TRANSACTION_TYPE.XACT_COMPLETE; pub const CONVINFO_CONVERSATION_STATE = enum(u32) { ADVACKRCVD = 13, ADVDATAACKRCVD = 16, ADVDATASENT = 15, ADVSENT = 11, CONNECTED = 2, DATARCVD = 6, EXECACKRCVD = 10, EXECSENT = 9, INCOMPLETE = 1, INIT1 = 3, INIT2 = 4, NULL = 0, POKEACKRCVD = 8, POKESENT = 7, REQSENT = 5, UNADVACKRCVD = 14, UNADVSENT = 12, }; pub const XST_ADVACKRCVD = CONVINFO_CONVERSATION_STATE.ADVACKRCVD; pub const XST_ADVDATAACKRCVD = CONVINFO_CONVERSATION_STATE.ADVDATAACKRCVD; pub const XST_ADVDATASENT = CONVINFO_CONVERSATION_STATE.ADVDATASENT; pub const XST_ADVSENT = CONVINFO_CONVERSATION_STATE.ADVSENT; pub const XST_CONNECTED = CONVINFO_CONVERSATION_STATE.CONNECTED; pub const XST_DATARCVD = CONVINFO_CONVERSATION_STATE.DATARCVD; pub const XST_EXECACKRCVD = CONVINFO_CONVERSATION_STATE.EXECACKRCVD; pub const XST_EXECSENT = CONVINFO_CONVERSATION_STATE.EXECSENT; pub const XST_INCOMPLETE = CONVINFO_CONVERSATION_STATE.INCOMPLETE; pub const XST_INIT1 = CONVINFO_CONVERSATION_STATE.INIT1; pub const XST_INIT2 = CONVINFO_CONVERSATION_STATE.INIT2; pub const XST_NULL = CONVINFO_CONVERSATION_STATE.NULL; pub const XST_POKEACKRCVD = CONVINFO_CONVERSATION_STATE.POKEACKRCVD; pub const XST_POKESENT = CONVINFO_CONVERSATION_STATE.POKESENT; pub const XST_REQSENT = CONVINFO_CONVERSATION_STATE.REQSENT; pub const XST_UNADVACKRCVD = CONVINFO_CONVERSATION_STATE.UNADVACKRCVD; pub const XST_UNADVSENT = CONVINFO_CONVERSATION_STATE.UNADVSENT; pub const CONVINFO_STATUS = enum(u32) { ADVISE = 2, BLOCKED = 8, BLOCKNEXT = 128, CLIENT = 16, CONNECTED = 1, INLIST = 64, ISLOCAL = 4, ISSELF = 256, TERMINATED = 32, _, pub fn initFlags(o: struct { ADVISE: u1 = 0, BLOCKED: u1 = 0, BLOCKNEXT: u1 = 0, CLIENT: u1 = 0, CONNECTED: u1 = 0, INLIST: u1 = 0, ISLOCAL: u1 = 0, ISSELF: u1 = 0, TERMINATED: u1 = 0, }) CONVINFO_STATUS { return @intToEnum(CONVINFO_STATUS, (if (o.ADVISE == 1) @enumToInt(CONVINFO_STATUS.ADVISE) else 0) | (if (o.BLOCKED == 1) @enumToInt(CONVINFO_STATUS.BLOCKED) else 0) | (if (o.BLOCKNEXT == 1) @enumToInt(CONVINFO_STATUS.BLOCKNEXT) else 0) | (if (o.CLIENT == 1) @enumToInt(CONVINFO_STATUS.CLIENT) else 0) | (if (o.CONNECTED == 1) @enumToInt(CONVINFO_STATUS.CONNECTED) else 0) | (if (o.INLIST == 1) @enumToInt(CONVINFO_STATUS.INLIST) else 0) | (if (o.ISLOCAL == 1) @enumToInt(CONVINFO_STATUS.ISLOCAL) else 0) | (if (o.ISSELF == 1) @enumToInt(CONVINFO_STATUS.ISSELF) else 0) | (if (o.TERMINATED == 1) @enumToInt(CONVINFO_STATUS.TERMINATED) else 0) ); } }; pub const ST_ADVISE = CONVINFO_STATUS.ADVISE; pub const ST_BLOCKED = CONVINFO_STATUS.BLOCKED; pub const ST_BLOCKNEXT = CONVINFO_STATUS.BLOCKNEXT; pub const ST_CLIENT = CONVINFO_STATUS.CLIENT; pub const ST_CONNECTED = CONVINFO_STATUS.CONNECTED; pub const ST_INLIST = CONVINFO_STATUS.INLIST; pub const ST_ISLOCAL = CONVINFO_STATUS.ISLOCAL; pub const ST_ISSELF = CONVINFO_STATUS.ISSELF; pub const ST_TERMINATED = CONVINFO_STATUS.TERMINATED; pub const HSZ = *opaque{}; pub const HCONV = *opaque{}; pub const HCONVLIST = *opaque{}; pub const HDDEDATA = *opaque{}; pub const DDEACK = extern struct { _bitfield: u16, }; pub const DDEADVISE = extern struct { _bitfield: u16, cfFormat: i16, }; pub const DDEDATA = extern struct { _bitfield: u16, cfFormat: i16, Value: [1]u8, }; pub const DDEPOKE = extern struct { _bitfield: u16, cfFormat: i16, Value: [1]u8, }; pub const DDELN = extern struct { _bitfield: u16, cfFormat: i16, }; pub const DDEUP = extern struct { _bitfield: u16, cfFormat: i16, rgb: [1]u8, }; pub const HSZPAIR = extern struct { hszSvc: ?HSZ, hszTopic: ?HSZ, }; pub const CONVCONTEXT = extern struct { cb: u32, wFlags: u32, wCountryID: u32, iCodePage: i32, dwLangID: u32, dwSecurity: u32, qos: SECURITY_QUALITY_OF_SERVICE, }; pub const CONVINFO = extern struct { cb: u32, hUser: usize, hConvPartner: ?HCONV, hszSvcPartner: ?HSZ, hszServiceReq: ?HSZ, hszTopic: ?HSZ, hszItem: ?HSZ, wFmt: u32, wType: DDE_CLIENT_TRANSACTION_TYPE, wStatus: CONVINFO_STATUS, wConvst: CONVINFO_CONVERSATION_STATE, wLastError: u32, hConvList: ?HCONVLIST, ConvCtxt: CONVCONTEXT, hwnd: ?HWND, hwndPartner: ?HWND, }; pub const PFNCALLBACK = fn( wType: u32, wFmt: u32, hConv: ?HCONV, hsz1: ?HSZ, hsz2: ?HSZ, hData: ?HDDEDATA, dwData1: usize, dwData2: usize, ) callconv(@import("std").os.windows.WINAPI) ?HDDEDATA; pub const DDEML_MSG_HOOK_DATA = extern struct { uiLo: usize, uiHi: usize, cbData: u32, Data: [8]u32, }; pub const MONMSGSTRUCT = extern struct { cb: u32, hwndTo: ?HWND, dwTime: u32, hTask: ?HANDLE, wMsg: u32, wParam: WPARAM, lParam: LPARAM, dmhd: DDEML_MSG_HOOK_DATA, }; pub const MONCBSTRUCT = extern struct { cb: u32, dwTime: u32, hTask: ?HANDLE, dwRet: u32, wType: u32, wFmt: u32, hConv: ?HCONV, hsz1: ?HSZ, hsz2: ?HSZ, hData: ?HDDEDATA, dwData1: usize, dwData2: usize, cc: CONVCONTEXT, cbData: u32, Data: [8]u32, }; pub const MONHSZSTRUCTA = extern struct { cb: u32, fsAction: BOOL, dwTime: u32, hsz: ?HSZ, hTask: ?HANDLE, str: [1]CHAR, }; pub const MONHSZSTRUCTW = extern struct { cb: u32, fsAction: BOOL, dwTime: u32, hsz: ?HSZ, hTask: ?HANDLE, str: [1]u16, }; pub const MONERRSTRUCT = extern struct { cb: u32, wLastError: u32, dwTime: u32, hTask: ?HANDLE, }; pub const MONLINKSTRUCT = extern struct { cb: u32, dwTime: u32, hTask: ?HANDLE, fEstablished: BOOL, fNoData: BOOL, hszSvc: ?HSZ, hszTopic: ?HSZ, hszItem: ?HSZ, wFmt: u32, fServer: BOOL, hConvServer: ?HCONV, hConvClient: ?HCONV, }; pub const MONCONVSTRUCT = extern struct { cb: u32, fConnect: BOOL, dwTime: u32, hTask: ?HANDLE, hszSvc: ?HSZ, hszTopic: ?HSZ, hConvClient: ?HCONV, hConvServer: ?HCONV, }; pub const METAFILEPICT = extern struct { mm: i32, xExt: i32, yExt: i32, hMF: ?HMETAFILE, }; pub const COPYDATASTRUCT = extern struct { dwData: usize, cbData: u32, lpData: ?*anyopaque, }; //-------------------------------------------------------------------------------- // Section: Functions (77) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeSetQualityOfService( hwndClient: ?HWND, pqosNew: ?*const SECURITY_QUALITY_OF_SERVICE, pqosPrev: ?*SECURITY_QUALITY_OF_SERVICE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn ImpersonateDdeClientWindow( hWndClient: ?HWND, hWndServer: ?HWND, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn PackDDElParam( msg: u32, uiLo: usize, uiHi: usize, ) callconv(@import("std").os.windows.WINAPI) LPARAM; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn UnpackDDElParam( msg: u32, lParam: LPARAM, puiLo: ?*usize, puiHi: ?*usize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn FreeDDElParam( msg: u32, lParam: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn ReuseDDElParam( lParam: LPARAM, msgIn: u32, msgOut: u32, uiLo: usize, uiHi: usize, ) callconv(@import("std").os.windows.WINAPI) LPARAM; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeInitializeA( pidInst: ?*u32, pfnCallback: ?PFNCALLBACK, afCmd: DDE_INITIALIZE_COMMAND, ulRes: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeInitializeW( pidInst: ?*u32, pfnCallback: ?PFNCALLBACK, afCmd: DDE_INITIALIZE_COMMAND, ulRes: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeUninitialize( idInst: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeConnectList( idInst: u32, hszService: ?HSZ, hszTopic: ?HSZ, hConvList: ?HCONVLIST, pCC: ?*CONVCONTEXT, ) callconv(@import("std").os.windows.WINAPI) ?HCONVLIST; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeQueryNextServer( hConvList: ?HCONVLIST, hConvPrev: ?HCONV, ) callconv(@import("std").os.windows.WINAPI) ?HCONV; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeDisconnectList( hConvList: ?HCONVLIST, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeConnect( idInst: u32, hszService: ?HSZ, hszTopic: ?HSZ, pCC: ?*CONVCONTEXT, ) callconv(@import("std").os.windows.WINAPI) ?HCONV; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeDisconnect( hConv: ?HCONV, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeReconnect( hConv: ?HCONV, ) callconv(@import("std").os.windows.WINAPI) ?HCONV; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeQueryConvInfo( hConv: ?HCONV, idTransaction: u32, pConvInfo: ?*CONVINFO, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeSetUserHandle( hConv: ?HCONV, id: u32, hUser: usize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeAbandonTransaction( idInst: u32, hConv: ?HCONV, idTransaction: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdePostAdvise( idInst: u32, hszTopic: ?HSZ, hszItem: ?HSZ, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeEnableCallback( idInst: u32, hConv: ?HCONV, wCmd: DDE_ENABLE_CALLBACK_CMD, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeImpersonateClient( hConv: ?HCONV, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeNameService( idInst: u32, hsz1: ?HSZ, hsz2: ?HSZ, afCmd: DDE_NAME_SERVICE_CMD, ) callconv(@import("std").os.windows.WINAPI) ?HDDEDATA; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeClientTransaction( pData: ?*u8, cbData: u32, hConv: ?HCONV, hszItem: ?HSZ, wFmt: u32, wType: DDE_CLIENT_TRANSACTION_TYPE, dwTimeout: u32, pdwResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) ?HDDEDATA; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeCreateDataHandle( idInst: u32, // TODO: what to do with BytesParamIndex 2? pSrc: ?*u8, cb: u32, cbOff: u32, hszItem: ?HSZ, wFmt: u32, afCmd: u32, ) callconv(@import("std").os.windows.WINAPI) ?HDDEDATA; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeAddData( hData: ?HDDEDATA, // TODO: what to do with BytesParamIndex 2? pSrc: ?*u8, cb: u32, cbOff: u32, ) callconv(@import("std").os.windows.WINAPI) ?HDDEDATA; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeGetData( hData: ?HDDEDATA, // TODO: what to do with BytesParamIndex 2? pDst: ?*u8, cbMax: u32, cbOff: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeAccessData( hData: ?HDDEDATA, pcbDataSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) ?*u8; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeUnaccessData( hData: ?HDDEDATA, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeFreeDataHandle( hData: ?HDDEDATA, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeGetLastError( idInst: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeCreateStringHandleA( idInst: u32, psz: ?[*:0]const u8, iCodePage: i32, ) callconv(@import("std").os.windows.WINAPI) ?HSZ; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeCreateStringHandleW( idInst: u32, psz: ?[*:0]const u16, iCodePage: i32, ) callconv(@import("std").os.windows.WINAPI) ?HSZ; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeQueryStringA( idInst: u32, hsz: ?HSZ, psz: ?[*:0]u8, cchMax: u32, iCodePage: i32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeQueryStringW( idInst: u32, hsz: ?HSZ, psz: ?[*:0]u16, cchMax: u32, iCodePage: i32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeFreeStringHandle( idInst: u32, hsz: ?HSZ, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeKeepStringHandle( idInst: u32, hsz: ?HSZ, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn DdeCmpStringHandles( hsz1: ?HSZ, hsz2: ?HSZ, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "GDI32" fn SetWinMetaFileBits( nSize: u32, // TODO: what to do with BytesParamIndex 0? lpMeta16Data: ?*const u8, hdcRef: ?HDC, lpMFP: ?*const METAFILEPICT, ) callconv(@import("std").os.windows.WINAPI) ?HENHMETAFILE; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn OpenClipboard( hWndNewOwner: ?HWND, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn CloseClipboard( ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn GetClipboardSequenceNumber( ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn GetClipboardOwner( ) callconv(@import("std").os.windows.WINAPI) ?HWND; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn SetClipboardViewer( hWndNewViewer: ?HWND, ) callconv(@import("std").os.windows.WINAPI) ?HWND; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn GetClipboardViewer( ) callconv(@import("std").os.windows.WINAPI) ?HWND; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn ChangeClipboardChain( hWndRemove: ?HWND, hWndNewNext: ?HWND, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn SetClipboardData( uFormat: u32, hMem: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn GetClipboardData( uFormat: u32, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn RegisterClipboardFormatA( lpszFormat: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn RegisterClipboardFormatW( lpszFormat: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn CountClipboardFormats( ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn EnumClipboardFormats( format: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn GetClipboardFormatNameA( format: u32, lpszFormatName: [*:0]u8, cchMaxCount: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn GetClipboardFormatNameW( format: u32, lpszFormatName: [*:0]u16, cchMaxCount: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn EmptyClipboard( ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn IsClipboardFormatAvailable( format: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn GetPriorityClipboardFormat( paFormatPriorityList: [*]u32, cFormats: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn GetOpenClipboardWindow( ) callconv(@import("std").os.windows.WINAPI) ?HWND; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "USER32" fn AddClipboardFormatListener( hwnd: ?HWND, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "USER32" fn RemoveClipboardFormatListener( hwnd: ?HWND, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "USER32" fn GetUpdatedClipboardFormats( lpuiFormats: [*]u32, cFormats: u32, pcFormatsOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GlobalDeleteAtom( nAtom: u16, ) callconv(@import("std").os.windows.WINAPI) u16; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn InitAtomTable( nSize: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn DeleteAtom( nAtom: u16, ) callconv(@import("std").os.windows.WINAPI) u16; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GlobalAddAtomA( lpString: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u16; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GlobalAddAtomW( lpString: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u16; pub extern "KERNEL32" fn GlobalAddAtomExA( lpString: ?[*:0]const u8, Flags: u32, ) callconv(@import("std").os.windows.WINAPI) u16; pub extern "KERNEL32" fn GlobalAddAtomExW( lpString: ?[*:0]const u16, Flags: u32, ) callconv(@import("std").os.windows.WINAPI) u16; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GlobalFindAtomA( lpString: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u16; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GlobalFindAtomW( lpString: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u16; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GlobalGetAtomNameA( nAtom: u16, lpBuffer: [*:0]u8, nSize: i32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GlobalGetAtomNameW( nAtom: u16, lpBuffer: [*:0]u16, nSize: i32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn AddAtomA( lpString: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u16; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn AddAtomW( lpString: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u16; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn FindAtomA( lpString: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u16; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn FindAtomW( lpString: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u16; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetAtomNameA( nAtom: u16, lpBuffer: [*:0]u8, nSize: i32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetAtomNameW( nAtom: u16, lpBuffer: [*:0]u16, nSize: i32, ) callconv(@import("std").os.windows.WINAPI) u32; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (13) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { pub const MONHSZSTRUCT = thismodule.MONHSZSTRUCTA; pub const DdeInitialize = thismodule.DdeInitializeA; pub const DdeCreateStringHandle = thismodule.DdeCreateStringHandleA; pub const DdeQueryString = thismodule.DdeQueryStringA; pub const RegisterClipboardFormat = thismodule.RegisterClipboardFormatA; pub const GetClipboardFormatName = thismodule.GetClipboardFormatNameA; pub const GlobalAddAtom = thismodule.GlobalAddAtomA; pub const GlobalAddAtomEx = thismodule.GlobalAddAtomExA; pub const GlobalFindAtom = thismodule.GlobalFindAtomA; pub const GlobalGetAtomName = thismodule.GlobalGetAtomNameA; pub const AddAtom = thismodule.AddAtomA; pub const FindAtom = thismodule.FindAtomA; pub const GetAtomName = thismodule.GetAtomNameA; }, .wide => struct { pub const MONHSZSTRUCT = thismodule.MONHSZSTRUCTW; pub const DdeInitialize = thismodule.DdeInitializeW; pub const DdeCreateStringHandle = thismodule.DdeCreateStringHandleW; pub const DdeQueryString = thismodule.DdeQueryStringW; pub const RegisterClipboardFormat = thismodule.RegisterClipboardFormatW; pub const GetClipboardFormatName = thismodule.GetClipboardFormatNameW; pub const GlobalAddAtom = thismodule.GlobalAddAtomW; pub const GlobalAddAtomEx = thismodule.GlobalAddAtomExW; pub const GlobalFindAtom = thismodule.GlobalFindAtomW; pub const GlobalGetAtomName = thismodule.GlobalGetAtomNameW; pub const AddAtom = thismodule.AddAtomW; pub const FindAtom = thismodule.FindAtomW; pub const GetAtomName = thismodule.GetAtomNameW; }, .unspecified => if (@import("builtin").is_test) struct { pub const MONHSZSTRUCT = *opaque{}; pub const DdeInitialize = *opaque{}; pub const DdeCreateStringHandle = *opaque{}; pub const DdeQueryString = *opaque{}; pub const RegisterClipboardFormat = *opaque{}; pub const GetClipboardFormatName = *opaque{}; pub const GlobalAddAtom = *opaque{}; pub const GlobalAddAtomEx = *opaque{}; pub const GlobalFindAtom = *opaque{}; pub const GlobalGetAtomName = *opaque{}; pub const AddAtom = *opaque{}; pub const FindAtom = *opaque{}; pub const GetAtomName = *opaque{}; } else struct { pub const MONHSZSTRUCT = @compileError("'MONHSZSTRUCT' requires that UNICODE be set to true or false in the root module"); pub const DdeInitialize = @compileError("'DdeInitialize' requires that UNICODE be set to true or false in the root module"); pub const DdeCreateStringHandle = @compileError("'DdeCreateStringHandle' requires that UNICODE be set to true or false in the root module"); pub const DdeQueryString = @compileError("'DdeQueryString' requires that UNICODE be set to true or false in the root module"); pub const RegisterClipboardFormat = @compileError("'RegisterClipboardFormat' requires that UNICODE be set to true or false in the root module"); pub const GetClipboardFormatName = @compileError("'GetClipboardFormatName' requires that UNICODE be set to true or false in the root module"); pub const GlobalAddAtom = @compileError("'GlobalAddAtom' requires that UNICODE be set to true or false in the root module"); pub const GlobalAddAtomEx = @compileError("'GlobalAddAtomEx' requires that UNICODE be set to true or false in the root module"); pub const GlobalFindAtom = @compileError("'GlobalFindAtom' requires that UNICODE be set to true or false in the root module"); pub const GlobalGetAtomName = @compileError("'GlobalGetAtomName' requires that UNICODE be set to true or false in the root module"); pub const AddAtom = @compileError("'AddAtom' requires that UNICODE be set to true or false in the root module"); pub const FindAtom = @compileError("'FindAtom' requires that UNICODE be set to true or false in the root module"); pub const GetAtomName = @compileError("'GetAtomName' requires that UNICODE be set to true or false in the root module"); }, }; //-------------------------------------------------------------------------------- // Section: Imports (12) //-------------------------------------------------------------------------------- const BOOL = @import("../foundation.zig").BOOL; const CHAR = @import("../foundation.zig").CHAR; const HANDLE = @import("../foundation.zig").HANDLE; const HDC = @import("../graphics/gdi.zig").HDC; const HENHMETAFILE = @import("../graphics/gdi.zig").HENHMETAFILE; const HMETAFILE = @import("../graphics/gdi.zig").HMETAFILE; const HWND = @import("../foundation.zig").HWND; const LPARAM = @import("../foundation.zig").LPARAM; const PSTR = @import("../foundation.zig").PSTR; const PWSTR = @import("../foundation.zig").PWSTR; const SECURITY_QUALITY_OF_SERVICE = @import("../security.zig").SECURITY_QUALITY_OF_SERVICE; const WPARAM = @import("../foundation.zig").WPARAM; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "PFNCALLBACK")) { _ = PFNCALLBACK; } @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/system/data_exchange.zig
const std = @import("std"); const testing = std.testing; pub const Computer = struct { accum: i32, instr: [1000]Instr, icount: usize, const Op = enum { None, ACC, JMP, NOP, }; const Instr = struct { op: Op, arg: i32, count: usize, pub fn reset(self: *Instr, op: Op, arg: i32) void { self.op = op; self.arg = arg; self.count = 0; } }; pub fn init() Computer { var self = Computer{ .accum = 0, .icount = 0, .instr = undefined, }; return self; } pub fn deinit(self: *Computer) void { _ = self; } pub fn add_instr(self: *Computer, line: []const u8) void { var it = std.mem.tokenize(u8, line, " "); const sop = it.next().?; var op = Op.None; if (std.mem.eql(u8, sop, "acc")) op = Op.ACC; if (std.mem.eql(u8, sop, "jmp")) op = Op.JMP; if (std.mem.eql(u8, sop, "nop")) op = Op.NOP; if (op == Op.None) @panic("OP"); const sarg = it.next().?; const arg = std.fmt.parseInt(i32, sarg, 10) catch unreachable; self.instr[self.icount].reset(op, arg); // std.debug.warn("OP {} {}\n", .{ op, arg }); self.icount += 1; } pub fn run_to_first_dupe(self: *Computer) bool { self.reset(); var pc: isize = 0; while (true) { if (pc < 0) @panic("PC"); if (pc >= self.icount) return true; const upc = @intCast(usize, pc); // std.debug.warn("RUN [{}]\n", .{self.instr[upc]}); self.instr[upc].count += 1; if (self.instr[upc].count > 1) { break; } var incr: isize = 1; switch (self.instr[upc].op) { Op.NOP => {}, Op.ACC => self.accum += self.instr[upc].arg, Op.JMP => incr = self.instr[upc].arg, else => @panic("RUN"), } pc += incr; } return false; } pub fn change_one_instr_until_success(self: *Computer) void { var pc: usize = 0; while (pc < self.icount) : (pc += 1) { const old = self.instr[pc].op; if (old != Op.NOP and old != Op.JMP) { continue; } const new = if (old == Op.NOP) Op.JMP else Op.NOP; self.instr[pc].op = new; const ok = self.run_to_first_dupe(); self.instr[pc].op = old; if (ok) { return; } } } pub fn get_accumulator(self: *Computer) i32 { return self.accum; } fn reset(self: *Computer) void { self.accum = 0; var pc: usize = 0; while (pc < self.icount) : (pc += 1) { self.instr[pc].count = 0; } } }; test "sample first dupe" { const data: []const u8 = \\nop +0 \\acc +1 \\jmp +4 \\acc +3 \\jmp -3 \\acc -99 \\acc +1 \\jmp -4 \\acc +6 ; var computer = Computer.init(); defer computer.deinit(); var it = std.mem.split(u8, data, "\n"); while (it.next()) |line| { computer.add_instr(line); } _ = computer.run_to_first_dupe(); const accum = computer.get_accumulator(); try testing.expect(accum == 5); } test "sample change one instr" { const data: []const u8 = \\nop +0 \\acc +1 \\jmp +4 \\acc +3 \\jmp -3 \\acc -99 \\acc +1 \\jmp -4 \\acc +6 ; var computer = Computer.init(); defer computer.deinit(); var it = std.mem.split(u8, data, "\n"); while (it.next()) |line| { computer.add_instr(line); } computer.change_one_instr_until_success(); const accum = computer.get_accumulator(); try testing.expect(accum == 8); }
2020/p08/computer.zig
const std = @import("std"); const zlm = @import("zlm"); const gl = @import("gl.zig"); const TextureSpec = @import("../track/piece_renderer.zig").TextureSpec; pub const texture_length = 512; pub const block_length = texture_length / 16; const empty_block_array = [_][block_length]bool{[_]bool{false} ** block_length} ** block_length; const TextureBlock = struct { address: u24, width: u4, height: u4, page: TextureSpec.Page, }; pub const TextureAtlas = struct { // opengl texture id texture: gl.Texture, // map of allocated blocks block_map: std.AutoHashMapUnmanaged(TextureBlock, zlm.Vec2), // array of which spaces are free used_blocks: [block_length][block_length]bool, // the actual texture data pixels: [texture_length][texture_length]u8, pub fn init(allocator: *std.mem.Allocator) !*TextureAtlas { const result = try allocator.create(TextureAtlas); errdefer allocator.destroy(result); result.texture = gl.Texture.init(); errdefer result.texture.deinit(); result.texture.bind(.@"2d"); gl.Texture.minFilter(.@"2d", .nearest); gl.Texture.magFilter(.@"2d", .nearest); result.block_map = .{}; errdefer result.block_map.deinit(allocator); result.used_blocks = empty_block_array; return result; } pub fn deinit(self: *TextureAtlas, allocator: *std.mem.Allocator) void { self.block_map.deinit(allocator); self.texture.deinit(); allocator.destroy(self); } pub fn clear(self: *TextureAtlas, allocator: *std.mem.Allocator) void { self.block_map.clearAndFree(allocator); self.used_blocks = empty_block_array; } fn readTexture(self: *TextureAtlas, dx: u8, dy: u8, spec: TextureSpec) !void { const pixel_w = @as(u8, @as(u4, 1) << spec.width) * 16; const pixel_h = @as(u8, @as(u4, 1) << spec.height) * 16; var view = spec.rom.view(spec.address); var y: u16 = 0; while (y < pixel_h) : (y += 1) { var x: u16 = 0; while (x < pixel_w) : (x += 1) { const b = try view.reader().readByte(); self.pixels[y + @as(u16, dy) * 16][x + @as(u16, dx) * 16] = switch (spec.page) { .left => b & 15, .right => b >> 4, }; } view.pos += 256 - @as(u16, pixel_w); } } fn isBlockEmpty(self: *const TextureAtlas, x: u8, y: u8, width: u4, height: u4) bool { var h: u8 = 0; while (h < height) : (h += 1) { var w: u8 = 0; while (w < width) : (w += 1) { if (self.used_blocks[y + h][x + w]) { return false; } } } return true; } fn markBlocks(self: *TextureAtlas, x: u8, y: u8, width: u4, height: u4) void { var h: u8 = 0; while (h < height) : (h += 1) { var w: u8 = 0; while (w < width) : (w += 1) { self.used_blocks[y + h][x + w] = true; } } } pub fn get(self: *TextureAtlas, allocator: *std.mem.Allocator, spec: TextureSpec) !zlm.Vec2 { const width = @as(u4, 1) << spec.width; const height = @as(u4, 1) << spec.height; const key = TextureBlock{ .address = spec.address, .width = width, .height = height, .page = spec.page, }; if (self.block_map.get(key)) |uv| { // we've already mapped this texture, so return the existing coordinate return uv; } else { var y: u8 = 0; while (y + height - 1 < block_length) : (y += 1) { var x: u8 = 0; while (x + width - 1 < block_length) : (x += 1) { if (self.isBlockEmpty(x, y, width, height)) { // read the texture from ROM try self.readTexture(x, y, spec); // create uv coordinate for top-left const value = zlm.vec2(@intToFloat(f32, x) / block_length, @intToFloat(f32, y) / block_length); // put coordinate into map, removing it if following code fails try self.block_map.put(allocator, key, value); errdefer _ = self.block_map.remove(key); // mark blocks as used self.markBlocks(x, y, width, height); // DO NOT PUT FALLIBLE CODE PAST HERE, or else used blocks may be lost return value; } } } return error.OutOfTextureSpace; } } pub fn update(self: *const TextureAtlas) void { gl.Texture.image2D(.@"2d", 0, gl.c.GL_R8UI, texture_length, texture_length, gl.c.GL_RED_INTEGER, gl.c.GL_UNSIGNED_BYTE, @ptrCast([*]const u8, &self.pixels)); } };
src/render/texture_atlas.zig
const std = @import("std"); const mem = std.mem; const testing = std.testing; const Allocator = mem.Allocator; const ArrayList = std.ArrayList; const Buffer = std.Buffer; /// A zero-indexed position of a buffer. /// `line = 0, col = 0` is the first line, first character. pub const Position = struct { line: usize, col: usize, }; /// A range between two positions in a buffer. Inclusive. pub const Range = struct { start: Position, end: Position, }; /// A gap buffer is like a growable array, but the reserved space is /// in the middle of the data, separating two sides, as opposed to /// being fixed at the end. This data structure is efficient for /// inserting and deleting text in close proximity. pub const GapBuffer = struct { const Self = @This(); data: ArrayList(u8), gap_start: usize, gap_len: usize, const GapBufferError = error{ InvalidUtf8, OutOfBounds, OutOfMemory, }; /// Initialize the GapBuffer with the given string as data. /// /// This function will verify that the given data is valid UTF-8. /// To prevent validation, you can use initUnchecked. An /// `error.InvalidUtf8` signals the data was not valid UTF-8. pub fn init(allocator: *Allocator, data: []const u8) GapBufferError!GapBuffer { // Verify that the provided data is valid UTF-8 if (!std.unicode.utf8ValidateSlice(data)) { return error.InvalidUtf8; } return initUnchecked(allocator, data); } /// Initialize the GapBuffer with the given string as data, without validations. pub fn initUnchecked(allocator: *Allocator, data: []const u8) GapBufferError!GapBuffer { var array_list = try ArrayList(u8).initCapacity(allocator, data.len); array_list.expandToCapacity(); mem.copy(u8, array_list.items[0..data.len], data); return GapBuffer{ .data = array_list, .gap_start = data.len, .gap_len = array_list.capacity - data.len }; } pub fn deinit(self: *Self) void { self.data.deinit(); } /// Returns all of the text from the buffer as a new string. /// /// The caller is responsible for freeing the returned string. pub fn toSlice(self: Self, allocator: *Allocator) GapBufferError![]const u8 { var s1 = self.data.items[0..self.gap_start]; var s2 = self.data.items[self.gap_start + self.gap_len ..]; var result = try allocator.alloc(u8, s1.len + s2.len); mem.copy(u8, result, s1); mem.copy(u8, result[s1.len..], s2); return result; } /// Insert text at the given position in the buffer. /// /// Just like `init`, this function will validate that data /// is valid UTF-8. /// /// If the position does not exist in the buffer, `error.OutOfBounds` /// is returned. An `error.OutOfMemory` is possible here. In addition, /// an error from `findOffset` may be returned also. pub fn insert(self: *Self, data: []const u8, pos: Position) GapBufferError!void { // Verify that the provided data is valid UTF-8 if (!std.unicode.utf8ValidateSlice(data)) { return error.InvalidUtf8; } return insertUnchecked(self, data, pos); } /// Insert text at the given position in the buffer, without validations. pub fn insertUnchecked(self: *Self, data: []const u8, pos: Position) GapBufferError!void { if (data.len > self.gap_len) { // If we need to allocate more memory ... self.moveGap(self.data.capacity); // Move gap to end try self.data.resize(self.data.capacity + (data.len - self.gap_len)); // Increase gap buffer size to fit requirement self.data.expandToCapacity(); // Make item count equal to available allocated space self.gap_len = self.data.capacity - self.gap_start; // Extend gap length to max available } var offset = self.findOffset(pos) orelse return error.OutOfBounds; self.moveGap(offset); self.writeToGap(data); } /// Returns the specified range of data from the buffer as a new string. Inclusive. /// /// If any part of the range is not found in the buffer, a null value will be returned. /// /// The caller is responsible for freeing the returned string. pub fn read(self: Self, allocator: *Allocator, range: Range) GapBufferError!?[]const u8 { var start_offset = self.findOffset(range.start) orelse return null; var end_offset = self.findOffset(range.end) orelse return null; if (start_offset < self.gap_start and self.gap_start < end_offset) { // If the gap is between the two positions ... var s1 = self.data.items[start_offset..self.gap_start]; // First half var s2 = self.data.items[self.gap_start + self.gap_len .. end_offset + 1]; // Second half var str = try allocator.alloc(u8, s1.len + s2.len); mem.copy(u8, str, s1); mem.copy(u8, str[s1.len..], s2); return str; } else { // No gap in the way, just return the requested data range var s = self.data.items[start_offset .. end_offset + 1]; var str = try allocator.alloc(u8, s.len); mem.copy(u8, str, s); return str; } } /// Removes the range of data from the buffer. Inclusive. pub fn delete(self: *Self, range: Range) void { var start_offset = self.findOffset(range.start) orelse return; self.moveGap(start_offset); var end_offset = self.findOffset(range.end) orelse return; self.gap_len = end_offset - self.gap_start + 1; // Widen gap in order to cover deleted contents } /// On the assumption that the gap is large enough to support the /// length of the data, this function will write it into the gap, /// decreasing the size of the gap in the process. fn writeToGap(self: *Self, data: []const u8) void { std.debug.assert(data.len <= self.gap_len); // Write data to the gap mem.copy(u8, self.data.items[self.gap_start..], data); // Shrink the gap self.gap_start += data.len; self.gap_len -= data.len; } /// Returns true if the provided character position could be found in the buffer. pub fn inBounds(self: Self, pos: Position) bool { return self.findOffset(pos) != null; } /// Maps a position to its offset in the data. Remember: positions are zero-based. /// For example, `.{.line=2, .col=3}` is the fourth character of the third line. /// /// The error returned could be `error.InvalidUtf8`. If the value returned is null, /// then the character position you provided was not found in the buffer. pub fn findOffset(self: Self, pos: Position) ?usize { var first_half = self.data.items[0..self.gap_start]; var line: usize = 0; var col: usize = 0; var iter = std.unicode.Utf8View.initUnchecked(first_half).iterator(); var offset: usize = 0; while (iter.nextCodepointSlice()) |c| : (offset += c.len) { if (line == pos.line and col == pos.col) return offset; // Have we found the correct position? if (mem.eql(u8, c, "\n")) { line += 1; col = 0; } else { col += 1; } } // If the position wasn't in the first half, it could be at the start of the gap if (line == pos.line and col == pos.col) return self.gap_start + self.gap_len; var second_half = self.data.items[self.gap_start + self.gap_len ..]; iter = std.unicode.Utf8View.initUnchecked(second_half).iterator(); offset = 0; while (iter.nextCodepointSlice()) |c| : (offset += c.len) { if (line == pos.line and col == pos.col) return self.gap_start + self.gap_len + offset; // Have we found the correct position? if (mem.eql(u8, c, "\n")) { line += 1; col = 0; } else { col += 1; } } // If the position wasn't in the second half, it could be at the end of the buffer if (line == pos.line and col == pos.col) return self.data.items.len; return null; } /// Moves closest boundary of the gap to the given index of the data. fn moveGap(self: *Self, offset: usize) void { if (self.gap_len == 0) { // If we're at full capacity, no need to move any data self.gap_start = offset; return; } if (offset < self.gap_start) { // If we need to move the gap to the left ... var i: usize = self.gap_start - 1; while (i >= offset) : (i -= 1) { self.data.items[i + self.gap_len] = self.data.items[i]; // Move items from left side to right side self.data.items[i] = 0; // Make characters within gap null bytes } self.gap_start = offset; } else if (offset > self.gap_start) { // If we need to move the gap to the right ... var i: usize = self.gap_start + self.gap_len; // Only moving enough to get right boundary in place while (i < offset) : (i += 1) { self.data.items[i - self.gap_len] = self.data.items[i]; // Move items from right side to left side self.data.items[i] = 0; } self.gap_start = offset - self.gap_len; } } }; test "basic init and moving the gap" { const alloc = testing.allocator; var gb = try GapBuffer.init(alloc, "this is a test"); defer gb.deinit(); gb.moveGap(3); // Set gap start position to index 3 testing.expect(gb.gap_start == 3); } test "utf-8" { const alloc = testing.allocator; var gb = try GapBuffer.init(alloc, "鶸膱𩋍ꈵO֫窄|̋喛\\ꜯnG"); // Random UTF-8 string defer gb.deinit(); var offset = gb.findOffset(.{ .line = 0, .col = 6 }); // Get the starting index of the SEVENTH character testing.expect(offset.? == 16); } test "lines and columns" { const alloc = testing.allocator; var gb = try GapBuffer.init(alloc, "first\n second\n\t\tthird\n\nfifth"); defer gb.deinit(); var offset = gb.findOffset(.{ .line = 1, .col = 4 }); // Get the first letter of word "second" (0-indexed) testing.expect(offset.? == 10); offset = gb.findOffset(.{ .line = 2, .col = 2 }); // Get the first letter of word "third" testing.expect(offset.? == 19); offset = gb.findOffset(.{ .line = 4, .col = 0 }); // Get the first letter of word "third" testing.expect(offset.? == 26); } test "inBounds" { const alloc = testing.allocator; var gb = try GapBuffer.init(alloc, "鶸膱𩋍ꈵO֫窄|̋喛\\ꜯnG"); // Random UTF-8 string defer gb.deinit(); testing.expect(gb.inBounds(.{ .line = 0, .col = 7 }) == true); testing.expect(gb.inBounds(.{ .line = 0, .col = 16 }) == false); testing.expect(gb.inBounds(.{ .line = 1, .col = 0 }) == false); } test "read from ranges" { const alloc = testing.allocator; var gb = try GapBuffer.init(alloc, "first\n second\n\t\tthird\n\nfifth"); defer gb.deinit(); const pos = Range{ .start = .{ .line = 1, .col = 0 }, .end = .{ .line = 2, .col = 7 } }; var lines_2_and_3 = try gb.read(alloc, pos); defer alloc.free(lines_2_and_3.?); testing.expectEqualStrings(lines_2_and_3.?, " second\n\t\tthird\n"); } test "inserting and deleting text" { const alloc = testing.allocator; var gb = try GapBuffer.init(alloc, "init"); defer gb.deinit(); try gb.insert("ial text", .{ .line = 0, .col = 4 }); var tmp1 = try gb.toSlice(alloc); defer alloc.free(tmp1); testing.expectEqualStrings(tmp1, "initial text"); gb.delete(.{ .start = .{ .line = 0, .col = 4 }, .end = .{ .line = 0, .col = 6 } }); var tmp2 = try gb.toSlice(alloc); defer alloc.free(tmp2); testing.expectEqualStrings(tmp2, "init text"); try gb.insert(" sequence! :)", Position{ .line = 0, .col = 9 }); var tmp3 = try gb.toSlice(alloc); defer alloc.free(tmp3); testing.expectEqualStrings(tmp3, "init text sequence! :)"); }
src/gap-buffer.zig
const std = @import("std"); const warn = std.debug.warn; const time = @import("./src/time.zig"); const Duration = time.Duration; test "now" { var local = time.Location.getLocal(); var now = time.now(&local); warn("\n today's date {}", .{now.date()}); warn("\n today's time {}", .{now.clock()}); warn("\n local timezone detail {}\n", .{now.zone()}); // $ zig test example.zig // Test 1/1 now... // today's date DateDetail{ .year = 2018, .month = Month.November, .day = 25, .yday = 328 } // today's time Clock{ .hour = 11, .min = 17, .sec = 16 } // local timezone detail ZoneDetail{ .name = EAT, .offset = 10800 } // OK // All tests passed. } const formatTest = struct { name: []const u8, format: []const u8, fn init(name: []const u8, format: []const u8) formatTest { return formatTest{ .name = name, .format = format }; } }; const format_tests = [_]formatTest{ formatTest.init("ANSIC", time.ANSIC), formatTest.init("UnixDate", time.UnixDate), formatTest.init("RubyDate", time.RubyDate), formatTest.init("RFC822", time.RFC822), formatTest.init("RFC850", time.RFC850), formatTest.init("RFC1123", time.RFC1123), formatTest.init("RFC1123Z", time.RFC1123Z), formatTest.init("RFC3339", time.RFC3339), formatTest.init("RFC3339Nano", time.RFC3339Nano), formatTest.init("Kitchen", time.Kitchen), formatTest.init("am/pm", "3pm"), formatTest.init("AM/PM", "3PM"), formatTest.init("two-digit year", "06 01 02"), // Three-letter months and days must not be followed by lower-case letter. formatTest.init("Janet", "Hi Janet, the Month is January"), // Time stamps, Fractional seconds. formatTest.init("Stamp", time.Stamp), formatTest.init("StampMilli", time.StampMilli), formatTest.init("StampMicro", time.StampMicro), formatTest.init("StampNano", time.StampNano), }; test "time.format" { var local = time.Location.getLocal(); var ts = time.now(&local); var buf = std.ArrayList(u8).init(std.testing.allocator); defer buf.deinit(); warn("\n", .{}); for (format_tests) |value| { try buf.resize(0); try ts.formatBuffer(&buf, value.format); warn("{}: {}\n", .{ value.name, buf.items }); } // Test 2/2 time.format... // ANSIC: Thu Nov 29 05:46:03 2018 // UnixDate: Thu Nov 29 05:46:03 EAT 2018 // RubyDate: Thu Nov 29 05:46:03 +0300 2018 // RFC822: 29 Nov 18 05:46 EAT // RFC850: Thursday, 29-Nov-18 05:46:03 EAT // RFC1123: Thu, 29 Nov 2018 05:46:03 EAT // RFC1123Z: Thu, 29 Nov 2018 05:46:03 +0300 // RFC3339: 2018-11-29T05:46:03+03:00 // RFC3339Nano: 2018-11-29T05:46:03.000024416+03:00 // Kitchen: 5:46AM // am/pm: 5am // AM/PM: 5AM // two-digit year: 18 11 29 // Janet: Hi Janet, the Month is November // Stamp: Nov 29 05:46:03 // StampMilli: Nov 29 05:46:03.000 // StampMicro: Nov 29 05:46:03.000024 // StampNano: Nov 29 05:46:03.000024416 // OK // All tests passed. } test "durations" { // print w0ne hour and 10 secods const hour = Duration.Hour.value; const minute = Duration.Minute.value; const second = Duration.Second.value; var d = Duration.init(hour + minute * 4 + second * 10); warn("duration is {} \n", .{d.string()}); } test "addDate" { var local = time.Location.getLocal(); var ts = time.now(&local); var buf = std.ArrayList(u8).init(std.testing.allocator); defer buf.deinit(); try ts.string(&buf); warn("\ncurrent time is {}\n", .{buf.items}); // let's add 1 year ts = ts.addDate(1, 0, 0); try ts.string(&buf); warn("this time next year is {}\n", .{buf.items}); }
example.zig
pub const Context = @import("context.zig").Context; pub const Swapchain = @import("swapchain.zig").Swapchain; pub const buffer = @import("buffer.zig"); pub const Program = @import("../program/program.zig").Program; pub const Uniform = @import("uniform.zig").Uniform; pub const Framebuffer = @import("framebuffer.zig").Framebuffer; const std = @import("std"); const Allocator = std.mem.Allocator; pub const vk = @import("../include/vk.zig"); const zva = @import("zva"); const windowing = @import("../windowing.zig"); const ImageView = vk.ImageView; // Config pub const IN_FLIGHT_FRAMES = 2; pub const BackendError = error{ NoValidDevices, ValidationLayersNotAvailable, CreateSurfaceFailed, AcquireImageFailed, PresentFailed, InvalidShader, UnknownResourceType }; // Vulkan Backend pub const Backend = struct { const Self = @This(); allocator: *Allocator, vallocator: zva.Allocator, window: *windowing.Window, swapchain: Swapchain, context: Context, present_queue: vk.Queue, graphics_queue: vk.Queue, frames: []Frame, frame_index: u32 = 0, pub fn new(allocator: *Allocator, window: *windowing.Window, swapchain: Swapchain) Self { return Self{ .allocator = allocator, .vallocator = undefined, .window = window, .swapchain = swapchain, .context = undefined, .present_queue = undefined, .graphics_queue = undefined, .frames = undefined, }; } pub fn init(self: *Self) !void { self.context = try Context.init(self.allocator, self.window); self.vallocator = try zva.Allocator.init(self.allocator, .{ .getPhysicalDeviceProperties = self.context.vki.vkGetPhysicalDeviceProperties, .getPhysicalDeviceMemoryProperties = self.context.vki.vkGetPhysicalDeviceMemoryProperties, .allocateMemory = self.context.vkd.vkAllocateMemory, .freeMemory = self.context.vkd.vkFreeMemory, .mapMemory = self.context.vkd.vkMapMemory, .unmapMemory = self.context.vkd.vkUnmapMemory, }, self.context.physical_device, self.context.device, 128); try self.swapchain.init(self.allocator, &self.context, self.window); self.frames = try self.allocator.alloc(Frame, IN_FLIGHT_FRAMES); for (self.frames) |*frame| { frame.* = try Frame.init(&self.context); } } pub fn deinit(self: *Self) void { self.context.vkd.deviceWaitIdle(self.context.device) catch unreachable; self.swapchain.deinit(); self.vallocator.deinit(); self.context.deinit(); } pub fn deinitFrames(self: *Self) void { for (self.frames) |*frame| { frame.waitForFence() catch unreachable; frame.deinit(); } self.allocator.free(self.frames); } fn recreateSwapchain(self: *Self) !void { try self.context.vkd.deviceWaitIdle(self.context.device); try self.swapchain.recreate(); for (self.frames) |*frame| { try frame.recreate(); } } pub fn present(self: *Self, program: *const Program) !void { var currentFrame = &self.frames[self.frame_index]; try currentFrame.waitForFence(); try self.context.vkd.resetFences(self.context.device, 1, @ptrCast([*]const vk.Fence, &currentFrame.fence)); var imageIndex: u32 = 0; if (try self.swapchain.acquireNextImage(currentFrame.image_available, &imageIndex)) { try self.recreateSwapchain(); return; } try currentFrame.prepare(program, &self.swapchain, imageIndex); try self.context.vkd.queueSubmit(self.context.graphics_queue, 1, &[_]vk.SubmitInfo{.{ .wait_semaphore_count = 1, .p_wait_semaphores = @ptrCast([*]const vk.Semaphore, &currentFrame.image_available), .p_wait_dst_stage_mask = &[_]vk.PipelineStageFlags{.{ .color_attachment_output_bit = true }}, .command_buffer_count = 1, .p_command_buffers = &[_]vk.CommandBuffer{currentFrame.command_buffer}, .signal_semaphore_count = 1, .p_signal_semaphores = @ptrCast([*]const vk.Semaphore, &currentFrame.render_finished), }}, currentFrame.fence); if (try self.swapchain.present(currentFrame.render_finished, imageIndex)) { try self.recreateSwapchain(); return; } self.frame_index = (self.frame_index + 1) % IN_FLIGHT_FRAMES; } }; const Frame = struct { context: *const Context, command_buffer: vk.CommandBuffer, command_pool: vk.CommandPool, framebuffer: ?Framebuffer, image_available: vk.Semaphore, render_finished: vk.Semaphore, fence: vk.Fence, fn init(context: *const Context) !Frame { var command_buffer: vk.CommandBuffer = undefined; try context.vkd.allocateCommandBuffers(context.device, .{ .command_pool = context.graphics_pool, .level = .primary, .command_buffer_count = 1, }, @ptrCast([*]vk.CommandBuffer, &command_buffer)); errdefer context.vkd.freeCommandBuffers(context.device, context.graphics_pool, 1, @ptrCast([*]vk.CommandBuffer, &command_buffer)); var command_pool: vk.CommandPool = try context.vkd.createCommandPool(context.device, .{ .queue_family_index = context.indices.graphics_family.?, .flags = .{ .transient_bit = true, .reset_command_buffer_bit = true, }, }, null); errdefer context.vkd.destroyCommandPool(context.device, command_pool, null); const image_available = try context.vkd.createSemaphore(context.device, .{ .flags = .{} }, null); errdefer context.vkd.destroySemaphore(context.device, image_available, null); const render_finished = try context.vkd.createSemaphore(context.device, .{ .flags = .{} }, null); errdefer context.vkd.destroySemaphore(context.device, render_finished, null); const fence = try context.vkd.createFence(context.device, .{ .flags = .{ .signaled_bit = true } }, null); errdefer context.vkd.destroyFence(context.device, fence, null); return Frame{ .context = context, .command_buffer = command_buffer, .command_pool = command_pool, .framebuffer = null, .image_available = image_available, .render_finished = render_finished, .fence = fence, }; } fn deinit(self: Frame) void { self.context.vkd.destroyFence(self.context.device, self.fence, null); self.context.vkd.destroySemaphore(self.context.device, self.render_finished, null); self.context.vkd.destroySemaphore(self.context.device, self.image_available, null); if (self.framebuffer) |fb| fb.deinit(); self.context.vkd.freeCommandBuffers(self.context.device, self.context.graphics_pool, 1, @ptrCast([*]const vk.CommandBuffer, &self.command_buffer)); self.context.vkd.destroyCommandPool(self.context.device, self.command_pool, null); } fn recreate(self: *Frame) !void { try self.context.vkd.resetCommandPool(self.context.device, self.command_pool, .{}); self.context.vkd.destroyFence(self.context.device, self.fence, null); if (self.framebuffer) |fb| fb.deinit(); self.framebuffer = null; self.fence = try self.context.vkd.createFence(self.context.device, .{ .flags = .{ .signaled_bit = true } }, null); errdefer self.context.vkd.destroyFence(self.context.device, self.fence, null); } fn prepare(self: *Frame, program: *const Program, swapchain: *Swapchain, imageIndex: u32) !void { if (self.framebuffer) |fb| fb.deinit(); var attachment = [_]vk.ImageView{swapchain.images[imageIndex].view}; self.framebuffer = try Framebuffer.init(self.context, attachment[0..], program.steps[0].RenderPass.renderpass(), swapchain); try program.execute(self.command_buffer, self.framebuffer.?); } fn waitForFence(self: *Frame) !void { _ = try self.context.vkd.waitForFences(self.context.device, 1, @ptrCast([*]const vk.Fence, &self.fence), vk.TRUE, std.math.maxInt(u64)); } };
render/src/backend/backend.zig
const std = @import("std"); const math = @import("math.zig").math; const shr = std.math.shr; const shl = std.math.shl; const expectEqual = @import("std").testing.expectEqual; pub const D64 = struct { v: i64, const offset = 32; const lowBits = 0xFFFFFFFF; pub const pi = lit("3.1415926535897932384626433"); pub fn lit(comptime str: [:0]const u8) D64 { if (str.len == 0) { @compileError("Empty fixed point literal."); } // Parse as a fixed 128 with 64 fractal bits, then shift // to D64. const parseOne = 1 << 64; comptime var r: i128 = 0; comptime var i: usize = 0; const negative = str[0] == '-'; if (negative) { i += 1; } parse: { inline while (true) { if (i >= str.len) { break :parse; } const c = str[i]; i += 1; if (c >= '0' and c <= '9') { r *= 10; r += parseOne * @intCast(i128, c - '0'); } else if (c == '.') { break; } else { @compileError("Not a valid fixed point literal: " ++ str); } } comptime var divisor: i128 = 1; inline while (true) { if (i >= str.len) { break :parse; } divisor *= 10; const c = str[i]; i += 1; if (c >= '0' and c <= '9') { r += @divFloor(parseOne, divisor) * @intCast(i128, c - '0'); } else { @compileError("Not a valid fixed point literal: " ++ str); } } } if (negative) { r *= -1; } return comptime D64{ .v = @intCast(i64, shr(i128, r, 32)) }; } pub fn add(self: D64, other: D64) D64 { // a*2^f + b*2^f = (a + b)*2^f return D64{ .v = self.v + other.v }; } pub fn sub(self: D64, other: D64) D64 { // a*2^f - b*2^f = (a - b)*2^f return D64{ .v = self.v - other.v }; } pub fn mul(self: D64, other: D64) D64 { // a*2^f * b*2^f = a*b*2^(2f) // (a*2^f * b*2^f) / 2^f = a*b*2^f // const selfLow = self.v & lowBits; // const selfHigh = shr(i64, self.v, 32); // const otherLow = other.v & lowBits; // const otherHigh = shr(i64, other.v, 32); // std.debug.print("--- {} * {}\n", .{ self.toF32(), other.toF32() }); // std.debug.print("--- {b} = {b} + {b}\n", .{ self.v, selfHigh, selfLow }); // std.debug.print("--- {b} = {b} + {b}\n", .{ other.v, otherHigh, otherLow }); // return D64{ .v = shr(i64, selfLow * otherLow, 32) + (selfLow * otherHigh) + (selfHigh * otherLow) + ((selfHigh * otherHigh) << 32) }; const rb = @intCast(i128, self.v) * @intCast(i128, other.v); return D64{ .v = @intCast(i64, shr(i128, rb, 32)) }; } pub fn div(self: D64, other: D64) D64 { // (a*2^f) / (b*2^f) = a/b // (a*2^f*2^f) / (b*2^f) = (a/b) * 2^f const sb = shl(i128, @intCast(i128, self.v), 32); const ob = @intCast(i128, other.v); const rb = @divFloor(sb, ob); return D64{ .v = @intCast(i64, rb) }; } pub fn mod(self: D64, other: D64) D64 { var sb = shl(i128, @intCast(i128, self.v), 32); if (self.v < 0) { sb |= 0xFFFFFFFF; } const ob = shl(i128, @intCast(i128, other.v), 32); const rb = @mod(sb, ob); return D64{ .v = @intCast(i64, shr(i128, rb, 32)) }; } pub fn sin(self: D64) D64 { const twoPi = comptime pi.mul(lit("2")); const piOverTwo = comptime pi.div(lit("2")); const partial = self.mod(twoPi).div(piOverTwo); // 0 to 4. if (partial.lessThan(lit("1"))) { return zeroToOneSin(partial); } if (partial.lessThan(lit("2"))) { return zeroToOneSin(lit("2").sub(partial)); } if (partial.lessThan(lit("3"))) { return lit("-1").mul(zeroToOneSin(partial.sub(lit("2")))); } return lit("-1").mul(zeroToOneSin(lit("4").sub(partial))); } pub fn cos(self: D64) D64 { const twoPi = comptime pi.mul(lit("2")); const piOverTwo = comptime pi.div(lit("2")); const partial = self.mod(twoPi).div(piOverTwo); // 0 to 4. if (partial.lessThan(lit("1"))) { return zeroToOneSin(lit("1").sub(partial)); } if (partial.lessThan(lit("2"))) { return lit("-1").mul(zeroToOneSin(partial.sub(lit("1")))); } if (partial.lessThan(lit("3"))) { return lit("-1").mul(zeroToOneSin(lit("3").sub(partial))); } return zeroToOneSin(partial.sub(lit("3"))); } fn zeroToOneSin(z: D64) D64 { // Is correct to within +-0.0075. A better Taylor series would yield better accuracy. // Equation source: https://www.nullhardware.com/blog/fixed-point-sine-and-cosine-for-embedded-systems/ const a = comptime math("four * ((three / pi) - (nine / sixteen))", .{ .four = lit("4"), .three = lit("3"), .pi = pi, .nine = lit("9"), .sixteen = lit("16"), }); const b = comptime math("(five / two) - (two * a)", .{ .two = lit("2"), .a = a, .five = lit("5"), }); const c = comptime math("a - (three / two)", .{ .a = a, .three = lit("3"), .two = lit("2"), }); const zSquared = math("z * z", .{ .z = z }); const zCubed = math("zSquared * z", .{ .zSquared = zSquared, .z = z }); const zFifth = math("zCubed * z", .{ .zCubed = zCubed, .z = z }); return math("(a * z) + (b * zCubed) + (c * zFifth)", .{ .a = a, .z = z, .b = b, .zCubed = zCubed, .c = c, .zFifth = zFifth, }); } pub fn floor(self: D64) D64 { return D64{ .v = self.v & (~@as(i64, lowBits)) }; } pub fn toF32(self: D64) f32 { return @intToFloat(f32, self.v) / (1 << 32); } pub fn lessThan(self: D64, other: D64) bool { return self.v < other.v; } pub fn sqrt(self: D64) D64 { var v: i128 = @intCast(i128, self.v); if (v < 0) { v *= -1; } var r: i128 = 0; var i: i128 = 1 << 63; while (true) { const testR = r | i; if (shr(i128, testR * testR, 32) <= v) { r = testR; } if (i == 1) { break; } i >>= 1; } return D64{ .v = @intCast(i64, r) }; } // const rb = @intCast(i128, self.v) * @intCast(i128, other.v); // return D64{ .v = @intCast(i64, shr(i128, rb, 32)) }; // var v = self.v; // if (v < 0) { // v *= -1; // if (v < 0) { // v += 1; // v *= -1; // } // } // var i: i64 = 1 << (32 + 15); // var r: D64 = D64{ .v = 0 }; // while (true) { // const testR = D64{ .v = r.v | i }; // if (testR.mul(testR).v <= v) { // r = testR; // } // if (i == 1) { // return r; // } // i >>= 1; // } // } }; test "lit" { const a = D64.lit("2"); try expectEqual(@as(f32, 2.0), a.toF32()); const b = D64.lit("-2"); try expectEqual(@as(f32, -2.0), b.toF32()); } test "mul" { const a = D64.lit("2"); try expectEqual(@as(f32, 4.0), math("a * a", .{ .a = a }).toF32()); const b = D64.lit("0.5"); try expectEqual(@as(f32, 0.25), math("b * b", .{ .b = b }).toF32()); const c = D64.lit("2.5"); try expectEqual(@as(f32, 6.25), math("c * c", .{ .c = c }).toF32()); const d = D64.lit("-2.5"); try expectEqual(@as(f32, 6.25), math("d * d", .{ .d = d }).toF32()); try expectEqual(@as(f32, -6.25), math("d * c", .{ .c = c, .d = d }).toF32()); try expectEqual(@as(f32, -6.25), math("c * d", .{ .c = c, .d = d }).toF32()); } test "add" { const a = D64.lit("2"); const b = D64.lit("0.5"); try expectEqual(@as(f32, 2.5), math("a + b", .{ .a = a, .b = b }).toF32()); } test "div" { const a = D64.lit("2"); const b = D64.lit("0.5"); try expectEqual(@as(f32, 4), math("a / b", .{ .a = a, .b = b }).toF32()); } test "mod" { const d = D64.lit; try expectEqual(d("1"), d("-5").mod(d("3"))); try expectEqual(d("2"), d("5").mod(d("3"))); try expectEqual( d("-5.5").sub(d("-5.5").div(d("3")).floor().mul(d("3"))), d("-5.5").mod(d("3")), ); // The literal seems to be the wrong part here, so exact comparison is slightly off? try std.testing.expectApproxEqAbs(d("0.5").toF32(), d("-5.5").mod(d("3")).toF32(), 0.0075); } test "zeroToOneSin" { var i: usize = 0; const pointOne = D64.lit("0.01"); var value = D64.lit("0"); while (i <= 100) : (i += 1) { const calculated = value.zeroToOneSin().toF32(); const groundTruth = std.math.sin(value.toF32() * std.math.pi / 2); try std.testing.expectApproxEqAbs(groundTruth, calculated, 0.0075); value = value.add(pointOne); } } test "sin and cos" { var i: usize = 0; const one = D64.lit("1"); // var value = D64.lit("0"); var value = D64.lit("-50"); while (i <= 100) : (i += 1) { const sinExpected = std.math.sin(value.toF32()); const sinActual = value.sin().toF32(); try std.testing.expectApproxEqAbs(sinExpected, sinActual, 0.0075); const cosExpected = std.math.cos(value.toF32()); const cosActual = value.cos().toF32(); try std.testing.expectApproxEqAbs(cosExpected, cosActual, 0.0075); value = value.add(one); } } test "floor" { try expectEqual(D64.lit("1"), D64.lit("1.5").floor()); try expectEqual(D64.lit("-1"), D64.lit("-0.5").floor()); } test "sqrt" { try expectEqual(D64.lit("2"), D64.lit("4").sqrt()); try expectEqual(D64.lit("2"), D64.lit("-4").sqrt()); // Not great, but better than nothing... try expectEqual(D64.lit("46340.9500011").toF32(), D64.lit("2147483647").sqrt().toF32()); }
src/fixed.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const Mirroring = @import("../ines.zig").Mirroring; const Config = @import("../console.zig").Config; const GenericMapper = @import("../mapper.zig").GenericMapper; pub const Prgs = BankSwitcher(0x4000, 2); pub const Chrs = BankSwitcher(0x1000, 2); pub fn BankSwitcher(comptime size: usize, comptime selectable_banks: usize) type { std.debug.assert(std.math.isPowerOfTwo(size)); const bank_bits = std.math.log2_int(usize, size); const BankAddr = @Type(.{ .Int = .{ .signedness = .unsigned, .bits = bank_bits } }); const full_bits = bank_bits + std.math.log2_int(usize, selectable_banks); const FullAddr = @Type(.{ .Int = .{ .signedness = .unsigned, .bits = full_bits } }); return struct { const Self = @This(); bytes: []u8, writable: bool, selected: [selectable_banks]usize, pub fn init(allocator: *Allocator, bytes: ?[]u8) !Self { var bank_switcher = blk: { if (bytes) |b| { break :blk Self{ .bytes = b, .writable = false, .selected = [_]usize{undefined} ** selectable_banks, }; } else { const b = try allocator.alloc(u8, size * selectable_banks); std.mem.set(u8, b, 0); break :blk Self{ .bytes = b, .writable = true, .selected = [_]usize{undefined} ** selectable_banks, }; } }; for (bank_switcher.selected) |*b, i| { b.* = (i % (bank_switcher.bankCount())) * size; } return bank_switcher; } pub fn deinit(self: Self, allocator: *Allocator) void { allocator.free(self.bytes); } pub fn bankCount(self: Self) usize { return @divExact(self.bytes.len, size); } pub fn getSelectedBankIndex(self: Self, selected_index: usize) usize { return @divExact(self.selected[selected_index], size); } pub fn setBank(self: *Self, selected: usize, bank: usize) void { self.selected[selected] = bank * size; } pub fn setConsecutiveBanks(self: *Self, selected: usize, count: usize, bank: usize) void { std.debug.assert(bank + count <= self.bankCount()); std.debug.assert(selected + count <= self.selected.len); var i: usize = 0; while (i < count) : (i += 1) { self.setBank(selected + i, bank + i); } } pub fn mapAddr(self: Self, addr: FullAddr) usize { var i: usize = 0; const offset = blk: while (i < selectable_banks) : (i += 1) { if (addr >= i * size and addr < (i + 1) * size) { break :blk self.selected[i]; } } else unreachable; return offset | @truncate(BankAddr, addr); } pub fn read(self: Self, addr: u16) u8 { return self.bytes[self.mapAddr(@truncate(FullAddr, addr))]; } pub fn write(self: *Self, addr: u16, val: u8) void { if (self.writable) { self.bytes[self.mapAddr(@truncate(FullAddr, addr))] = val; } } }; } pub const PrgRam = struct { bytes: ?[]u8, writable: bool = true, enabled: bool = true, // TODO: used for savegames, etc. persistent: bool = false, pub fn init(allocator: *Allocator, mapped: bool, persistent: bool) !PrgRam { const bytes = blk: { if (mapped) { const b = try allocator.alloc(u8, 0x2000); std.mem.set(u8, b, 0); break :blk b; } else { break :blk null; } }; return PrgRam{ .bytes = bytes, .persistent = persistent, }; } pub fn deinit(self: PrgRam, allocator: *Allocator) void { if (self.bytes) |bytes| { allocator.free(bytes); } } pub fn enable(self: *PrgRam) void { self.enabled = true; } pub fn disable(self: *PrgRam) void { self.enabled = false; } pub fn read(self: PrgRam, addr: u16) ?u8 { if (self.enabled) { if (self.bytes) |bytes| { return bytes[addr & 0x1fff]; } } return null; } pub fn write(self: *PrgRam, addr: u16, val: u8) void { if (!(self.enabled and self.writable)) { return; } if (self.bytes) |bytes| { bytes[addr & 0x1fff] = val; } } }; pub fn mirrorNametable(mirroring: Mirroring, addr: u16) u12 { return switch (mirroring) { .horizontal => @truncate(u12, addr & 0xbff), .vertical => @truncate(u12, addr & 0x7ff), .four_screen => @truncate(u12, addr), }; } pub fn fromGeneric(comptime Self: type, comptime config: Config, generic: GenericMapper(config)) *Self { return @ptrCast(*Self, generic.mapper_ptr); }
src/mapper/common.zig
const std = @import("std"); const CrossTarget = std.zig.CrossTarget; const TestContext = @import("../../src/test.zig").TestContext; const linux_aarch64 = CrossTarget{ .cpu_arch = .aarch64, .os_tag = .linux, }; const macos_aarch64 = CrossTarget{ .cpu_arch = .aarch64, .os_tag = .macos, }; pub fn addCases(ctx: *TestContext) !void { // Linux tests { var case = ctx.exe("linux_aarch64 hello world", linux_aarch64); // Regular old hello world case.addCompareOutput( \\pub fn main() void { \\ print(); \\} \\ \\fn print() void { \\ asm volatile ("svc #0" \\ : \\ : [number] "{x8}" (64), \\ [arg1] "{x0}" (1), \\ [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), \\ [arg3] "{x2}" ("Hello, World!\n".len) \\ : "memory", "cc" \\ ); \\} , "Hello, World!\n", ); } { var case = ctx.exe("exit fn taking argument", linux_aarch64); case.addCompareOutput( \\pub export fn _start() noreturn { \\ exit(0); \\} \\ \\fn exit(ret: usize) noreturn { \\ asm volatile ("svc #0" \\ : \\ : [number] "{x8}" (93), \\ [arg1] "{x0}" (ret) \\ : "memory", "cc" \\ ); \\ unreachable; \\} , "", ); } { var case = ctx.exe("conditional branches", linux_aarch64); case.addCompareOutput( \\pub fn main() void { \\ foo(123); \\} \\ \\fn foo(x: u64) void { \\ if (x > 42) { \\ print(); \\ } \\} \\ \\fn print() void { \\ asm volatile ("svc #0" \\ : \\ : [number] "{x8}" (64), \\ [arg1] "{x0}" (1), \\ [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), \\ [arg3] "{x2}" ("Hello, World!\n".len), \\ : "memory", "cc" \\ ); \\} , "Hello, World!\n", ); case.addCompareOutput( \\pub fn main() void { \\ foo(true); \\} \\ \\fn foo(x: bool) void { \\ if (x) { \\ print(); \\ } \\} \\ \\fn print() void { \\ asm volatile ("svc #0" \\ : \\ : [number] "{x8}" (64), \\ [arg1] "{x0}" (1), \\ [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), \\ [arg3] "{x2}" ("Hello, World!\n".len), \\ : "memory", "cc" \\ ); \\} , "Hello, World!\n", ); } { var case = ctx.exe("large add function", linux_aarch64); case.addCompareOutput( \\pub fn main() void { \\ assert(add(3, 4) == 791); \\} \\ \\fn add(a: u32, b: u32) u32 { \\ const x: u32 = blk: { \\ const c = a + b; // 7 \\ const d = a + c; // 10 \\ const e = d + b; // 14 \\ const f = d + e; // 24 \\ const g = e + f; // 38 \\ const h = f + g; // 62 \\ const i = g + h; // 100 \\ const j = i + d; // 110 \\ const k = i + j; // 210 \\ const l = k + c; // 217 \\ const m = l + d; // 227 \\ const n = m + e; // 241 \\ const o = n + f; // 265 \\ const p = o + g; // 303 \\ const q = p + h; // 365 \\ const r = q + i; // 465 \\ const s = r + j; // 575 \\ const t = s + k; // 785 \\ break :blk t; \\ }; \\ const y = x + a; // 788 \\ const z = y + a; // 791 \\ return z; \\} \\ \\fn assert(ok: bool) void { \\ if (!ok) unreachable; \\} , "", ); } // macOS tests { var case = ctx.exe("hello world with updates", macos_aarch64); case.addError("", &[_][]const u8{ ":109:9: error: struct 'tmp.tmp' has no member named 'main'", }); // Incorrect return type case.addError( \\pub 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; \\ \\pub 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", ); // Now using start.zig without an explicit extern exit fn case.addCompareOutput( \\extern "c" fn write(usize, usize, usize) usize; \\ \\pub fn main() void { \\ print(); \\} \\ \\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; \\ \\pub fn main() void { \\ print(); \\ print(); \\ print(); \\ print(); \\} \\ \\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; \\ \\pub fn main() void { \\ print(); \\} \\ \\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; \\ \\pub fn main() void { \\ print(); \\ print(); \\} \\ \\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. \\ ); } }
test/stage2/aarch64.zig
const std = @import("std"); const zangscript = @import("zangscript"); // parse a zig file at runtime looking for builtin module definitions const BuiltinParser = struct { arena_allocator: *std.mem.Allocator, contents: []const u8, tree: *std.zig.ast.Tree, fn getToken(self: BuiltinParser, token_index: usize) []const u8 { const token = self.tree.tokens.at(token_index); return self.contents[token.start..token.end]; } fn parseIntLiteral(self: BuiltinParser, var_decl: *const std.zig.ast.Node.VarDecl) ?usize { const init_node = var_decl.init_node orelse return null; const lit = init_node.cast(std.zig.ast.Node.IntegerLiteral) orelse return null; return std.fmt.parseInt(usize, self.getToken(lit.token), 10) catch return null; } // `one_of` (enums) not supported fn parseParamType(self: BuiltinParser, type_expr: *std.zig.ast.Node) ?zangscript.ParamType { if (type_expr.cast(std.zig.ast.Node.Identifier)) |identifier| { const type_name = self.getToken(identifier.token); if (std.mem.eql(u8, type_name, "bool")) { return .boolean; } if (std.mem.eql(u8, type_name, "f32")) { return .constant; } } else if (type_expr.cast(std.zig.ast.Node.PrefixOp)) |prefix_op| { switch (prefix_op.op) { .SliceType => |st| { if (st.const_token != null and st.allowzero_token == null and st.sentinel == null) { if (prefix_op.rhs.cast(std.zig.ast.Node.Identifier)) |rhs_identifier| { const type_name = self.getToken(rhs_identifier.token); if (std.mem.eql(u8, type_name, "f32")) { return .buffer; } } } }, else => {}, } } else if (type_expr.cast(std.zig.ast.Node.InfixOp)) |infix_op| { if (infix_op.lhs.cast(std.zig.ast.Node.Identifier)) |lhs_identifier| { if (std.mem.eql(u8, self.getToken(lhs_identifier.token), "zang") and infix_op.op == .Period) { if (infix_op.rhs.cast(std.zig.ast.Node.Identifier)) |rhs_identifier| { if (std.mem.eql(u8, self.getToken(rhs_identifier.token), "ConstantOrBuffer")) { return .constant_or_buffer; } } } } } return null; } fn parseParams(self: BuiltinParser, stderr: *std.fs.File.OutStream, var_decl: *const std.zig.ast.Node.VarDecl) ![]const zangscript.ModuleParam { const init_node = var_decl.init_node orelse { try stderr.print("expected init node\n", .{}); return error.Failed; }; const container_decl = init_node.cast(std.zig.ast.Node.ContainerDecl) orelse { try stderr.print("expected container decl\n", .{}); return error.Failed; }; var params = std.ArrayList(zangscript.ModuleParam).init(self.arena_allocator); var it = container_decl.fields_and_decls.iterator(0); while (it.next()) |node_ptr| { const field = node_ptr.*.cast(std.zig.ast.Node.ContainerField) orelse continue; const name = self.getToken(field.name_token); const type_expr = field.type_expr orelse { try stderr.print("expected type expr\n", .{}); return error.Failed; }; const param_type = self.parseParamType(type_expr) orelse { try stderr.print("{}: unrecognized param type\n", .{name}); return error.Failed; }; try params.append(.{ .name = try std.mem.dupe(self.arena_allocator, u8, name), .param_type = param_type, }); } return params.items; } fn parseTopLevelDecl(self: BuiltinParser, stderr: *std.fs.File.OutStream, var_decl: *std.zig.ast.Node.VarDecl) !?zangscript.BuiltinModule { // TODO check for `pub`, and initial uppercase const init_node = var_decl.init_node orelse return null; const container_decl = init_node.cast(std.zig.ast.Node.ContainerDecl) orelse return null; const name = self.getToken(var_decl.name_token); var num_outputs: ?usize = null; var num_temps: ?usize = null; var params: ?[]const zangscript.ModuleParam = null; var it = container_decl.fields_and_decls.iterator(0); while (it.next()) |node_ptr| { const var_decl2 = node_ptr.*.cast(std.zig.ast.Node.VarDecl) orelse continue; const name2 = self.getToken(var_decl2.name_token); if (std.mem.eql(u8, name2, "num_outputs")) { num_outputs = self.parseIntLiteral(var_decl2) orelse { try stderr.print("num_outputs: expected an integer literal\n", .{}); return error.Failed; }; } if (std.mem.eql(u8, name2, "num_temps")) { num_temps = self.parseIntLiteral(var_decl2) orelse { try stderr.print("num_temps: expected an integer literal\n", .{}); return error.Failed; }; } if (std.mem.eql(u8, name2, "Params")) { params = try self.parseParams(stderr, var_decl2); } } return zangscript.BuiltinModule{ .name = try std.mem.dupe(self.arena_allocator, u8, name), .params = params orelse return null, .num_temps = num_temps orelse return null, .num_outputs = num_outputs orelse return null, }; } }; pub fn parseBuiltins( arena_allocator: *std.mem.Allocator, temp_allocator: *std.mem.Allocator, stderr: *std.fs.File.OutStream, name: []const u8, filename: []const u8, contents: []const u8, ) !zangscript.BuiltinPackage { var builtins = std.ArrayList(zangscript.BuiltinModule).init(arena_allocator); var enums = std.ArrayList(zangscript.BuiltinEnum).init(arena_allocator); const tree = std.zig.parse(temp_allocator, contents) catch |err| { try stderr.print("failed to parse {}: {}\n", .{ filename, err }); return error.Failed; }; defer tree.deinit(); if (tree.errors.count() > 0) { try stderr.print("parse error in {}\n", .{filename}); var it = tree.errors.iterator(0); while (it.next()) |err| { const token = tree.tokens.at(err.loc()); var line: usize = 1; var col: usize = 1; for (contents[0..token.start]) |ch| { if (ch == '\n') { line += 1; col = 1; } else { col += 1; } } try stderr.print("(line {}, col {}) ", .{ line, col }); try err.render(&tree.tokens, stderr); try stderr.writeAll("\n"); } return error.Failed; } var bp: BuiltinParser = .{ .arena_allocator = arena_allocator, .contents = contents, .tree = tree, }; var it = tree.root_node.decls.iterator(0); while (it.next()) |node_ptr| { const var_decl = node_ptr.*.cast(std.zig.ast.Node.VarDecl) orelse continue; if (try bp.parseTopLevelDecl(stderr, var_decl)) |builtin| { try builtins.append(builtin); } } return zangscript.BuiltinPackage{ .zig_package_name = name, .zig_import_path = filename, .builtins = builtins.items, .enums = enums.items, }; }
tools/zangc/parse_builtins.zig
const std = @import("std"); const Fundude = @import("main.zig"); const c = @cImport({ @cInclude("SDL.h"); }); const input = packed struct { right: bool, left: bool, up: bool, down: bool, a: bool, b: bool, select: bool, start: bool, }; pub fn main() anyerror!u8 { _ = c.SDL_Init(c.SDL_INIT_VIDEO); defer c.SDL_Quit(); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = &gpa.allocator; var arg_iter = std.process.ArgIterator.init(); const binary_name = try arg_iter.next(allocator) orelse @panic("missing first arugment"); defer allocator.free(binary_name); const rom_file = try arg_iter.next(allocator) orelse { std.debug.print("usage:\n {s} [rom.gb]\n", .{binary_name}); return 1; }; defer allocator.free(rom_file); var fd: Fundude = .{}; const data = try std.fs.cwd().readFileAlloc(allocator, rom_file, 0xfffffff); defer allocator.free(data); try fd.init(allocator, .{ .cart = data }); defer fd.deinit(allocator); const screen = fd.video.screen(); var window = c.SDL_CreateWindow( "fundude", c.SDL_WINDOWPOS_CENTERED, c.SDL_WINDOWPOS_CENTERED, screen.width * 3, screen.height * 3, c.SDL_WINDOW_OPENGL | c.SDL_WINDOW_RESIZABLE, ); defer c.SDL_DestroyWindow(window); var renderer = c.SDL_CreateRenderer( window, 0, c.SDL_RENDERER_PRESENTVSYNC, ); defer c.SDL_DestroyRenderer(renderer); _ = c.SDL_RenderSetLogicalSize(renderer, screen.width, screen.height); var texture = c.SDL_CreateTexture( renderer, c.SDL_PIXELFORMAT_ARGB1555, c.SDL_TEXTUREACCESS_STREAMING, screen.width, screen.height, ); defer c.SDL_DestroyTexture(texture); _ = c.SDL_SetRenderDrawColor(renderer, 0xff, 0xff, 0xff, 0xff); _ = c.SDL_RenderClear(renderer); var frame: usize = 0; var prevSpin: i64 = std.time.milliTimestamp(); mainloop: while (true) { var sdl_event: c.SDL_Event = undefined; while (c.SDL_PollEvent(&sdl_event) != 0) { switch (sdl_event.type) { c.SDL_QUIT => break :mainloop, c.SDL_KEYDOWN, c.SDL_KEYUP => { //TODO: configurable keymap const keys: input = .{ .up = sdl_event.key.keysym.sym == c.SDLK_UP, .down = sdl_event.key.keysym.sym == c.SDLK_DOWN, .left = sdl_event.key.keysym.sym == c.SDLK_LEFT, .right = sdl_event.key.keysym.sym == c.SDLK_RIGHT, .a = sdl_event.key.keysym.sym == c.SDLK_PERIOD, .b = sdl_event.key.keysym.sym == c.SDLK_COMMA, .select = sdl_event.key.keysym.sym == c.SDLK_BACKSPACE, .start = sdl_event.key.keysym.sym == c.SDLK_RETURN, }; if (sdl_event.type == c.SDL_KEYDOWN) { const changed = fd.inputs.press(&fd.mmu, .{ .raw = @bitCast(u8, keys) }); if (changed) { fd.cpu.mode = .norm; fd.mmu.dyn.io.IF.joypad = true; } if (sdl_event.key.keysym.sym == c.SDLK_a) { fd.temportal.rewind(&fd); } } else { _ = fd.inputs.release(&fd.mmu, .{ .raw = @bitCast(u8, keys) }); } }, else => {}, } } const ts = std.time.milliTimestamp(); const elapsed = ts - prevSpin; _ = fd.step_ms(elapsed, false); prevSpin = ts; // draw the current framebuffer to the screen // TODO: find a more optimal way of doing this var pixels: ?*c_void = undefined; var pitch: c_int = undefined; _ = c.SDL_LockTexture(texture, null, &pixels, &pitch); @memcpy( @ptrCast([*]u8, pixels.?), @ptrCast([*]u8, screen.toArraySlice().ptr), screen.width * screen.height * 2, ); c.SDL_UnlockTexture(texture); _ = c.SDL_RenderCopy(renderer, texture, null, null); c.SDL_RenderPresent(renderer); } return 0; }
src/native.zig
// SPDX-License-Identifier: MIT // This file belongs to the Termelot project under the MIT license. const std = @import("std"); const termelot = @import("termelot.zig"); const Size = termelot.Size; const Position = termelot.Position; const Cell = termelot.Cell; const Rune = termelot.Rune; usingnamespace termelot.style; const Backend = termelot.Backend; const default_size = Size{ .rows = 200, .cols = 300 }; // TODO: Add mutex lock and engage in relevant functions pub const Buffer = struct { backend: *Backend, allocator: *std.mem.Allocator, default_rune: Rune, default_style: Style, size: Size, rune_buffer: std.ArrayList(Rune), style_buffer: std.ArrayList(Style), old_rune_buffer: std.ArrayList(Rune), old_style_buffer: std.ArrayList(Style), const Self = @This(); pub fn init( backend: *Backend, allocator: *std.mem.Allocator, initial_size: ?Size, ) !Buffer { var result = Buffer{ .backend = backend, .allocator = allocator, .size = initial_size orelse default_size, .default_rune = ' ', .default_style = Style{ .fg_color = Color.Default, .bg_color = Color.Default, .decorations = Decorations{ .bold = false, .italic = false, .underline = false, .blinking = false, }, }, .rune_buffer = std.ArrayList(Rune).init(allocator), .style_buffer = std.ArrayList(Style).init(allocator), .old_rune_buffer = std.ArrayList(Rune).init(allocator), .old_style_buffer = std.ArrayList(Style).init(allocator), }; errdefer result.rune_buffer.deinit(); errdefer result.style_buffer.deinit(); errdefer result.old_rune_buffer.deinit(); errdefer result.old_style_buffer.deinit(); const buffer_length = @as(u32, result.size.rows) * @as(u32, result.size.cols); try result.rune_buffer.ensureCapacity(buffer_length); try result.style_buffer.ensureCapacity(buffer_length); try result.rune_buffer.resize(buffer_length); try result.style_buffer.resize(buffer_length); std.mem.set( Rune, result.rune_buffer.items, result.default_rune, ); std.mem.set( Style, result.style_buffer.items, result.default_style, ); return result; } pub fn deinit(self: *Self) void { self.old_rune_buffer.deinit(); self.old_style_buffer.deinit(); self.rune_buffer.deinit(); self.style_buffer.deinit(); } /// Set the default cell to use in operations such as `clear` and `resize`. pub fn setDefaultCell(self: *Self, new_default_cell: Cell) void { self.default_rune = new_default_cell.rune; self.default_style = new_default_cell.style; } /// Set the default rune to use in operations such as `clear` and `resize`. pub fn setDefaultRune(self: *Self, new_default_rune: Rune) void { self.default_rune = new_default_rune; } /// Set the default style to use in operations such as `clear` and `resize`. pub fn setDefaultStyle(self: *Self, new_default_style: Style) void { self.default_style = new_default_style; } /// Resize buffers keeping cells within the new buffer size, and filling /// new cells with the default cell. This function is expensive; minimize /// its use. If the function fails, then the buffer will not be modified. pub fn resize(self: *Self, new_size: Size, fill_cell: ?Cell) !void { if (self.size.equal(new_size)) return; const b_rows = self.buffer_size.rows; const b_cols = self.buffer_size.cols; const b_length = @as(u32, b_rows) * @as(u32, b_cols); const n_rows = new_size.rows; const n_cols = new_size.cols; const n_length = @as(u32, n_rows) * @as(u32, n_cols); const fill = fill_cell orelse Cell{ .rune = self.default_rune, .style = self.default_style, }; // Sanity checks { std.debug.assert(self.rune_buffer.items.len == b_length); std.debug.assert(self.style_buffer.items.len == b_length); } // Only make changes to buffer *after* all potential fail points if (n_length > b_length) { try self.rune_buffer.ensureCapacity(n_length); try self.style_buffer.ensureCapacity(n_length); self.rune_buffer.expandToCapacity(); self.style_buffer.expandToCapacity(); } // Copy buffer content to new positions and fill empty with defaults if (n_cols < b_cols) { var row_index: u16 = 1; while (row_index < b_rows) : (row_index += 1) { const source_start = row_index * b_cols; const source_end = row_index * b_cols + n_cols; const dest_start = row_index * n_cols; const dest_end = (row_index + 1) * n_cols; std.mem.copy( Rune, self.rune_buffer.items[dest_start..dest_end], self.rune_buffer.items[source_start..source_end], ); std.mem.copy( Style, self.style_buffer.items[dest_start..dest_end], self.style_buffer.items[source_start..source_end], ); } } else if (n_cols > b_cols) { var row: u16 = b_rows; while (row > 0) : (row -= 1) { const row_index = row - 1; const source_start = row_index * b_cols; const source_end = (row_index + 1) * b_cols; const dest_start = row_index * n_cols; const dest_end = row_index * n_cols + b_cols; const empty_start = dest_end; const empty_end = (row_index + 1) * n_cols; std.mem.copyBackwards( Rune, self.rune_buffer.items[dest_start..dest_end], self.rune_buffer.items[source_start..source_end], ); std.mem.copyBackwards( Style, self.style_buffer.items[dest_start..dest_end], self.style_buffer.items[source_start..source_end], ); std.mem.set( Rune, self.rune_buffer.items[empty_start..empty_end], fill_rune, ); std.mem.set( Style, self.style_buffer.items[empty_start..empty_end], fill_style, ); } } if (n_rows > b_rows) { const empty_start = b_rows * n_cols; const empty_end = n_rows * n_cols; std.mem.set( Rune, self.rune_buffer.items[empty_start..empty_end], fill_rune, ); std.mem.set( Style, self.style_buffer.items[empty_start..empty_end], fill_style, ); } self.size = new_size; self.rune_buffer.items.len = n_length; self.style_buffer.items.len = n_length; // Necessitate a full repaint of screen self.old_rune_buffer.items.len = 0; self.old_style_buffer.items.len = 0; } /// Draw diffs to screen. Cursor position is not guaranteed after draw. pub fn draw(self: *Self, screen_size: Size) !void { if (self.old_rune_buffer.items.len == 0 and self.old_style_buffer.items.len == 0) { return self.drawForce(screen_size); } const b_len = @as(u32, self.size.rows) * @as(u32, self.size.cols); // Sanity checks { std.debug.assert(self.rune_buffer.items.len == b_len); std.debug.assert(self.style_buffer.items.len == b_len); std.debug.assert(self.old_rune_buffer.items.len == b_len); std.debug.assert(self.old_style_buffer.items.len == b_len); } { var row_index: u16 = 0; while (row_index < screen_size.rows) : (row_index += 1) { var diff_origin: ?u32 = null; // TODO: Think again about how to handle newlines; it wouldn't // be nice to let users set a cell as a newline, and // then all of a sudden the cells set afterwards are // implicitly shifted down a row // Do not batch adjacent diffs across lines, to avoid newline var col_index: u16 = 0; while (col_index < screen_size.cols) : (col_index += 1) { const b_index = @as(u32, row_index) * @as(u32, self.size.cols) + @as(u32, col_index); if (std.meta.eql( self.rune_buffer.items[b_index], self.old_rune_buffer.items[b_index], ) and std.meta.eql( self.style_buffer.items[b_index], self.old_style_buffer.items[b_index], )) { if (diff_origin) |i| { try self.backend.write( Position{ .row = row_index, .col = col_index }, self.rune_buffer.items[i..b_index], self.style_buffer.items[i..b_index], ); } diff_origin = null; } else if (diff_origin == null) { diff_origin = b_index; } } if (diff_origin) |i| { try self.backend.write( Position{ .row = row_index, .col = col_index }, self.rune_buffer.items[i..b_len], self.style_buffer.items[i..b_len], ); } } } // Copy current buffer to old buffer std.mem.copy( Rune, self.old_rune_buffer.items, self.rune_buffer.items, ); std.mem.copy( Style, self.old_style_buffer.items, self.style_buffer.items, ); } /// Draw buffer to screen. Cursor position is not guaranteed after draw. pub fn drawForce(self: *Self, screen_size: Size) !void { const b_len = @as(u32, self.size.rows) * @as(u32, self.size.cols); // Sanity checks { std.debug.assert(self.rune_buffer.items.len == b_len); std.debug.assert(self.style_buffer.items.len == b_len); } try self.old_rune_buffer.ensureCapacity(b_len); try self.old_style_buffer.ensureCapacity(b_len); { var row_index: u16 = 0; while (row_index < self.size.rows) : (row_index += 1) { const row_start: u32 = @as(u32, row_index) * @as(u32, self.size.cols); const row_end: u32 = row_start + @as(u32, screen_size.cols); try self.backend.write( Position{ .row = row_index, .col = 0 }, self.rune_buffer.items[row_start..row_end], self.style_buffer.items[row_start..row_end], ); } } // Copy current buffer to old buffer self.old_rune_buffer.items.len = b_len; self.old_style_buffer.items.len = b_len; std.mem.copy( Rune, self.old_rune_buffer.items, self.rune_buffer.items, ); std.mem.copy( Style, self.old_style_buffer.items, self.style_buffer.items, ); } /// Clear and fill the buffer with defaults. pub fn clear(self: *Self) void { const b_len = @as(u32, self.size.rows) * @as(u32, self.size.cols); // Sanity checks { std.debug.assert(self.rune_buffer.items.len == b_len); std.debug.assert(self.style_buffer.items.len == b_len); } std.mem.set(Rune, self.rune_buffer.items, self.default_rune); std.mem.set(Style, self.style_buffer.items, self.default_style); self.old_rune_buffer.items.len = 0; self.old_style_buffer.items.len = 0; } // TODO: Should this also return through a result argument? /// Get a cell within the buffer. `null` if position is outside buffer. pub fn getCell(self: Self, position: Position) ?Cell { if (position.row >= self.size.rows or position.col >= self.size.cols) { return null; } const p_index = @as(u32, position.row) * @as(u32, self.size.cols) + @as(u32, position.col); return Cell{ .rune = self.rune_buffer.items[p_index], .style = self.style_buffer.items[p_index], }; } /// Get a slice of cells within the buffer. This slice cannot span across /// rows. Results will be placed in provided "result", and the number of /// cells filled will be returned (only less than the specified length if /// the slice extends past the edges of the buffer). If position is outside /// the buffer, `null` is returned instead. pub fn getCells( self: Self, position: Position, length: u16, result: *[length]Cell, ) ?u16 { if (position.row >= self.size.rows or position.col >= self.size.cols) { return null; } const row_index = @as(u32, position.row) * @as(u32, self.size.cols); var offset: u16 = 0; while (position.col + offset < self.size.cols) : (offset += 1) { const index = row_index + @as(u32, position.col + offset); result[offset] = Cell{ .rune = self.rune_buffer.items[index], .style = self.style_buffer.items[index], }; } return offset; } /// Set a cell within the buffer. Ignored if position is outside buffer. pub fn setCell(self: *Self, position: Position, new_cell: Cell) void { if (position.row >= self.size.rows or position.col >= self.size.cols) { return; } const index = @as(u32, position.row) * @as(u32, self.size.cols) + @as(u32, position.col); self.rune_buffer.items[index] = new_cell.rune; self.style_buffer.items[index] = new_cell.style; } /// Set a slice of cells within the buffer. Cells that would extend beyond /// the buffer are ignored. pub fn setCells(self: *Self, position: Position, new_cells: []Cell) void { if (position.row >= self.size.rows or position.col >= self.size.cols) { return; } const row_index = @as(u32, position.row) * @as(u32, self.size.cols); for (new_cells) |new_cell, offset| { if (position.col + offset >= self.size.cols) break; const index = row_index + @as(u32, position.col + offset); self.rune_buffer.items[index] = new_cell.rune; self.style_buffer.items[index] = new_cell.style; } } /// Fill a slice of cells within the buffer. Cells that would extend beyond /// the buffer are ignored. pub fn fillCells( self: *Self, position: Position, length: u16, new_cell: Cell, ) void { if (position.row >= self.size.rows or position.col >= self.size.cols) { return; } const row_index = @as(u32, position.row) * @as(u32, self.size.cols); var offset: u16 = 0; while (position.col + offset < self.size.cols) : (offset += 1) { const index = row_index + @as(u32, position.col + offset); self.rune_buffer.items[index] = new_cell.rune; self.rune_buffer.items[index] = new_cell.style; } } };
src/buffer.zig
/// The function fiatP224AddcarryxU64 is an addition with carry. /// Postconditions: /// out1 = (arg1 + arg2 + arg3) mod 2^64 /// out2 = ⌊(arg1 + arg2 + arg3) / 2^64⌋ /// /// Input Bounds: /// arg1: [0x0 ~> 0x1] /// arg2: [0x0 ~> 0xffffffffffffffff] /// arg3: [0x0 ~> 0xffffffffffffffff] /// Output Bounds: /// out1: [0x0 ~> 0xffffffffffffffff] /// out2: [0x0 ~> 0x1] fn fiatP224AddcarryxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) callconv(.Inline) void { const x1: u128 = ((@intCast(u128, arg1) + @intCast(u128, arg2)) + @intCast(u128, arg3)); const x2: u64 = @intCast(u64, (x1 & @intCast(u128, 0xffffffffffffffff))); const x3: u1 = @intCast(u1, (x1 >> 64)); out1.* = x2; out2.* = x3; } /// The function fiatP224SubborrowxU64 is a subtraction with borrow. /// Postconditions: /// out1 = (-arg1 + arg2 + -arg3) mod 2^64 /// out2 = -⌊(-arg1 + arg2 + -arg3) / 2^64⌋ /// /// Input Bounds: /// arg1: [0x0 ~> 0x1] /// arg2: [0x0 ~> 0xffffffffffffffff] /// arg3: [0x0 ~> 0xffffffffffffffff] /// Output Bounds: /// out1: [0x0 ~> 0xffffffffffffffff] /// out2: [0x0 ~> 0x1] fn fiatP224SubborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) callconv(.Inline) void { const x1: i128 = ((@intCast(i128, arg2) - @intCast(i128, arg1)) - @intCast(i128, arg3)); const x2: i1 = @intCast(i1, (x1 >> 64)); const x3: u64 = @intCast(u64, (x1 & @intCast(i128, 0xffffffffffffffff))); out1.* = x3; out2.* = @intCast(u1, (@intCast(i2, 0x0) - @intCast(i2, x2))); } /// The function fiatP224MulxU64 is a multiplication, returning the full double-width result. /// Postconditions: /// out1 = (arg1 * arg2) mod 2^64 /// out2 = ⌊arg1 * arg2 / 2^64⌋ /// /// Input Bounds: /// arg1: [0x0 ~> 0xffffffffffffffff] /// arg2: [0x0 ~> 0xffffffffffffffff] /// Output Bounds: /// out1: [0x0 ~> 0xffffffffffffffff] /// out2: [0x0 ~> 0xffffffffffffffff] fn fiatP224MulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) callconv(.Inline) void { const x1: u128 = (@intCast(u128, arg1) * @intCast(u128, arg2)); const x2: u64 = @intCast(u64, (x1 & @intCast(u128, 0xffffffffffffffff))); const x3: u64 = @intCast(u64, (x1 >> 64)); out1.* = x2; out2.* = x3; } /// The function fiatP224CmovznzU64 is a single-word conditional move. /// Postconditions: /// out1 = (if arg1 = 0 then arg2 else arg3) /// /// Input Bounds: /// arg1: [0x0 ~> 0x1] /// arg2: [0x0 ~> 0xffffffffffffffff] /// arg3: [0x0 ~> 0xffffffffffffffff] /// Output Bounds: /// out1: [0x0 ~> 0xffffffffffffffff] fn fiatP224CmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) callconv(.Inline) void { const x1: u1 = (~(~arg1)); const x2: u64 = @intCast(u64, (@intCast(i128, @intCast(i1, (@intCast(i2, 0x0) - @intCast(i2, x1)))) & @intCast(i128, 0xffffffffffffffff))); const x3: u64 = ((x2 & arg3) | ((~x2) & arg2)); out1.* = x3; } /// The function fiatP224Mul multiplies two field elements in the Montgomery domain. /// Preconditions: /// 0 ≤ eval arg1 < m /// 0 ≤ eval arg2 < m /// Postconditions: /// eval (from_montgomery out1) mod m = (eval (from_montgomery arg1) * eval (from_montgomery arg2)) mod m /// 0 ≤ eval out1 < m /// /// Input Bounds: /// arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// arg2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// Output Bounds: /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] pub fn fiatP224Mul(out1: *[4]u64, arg1: [4]u64, arg2: [4]u64) void { const x1: u64 = (arg1[1]); const x2: u64 = (arg1[2]); const x3: u64 = (arg1[3]); const x4: u64 = (arg1[0]); var x5: u64 = undefined; var x6: u64 = undefined; fiatP224MulxU64(&x5, &x6, x4, (arg2[3])); var x7: u64 = undefined; var x8: u64 = undefined; fiatP224MulxU64(&x7, &x8, x4, (arg2[2])); var x9: u64 = undefined; var x10: u64 = undefined; fiatP224MulxU64(&x9, &x10, x4, (arg2[1])); var x11: u64 = undefined; var x12: u64 = undefined; fiatP224MulxU64(&x11, &x12, x4, (arg2[0])); var x13: u64 = undefined; var x14: u1 = undefined; fiatP224AddcarryxU64(&x13, &x14, 0x0, x12, x9); var x15: u64 = undefined; var x16: u1 = undefined; fiatP224AddcarryxU64(&x15, &x16, x14, x10, x7); var x17: u64 = undefined; var x18: u1 = undefined; fiatP224AddcarryxU64(&x17, &x18, x16, x8, x5); const x19: u64 = (@intCast(u64, x18) + x6); var x20: u64 = undefined; var x21: u64 = undefined; fiatP224MulxU64(&x20, &x21, x11, 0xffffffffffffffff); var x22: u64 = undefined; var x23: u64 = undefined; fiatP224MulxU64(&x22, &x23, x20, 0xffffffff); var x24: u64 = undefined; var x25: u64 = undefined; fiatP224MulxU64(&x24, &x25, x20, 0xffffffffffffffff); var x26: u64 = undefined; var x27: u64 = undefined; fiatP224MulxU64(&x26, &x27, x20, 0xffffffff00000000); var x28: u64 = undefined; var x29: u1 = undefined; fiatP224AddcarryxU64(&x28, &x29, 0x0, x27, x24); var x30: u64 = undefined; var x31: u1 = undefined; fiatP224AddcarryxU64(&x30, &x31, x29, x25, x22); const x32: u64 = (@intCast(u64, x31) + x23); var x33: u64 = undefined; var x34: u1 = undefined; fiatP224AddcarryxU64(&x33, &x34, 0x0, x11, x20); var x35: u64 = undefined; var x36: u1 = undefined; fiatP224AddcarryxU64(&x35, &x36, x34, x13, x26); var x37: u64 = undefined; var x38: u1 = undefined; fiatP224AddcarryxU64(&x37, &x38, x36, x15, x28); var x39: u64 = undefined; var x40: u1 = undefined; fiatP224AddcarryxU64(&x39, &x40, x38, x17, x30); var x41: u64 = undefined; var x42: u1 = undefined; fiatP224AddcarryxU64(&x41, &x42, x40, x19, x32); var x43: u64 = undefined; var x44: u64 = undefined; fiatP224MulxU64(&x43, &x44, x1, (arg2[3])); var x45: u64 = undefined; var x46: u64 = undefined; fiatP224MulxU64(&x45, &x46, x1, (arg2[2])); var x47: u64 = undefined; var x48: u64 = undefined; fiatP224MulxU64(&x47, &x48, x1, (arg2[1])); var x49: u64 = undefined; var x50: u64 = undefined; fiatP224MulxU64(&x49, &x50, x1, (arg2[0])); var x51: u64 = undefined; var x52: u1 = undefined; fiatP224AddcarryxU64(&x51, &x52, 0x0, x50, x47); var x53: u64 = undefined; var x54: u1 = undefined; fiatP224AddcarryxU64(&x53, &x54, x52, x48, x45); var x55: u64 = undefined; var x56: u1 = undefined; fiatP224AddcarryxU64(&x55, &x56, x54, x46, x43); const x57: u64 = (@intCast(u64, x56) + x44); var x58: u64 = undefined; var x59: u1 = undefined; fiatP224AddcarryxU64(&x58, &x59, 0x0, x35, x49); var x60: u64 = undefined; var x61: u1 = undefined; fiatP224AddcarryxU64(&x60, &x61, x59, x37, x51); var x62: u64 = undefined; var x63: u1 = undefined; fiatP224AddcarryxU64(&x62, &x63, x61, x39, x53); var x64: u64 = undefined; var x65: u1 = undefined; fiatP224AddcarryxU64(&x64, &x65, x63, x41, x55); var x66: u64 = undefined; var x67: u1 = undefined; fiatP224AddcarryxU64(&x66, &x67, x65, @intCast(u64, x42), x57); var x68: u64 = undefined; var x69: u64 = undefined; fiatP224MulxU64(&x68, &x69, x58, 0xffffffffffffffff); var x70: u64 = undefined; var x71: u64 = undefined; fiatP224MulxU64(&x70, &x71, x68, 0xffffffff); var x72: u64 = undefined; var x73: u64 = undefined; fiatP224MulxU64(&x72, &x73, x68, 0xffffffffffffffff); var x74: u64 = undefined; var x75: u64 = undefined; fiatP224MulxU64(&x74, &x75, x68, 0xffffffff00000000); var x76: u64 = undefined; var x77: u1 = undefined; fiatP224AddcarryxU64(&x76, &x77, 0x0, x75, x72); var x78: u64 = undefined; var x79: u1 = undefined; fiatP224AddcarryxU64(&x78, &x79, x77, x73, x70); const x80: u64 = (@intCast(u64, x79) + x71); var x81: u64 = undefined; var x82: u1 = undefined; fiatP224AddcarryxU64(&x81, &x82, 0x0, x58, x68); var x83: u64 = undefined; var x84: u1 = undefined; fiatP224AddcarryxU64(&x83, &x84, x82, x60, x74); var x85: u64 = undefined; var x86: u1 = undefined; fiatP224AddcarryxU64(&x85, &x86, x84, x62, x76); var x87: u64 = undefined; var x88: u1 = undefined; fiatP224AddcarryxU64(&x87, &x88, x86, x64, x78); var x89: u64 = undefined; var x90: u1 = undefined; fiatP224AddcarryxU64(&x89, &x90, x88, x66, x80); const x91: u64 = (@intCast(u64, x90) + @intCast(u64, x67)); var x92: u64 = undefined; var x93: u64 = undefined; fiatP224MulxU64(&x92, &x93, x2, (arg2[3])); var x94: u64 = undefined; var x95: u64 = undefined; fiatP224MulxU64(&x94, &x95, x2, (arg2[2])); var x96: u64 = undefined; var x97: u64 = undefined; fiatP224MulxU64(&x96, &x97, x2, (arg2[1])); var x98: u64 = undefined; var x99: u64 = undefined; fiatP224MulxU64(&x98, &x99, x2, (arg2[0])); var x100: u64 = undefined; var x101: u1 = undefined; fiatP224AddcarryxU64(&x100, &x101, 0x0, x99, x96); var x102: u64 = undefined; var x103: u1 = undefined; fiatP224AddcarryxU64(&x102, &x103, x101, x97, x94); var x104: u64 = undefined; var x105: u1 = undefined; fiatP224AddcarryxU64(&x104, &x105, x103, x95, x92); const x106: u64 = (@intCast(u64, x105) + x93); var x107: u64 = undefined; var x108: u1 = undefined; fiatP224AddcarryxU64(&x107, &x108, 0x0, x83, x98); var x109: u64 = undefined; var x110: u1 = undefined; fiatP224AddcarryxU64(&x109, &x110, x108, x85, x100); var x111: u64 = undefined; var x112: u1 = undefined; fiatP224AddcarryxU64(&x111, &x112, x110, x87, x102); var x113: u64 = undefined; var x114: u1 = undefined; fiatP224AddcarryxU64(&x113, &x114, x112, x89, x104); var x115: u64 = undefined; var x116: u1 = undefined; fiatP224AddcarryxU64(&x115, &x116, x114, x91, x106); var x117: u64 = undefined; var x118: u64 = undefined; fiatP224MulxU64(&x117, &x118, x107, 0xffffffffffffffff); var x119: u64 = undefined; var x120: u64 = undefined; fiatP224MulxU64(&x119, &x120, x117, 0xffffffff); var x121: u64 = undefined; var x122: u64 = undefined; fiatP224MulxU64(&x121, &x122, x117, 0xffffffffffffffff); var x123: u64 = undefined; var x124: u64 = undefined; fiatP224MulxU64(&x123, &x124, x117, 0xffffffff00000000); var x125: u64 = undefined; var x126: u1 = undefined; fiatP224AddcarryxU64(&x125, &x126, 0x0, x124, x121); var x127: u64 = undefined; var x128: u1 = undefined; fiatP224AddcarryxU64(&x127, &x128, x126, x122, x119); const x129: u64 = (@intCast(u64, x128) + x120); var x130: u64 = undefined; var x131: u1 = undefined; fiatP224AddcarryxU64(&x130, &x131, 0x0, x107, x117); var x132: u64 = undefined; var x133: u1 = undefined; fiatP224AddcarryxU64(&x132, &x133, x131, x109, x123); var x134: u64 = undefined; var x135: u1 = undefined; fiatP224AddcarryxU64(&x134, &x135, x133, x111, x125); var x136: u64 = undefined; var x137: u1 = undefined; fiatP224AddcarryxU64(&x136, &x137, x135, x113, x127); var x138: u64 = undefined; var x139: u1 = undefined; fiatP224AddcarryxU64(&x138, &x139, x137, x115, x129); const x140: u64 = (@intCast(u64, x139) + @intCast(u64, x116)); var x141: u64 = undefined; var x142: u64 = undefined; fiatP224MulxU64(&x141, &x142, x3, (arg2[3])); var x143: u64 = undefined; var x144: u64 = undefined; fiatP224MulxU64(&x143, &x144, x3, (arg2[2])); var x145: u64 = undefined; var x146: u64 = undefined; fiatP224MulxU64(&x145, &x146, x3, (arg2[1])); var x147: u64 = undefined; var x148: u64 = undefined; fiatP224MulxU64(&x147, &x148, x3, (arg2[0])); var x149: u64 = undefined; var x150: u1 = undefined; fiatP224AddcarryxU64(&x149, &x150, 0x0, x148, x145); var x151: u64 = undefined; var x152: u1 = undefined; fiatP224AddcarryxU64(&x151, &x152, x150, x146, x143); var x153: u64 = undefined; var x154: u1 = undefined; fiatP224AddcarryxU64(&x153, &x154, x152, x144, x141); const x155: u64 = (@intCast(u64, x154) + x142); var x156: u64 = undefined; var x157: u1 = undefined; fiatP224AddcarryxU64(&x156, &x157, 0x0, x132, x147); var x158: u64 = undefined; var x159: u1 = undefined; fiatP224AddcarryxU64(&x158, &x159, x157, x134, x149); var x160: u64 = undefined; var x161: u1 = undefined; fiatP224AddcarryxU64(&x160, &x161, x159, x136, x151); var x162: u64 = undefined; var x163: u1 = undefined; fiatP224AddcarryxU64(&x162, &x163, x161, x138, x153); var x164: u64 = undefined; var x165: u1 = undefined; fiatP224AddcarryxU64(&x164, &x165, x163, x140, x155); var x166: u64 = undefined; var x167: u64 = undefined; fiatP224MulxU64(&x166, &x167, x156, 0xffffffffffffffff); var x168: u64 = undefined; var x169: u64 = undefined; fiatP224MulxU64(&x168, &x169, x166, 0xffffffff); var x170: u64 = undefined; var x171: u64 = undefined; fiatP224MulxU64(&x170, &x171, x166, 0xffffffffffffffff); var x172: u64 = undefined; var x173: u64 = undefined; fiatP224MulxU64(&x172, &x173, x166, 0xffffffff00000000); var x174: u64 = undefined; var x175: u1 = undefined; fiatP224AddcarryxU64(&x174, &x175, 0x0, x173, x170); var x176: u64 = undefined; var x177: u1 = undefined; fiatP224AddcarryxU64(&x176, &x177, x175, x171, x168); const x178: u64 = (@intCast(u64, x177) + x169); var x179: u64 = undefined; var x180: u1 = undefined; fiatP224AddcarryxU64(&x179, &x180, 0x0, x156, x166); var x181: u64 = undefined; var x182: u1 = undefined; fiatP224AddcarryxU64(&x181, &x182, x180, x158, x172); var x183: u64 = undefined; var x184: u1 = undefined; fiatP224AddcarryxU64(&x183, &x184, x182, x160, x174); var x185: u64 = undefined; var x186: u1 = undefined; fiatP224AddcarryxU64(&x185, &x186, x184, x162, x176); var x187: u64 = undefined; var x188: u1 = undefined; fiatP224AddcarryxU64(&x187, &x188, x186, x164, x178); const x189: u64 = (@intCast(u64, x188) + @intCast(u64, x165)); var x190: u64 = undefined; var x191: u1 = undefined; fiatP224SubborrowxU64(&x190, &x191, 0x0, x181, @intCast(u64, 0x1)); var x192: u64 = undefined; var x193: u1 = undefined; fiatP224SubborrowxU64(&x192, &x193, x191, x183, 0xffffffff00000000); var x194: u64 = undefined; var x195: u1 = undefined; fiatP224SubborrowxU64(&x194, &x195, x193, x185, 0xffffffffffffffff); var x196: u64 = undefined; var x197: u1 = undefined; fiatP224SubborrowxU64(&x196, &x197, x195, x187, 0xffffffff); var x198: u64 = undefined; var x199: u1 = undefined; fiatP224SubborrowxU64(&x198, &x199, x197, x189, @intCast(u64, 0x0)); var x200: u64 = undefined; fiatP224CmovznzU64(&x200, x199, x190, x181); var x201: u64 = undefined; fiatP224CmovznzU64(&x201, x199, x192, x183); var x202: u64 = undefined; fiatP224CmovznzU64(&x202, x199, x194, x185); var x203: u64 = undefined; fiatP224CmovznzU64(&x203, x199, x196, x187); out1[0] = x200; out1[1] = x201; out1[2] = x202; out1[3] = x203; } /// The function fiatP224Square squares a field element in the Montgomery domain. /// Preconditions: /// 0 ≤ eval arg1 < m /// Postconditions: /// eval (from_montgomery out1) mod m = (eval (from_montgomery arg1) * eval (from_montgomery arg1)) mod m /// 0 ≤ eval out1 < m /// /// Input Bounds: /// arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// Output Bounds: /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] pub fn fiatP224Square(out1: *[4]u64, arg1: [4]u64) void { const x1: u64 = (arg1[1]); const x2: u64 = (arg1[2]); const x3: u64 = (arg1[3]); const x4: u64 = (arg1[0]); var x5: u64 = undefined; var x6: u64 = undefined; fiatP224MulxU64(&x5, &x6, x4, (arg1[3])); var x7: u64 = undefined; var x8: u64 = undefined; fiatP224MulxU64(&x7, &x8, x4, (arg1[2])); var x9: u64 = undefined; var x10: u64 = undefined; fiatP224MulxU64(&x9, &x10, x4, (arg1[1])); var x11: u64 = undefined; var x12: u64 = undefined; fiatP224MulxU64(&x11, &x12, x4, (arg1[0])); var x13: u64 = undefined; var x14: u1 = undefined; fiatP224AddcarryxU64(&x13, &x14, 0x0, x12, x9); var x15: u64 = undefined; var x16: u1 = undefined; fiatP224AddcarryxU64(&x15, &x16, x14, x10, x7); var x17: u64 = undefined; var x18: u1 = undefined; fiatP224AddcarryxU64(&x17, &x18, x16, x8, x5); const x19: u64 = (@intCast(u64, x18) + x6); var x20: u64 = undefined; var x21: u64 = undefined; fiatP224MulxU64(&x20, &x21, x11, 0xffffffffffffffff); var x22: u64 = undefined; var x23: u64 = undefined; fiatP224MulxU64(&x22, &x23, x20, 0xffffffff); var x24: u64 = undefined; var x25: u64 = undefined; fiatP224MulxU64(&x24, &x25, x20, 0xffffffffffffffff); var x26: u64 = undefined; var x27: u64 = undefined; fiatP224MulxU64(&x26, &x27, x20, 0xffffffff00000000); var x28: u64 = undefined; var x29: u1 = undefined; fiatP224AddcarryxU64(&x28, &x29, 0x0, x27, x24); var x30: u64 = undefined; var x31: u1 = undefined; fiatP224AddcarryxU64(&x30, &x31, x29, x25, x22); const x32: u64 = (@intCast(u64, x31) + x23); var x33: u64 = undefined; var x34: u1 = undefined; fiatP224AddcarryxU64(&x33, &x34, 0x0, x11, x20); var x35: u64 = undefined; var x36: u1 = undefined; fiatP224AddcarryxU64(&x35, &x36, x34, x13, x26); var x37: u64 = undefined; var x38: u1 = undefined; fiatP224AddcarryxU64(&x37, &x38, x36, x15, x28); var x39: u64 = undefined; var x40: u1 = undefined; fiatP224AddcarryxU64(&x39, &x40, x38, x17, x30); var x41: u64 = undefined; var x42: u1 = undefined; fiatP224AddcarryxU64(&x41, &x42, x40, x19, x32); var x43: u64 = undefined; var x44: u64 = undefined; fiatP224MulxU64(&x43, &x44, x1, (arg1[3])); var x45: u64 = undefined; var x46: u64 = undefined; fiatP224MulxU64(&x45, &x46, x1, (arg1[2])); var x47: u64 = undefined; var x48: u64 = undefined; fiatP224MulxU64(&x47, &x48, x1, (arg1[1])); var x49: u64 = undefined; var x50: u64 = undefined; fiatP224MulxU64(&x49, &x50, x1, (arg1[0])); var x51: u64 = undefined; var x52: u1 = undefined; fiatP224AddcarryxU64(&x51, &x52, 0x0, x50, x47); var x53: u64 = undefined; var x54: u1 = undefined; fiatP224AddcarryxU64(&x53, &x54, x52, x48, x45); var x55: u64 = undefined; var x56: u1 = undefined; fiatP224AddcarryxU64(&x55, &x56, x54, x46, x43); const x57: u64 = (@intCast(u64, x56) + x44); var x58: u64 = undefined; var x59: u1 = undefined; fiatP224AddcarryxU64(&x58, &x59, 0x0, x35, x49); var x60: u64 = undefined; var x61: u1 = undefined; fiatP224AddcarryxU64(&x60, &x61, x59, x37, x51); var x62: u64 = undefined; var x63: u1 = undefined; fiatP224AddcarryxU64(&x62, &x63, x61, x39, x53); var x64: u64 = undefined; var x65: u1 = undefined; fiatP224AddcarryxU64(&x64, &x65, x63, x41, x55); var x66: u64 = undefined; var x67: u1 = undefined; fiatP224AddcarryxU64(&x66, &x67, x65, @intCast(u64, x42), x57); var x68: u64 = undefined; var x69: u64 = undefined; fiatP224MulxU64(&x68, &x69, x58, 0xffffffffffffffff); var x70: u64 = undefined; var x71: u64 = undefined; fiatP224MulxU64(&x70, &x71, x68, 0xffffffff); var x72: u64 = undefined; var x73: u64 = undefined; fiatP224MulxU64(&x72, &x73, x68, 0xffffffffffffffff); var x74: u64 = undefined; var x75: u64 = undefined; fiatP224MulxU64(&x74, &x75, x68, 0xffffffff00000000); var x76: u64 = undefined; var x77: u1 = undefined; fiatP224AddcarryxU64(&x76, &x77, 0x0, x75, x72); var x78: u64 = undefined; var x79: u1 = undefined; fiatP224AddcarryxU64(&x78, &x79, x77, x73, x70); const x80: u64 = (@intCast(u64, x79) + x71); var x81: u64 = undefined; var x82: u1 = undefined; fiatP224AddcarryxU64(&x81, &x82, 0x0, x58, x68); var x83: u64 = undefined; var x84: u1 = undefined; fiatP224AddcarryxU64(&x83, &x84, x82, x60, x74); var x85: u64 = undefined; var x86: u1 = undefined; fiatP224AddcarryxU64(&x85, &x86, x84, x62, x76); var x87: u64 = undefined; var x88: u1 = undefined; fiatP224AddcarryxU64(&x87, &x88, x86, x64, x78); var x89: u64 = undefined; var x90: u1 = undefined; fiatP224AddcarryxU64(&x89, &x90, x88, x66, x80); const x91: u64 = (@intCast(u64, x90) + @intCast(u64, x67)); var x92: u64 = undefined; var x93: u64 = undefined; fiatP224MulxU64(&x92, &x93, x2, (arg1[3])); var x94: u64 = undefined; var x95: u64 = undefined; fiatP224MulxU64(&x94, &x95, x2, (arg1[2])); var x96: u64 = undefined; var x97: u64 = undefined; fiatP224MulxU64(&x96, &x97, x2, (arg1[1])); var x98: u64 = undefined; var x99: u64 = undefined; fiatP224MulxU64(&x98, &x99, x2, (arg1[0])); var x100: u64 = undefined; var x101: u1 = undefined; fiatP224AddcarryxU64(&x100, &x101, 0x0, x99, x96); var x102: u64 = undefined; var x103: u1 = undefined; fiatP224AddcarryxU64(&x102, &x103, x101, x97, x94); var x104: u64 = undefined; var x105: u1 = undefined; fiatP224AddcarryxU64(&x104, &x105, x103, x95, x92); const x106: u64 = (@intCast(u64, x105) + x93); var x107: u64 = undefined; var x108: u1 = undefined; fiatP224AddcarryxU64(&x107, &x108, 0x0, x83, x98); var x109: u64 = undefined; var x110: u1 = undefined; fiatP224AddcarryxU64(&x109, &x110, x108, x85, x100); var x111: u64 = undefined; var x112: u1 = undefined; fiatP224AddcarryxU64(&x111, &x112, x110, x87, x102); var x113: u64 = undefined; var x114: u1 = undefined; fiatP224AddcarryxU64(&x113, &x114, x112, x89, x104); var x115: u64 = undefined; var x116: u1 = undefined; fiatP224AddcarryxU64(&x115, &x116, x114, x91, x106); var x117: u64 = undefined; var x118: u64 = undefined; fiatP224MulxU64(&x117, &x118, x107, 0xffffffffffffffff); var x119: u64 = undefined; var x120: u64 = undefined; fiatP224MulxU64(&x119, &x120, x117, 0xffffffff); var x121: u64 = undefined; var x122: u64 = undefined; fiatP224MulxU64(&x121, &x122, x117, 0xffffffffffffffff); var x123: u64 = undefined; var x124: u64 = undefined; fiatP224MulxU64(&x123, &x124, x117, 0xffffffff00000000); var x125: u64 = undefined; var x126: u1 = undefined; fiatP224AddcarryxU64(&x125, &x126, 0x0, x124, x121); var x127: u64 = undefined; var x128: u1 = undefined; fiatP224AddcarryxU64(&x127, &x128, x126, x122, x119); const x129: u64 = (@intCast(u64, x128) + x120); var x130: u64 = undefined; var x131: u1 = undefined; fiatP224AddcarryxU64(&x130, &x131, 0x0, x107, x117); var x132: u64 = undefined; var x133: u1 = undefined; fiatP224AddcarryxU64(&x132, &x133, x131, x109, x123); var x134: u64 = undefined; var x135: u1 = undefined; fiatP224AddcarryxU64(&x134, &x135, x133, x111, x125); var x136: u64 = undefined; var x137: u1 = undefined; fiatP224AddcarryxU64(&x136, &x137, x135, x113, x127); var x138: u64 = undefined; var x139: u1 = undefined; fiatP224AddcarryxU64(&x138, &x139, x137, x115, x129); const x140: u64 = (@intCast(u64, x139) + @intCast(u64, x116)); var x141: u64 = undefined; var x142: u64 = undefined; fiatP224MulxU64(&x141, &x142, x3, (arg1[3])); var x143: u64 = undefined; var x144: u64 = undefined; fiatP224MulxU64(&x143, &x144, x3, (arg1[2])); var x145: u64 = undefined; var x146: u64 = undefined; fiatP224MulxU64(&x145, &x146, x3, (arg1[1])); var x147: u64 = undefined; var x148: u64 = undefined; fiatP224MulxU64(&x147, &x148, x3, (arg1[0])); var x149: u64 = undefined; var x150: u1 = undefined; fiatP224AddcarryxU64(&x149, &x150, 0x0, x148, x145); var x151: u64 = undefined; var x152: u1 = undefined; fiatP224AddcarryxU64(&x151, &x152, x150, x146, x143); var x153: u64 = undefined; var x154: u1 = undefined; fiatP224AddcarryxU64(&x153, &x154, x152, x144, x141); const x155: u64 = (@intCast(u64, x154) + x142); var x156: u64 = undefined; var x157: u1 = undefined; fiatP224AddcarryxU64(&x156, &x157, 0x0, x132, x147); var x158: u64 = undefined; var x159: u1 = undefined; fiatP224AddcarryxU64(&x158, &x159, x157, x134, x149); var x160: u64 = undefined; var x161: u1 = undefined; fiatP224AddcarryxU64(&x160, &x161, x159, x136, x151); var x162: u64 = undefined; var x163: u1 = undefined; fiatP224AddcarryxU64(&x162, &x163, x161, x138, x153); var x164: u64 = undefined; var x165: u1 = undefined; fiatP224AddcarryxU64(&x164, &x165, x163, x140, x155); var x166: u64 = undefined; var x167: u64 = undefined; fiatP224MulxU64(&x166, &x167, x156, 0xffffffffffffffff); var x168: u64 = undefined; var x169: u64 = undefined; fiatP224MulxU64(&x168, &x169, x166, 0xffffffff); var x170: u64 = undefined; var x171: u64 = undefined; fiatP224MulxU64(&x170, &x171, x166, 0xffffffffffffffff); var x172: u64 = undefined; var x173: u64 = undefined; fiatP224MulxU64(&x172, &x173, x166, 0xffffffff00000000); var x174: u64 = undefined; var x175: u1 = undefined; fiatP224AddcarryxU64(&x174, &x175, 0x0, x173, x170); var x176: u64 = undefined; var x177: u1 = undefined; fiatP224AddcarryxU64(&x176, &x177, x175, x171, x168); const x178: u64 = (@intCast(u64, x177) + x169); var x179: u64 = undefined; var x180: u1 = undefined; fiatP224AddcarryxU64(&x179, &x180, 0x0, x156, x166); var x181: u64 = undefined; var x182: u1 = undefined; fiatP224AddcarryxU64(&x181, &x182, x180, x158, x172); var x183: u64 = undefined; var x184: u1 = undefined; fiatP224AddcarryxU64(&x183, &x184, x182, x160, x174); var x185: u64 = undefined; var x186: u1 = undefined; fiatP224AddcarryxU64(&x185, &x186, x184, x162, x176); var x187: u64 = undefined; var x188: u1 = undefined; fiatP224AddcarryxU64(&x187, &x188, x186, x164, x178); const x189: u64 = (@intCast(u64, x188) + @intCast(u64, x165)); var x190: u64 = undefined; var x191: u1 = undefined; fiatP224SubborrowxU64(&x190, &x191, 0x0, x181, @intCast(u64, 0x1)); var x192: u64 = undefined; var x193: u1 = undefined; fiatP224SubborrowxU64(&x192, &x193, x191, x183, 0xffffffff00000000); var x194: u64 = undefined; var x195: u1 = undefined; fiatP224SubborrowxU64(&x194, &x195, x193, x185, 0xffffffffffffffff); var x196: u64 = undefined; var x197: u1 = undefined; fiatP224SubborrowxU64(&x196, &x197, x195, x187, 0xffffffff); var x198: u64 = undefined; var x199: u1 = undefined; fiatP224SubborrowxU64(&x198, &x199, x197, x189, @intCast(u64, 0x0)); var x200: u64 = undefined; fiatP224CmovznzU64(&x200, x199, x190, x181); var x201: u64 = undefined; fiatP224CmovznzU64(&x201, x199, x192, x183); var x202: u64 = undefined; fiatP224CmovznzU64(&x202, x199, x194, x185); var x203: u64 = undefined; fiatP224CmovznzU64(&x203, x199, x196, x187); out1[0] = x200; out1[1] = x201; out1[2] = x202; out1[3] = x203; } /// The function fiatP224Add adds two field elements in the Montgomery domain. /// Preconditions: /// 0 ≤ eval arg1 < m /// 0 ≤ eval arg2 < m /// Postconditions: /// eval (from_montgomery out1) mod m = (eval (from_montgomery arg1) + eval (from_montgomery arg2)) mod m /// 0 ≤ eval out1 < m /// /// Input Bounds: /// arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// arg2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// Output Bounds: /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] pub fn fiatP224Add(out1: *[4]u64, arg1: [4]u64, arg2: [4]u64) void { var x1: u64 = undefined; var x2: u1 = undefined; fiatP224AddcarryxU64(&x1, &x2, 0x0, (arg1[0]), (arg2[0])); var x3: u64 = undefined; var x4: u1 = undefined; fiatP224AddcarryxU64(&x3, &x4, x2, (arg1[1]), (arg2[1])); var x5: u64 = undefined; var x6: u1 = undefined; fiatP224AddcarryxU64(&x5, &x6, x4, (arg1[2]), (arg2[2])); var x7: u64 = undefined; var x8: u1 = undefined; fiatP224AddcarryxU64(&x7, &x8, x6, (arg1[3]), (arg2[3])); var x9: u64 = undefined; var x10: u1 = undefined; fiatP224SubborrowxU64(&x9, &x10, 0x0, x1, @intCast(u64, 0x1)); var x11: u64 = undefined; var x12: u1 = undefined; fiatP224SubborrowxU64(&x11, &x12, x10, x3, 0xffffffff00000000); var x13: u64 = undefined; var x14: u1 = undefined; fiatP224SubborrowxU64(&x13, &x14, x12, x5, 0xffffffffffffffff); var x15: u64 = undefined; var x16: u1 = undefined; fiatP224SubborrowxU64(&x15, &x16, x14, x7, 0xffffffff); var x17: u64 = undefined; var x18: u1 = undefined; fiatP224SubborrowxU64(&x17, &x18, x16, @intCast(u64, x8), @intCast(u64, 0x0)); var x19: u64 = undefined; fiatP224CmovznzU64(&x19, x18, x9, x1); var x20: u64 = undefined; fiatP224CmovznzU64(&x20, x18, x11, x3); var x21: u64 = undefined; fiatP224CmovznzU64(&x21, x18, x13, x5); var x22: u64 = undefined; fiatP224CmovznzU64(&x22, x18, x15, x7); out1[0] = x19; out1[1] = x20; out1[2] = x21; out1[3] = x22; } /// The function fiatP224Sub subtracts two field elements in the Montgomery domain. /// Preconditions: /// 0 ≤ eval arg1 < m /// 0 ≤ eval arg2 < m /// Postconditions: /// eval (from_montgomery out1) mod m = (eval (from_montgomery arg1) - eval (from_montgomery arg2)) mod m /// 0 ≤ eval out1 < m /// /// Input Bounds: /// arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// arg2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// Output Bounds: /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] pub fn fiatP224Sub(out1: *[4]u64, arg1: [4]u64, arg2: [4]u64) void { var x1: u64 = undefined; var x2: u1 = undefined; fiatP224SubborrowxU64(&x1, &x2, 0x0, (arg1[0]), (arg2[0])); var x3: u64 = undefined; var x4: u1 = undefined; fiatP224SubborrowxU64(&x3, &x4, x2, (arg1[1]), (arg2[1])); var x5: u64 = undefined; var x6: u1 = undefined; fiatP224SubborrowxU64(&x5, &x6, x4, (arg1[2]), (arg2[2])); var x7: u64 = undefined; var x8: u1 = undefined; fiatP224SubborrowxU64(&x7, &x8, x6, (arg1[3]), (arg2[3])); var x9: u64 = undefined; fiatP224CmovznzU64(&x9, x8, @intCast(u64, 0x0), 0xffffffffffffffff); var x10: u64 = undefined; var x11: u1 = undefined; fiatP224AddcarryxU64(&x10, &x11, 0x0, x1, @intCast(u64, @intCast(u1, (x9 & @intCast(u64, 0x1))))); var x12: u64 = undefined; var x13: u1 = undefined; fiatP224AddcarryxU64(&x12, &x13, x11, x3, (x9 & 0xffffffff00000000)); var x14: u64 = undefined; var x15: u1 = undefined; fiatP224AddcarryxU64(&x14, &x15, x13, x5, x9); var x16: u64 = undefined; var x17: u1 = undefined; fiatP224AddcarryxU64(&x16, &x17, x15, x7, (x9 & 0xffffffff)); out1[0] = x10; out1[1] = x12; out1[2] = x14; out1[3] = x16; } /// The function fiatP224Opp negates a field element in the Montgomery domain. /// Preconditions: /// 0 ≤ eval arg1 < m /// Postconditions: /// eval (from_montgomery out1) mod m = -eval (from_montgomery arg1) mod m /// 0 ≤ eval out1 < m /// /// Input Bounds: /// arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// Output Bounds: /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] pub fn fiatP224Opp(out1: *[4]u64, arg1: [4]u64) void { var x1: u64 = undefined; var x2: u1 = undefined; fiatP224SubborrowxU64(&x1, &x2, 0x0, @intCast(u64, 0x0), (arg1[0])); var x3: u64 = undefined; var x4: u1 = undefined; fiatP224SubborrowxU64(&x3, &x4, x2, @intCast(u64, 0x0), (arg1[1])); var x5: u64 = undefined; var x6: u1 = undefined; fiatP224SubborrowxU64(&x5, &x6, x4, @intCast(u64, 0x0), (arg1[2])); var x7: u64 = undefined; var x8: u1 = undefined; fiatP224SubborrowxU64(&x7, &x8, x6, @intCast(u64, 0x0), (arg1[3])); var x9: u64 = undefined; fiatP224CmovznzU64(&x9, x8, @intCast(u64, 0x0), 0xffffffffffffffff); var x10: u64 = undefined; var x11: u1 = undefined; fiatP224AddcarryxU64(&x10, &x11, 0x0, x1, @intCast(u64, @intCast(u1, (x9 & @intCast(u64, 0x1))))); var x12: u64 = undefined; var x13: u1 = undefined; fiatP224AddcarryxU64(&x12, &x13, x11, x3, (x9 & 0xffffffff00000000)); var x14: u64 = undefined; var x15: u1 = undefined; fiatP224AddcarryxU64(&x14, &x15, x13, x5, x9); var x16: u64 = undefined; var x17: u1 = undefined; fiatP224AddcarryxU64(&x16, &x17, x15, x7, (x9 & 0xffffffff)); out1[0] = x10; out1[1] = x12; out1[2] = x14; out1[3] = x16; } /// The function fiatP224FromMontgomery translates a field element out of the Montgomery domain. /// Preconditions: /// 0 ≤ eval arg1 < m /// Postconditions: /// eval out1 mod m = (eval arg1 * ((2^64)⁻¹ mod m)^4) mod m /// 0 ≤ eval out1 < m /// /// Input Bounds: /// arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// Output Bounds: /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] pub fn fiatP224FromMontgomery(out1: *[4]u64, arg1: [4]u64) void { const x1: u64 = (arg1[0]); var x2: u64 = undefined; var x3: u64 = undefined; fiatP224MulxU64(&x2, &x3, x1, 0xffffffffffffffff); var x4: u64 = undefined; var x5: u64 = undefined; fiatP224MulxU64(&x4, &x5, x2, 0xffffffff); var x6: u64 = undefined; var x7: u64 = undefined; fiatP224MulxU64(&x6, &x7, x2, 0xffffffffffffffff); var x8: u64 = undefined; var x9: u64 = undefined; fiatP224MulxU64(&x8, &x9, x2, 0xffffffff00000000); var x10: u64 = undefined; var x11: u1 = undefined; fiatP224AddcarryxU64(&x10, &x11, 0x0, x9, x6); var x12: u64 = undefined; var x13: u1 = undefined; fiatP224AddcarryxU64(&x12, &x13, x11, x7, x4); var x14: u64 = undefined; var x15: u1 = undefined; fiatP224AddcarryxU64(&x14, &x15, 0x0, x1, x2); var x16: u64 = undefined; var x17: u1 = undefined; fiatP224AddcarryxU64(&x16, &x17, x15, @intCast(u64, 0x0), x8); var x18: u64 = undefined; var x19: u1 = undefined; fiatP224AddcarryxU64(&x18, &x19, x17, @intCast(u64, 0x0), x10); var x20: u64 = undefined; var x21: u1 = undefined; fiatP224AddcarryxU64(&x20, &x21, x19, @intCast(u64, 0x0), x12); var x22: u64 = undefined; var x23: u1 = undefined; fiatP224AddcarryxU64(&x22, &x23, 0x0, x16, (arg1[1])); var x24: u64 = undefined; var x25: u1 = undefined; fiatP224AddcarryxU64(&x24, &x25, x23, x18, @intCast(u64, 0x0)); var x26: u64 = undefined; var x27: u1 = undefined; fiatP224AddcarryxU64(&x26, &x27, x25, x20, @intCast(u64, 0x0)); var x28: u64 = undefined; var x29: u64 = undefined; fiatP224MulxU64(&x28, &x29, x22, 0xffffffffffffffff); var x30: u64 = undefined; var x31: u64 = undefined; fiatP224MulxU64(&x30, &x31, x28, 0xffffffff); var x32: u64 = undefined; var x33: u64 = undefined; fiatP224MulxU64(&x32, &x33, x28, 0xffffffffffffffff); var x34: u64 = undefined; var x35: u64 = undefined; fiatP224MulxU64(&x34, &x35, x28, 0xffffffff00000000); var x36: u64 = undefined; var x37: u1 = undefined; fiatP224AddcarryxU64(&x36, &x37, 0x0, x35, x32); var x38: u64 = undefined; var x39: u1 = undefined; fiatP224AddcarryxU64(&x38, &x39, x37, x33, x30); var x40: u64 = undefined; var x41: u1 = undefined; fiatP224AddcarryxU64(&x40, &x41, 0x0, x22, x28); var x42: u64 = undefined; var x43: u1 = undefined; fiatP224AddcarryxU64(&x42, &x43, x41, x24, x34); var x44: u64 = undefined; var x45: u1 = undefined; fiatP224AddcarryxU64(&x44, &x45, x43, x26, x36); var x46: u64 = undefined; var x47: u1 = undefined; fiatP224AddcarryxU64(&x46, &x47, x45, (@intCast(u64, x27) + (@intCast(u64, x21) + (@intCast(u64, x13) + x5))), x38); var x48: u64 = undefined; var x49: u1 = undefined; fiatP224AddcarryxU64(&x48, &x49, 0x0, x42, (arg1[2])); var x50: u64 = undefined; var x51: u1 = undefined; fiatP224AddcarryxU64(&x50, &x51, x49, x44, @intCast(u64, 0x0)); var x52: u64 = undefined; var x53: u1 = undefined; fiatP224AddcarryxU64(&x52, &x53, x51, x46, @intCast(u64, 0x0)); var x54: u64 = undefined; var x55: u64 = undefined; fiatP224MulxU64(&x54, &x55, x48, 0xffffffffffffffff); var x56: u64 = undefined; var x57: u64 = undefined; fiatP224MulxU64(&x56, &x57, x54, 0xffffffff); var x58: u64 = undefined; var x59: u64 = undefined; fiatP224MulxU64(&x58, &x59, x54, 0xffffffffffffffff); var x60: u64 = undefined; var x61: u64 = undefined; fiatP224MulxU64(&x60, &x61, x54, 0xffffffff00000000); var x62: u64 = undefined; var x63: u1 = undefined; fiatP224AddcarryxU64(&x62, &x63, 0x0, x61, x58); var x64: u64 = undefined; var x65: u1 = undefined; fiatP224AddcarryxU64(&x64, &x65, x63, x59, x56); var x66: u64 = undefined; var x67: u1 = undefined; fiatP224AddcarryxU64(&x66, &x67, 0x0, x48, x54); var x68: u64 = undefined; var x69: u1 = undefined; fiatP224AddcarryxU64(&x68, &x69, x67, x50, x60); var x70: u64 = undefined; var x71: u1 = undefined; fiatP224AddcarryxU64(&x70, &x71, x69, x52, x62); var x72: u64 = undefined; var x73: u1 = undefined; fiatP224AddcarryxU64(&x72, &x73, x71, (@intCast(u64, x53) + (@intCast(u64, x47) + (@intCast(u64, x39) + x31))), x64); var x74: u64 = undefined; var x75: u1 = undefined; fiatP224AddcarryxU64(&x74, &x75, 0x0, x68, (arg1[3])); var x76: u64 = undefined; var x77: u1 = undefined; fiatP224AddcarryxU64(&x76, &x77, x75, x70, @intCast(u64, 0x0)); var x78: u64 = undefined; var x79: u1 = undefined; fiatP224AddcarryxU64(&x78, &x79, x77, x72, @intCast(u64, 0x0)); var x80: u64 = undefined; var x81: u64 = undefined; fiatP224MulxU64(&x80, &x81, x74, 0xffffffffffffffff); var x82: u64 = undefined; var x83: u64 = undefined; fiatP224MulxU64(&x82, &x83, x80, 0xffffffff); var x84: u64 = undefined; var x85: u64 = undefined; fiatP224MulxU64(&x84, &x85, x80, 0xffffffffffffffff); var x86: u64 = undefined; var x87: u64 = undefined; fiatP224MulxU64(&x86, &x87, x80, 0xffffffff00000000); var x88: u64 = undefined; var x89: u1 = undefined; fiatP224AddcarryxU64(&x88, &x89, 0x0, x87, x84); var x90: u64 = undefined; var x91: u1 = undefined; fiatP224AddcarryxU64(&x90, &x91, x89, x85, x82); var x92: u64 = undefined; var x93: u1 = undefined; fiatP224AddcarryxU64(&x92, &x93, 0x0, x74, x80); var x94: u64 = undefined; var x95: u1 = undefined; fiatP224AddcarryxU64(&x94, &x95, x93, x76, x86); var x96: u64 = undefined; var x97: u1 = undefined; fiatP224AddcarryxU64(&x96, &x97, x95, x78, x88); var x98: u64 = undefined; var x99: u1 = undefined; fiatP224AddcarryxU64(&x98, &x99, x97, (@intCast(u64, x79) + (@intCast(u64, x73) + (@intCast(u64, x65) + x57))), x90); const x100: u64 = (@intCast(u64, x99) + (@intCast(u64, x91) + x83)); var x101: u64 = undefined; var x102: u1 = undefined; fiatP224SubborrowxU64(&x101, &x102, 0x0, x94, @intCast(u64, 0x1)); var x103: u64 = undefined; var x104: u1 = undefined; fiatP224SubborrowxU64(&x103, &x104, x102, x96, 0xffffffff00000000); var x105: u64 = undefined; var x106: u1 = undefined; fiatP224SubborrowxU64(&x105, &x106, x104, x98, 0xffffffffffffffff); var x107: u64 = undefined; var x108: u1 = undefined; fiatP224SubborrowxU64(&x107, &x108, x106, x100, 0xffffffff); var x109: u64 = undefined; var x110: u1 = undefined; fiatP224SubborrowxU64(&x109, &x110, x108, @intCast(u64, 0x0), @intCast(u64, 0x0)); var x111: u64 = undefined; fiatP224CmovznzU64(&x111, x110, x101, x94); var x112: u64 = undefined; fiatP224CmovznzU64(&x112, x110, x103, x96); var x113: u64 = undefined; fiatP224CmovznzU64(&x113, x110, x105, x98); var x114: u64 = undefined; fiatP224CmovznzU64(&x114, x110, x107, x100); out1[0] = x111; out1[1] = x112; out1[2] = x113; out1[3] = x114; } /// The function fiatP224ToMontgomery translates a field element into the Montgomery domain. /// Preconditions: /// 0 ≤ eval arg1 < m /// Postconditions: /// eval (from_montgomery out1) mod m = eval arg1 mod m /// 0 ≤ eval out1 < m /// /// Input Bounds: /// arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// Output Bounds: /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] pub fn fiatP224ToMontgomery(out1: *[4]u64, arg1: [4]u64) void { const x1: u64 = (arg1[1]); const x2: u64 = (arg1[2]); const x3: u64 = (arg1[3]); const x4: u64 = (arg1[0]); var x5: u64 = undefined; var x6: u64 = undefined; fiatP224MulxU64(&x5, &x6, x4, 0xffffffff); var x7: u64 = undefined; var x8: u64 = undefined; fiatP224MulxU64(&x7, &x8, x4, 0xfffffffe00000000); var x9: u64 = undefined; var x10: u64 = undefined; fiatP224MulxU64(&x9, &x10, x4, 0xffffffff00000000); var x11: u64 = undefined; var x12: u64 = undefined; fiatP224MulxU64(&x11, &x12, x4, 0xffffffff00000001); var x13: u64 = undefined; var x14: u1 = undefined; fiatP224AddcarryxU64(&x13, &x14, 0x0, x12, x9); var x15: u64 = undefined; var x16: u1 = undefined; fiatP224AddcarryxU64(&x15, &x16, x14, x10, x7); var x17: u64 = undefined; var x18: u1 = undefined; fiatP224AddcarryxU64(&x17, &x18, x16, x8, x5); var x19: u64 = undefined; var x20: u64 = undefined; fiatP224MulxU64(&x19, &x20, x11, 0xffffffffffffffff); var x21: u64 = undefined; var x22: u64 = undefined; fiatP224MulxU64(&x21, &x22, x19, 0xffffffff); var x23: u64 = undefined; var x24: u64 = undefined; fiatP224MulxU64(&x23, &x24, x19, 0xffffffffffffffff); var x25: u64 = undefined; var x26: u64 = undefined; fiatP224MulxU64(&x25, &x26, x19, 0xffffffff00000000); var x27: u64 = undefined; var x28: u1 = undefined; fiatP224AddcarryxU64(&x27, &x28, 0x0, x26, x23); var x29: u64 = undefined; var x30: u1 = undefined; fiatP224AddcarryxU64(&x29, &x30, x28, x24, x21); var x31: u64 = undefined; var x32: u1 = undefined; fiatP224AddcarryxU64(&x31, &x32, 0x0, x11, x19); var x33: u64 = undefined; var x34: u1 = undefined; fiatP224AddcarryxU64(&x33, &x34, x32, x13, x25); var x35: u64 = undefined; var x36: u1 = undefined; fiatP224AddcarryxU64(&x35, &x36, x34, x15, x27); var x37: u64 = undefined; var x38: u1 = undefined; fiatP224AddcarryxU64(&x37, &x38, x36, x17, x29); var x39: u64 = undefined; var x40: u64 = undefined; fiatP224MulxU64(&x39, &x40, x1, 0xffffffff); var x41: u64 = undefined; var x42: u64 = undefined; fiatP224MulxU64(&x41, &x42, x1, 0xfffffffe00000000); var x43: u64 = undefined; var x44: u64 = undefined; fiatP224MulxU64(&x43, &x44, x1, 0xffffffff00000000); var x45: u64 = undefined; var x46: u64 = undefined; fiatP224MulxU64(&x45, &x46, x1, 0xffffffff00000001); var x47: u64 = undefined; var x48: u1 = undefined; fiatP224AddcarryxU64(&x47, &x48, 0x0, x46, x43); var x49: u64 = undefined; var x50: u1 = undefined; fiatP224AddcarryxU64(&x49, &x50, x48, x44, x41); var x51: u64 = undefined; var x52: u1 = undefined; fiatP224AddcarryxU64(&x51, &x52, x50, x42, x39); var x53: u64 = undefined; var x54: u1 = undefined; fiatP224AddcarryxU64(&x53, &x54, 0x0, x33, x45); var x55: u64 = undefined; var x56: u1 = undefined; fiatP224AddcarryxU64(&x55, &x56, x54, x35, x47); var x57: u64 = undefined; var x58: u1 = undefined; fiatP224AddcarryxU64(&x57, &x58, x56, x37, x49); var x59: u64 = undefined; var x60: u1 = undefined; fiatP224AddcarryxU64(&x59, &x60, x58, ((@intCast(u64, x38) + (@intCast(u64, x18) + x6)) + (@intCast(u64, x30) + x22)), x51); var x61: u64 = undefined; var x62: u64 = undefined; fiatP224MulxU64(&x61, &x62, x53, 0xffffffffffffffff); var x63: u64 = undefined; var x64: u64 = undefined; fiatP224MulxU64(&x63, &x64, x61, 0xffffffff); var x65: u64 = undefined; var x66: u64 = undefined; fiatP224MulxU64(&x65, &x66, x61, 0xffffffffffffffff); var x67: u64 = undefined; var x68: u64 = undefined; fiatP224MulxU64(&x67, &x68, x61, 0xffffffff00000000); var x69: u64 = undefined; var x70: u1 = undefined; fiatP224AddcarryxU64(&x69, &x70, 0x0, x68, x65); var x71: u64 = undefined; var x72: u1 = undefined; fiatP224AddcarryxU64(&x71, &x72, x70, x66, x63); var x73: u64 = undefined; var x74: u1 = undefined; fiatP224AddcarryxU64(&x73, &x74, 0x0, x53, x61); var x75: u64 = undefined; var x76: u1 = undefined; fiatP224AddcarryxU64(&x75, &x76, x74, x55, x67); var x77: u64 = undefined; var x78: u1 = undefined; fiatP224AddcarryxU64(&x77, &x78, x76, x57, x69); var x79: u64 = undefined; var x80: u1 = undefined; fiatP224AddcarryxU64(&x79, &x80, x78, x59, x71); var x81: u64 = undefined; var x82: u64 = undefined; fiatP224MulxU64(&x81, &x82, x2, 0xffffffff); var x83: u64 = undefined; var x84: u64 = undefined; fiatP224MulxU64(&x83, &x84, x2, 0xfffffffe00000000); var x85: u64 = undefined; var x86: u64 = undefined; fiatP224MulxU64(&x85, &x86, x2, 0xffffffff00000000); var x87: u64 = undefined; var x88: u64 = undefined; fiatP224MulxU64(&x87, &x88, x2, 0xffffffff00000001); var x89: u64 = undefined; var x90: u1 = undefined; fiatP224AddcarryxU64(&x89, &x90, 0x0, x88, x85); var x91: u64 = undefined; var x92: u1 = undefined; fiatP224AddcarryxU64(&x91, &x92, x90, x86, x83); var x93: u64 = undefined; var x94: u1 = undefined; fiatP224AddcarryxU64(&x93, &x94, x92, x84, x81); var x95: u64 = undefined; var x96: u1 = undefined; fiatP224AddcarryxU64(&x95, &x96, 0x0, x75, x87); var x97: u64 = undefined; var x98: u1 = undefined; fiatP224AddcarryxU64(&x97, &x98, x96, x77, x89); var x99: u64 = undefined; var x100: u1 = undefined; fiatP224AddcarryxU64(&x99, &x100, x98, x79, x91); var x101: u64 = undefined; var x102: u1 = undefined; fiatP224AddcarryxU64(&x101, &x102, x100, ((@intCast(u64, x80) + (@intCast(u64, x60) + (@intCast(u64, x52) + x40))) + (@intCast(u64, x72) + x64)), x93); var x103: u64 = undefined; var x104: u64 = undefined; fiatP224MulxU64(&x103, &x104, x95, 0xffffffffffffffff); var x105: u64 = undefined; var x106: u64 = undefined; fiatP224MulxU64(&x105, &x106, x103, 0xffffffff); var x107: u64 = undefined; var x108: u64 = undefined; fiatP224MulxU64(&x107, &x108, x103, 0xffffffffffffffff); var x109: u64 = undefined; var x110: u64 = undefined; fiatP224MulxU64(&x109, &x110, x103, 0xffffffff00000000); var x111: u64 = undefined; var x112: u1 = undefined; fiatP224AddcarryxU64(&x111, &x112, 0x0, x110, x107); var x113: u64 = undefined; var x114: u1 = undefined; fiatP224AddcarryxU64(&x113, &x114, x112, x108, x105); var x115: u64 = undefined; var x116: u1 = undefined; fiatP224AddcarryxU64(&x115, &x116, 0x0, x95, x103); var x117: u64 = undefined; var x118: u1 = undefined; fiatP224AddcarryxU64(&x117, &x118, x116, x97, x109); var x119: u64 = undefined; var x120: u1 = undefined; fiatP224AddcarryxU64(&x119, &x120, x118, x99, x111); var x121: u64 = undefined; var x122: u1 = undefined; fiatP224AddcarryxU64(&x121, &x122, x120, x101, x113); var x123: u64 = undefined; var x124: u64 = undefined; fiatP224MulxU64(&x123, &x124, x3, 0xffffffff); var x125: u64 = undefined; var x126: u64 = undefined; fiatP224MulxU64(&x125, &x126, x3, 0xfffffffe00000000); var x127: u64 = undefined; var x128: u64 = undefined; fiatP224MulxU64(&x127, &x128, x3, 0xffffffff00000000); var x129: u64 = undefined; var x130: u64 = undefined; fiatP224MulxU64(&x129, &x130, x3, 0xffffffff00000001); var x131: u64 = undefined; var x132: u1 = undefined; fiatP224AddcarryxU64(&x131, &x132, 0x0, x130, x127); var x133: u64 = undefined; var x134: u1 = undefined; fiatP224AddcarryxU64(&x133, &x134, x132, x128, x125); var x135: u64 = undefined; var x136: u1 = undefined; fiatP224AddcarryxU64(&x135, &x136, x134, x126, x123); var x137: u64 = undefined; var x138: u1 = undefined; fiatP224AddcarryxU64(&x137, &x138, 0x0, x117, x129); var x139: u64 = undefined; var x140: u1 = undefined; fiatP224AddcarryxU64(&x139, &x140, x138, x119, x131); var x141: u64 = undefined; var x142: u1 = undefined; fiatP224AddcarryxU64(&x141, &x142, x140, x121, x133); var x143: u64 = undefined; var x144: u1 = undefined; fiatP224AddcarryxU64(&x143, &x144, x142, ((@intCast(u64, x122) + (@intCast(u64, x102) + (@intCast(u64, x94) + x82))) + (@intCast(u64, x114) + x106)), x135); var x145: u64 = undefined; var x146: u64 = undefined; fiatP224MulxU64(&x145, &x146, x137, 0xffffffffffffffff); var x147: u64 = undefined; var x148: u64 = undefined; fiatP224MulxU64(&x147, &x148, x145, 0xffffffff); var x149: u64 = undefined; var x150: u64 = undefined; fiatP224MulxU64(&x149, &x150, x145, 0xffffffffffffffff); var x151: u64 = undefined; var x152: u64 = undefined; fiatP224MulxU64(&x151, &x152, x145, 0xffffffff00000000); var x153: u64 = undefined; var x154: u1 = undefined; fiatP224AddcarryxU64(&x153, &x154, 0x0, x152, x149); var x155: u64 = undefined; var x156: u1 = undefined; fiatP224AddcarryxU64(&x155, &x156, x154, x150, x147); var x157: u64 = undefined; var x158: u1 = undefined; fiatP224AddcarryxU64(&x157, &x158, 0x0, x137, x145); var x159: u64 = undefined; var x160: u1 = undefined; fiatP224AddcarryxU64(&x159, &x160, x158, x139, x151); var x161: u64 = undefined; var x162: u1 = undefined; fiatP224AddcarryxU64(&x161, &x162, x160, x141, x153); var x163: u64 = undefined; var x164: u1 = undefined; fiatP224AddcarryxU64(&x163, &x164, x162, x143, x155); const x165: u64 = ((@intCast(u64, x164) + (@intCast(u64, x144) + (@intCast(u64, x136) + x124))) + (@intCast(u64, x156) + x148)); var x166: u64 = undefined; var x167: u1 = undefined; fiatP224SubborrowxU64(&x166, &x167, 0x0, x159, @intCast(u64, 0x1)); var x168: u64 = undefined; var x169: u1 = undefined; fiatP224SubborrowxU64(&x168, &x169, x167, x161, 0xffffffff00000000); var x170: u64 = undefined; var x171: u1 = undefined; fiatP224SubborrowxU64(&x170, &x171, x169, x163, 0xffffffffffffffff); var x172: u64 = undefined; var x173: u1 = undefined; fiatP224SubborrowxU64(&x172, &x173, x171, x165, 0xffffffff); var x174: u64 = undefined; var x175: u1 = undefined; fiatP224SubborrowxU64(&x174, &x175, x173, @intCast(u64, 0x0), @intCast(u64, 0x0)); var x176: u64 = undefined; fiatP224CmovznzU64(&x176, x175, x166, x159); var x177: u64 = undefined; fiatP224CmovznzU64(&x177, x175, x168, x161); var x178: u64 = undefined; fiatP224CmovznzU64(&x178, x175, x170, x163); var x179: u64 = undefined; fiatP224CmovznzU64(&x179, x175, x172, x165); out1[0] = x176; out1[1] = x177; out1[2] = x178; out1[3] = x179; } /// The function fiatP224Nonzero outputs a single non-zero word if the input is non-zero and zero otherwise. /// Preconditions: /// 0 ≤ eval arg1 < m /// Postconditions: /// out1 = 0 ↔ eval (from_montgomery arg1) mod m = 0 /// /// Input Bounds: /// arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// Output Bounds: /// out1: [0x0 ~> 0xffffffffffffffff] pub fn fiatP224Nonzero(out1: *u64, arg1: [4]u64) void { const x1: u64 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3])))); out1.* = x1; } /// The function fiatP224Selectznz is a multi-limb conditional select. /// Postconditions: /// eval out1 = (if arg1 = 0 then eval arg2 else eval arg3) /// /// Input Bounds: /// arg1: [0x0 ~> 0x1] /// arg2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// arg3: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// Output Bounds: /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] pub fn fiatP224Selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void { var x1: u64 = undefined; fiatP224CmovznzU64(&x1, arg1, (arg2[0]), (arg3[0])); var x2: u64 = undefined; fiatP224CmovznzU64(&x2, arg1, (arg2[1]), (arg3[1])); var x3: u64 = undefined; fiatP224CmovznzU64(&x3, arg1, (arg2[2]), (arg3[2])); var x4: u64 = undefined; fiatP224CmovznzU64(&x4, arg1, (arg2[3]), (arg3[3])); out1[0] = x1; out1[1] = x2; out1[2] = x3; out1[3] = x4; } /// The function fiatP224ToBytes serializes a field element NOT in the Montgomery domain to bytes in little-endian order. /// Preconditions: /// 0 ≤ eval arg1 < m /// Postconditions: /// out1 = map (λ x, ⌊((eval arg1 mod m) mod 2^(8 * (x + 1))) / 2^(8 * x)⌋) [0..27] /// /// Input Bounds: /// arg1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffff]] /// Output Bounds: /// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]] pub fn fiatP224ToBytes(out1: *[28]u8, arg1: [4]u64) void { const x1: u64 = (arg1[3]); const x2: u64 = (arg1[2]); const x3: u64 = (arg1[1]); const x4: u64 = (arg1[0]); const x5: u8 = @intCast(u8, (x4 & @intCast(u64, 0xff))); const x6: u64 = (x4 >> 8); const x7: u8 = @intCast(u8, (x6 & @intCast(u64, 0xff))); const x8: u64 = (x6 >> 8); const x9: u8 = @intCast(u8, (x8 & @intCast(u64, 0xff))); const x10: u64 = (x8 >> 8); const x11: u8 = @intCast(u8, (x10 & @intCast(u64, 0xff))); const x12: u64 = (x10 >> 8); const x13: u8 = @intCast(u8, (x12 & @intCast(u64, 0xff))); const x14: u64 = (x12 >> 8); const x15: u8 = @intCast(u8, (x14 & @intCast(u64, 0xff))); const x16: u64 = (x14 >> 8); const x17: u8 = @intCast(u8, (x16 & @intCast(u64, 0xff))); const x18: u8 = @intCast(u8, (x16 >> 8)); const x19: u8 = @intCast(u8, (x3 & @intCast(u64, 0xff))); const x20: u64 = (x3 >> 8); const x21: u8 = @intCast(u8, (x20 & @intCast(u64, 0xff))); const x22: u64 = (x20 >> 8); const x23: u8 = @intCast(u8, (x22 & @intCast(u64, 0xff))); const x24: u64 = (x22 >> 8); const x25: u8 = @intCast(u8, (x24 & @intCast(u64, 0xff))); const x26: u64 = (x24 >> 8); const x27: u8 = @intCast(u8, (x26 & @intCast(u64, 0xff))); const x28: u64 = (x26 >> 8); const x29: u8 = @intCast(u8, (x28 & @intCast(u64, 0xff))); const x30: u64 = (x28 >> 8); const x31: u8 = @intCast(u8, (x30 & @intCast(u64, 0xff))); const x32: u8 = @intCast(u8, (x30 >> 8)); const x33: u8 = @intCast(u8, (x2 & @intCast(u64, 0xff))); const x34: u64 = (x2 >> 8); const x35: u8 = @intCast(u8, (x34 & @intCast(u64, 0xff))); const x36: u64 = (x34 >> 8); const x37: u8 = @intCast(u8, (x36 & @intCast(u64, 0xff))); const x38: u64 = (x36 >> 8); const x39: u8 = @intCast(u8, (x38 & @intCast(u64, 0xff))); const x40: u64 = (x38 >> 8); const x41: u8 = @intCast(u8, (x40 & @intCast(u64, 0xff))); const x42: u64 = (x40 >> 8); const x43: u8 = @intCast(u8, (x42 & @intCast(u64, 0xff))); const x44: u64 = (x42 >> 8); const x45: u8 = @intCast(u8, (x44 & @intCast(u64, 0xff))); const x46: u8 = @intCast(u8, (x44 >> 8)); const x47: u8 = @intCast(u8, (x1 & @intCast(u64, 0xff))); const x48: u64 = (x1 >> 8); const x49: u8 = @intCast(u8, (x48 & @intCast(u64, 0xff))); const x50: u64 = (x48 >> 8); const x51: u8 = @intCast(u8, (x50 & @intCast(u64, 0xff))); const x52: u8 = @intCast(u8, (x50 >> 8)); out1[0] = x5; out1[1] = x7; out1[2] = x9; out1[3] = x11; out1[4] = x13; out1[5] = x15; out1[6] = x17; out1[7] = x18; out1[8] = x19; out1[9] = x21; out1[10] = x23; out1[11] = x25; out1[12] = x27; out1[13] = x29; out1[14] = x31; out1[15] = x32; out1[16] = x33; out1[17] = x35; out1[18] = x37; out1[19] = x39; out1[20] = x41; out1[21] = x43; out1[22] = x45; out1[23] = x46; out1[24] = x47; out1[25] = x49; out1[26] = x51; out1[27] = x52; } /// The function fiatP224FromBytes deserializes a field element NOT in the Montgomery domain from bytes in little-endian order. /// Preconditions: /// 0 ≤ bytes_eval arg1 < m /// Postconditions: /// eval out1 mod m = bytes_eval arg1 mod m /// 0 ≤ eval out1 < m /// /// Input Bounds: /// arg1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]] /// Output Bounds: /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffff]] pub fn fiatP224FromBytes(out1: *[4]u64, arg1: [28]u8) void { const x1: u64 = (@intCast(u64, (arg1[27])) << 24); const x2: u64 = (@intCast(u64, (arg1[26])) << 16); const x3: u64 = (@intCast(u64, (arg1[25])) << 8); const x4: u8 = (arg1[24]); const x5: u64 = (@intCast(u64, (arg1[23])) << 56); const x6: u64 = (@intCast(u64, (arg1[22])) << 48); const x7: u64 = (@intCast(u64, (arg1[21])) << 40); const x8: u64 = (@intCast(u64, (arg1[20])) << 32); const x9: u64 = (@intCast(u64, (arg1[19])) << 24); const x10: u64 = (@intCast(u64, (arg1[18])) << 16); const x11: u64 = (@intCast(u64, (arg1[17])) << 8); const x12: u8 = (arg1[16]); const x13: u64 = (@intCast(u64, (arg1[15])) << 56); const x14: u64 = (@intCast(u64, (arg1[14])) << 48); const x15: u64 = (@intCast(u64, (arg1[13])) << 40); const x16: u64 = (@intCast(u64, (arg1[12])) << 32); const x17: u64 = (@intCast(u64, (arg1[11])) << 24); const x18: u64 = (@intCast(u64, (arg1[10])) << 16); const x19: u64 = (@intCast(u64, (arg1[9])) << 8); const x20: u8 = (arg1[8]); const x21: u64 = (@intCast(u64, (arg1[7])) << 56); const x22: u64 = (@intCast(u64, (arg1[6])) << 48); const x23: u64 = (@intCast(u64, (arg1[5])) << 40); const x24: u64 = (@intCast(u64, (arg1[4])) << 32); const x25: u64 = (@intCast(u64, (arg1[3])) << 24); const x26: u64 = (@intCast(u64, (arg1[2])) << 16); const x27: u64 = (@intCast(u64, (arg1[1])) << 8); const x28: u8 = (arg1[0]); const x29: u64 = (x27 + @intCast(u64, x28)); const x30: u64 = (x26 + x29); const x31: u64 = (x25 + x30); const x32: u64 = (x24 + x31); const x33: u64 = (x23 + x32); const x34: u64 = (x22 + x33); const x35: u64 = (x21 + x34); const x36: u64 = (x19 + @intCast(u64, x20)); const x37: u64 = (x18 + x36); const x38: u64 = (x17 + x37); const x39: u64 = (x16 + x38); const x40: u64 = (x15 + x39); const x41: u64 = (x14 + x40); const x42: u64 = (x13 + x41); const x43: u64 = (x11 + @intCast(u64, x12)); const x44: u64 = (x10 + x43); const x45: u64 = (x9 + x44); const x46: u64 = (x8 + x45); const x47: u64 = (x7 + x46); const x48: u64 = (x6 + x47); const x49: u64 = (x5 + x48); const x50: u64 = (x3 + @intCast(u64, x4)); const x51: u64 = (x2 + x50); const x52: u64 = (x1 + x51); out1[0] = x35; out1[1] = x42; out1[2] = x49; out1[3] = x52; } /// The function fiatP224SetOne returns the field element one in the Montgomery domain. /// Postconditions: /// eval (from_montgomery out1) mod m = 1 mod m /// 0 ≤ eval out1 < m /// /// Input Bounds: /// Output Bounds: /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] pub fn fiatP224SetOne(out1: *[4]u64) void { out1[0] = 0xffffffff00000000; out1[1] = 0xffffffffffffffff; out1[2] = @intCast(u64, 0x0); out1[3] = @intCast(u64, 0x0); } /// The function fiatP224Msat returns the saturated representation of the prime modulus. /// Postconditions: /// twos_complement_eval out1 = m /// 0 ≤ eval out1 < m /// /// Input Bounds: /// Output Bounds: /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] pub fn fiatP224Msat(out1: *[5]u64) void { out1[0] = @intCast(u64, 0x1); out1[1] = 0xffffffff00000000; out1[2] = 0xffffffffffffffff; out1[3] = 0xffffffff; out1[4] = @intCast(u64, 0x0); } /// The function fiatP224Divstep computes a divstep. /// Preconditions: /// 0 ≤ eval arg4 < m /// 0 ≤ eval arg5 < m /// Postconditions: /// out1 = (if 0 < arg1 ∧ (twos_complement_eval arg3) is odd then 1 - arg1 else 1 + arg1) /// twos_complement_eval out2 = (if 0 < arg1 ∧ (twos_complement_eval arg3) is odd then twos_complement_eval arg3 else twos_complement_eval arg2) /// twos_complement_eval out3 = (if 0 < arg1 ∧ (twos_complement_eval arg3) is odd then ⌊(twos_complement_eval arg3 - twos_complement_eval arg2) / 2⌋ else ⌊(twos_complement_eval arg3 + (twos_complement_eval arg3 mod 2) * twos_complement_eval arg2) / 2⌋) /// eval (from_montgomery out4) mod m = (if 0 < arg1 ∧ (twos_complement_eval arg3) is odd then (2 * eval (from_montgomery arg5)) mod m else (2 * eval (from_montgomery arg4)) mod m) /// eval (from_montgomery out5) mod m = (if 0 < arg1 ∧ (twos_complement_eval arg3) is odd then (eval (from_montgomery arg4) - eval (from_montgomery arg4)) mod m else (eval (from_montgomery arg5) + (twos_complement_eval arg3 mod 2) * eval (from_montgomery arg4)) mod m) /// 0 ≤ eval out5 < m /// 0 ≤ eval out5 < m /// 0 ≤ eval out2 < m /// 0 ≤ eval out3 < m /// /// Input Bounds: /// arg1: [0x0 ~> 0xffffffffffffffff] /// arg2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// arg3: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// arg4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// arg5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// Output Bounds: /// out1: [0x0 ~> 0xffffffffffffffff] /// out2: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// out3: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] /// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] pub fn fiatP224Divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[4]u64, arg1: u64, arg2: [5]u64, arg3: [5]u64, arg4: [4]u64, arg5: [4]u64) void { var x1: u64 = undefined; var x2: u1 = undefined; fiatP224AddcarryxU64(&x1, &x2, 0x0, (~arg1), @intCast(u64, 0x1)); const x3: u1 = (@intCast(u1, (x1 >> 63)) & @intCast(u1, ((arg3[0]) & @intCast(u64, 0x1)))); var x4: u64 = undefined; var x5: u1 = undefined; fiatP224AddcarryxU64(&x4, &x5, 0x0, (~arg1), @intCast(u64, 0x1)); var x6: u64 = undefined; fiatP224CmovznzU64(&x6, x3, arg1, x4); var x7: u64 = undefined; fiatP224CmovznzU64(&x7, x3, (arg2[0]), (arg3[0])); var x8: u64 = undefined; fiatP224CmovznzU64(&x8, x3, (arg2[1]), (arg3[1])); var x9: u64 = undefined; fiatP224CmovznzU64(&x9, x3, (arg2[2]), (arg3[2])); var x10: u64 = undefined; fiatP224CmovznzU64(&x10, x3, (arg2[3]), (arg3[3])); var x11: u64 = undefined; fiatP224CmovznzU64(&x11, x3, (arg2[4]), (arg3[4])); var x12: u64 = undefined; var x13: u1 = undefined; fiatP224AddcarryxU64(&x12, &x13, 0x0, @intCast(u64, 0x1), (~(arg2[0]))); var x14: u64 = undefined; var x15: u1 = undefined; fiatP224AddcarryxU64(&x14, &x15, x13, @intCast(u64, 0x0), (~(arg2[1]))); var x16: u64 = undefined; var x17: u1 = undefined; fiatP224AddcarryxU64(&x16, &x17, x15, @intCast(u64, 0x0), (~(arg2[2]))); var x18: u64 = undefined; var x19: u1 = undefined; fiatP224AddcarryxU64(&x18, &x19, x17, @intCast(u64, 0x0), (~(arg2[3]))); var x20: u64 = undefined; var x21: u1 = undefined; fiatP224AddcarryxU64(&x20, &x21, x19, @intCast(u64, 0x0), (~(arg2[4]))); var x22: u64 = undefined; fiatP224CmovznzU64(&x22, x3, (arg3[0]), x12); var x23: u64 = undefined; fiatP224CmovznzU64(&x23, x3, (arg3[1]), x14); var x24: u64 = undefined; fiatP224CmovznzU64(&x24, x3, (arg3[2]), x16); var x25: u64 = undefined; fiatP224CmovznzU64(&x25, x3, (arg3[3]), x18); var x26: u64 = undefined; fiatP224CmovznzU64(&x26, x3, (arg3[4]), x20); var x27: u64 = undefined; fiatP224CmovznzU64(&x27, x3, (arg4[0]), (arg5[0])); var x28: u64 = undefined; fiatP224CmovznzU64(&x28, x3, (arg4[1]), (arg5[1])); var x29: u64 = undefined; fiatP224CmovznzU64(&x29, x3, (arg4[2]), (arg5[2])); var x30: u64 = undefined; fiatP224CmovznzU64(&x30, x3, (arg4[3]), (arg5[3])); var x31: u64 = undefined; var x32: u1 = undefined; fiatP224AddcarryxU64(&x31, &x32, 0x0, x27, x27); var x33: u64 = undefined; var x34: u1 = undefined; fiatP224AddcarryxU64(&x33, &x34, x32, x28, x28); var x35: u64 = undefined; var x36: u1 = undefined; fiatP224AddcarryxU64(&x35, &x36, x34, x29, x29); var x37: u64 = undefined; var x38: u1 = undefined; fiatP224AddcarryxU64(&x37, &x38, x36, x30, x30); var x39: u64 = undefined; var x40: u1 = undefined; fiatP224SubborrowxU64(&x39, &x40, 0x0, x31, @intCast(u64, 0x1)); var x41: u64 = undefined; var x42: u1 = undefined; fiatP224SubborrowxU64(&x41, &x42, x40, x33, 0xffffffff00000000); var x43: u64 = undefined; var x44: u1 = undefined; fiatP224SubborrowxU64(&x43, &x44, x42, x35, 0xffffffffffffffff); var x45: u64 = undefined; var x46: u1 = undefined; fiatP224SubborrowxU64(&x45, &x46, x44, x37, 0xffffffff); var x47: u64 = undefined; var x48: u1 = undefined; fiatP224SubborrowxU64(&x47, &x48, x46, @intCast(u64, x38), @intCast(u64, 0x0)); const x49: u64 = (arg4[3]); const x50: u64 = (arg4[2]); const x51: u64 = (arg4[1]); const x52: u64 = (arg4[0]); var x53: u64 = undefined; var x54: u1 = undefined; fiatP224SubborrowxU64(&x53, &x54, 0x0, @intCast(u64, 0x0), x52); var x55: u64 = undefined; var x56: u1 = undefined; fiatP224SubborrowxU64(&x55, &x56, x54, @intCast(u64, 0x0), x51); var x57: u64 = undefined; var x58: u1 = undefined; fiatP224SubborrowxU64(&x57, &x58, x56, @intCast(u64, 0x0), x50); var x59: u64 = undefined; var x60: u1 = undefined; fiatP224SubborrowxU64(&x59, &x60, x58, @intCast(u64, 0x0), x49); var x61: u64 = undefined; fiatP224CmovznzU64(&x61, x60, @intCast(u64, 0x0), 0xffffffffffffffff); var x62: u64 = undefined; var x63: u1 = undefined; fiatP224AddcarryxU64(&x62, &x63, 0x0, x53, @intCast(u64, @intCast(u1, (x61 & @intCast(u64, 0x1))))); var x64: u64 = undefined; var x65: u1 = undefined; fiatP224AddcarryxU64(&x64, &x65, x63, x55, (x61 & 0xffffffff00000000)); var x66: u64 = undefined; var x67: u1 = undefined; fiatP224AddcarryxU64(&x66, &x67, x65, x57, x61); var x68: u64 = undefined; var x69: u1 = undefined; fiatP224AddcarryxU64(&x68, &x69, x67, x59, (x61 & 0xffffffff)); var x70: u64 = undefined; fiatP224CmovznzU64(&x70, x3, (arg5[0]), x62); var x71: u64 = undefined; fiatP224CmovznzU64(&x71, x3, (arg5[1]), x64); var x72: u64 = undefined; fiatP224CmovznzU64(&x72, x3, (arg5[2]), x66); var x73: u64 = undefined; fiatP224CmovznzU64(&x73, x3, (arg5[3]), x68); const x74: u1 = @intCast(u1, (x22 & @intCast(u64, 0x1))); var x75: u64 = undefined; fiatP224CmovznzU64(&x75, x74, @intCast(u64, 0x0), x7); var x76: u64 = undefined; fiatP224CmovznzU64(&x76, x74, @intCast(u64, 0x0), x8); var x77: u64 = undefined; fiatP224CmovznzU64(&x77, x74, @intCast(u64, 0x0), x9); var x78: u64 = undefined; fiatP224CmovznzU64(&x78, x74, @intCast(u64, 0x0), x10); var x79: u64 = undefined; fiatP224CmovznzU64(&x79, x74, @intCast(u64, 0x0), x11); var x80: u64 = undefined; var x81: u1 = undefined; fiatP224AddcarryxU64(&x80, &x81, 0x0, x22, x75); var x82: u64 = undefined; var x83: u1 = undefined; fiatP224AddcarryxU64(&x82, &x83, x81, x23, x76); var x84: u64 = undefined; var x85: u1 = undefined; fiatP224AddcarryxU64(&x84, &x85, x83, x24, x77); var x86: u64 = undefined; var x87: u1 = undefined; fiatP224AddcarryxU64(&x86, &x87, x85, x25, x78); var x88: u64 = undefined; var x89: u1 = undefined; fiatP224AddcarryxU64(&x88, &x89, x87, x26, x79); var x90: u64 = undefined; fiatP224CmovznzU64(&x90, x74, @intCast(u64, 0x0), x27); var x91: u64 = undefined; fiatP224CmovznzU64(&x91, x74, @intCast(u64, 0x0), x28); var x92: u64 = undefined; fiatP224CmovznzU64(&x92, x74, @intCast(u64, 0x0), x29); var x93: u64 = undefined; fiatP224CmovznzU64(&x93, x74, @intCast(u64, 0x0), x30); var x94: u64 = undefined; var x95: u1 = undefined; fiatP224AddcarryxU64(&x94, &x95, 0x0, x70, x90); var x96: u64 = undefined; var x97: u1 = undefined; fiatP224AddcarryxU64(&x96, &x97, x95, x71, x91); var x98: u64 = undefined; var x99: u1 = undefined; fiatP224AddcarryxU64(&x98, &x99, x97, x72, x92); var x100: u64 = undefined; var x101: u1 = undefined; fiatP224AddcarryxU64(&x100, &x101, x99, x73, x93); var x102: u64 = undefined; var x103: u1 = undefined; fiatP224SubborrowxU64(&x102, &x103, 0x0, x94, @intCast(u64, 0x1)); var x104: u64 = undefined; var x105: u1 = undefined; fiatP224SubborrowxU64(&x104, &x105, x103, x96, 0xffffffff00000000); var x106: u64 = undefined; var x107: u1 = undefined; fiatP224SubborrowxU64(&x106, &x107, x105, x98, 0xffffffffffffffff); var x108: u64 = undefined; var x109: u1 = undefined; fiatP224SubborrowxU64(&x108, &x109, x107, x100, 0xffffffff); var x110: u64 = undefined; var x111: u1 = undefined; fiatP224SubborrowxU64(&x110, &x111, x109, @intCast(u64, x101), @intCast(u64, 0x0)); var x112: u64 = undefined; var x113: u1 = undefined; fiatP224AddcarryxU64(&x112, &x113, 0x0, x6, @intCast(u64, 0x1)); const x114: u64 = ((x80 >> 1) | ((x82 << 63) & 0xffffffffffffffff)); const x115: u64 = ((x82 >> 1) | ((x84 << 63) & 0xffffffffffffffff)); const x116: u64 = ((x84 >> 1) | ((x86 << 63) & 0xffffffffffffffff)); const x117: u64 = ((x86 >> 1) | ((x88 << 63) & 0xffffffffffffffff)); const x118: u64 = ((x88 & 0x8000000000000000) | (x88 >> 1)); var x119: u64 = undefined; fiatP224CmovznzU64(&x119, x48, x39, x31); var x120: u64 = undefined; fiatP224CmovznzU64(&x120, x48, x41, x33); var x121: u64 = undefined; fiatP224CmovznzU64(&x121, x48, x43, x35); var x122: u64 = undefined; fiatP224CmovznzU64(&x122, x48, x45, x37); var x123: u64 = undefined; fiatP224CmovznzU64(&x123, x111, x102, x94); var x124: u64 = undefined; fiatP224CmovznzU64(&x124, x111, x104, x96); var x125: u64 = undefined; fiatP224CmovznzU64(&x125, x111, x106, x98); var x126: u64 = undefined; fiatP224CmovznzU64(&x126, x111, x108, x100); out1.* = x112; out2[0] = x7; out2[1] = x8; out2[2] = x9; out2[3] = x10; out2[4] = x11; out3[0] = x114; out3[1] = x115; out3[2] = x116; out3[3] = x117; out3[4] = x118; out4[0] = x119; out4[1] = x120; out4[2] = x121; out4[3] = x122; out5[0] = x123; out5[1] = x124; out5[2] = x125; out5[3] = x126; } /// The function fiatP224DivstepPrecomp returns the precomputed value for Bernstein-Yang-inversion (in montgomery form). /// Postconditions: /// eval (from_montgomery out1) = ⌊(m - 1) / 2⌋^(if (log2 m) + 1 < 46 then ⌊(49 * ((log2 m) + 1) + 80) / 17⌋ else ⌊(49 * ((log2 m) + 1) + 57) / 17⌋) /// 0 ≤ eval out1 < m /// /// Input Bounds: /// Output Bounds: /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] pub fn fiatP224DivstepPrecomp(out1: *[4]u64) void { out1[0] = 0x7ffffffe800001; out1[1] = 0xff7fffff00800000; out1[2] = 0xffffff; out1[3] = 0xff800000; }
fiat-zig/src/p224_64.zig
const std = @import("std"); const mem = std.mem; const math = std.math; const testing = std.testing; pub const Error = error{ OutOfMemory, AllocatorRequired }; pub const Algorithm = enum { Bubble, Quick, Insertion, Selection, Comb, Shell, Heap, Merge, Radix, }; /// sort and return the result pub fn sortR(comptime T: anytype, arr: []T, desc: bool, algorithm: ?Algorithm, allocator: ?*mem.Allocator) Error![]T { try sort(T, arr, desc, algorithm, allocator); return arr; } /// sort to an owned slice. don't forgot to free pub fn sortC(comptime T: anytype, arr: []const T, desc: bool, algorithm: ?Algorithm, allocator: *mem.Allocator) Error![]T { return try sortR(T, try allocator.dupe(T, arr), desc, algorithm, allocator); } /// sort array by given algorithm. default algorithm is Quick Sort pub fn sort(comptime T: anytype, arr: []T, desc: bool, algorithm_opt: ?Algorithm, allocator_opt: ?*mem.Allocator) Error!void { if (algorithm_opt) |algorithm| { switch (algorithm) { .Bubble => bubbleSort(T, arr, desc), .Quick => quickSort(T, arr, 0, math.max(arr.len, 1) - 1, desc), .Insertion => insertionSort(T, arr, desc), .Selection => selectionSort(T, arr, desc), .Comb => combSort(T, arr, desc), .Shell => shellSort(T, arr, desc), .Heap => heapSort(T, arr, desc), else => { if (allocator_opt) |allocator| switch (algorithm) { .Merge => try mergeSort(T, arr, 0, math.max(arr.len, 1) - 1, desc, allocator), .Radix => try radixSort(T, arr, desc, allocator), else => {}, } else { return error.AllocatorRequired; } }, } } else { quickSort(T, arr, 0, math.max(arr.len, 1) - 1, desc); } } pub fn bubbleSort(comptime T: anytype, arr: []T, desc: bool) void { for (arr) |_, i| { var j: usize = 0; while (j < arr.len - i - 1) : (j += 1) { if (flow(arr[j + 1], arr[j], desc)) { mem.swap(T, &arr[j], &arr[j + 1]); } } } } pub fn quickSort(comptime T: anytype, arr: []T, left: usize, right: usize, desc: bool) void { if (left >= right) return; const pivot = arr[right]; var i = left; var j = left; while (j < right) : (j += 1) { if (flow(arr[j], pivot, desc)) { mem.swap(T, &arr[i], &arr[j]); i += 1; } } mem.swap(T, &arr[i], &arr[right]); quickSort(T, arr, left, math.max(i, 1) - 1, desc); quickSort(T, arr, i + 1, right, desc); } pub fn insertionSort(comptime T: anytype, arr: []T, desc: bool) void { var i: usize = 1; while (i < arr.len) : (i += 1) { const x = arr[i]; var j = i; while (j > 0 and flow(x, arr[j - 1], desc)) : (j -= 1) { arr[j] = arr[j - 1]; } arr[j] = x; } } pub fn selectionSort(comptime T: anytype, arr: []T, desc: bool) void { for (arr) |*item, i| { var pos = i; var j = i + 1; while (j < arr.len) : (j += 1) { if (flow(arr[j], arr[pos], desc)) { pos = j; } } mem.swap(T, &arr[pos], item); } } pub fn combSort(comptime T: anytype, arr: []T, desc: bool) void { if (arr.len == 0) return; var gap = arr.len; var swapped = true; while (gap != 1 or swapped) { gap = (gap * 10 / 13) ^ 1; swapped = false; var i: usize = 0; while (i < arr.len - gap) : (i += 1) { if (flow(arr[i + gap], arr[i], desc)) { mem.swap(T, &arr[i], &arr[i + gap]); swapped = true; } } } } pub fn shellSort(comptime T: anytype, arr: []T, desc: bool) void { var gap = arr.len / 2; while (gap > 0) : (gap /= 2) { var i = gap; while (i < arr.len) : (i += 1) { const x = arr[i]; var j = i; while (j >= gap and flow(x, arr[j - gap], desc)) : (j -= gap) { arr[j] = arr[j - gap]; } arr[j] = x; } } } fn heapify(comptime T: anytype, arr: []T, n: usize, i: usize, desc: bool) void { // in ASC this should be largest, in desc smallest. so i just named this los = largest or samallest var los = i; const left = 2 * i + 1; const right = 2 * i + 2; if (left < n and flow(arr[los], arr[left], desc)) los = left; if (right < n and flow(arr[los], arr[right], desc)) los = right; if (los != i) { mem.swap(T, &arr[i], &arr[los]); heapify(T, arr, n, los, desc); } } pub fn heapSort(comptime T: anytype, arr: []T, desc: bool) void { if (arr.len == 0) return; var i = arr.len / 2; while (i > 0) : (i -= 1) { heapify(T, arr, arr.len, i - 1, desc); } i = arr.len - 1; while (i > 0) : (i -= 1) { mem.swap(T, &arr[0], &arr[i]); heapify(T, arr, i, 0, desc); } } pub fn mergeSort(comptime T: anytype, arr: []T, left: usize, right: usize, desc: bool, allocator: *mem.Allocator) Error!void { if (left >= right) return; const mid = left + (right - left) / 2; try mergeSort(T, arr, left, mid, desc, allocator); try mergeSort(T, arr, mid + 1, right, desc, allocator); const n1 = mid - left + 1; const n2 = right - mid; var L = allocator.alloc(T, n1) catch return Error.OutOfMemory; var R = allocator.alloc(T, n2) catch return Error.OutOfMemory; defer { allocator.free(L); allocator.free(R); } var i: usize = 0; var j: usize = 0; while (i < n1) : (i += 1) { L[i] = arr[left + i]; } i = 0; while (i < n2) : (i += 1) { R[i] = arr[mid + 1 + i]; } i = 0; var k = left; while (i < n1 and j < n2) : (k += 1) { if (flow(L[i], R[j], desc)) { arr[k] = L[i]; i += 1; } else { arr[k] = R[j]; j += 1; } } while (i < n1) { arr[k] = L[i]; i += 1; k += 1; } while (j < n2) { arr[k] = R[j]; j += 1; k += 1; } } pub fn radixSort(comptime T: anytype, arr: []T, desc: bool, allocator: *mem.Allocator) Error!void { if (arr.len == 0) return; var x: T = 1; const base: u4 = 10; while (@divFloor(mem.max(T, arr), x) > 0) : (x *= base) { var res = allocator.alloc(T, arr.len) catch return Error.OutOfMemory; defer allocator.free(res); var count = [_]usize{0} ** base; for (arr) |item| { count[@intCast(usize, @mod(@divFloor(item, x), base))] += 1; } { var i: u4 = 1; while (i < base) : (i += 1) count[i] += count[i - 1]; } for (arr) |_, i| { const item = arr[arr.len - i - 1]; res[count[@intCast(usize, @mod(@divFloor(item, x), base))] - 1] = item; count[@intCast(usize, @mod(@divFloor(item, x), base))] -= 1; } for (arr) |*item, i| item.* = res[i]; } if (desc) mem.reverse(T, arr); } fn flow(a: anytype, b: @TypeOf(a), desc: bool) bool { if (desc) return a > b else return a < b; } const items = [_]i32{ 9, 1, 4, 12, 3, 4 }; const expectedASC = [_]i32{ 1, 3, 4, 4, 9, 12 }; const expectedDESC = [_]i32{ 12, 9, 4, 4, 3, 1 }; const ItemsT = @TypeOf(items[0]); test "bubble" { { var arr = items; bubbleSort(ItemsT, &arr, false); try testing.expectEqualSlices(ItemsT, &arr, &expectedASC); } { var arr = items; bubbleSort(ItemsT, &arr, true); try testing.expectEqualSlices(ItemsT, &arr, &expectedDESC); } } test "quick" { { var arr = items; quickSort(ItemsT, &arr, 0, math.max(arr.len, 1) - 1, false); try testing.expectEqualSlices(ItemsT, &arr, &expectedASC); } { var arr = items; quickSort(ItemsT, &arr, 0, math.max(arr.len, 1) - 1, true); try testing.expectEqualSlices(ItemsT, &arr, &expectedDESC); } } test "insertion" { { var arr = items; insertionSort(ItemsT, &arr, false); try testing.expectEqualSlices(ItemsT, &arr, &expectedASC); } { var arr = items; insertionSort(ItemsT, &arr, true); try testing.expectEqualSlices(ItemsT, &arr, &expectedDESC); } } test "selection" { { var arr = items; selectionSort(ItemsT, &arr, false); try testing.expectEqualSlices(ItemsT, &arr, &expectedASC); } { var arr = items; selectionSort(ItemsT, &arr, true); try testing.expectEqualSlices(ItemsT, &arr, &expectedDESC); } } test "comb" { { var arr = items; combSort(ItemsT, &arr, false); try testing.expectEqualSlices(ItemsT, &arr, &expectedASC); } { var arr = items; combSort(ItemsT, &arr, true); try testing.expectEqualSlices(ItemsT, &arr, &expectedDESC); } } test "shell" { { var arr = items; shellSort(ItemsT, &arr, false); try testing.expectEqualSlices(ItemsT, &arr, &expectedASC); } { var arr = items; shellSort(ItemsT, &arr, true); try testing.expectEqualSlices(ItemsT, &arr, &expectedDESC); } } test "heap" { { var arr = items; heapSort(ItemsT, &arr, false); try testing.expectEqualSlices(ItemsT, &arr, &expectedASC); } { var arr = items; heapSort(ItemsT, &arr, true); testing.expectEqualSlices(ItemsT, &arr, &expectedDESC) catch |err| { std.debug.print("\n\n{any}\n\n", .{arr}); return err; }; } } test "merge" { { var arr = items; try mergeSort(ItemsT, &arr, 0, comptime math.max(arr.len, 1) - 1, false, testing.allocator); try testing.expectEqualSlices(ItemsT, &arr, &expectedASC); } { var arr = items; try mergeSort(ItemsT, &arr, 0, comptime math.max(arr.len, 1) - 1, true, testing.allocator); try testing.expectEqualSlices(ItemsT, &arr, &expectedDESC); } } test "radix" { { var arr = items; try radixSort(ItemsT, &arr, false, testing.allocator); try testing.expectEqualSlices(ItemsT, &arr, &expectedASC); } { var arr = items; try radixSort(ItemsT, &arr, true, testing.allocator); try testing.expectEqualSlices(ItemsT, &arr, &expectedDESC); } } test "sort" { { var arr = items; try sort(ItemsT, &arr, false, .Quick, null); try testing.expectEqualSlices(ItemsT, &arr, &expectedASC); } { try testing.expectError(Error.AllocatorRequired, sort(ItemsT, &[_]ItemsT{}, false, .Merge, null)); } { var arr = items; const res = try sortR(ItemsT, &arr, false, null, null); try testing.expectEqualSlices(ItemsT, res, &expectedASC); } { var arr = items; const res = try sortC(ItemsT, &arr, false, null, testing.allocator); defer testing.allocator.free(res); try testing.expectEqualSlices(ItemsT, res, &expectedASC); try testing.expectEqualSlices(ItemsT, &arr, &items); } }
zort.zig
const builtin = @import("builtin"); const fprint = @import("fprint.zig"); const io = @import("io.zig"); var console_file: ?*io.File = null; pub var debug_print = false; pub fn init(file: ?*io.File, debug: bool) void { console_file = file; debug_print = debug; } pub fn get_console_file() ?*io.File { return console_file; } pub fn char(ch: u8) void { if (console_file) |o| { fprint.char(o, ch) catch unreachable; } } pub fn nstring(str: [*]const u8, size: usize) void { if (console_file) |o| { fprint.nstring(o, str, size) catch unreachable; } } pub fn string(str: []const u8) void { if (console_file) |o| { fprint.string(o, str) catch unreachable; } } pub fn cstring(str: [*]const u8) void { if (console_file) |o| { fprint.cstring(o, str) catch unreachable; } } pub fn stripped_string(str: [*]const u8, size: usize) void { if (console_file) |o| { fprint.stripped_string(o, str, size) catch unreachable; } } pub fn uint(value: usize) void { if (console_file) |o| { fprint.uint(o, value) catch unreachable; } } pub fn uint64(value: u64) void { if (console_file) |o| { fprint.uint64(o, value) catch unreachable; } } pub fn int(value: isize) void { if (console_file) |o| { fprint.int(o, value) catch unreachable; } } pub fn int_sign(value: usize) void { if (console_file) |o| { fprint.int_sign(o, value) catch unreachable; } } pub fn hex(value: usize) void { if (console_file) |o| { fprint.hex(o, value) catch unreachable; } } pub fn address(value: usize) void { if (console_file) |o| { fprint.address(o, value) catch unreachable; } } pub fn byte(value: u8) void { if (console_file) |o| { fprint.byte(o, value) catch unreachable; } } pub fn boolean(value: bool) void { if (console_file) |o| { fprint.boolean(o, value) catch unreachable; } } pub fn any(value: anytype) void { if (console_file) |o| { fprint.any(o, value) catch unreachable; } } pub fn format(comptime fmtstr: []const u8, args: anytype)void { if (console_file) |o| { fprint.format(o, fmtstr, args) catch unreachable; } } pub fn dump_memory(ptr: usize, size: usize) void { if (console_file) |o| { fprint.dump_memory(o, ptr, size) catch unreachable; } } pub fn dump_bytes(byteslice: []const u8) void { if (console_file) |o| { fprint.dump_bytes(o, byteslice) catch unreachable; } } pub fn dump_raw_object(comptime Type: type, value: *const Type) void { if (console_file) |o| { fprint.dump_raw_object(o, Type, value) catch unreachable; } } // print.string("0x0 -> "); // print.hex(0x0); // print.char('\n'); // print.string("0x1 -> "); // print.hex(0x1); // print.char('\n'); // print.string("0x9 -> "); // print.hex(0x9); // print.char('\n'); // print.string("0xA -> "); // print.hex(0xA); // print.char('\n'); // print.string("0xF -> "); // print.hex(0xF); // print.char('\n'); // print.string("0x10 -> "); // print.hex(0x10); // print.char('\n'); // print.string("0xABCDEF -> "); // print.hex(0xABCDEF); // print.char('\n'); // print.byte(0x00); // print.char('\n'); // print.byte(0x01); // print.char('\n'); // print.byte(0x0F); // print.char('\n'); // print.byte(0xFF); // print.char('\n'); // var b: bool = false; // var x: u16 = 0xABCD; // print.format("Hello {} {}\n", @intCast(usize, 10), b); // print.format("Strings {} {}\n", "Hello1", c"Hello2"); // print.format("{{These braces are escaped}}\n"); // print.format("{:x}\n", x); pub fn debug_char(ch: u8) void { if (debug_print) { char(ch); } } pub fn debug_nstring(str: [*]const u8, size: usize) void { if (debug_print) { nstring(str, size); } } pub fn debug_string(str: []const u8) void { if (debug_print) { string(str); } } pub fn debug_cstring(str: [*]const u8) void { if (debug_print) { cstring(str); } } pub fn debug_stripped_string(str: [*]const u8) void { if (debug_print) { stripped_string(str); } } pub fn debug_uint(value: usize) void { if (debug_print) { uint(value); } } pub fn debug_uint64(value: u64) void { if (debug_print) { uint64(value); } } pub fn debug_int(value: isize) void { if (debug_print) { int(value); } } pub fn debug_int_sign(value: usize, show_positive: bool) void { if (debug_print) { int_sign(value, show_positive); } } pub fn debug_hex(value: usize) void { if (debug_print) { hex(value); } } pub fn debug_address(value: usize) void { if (debug_print) { address(value); } } pub fn debug_byte(value: u8) void { if (debug_print) { byte(value); } } pub fn debug_boolean(value: bool) void { if (debug_print) { boolean(value); } } pub fn debug_any(value: anytype) void { if (debug_print) { any(value); } } pub fn debug_format(comptime fmtstr: []const u8, args: anytype)void { if (debug_print) { format(fmtstr, args); } } pub fn debug_dump_memory(ptr: usize, size: usize) void { if (debug_print) { dump_memory(ptr, size); } } pub fn debug_dump_bytes(byteslice: []const u8) void { if (debug_print) { dump_bytes(byteslice); } } pub fn debug_dump_raw_object(comptime Type: type, value: *const Type) void { if (debug_print) { dump_raw_object(Type, value); } }
kernel/print.zig
const std = @import("std"); const builtin = @import("builtin"); const debug = std.debug; const mem = std.mem; const testing = std.testing; pub const Self = @OpaqueType(); pub fn Interface(comptime T: type) type { const info = @typeInfo(T).Struct; const VTable = struct { funcs: [info.decls.len]fn () void, fn init(comptime Funcs: type, comptime State: type) @This() { var res: @This() = undefined; inline for (info.decls) |def, i| { const DefType = @field(T, def.name); comptime debug.assert(@TypeOf(DefType) == type); const func_info = @typeInfo(DefType).Fn; comptime debug.assert(func_info.args[0].arg_type.? == *Self); const Type = FnType(State, func_info.args[1..], func_info.return_type.?); const func: Type = @field(Funcs, def.name); res.funcs[i] = @ptrCast(fn () void, func); } return res; } fn dispatch(vtable: @This(), comptime fn_name: []const u8, self: *Self, args: var) @field(T, fn_name).ReturnType { inline for (info.decls) |decl, i| { if (comptime !mem.eql(u8, decl.name, fn_name)) continue; const func = @ptrCast(@field(T, decl.name), vtable.funcs[i]); return switch (args.len) { 0 => func(self), 1 => func(self, args[0]), 2 => func(self, args[0], args[1]), 3 => func(self, args[0], args[1], args[2]), else => comptime unreachable, }; } comptime unreachable; } fn FnType(comptime State: type, comptime args: []const builtin.TypeInfo.FnArg, comptime Return: type) type { return switch (args.len) { 0 => fn (*State) Return, 1 => fn (*State, args[0].arg_type.?) Return, 2 => fn (*State, args[0].arg_type.?, args[1].arg_type.?) Return, 3 => fn (*State, args[0].arg_type.?, args[1].arg_type.?, args[2].arg_type.?) Return, else => comptime unreachable, }; } }; return struct { state: *Self, vtable: *const VTable, pub fn init(comptime State: type, state: *State) @This() { return initWithFuncs(State, state, State); } pub fn initWithFuncs(comptime State: type, state: *State, comptime Funcs: type) @This() { return @This(){ .state = @ptrCast(*Self, state), .vtable = &comptime VTable.init(Funcs, State), }; } fn call(self: @This(), comptime fn_name: []const u8, args: var) @field(T, fn_name).ReturnType { return self.vtable.dispatch(fn_name, self.state, args); } }; } const Sb = struct { b: u8, fn a(self: *Sb, v: u8) u8 { return self.b + v; } }; const Sq = struct { q: u8, fn a(self: *Sq, v: u8) u8 { return self.q * v; } }; const IA = Interface(struct { const a = fn (*Self, u8) u8; }); test "interface" { var sb = Sb{ .b = 3 }; var sq = Sq{ .q = 3 }; const ib = IA.init(Sb, &sb); const iq = IA.init(Sq, &sq); testing.expectEqual(@as(u8, 5), ib.call("a", .{@as(u8, 2)})); testing.expectEqual(@as(u8, 6), iq.call("a", .{@as(u8, 2)})); }
fun/interface.zig
const std = @import("../../std.zig"); const builtin = @import("builtin"); const windows = std.os.windows; const mem = std.mem; const testing = std.testing; const expect = testing.expect; fn testRemoveDotDirs(str: []const u8, expected: []const u8) !void { const mutable = try testing.allocator.dupe(u8, str); defer testing.allocator.free(mutable); const actual = mutable[0..try windows.removeDotDirsSanitized(u8, mutable)]; try testing.expect(mem.eql(u8, actual, expected)); } fn testRemoveDotDirsError(err: anyerror, str: []const u8) !void { const mutable = try testing.allocator.dupe(u8, str); defer testing.allocator.free(mutable); try testing.expectError(err, windows.removeDotDirsSanitized(u8, mutable)); } test "removeDotDirs" { try testRemoveDotDirs("", ""); try testRemoveDotDirs(".", ""); try testRemoveDotDirs(".\\", ""); try testRemoveDotDirs(".\\.", ""); try testRemoveDotDirs(".\\.\\", ""); try testRemoveDotDirs(".\\.\\.", ""); try testRemoveDotDirs("a", "a"); try testRemoveDotDirs("a\\", "a\\"); try testRemoveDotDirs("a\\b", "a\\b"); try testRemoveDotDirs("a\\.", "a\\"); try testRemoveDotDirs("a\\b\\.", "a\\b\\"); try testRemoveDotDirs("a\\.\\b", "a\\b"); try testRemoveDotDirs(".a", ".a"); try testRemoveDotDirs(".a\\", ".a\\"); try testRemoveDotDirs(".a\\.b", ".a\\.b"); try testRemoveDotDirs(".a\\.", ".a\\"); try testRemoveDotDirs(".a\\.\\.", ".a\\"); try testRemoveDotDirs(".a\\.\\.\\.b", ".a\\.b"); try testRemoveDotDirs(".a\\.\\.\\.b\\", ".a\\.b\\"); try testRemoveDotDirsError(error.TooManyParentDirs, ".."); try testRemoveDotDirsError(error.TooManyParentDirs, "..\\"); try testRemoveDotDirsError(error.TooManyParentDirs, ".\\..\\"); try testRemoveDotDirsError(error.TooManyParentDirs, ".\\.\\..\\"); try testRemoveDotDirs("a\\..", ""); try testRemoveDotDirs("a\\..\\", ""); try testRemoveDotDirs("a\\..\\.", ""); try testRemoveDotDirs("a\\..\\.\\", ""); try testRemoveDotDirs("a\\..\\.\\.", ""); try testRemoveDotDirsError(error.TooManyParentDirs, "a\\..\\.\\.\\.."); try testRemoveDotDirs("a\\..\\.\\.\\b", "b"); try testRemoveDotDirs("a\\..\\.\\.\\b\\", "b\\"); try testRemoveDotDirs("a\\..\\.\\.\\b\\.", "b\\"); try testRemoveDotDirs("a\\..\\.\\.\\b\\.\\", "b\\"); try testRemoveDotDirs("a\\..\\.\\.\\b\\.\\..", ""); try testRemoveDotDirs("a\\..\\.\\.\\b\\.\\..\\", ""); try testRemoveDotDirs("a\\..\\.\\.\\b\\.\\..\\.", ""); try testRemoveDotDirsError(error.TooManyParentDirs, "a\\..\\.\\.\\b\\.\\..\\.\\.."); try testRemoveDotDirs("a\\b\\..\\", "a\\"); try testRemoveDotDirs("a\\b\\..\\c", "a\\c"); }
lib/std/os/windows/test.zig
const inputFile = @embedFile("./input/day18.txt"); const std = @import("std"); const builtin = @import("builtin"); const Allocator = std.mem.Allocator; const List = std.ArrayList; const Str = []const u8; const BitSet = std.DynamicBitSet; const StrMap = std.StringHashMap; const HashMap = std.HashMap; const Map = std.AutoHashMap; const PriorityQueue = std.PriorityQueue; const assert = std.debug.assert; const tokenize = std.mem.tokenize; const print = std.debug.print; const parseInt = std.fmt.parseInt; const abs = std.math.absInt; fn sort(comptime T: type, items: []T) void { std.sort.sort(T, items, {}, comptime std.sort.asc(T)); } fn println(x: Str) void { print("{s}\n", .{x}); } const LeafNode = struct { p: ?*Node, val: u8, }; const InnerNode = struct { p: ?*Node, /// We are guaranteed a full binary tree, no inner node can have only one leaf. l: *Node, r: *Node, }; const Node = union(enum) { Leaf: LeafNode, Inner: InnerNode, const Self = @This(); pub fn parent(self: Self) ?*Node { return switch (self) { .Leaf => |x| x.p, .Inner => |x| x.p, }; } pub fn setParent(self: *Self, newParent: *Node) void { switch (self.*) { .Leaf => |*x| x.p = newParent, .Inner => |*x| x.p = newParent, } } pub fn isLeaf(self: Self) bool { return switch (self) { .Leaf => true, .Inner => false, }; } pub fn isPair(self: Self) bool { switch (self) { .Leaf => return false, .Inner => |inn| { return inn.l.isLeaf() and inn.r.isLeaf(); }, } } fn rightOf(self: *Self) *LeafNode { var x = self; while (true) { switch (x.*) { .Leaf => |*leaf| return leaf, .Inner => |inn| x = inn.r, } } } fn leftOf(self: *Self) *LeafNode { var x = self; while (true) { switch (x.*) { .Leaf => |*leaf| return leaf, .Inner => |inn| x = inn.l, } } } /// If this returns null, means that the node is currently the leftmost node pub fn moveLeft(self: Self) ?*LeafNode { // Walk up the parent chain until you reach the first parent with a different left child // from that left child, walk rightwards until you hit the end. var curr = &self; var p = self.parent(); const leftOfParent: *Node = while (p) |x| { if (curr != x.Inner.l) break x.Inner.l; p = x.Inner.p; curr = x; } else return null; // reached the root and no left child, so return null return rightOf(leftOfParent); } pub fn moveRight(self: Self) ?*LeafNode { // same as moveLeft, but mirrored var curr = &self; var p = self.parent(); const rightOfParent: *Node = while (p) |x| { if (curr != x.Inner.r) break x.Inner.r; p = x.Inner.p; curr = x; } else return null; return leftOf(rightOfParent); } // ----------- Iterators --------- const NodeAndDepth = struct { node: *Node, depth: u32, }; const TreePreOrderIterator = struct { stack: List(NodeAndDepth), pub fn next(self: *@This()) !?NodeAndDepth { if (self.stack.popOrNull()) |top| { switch (top.node.*) { .Inner => |inn| { try self.stack.append(.{ .node = inn.r, .depth = top.depth + 1 }); try self.stack.append(.{ .node = inn.l, .depth = top.depth + 1 }); }, .Leaf => {}, } return top; } else return null; } pub fn deinit(self: @This()) void { self.stack.deinit(); } }; /// Returns an iterator that walks over every node in the tree, as a pre-order traversal. fn treePreOrderIterator(root: *Self, allocator: Allocator) !TreePreOrderIterator { var stack = List(NodeAndDepth).init(allocator); try stack.append(.{ .node = root, .depth = 0 }); return TreePreOrderIterator{ .stack = stack }; } pub const PairIterator = struct { it: TreePreOrderIterator, /// Returns the next pair in tree order, or null if no such pair exists. /// When it returns a pair, the depth field on the iterator is a 0-indexed height of the pair pub fn next(self: *@This()) !?NodeAndDepth { while (try self.it.next()) |pair| { if (pair.node.isPair()) { // Hack: internal impl details of the iterator (whatever...) // pop off the leaves because the pair may get exploded and anyway we don't care about leaves. _ = self.it.stack.pop(); _ = self.it.stack.pop(); return pair; } } else return null; } pub fn deinit(self: @This()) void { self.it.deinit(); } }; // Iterates over all the pairs in the tree rooted at root pub fn pairIterator(root: *Self, allocator: Allocator) !PairIterator { return PairIterator{ .it = try treePreOrderIterator(root, allocator) }; } pub const LeafIterator = struct { it: TreePreOrderIterator, /// Always returns a Leaf node. pub fn next(self: *@This()) !?*Node { while (try self.it.next()) |pair| { if (pair.node.isLeaf()) return pair.node; } else return null; } pub fn deinit(self: @This()) void { self.it.deinit(); } }; // Iterates over all the leaves in the tree rooted at root pub fn leafIterator(root: *Self, allocator: Allocator) !LeafIterator { return LeafIterator{ .it = try treePreOrderIterator(root, allocator) }; } // ------------- Serializing and parsing ---------------------- // Turns a tree into a series of brackets pub fn toString(number: *Self, allocator: Allocator) !Str { var resultList = List(u8).init(allocator); errdefer resultList.deinit(); try toStringRec(number, allocator, &resultList); return resultList.toOwnedSlice(); } fn toStringRec(number: *Self, allocator: Allocator, resultList: *List(u8)) error{OutOfMemory}!void { switch (number.*) { .Inner => |inn| { try resultList.append('['); try toStringRec(inn.l, allocator, resultList); try resultList.append(','); try toStringRec(inn.r, allocator, resultList); try resultList.append(']'); }, .Leaf => |leaf| { var val = leaf.val; if (val >= 10) { try resultList.append(val / 10 + '0'); val = val % 10; } try resultList.append(val + '0'); }, } } pub fn magnitude(number: Self) usize { var total: usize = 0; switch (number) { .Inner => |inn| { total += 3 * magnitude(inn.l.*); total += 2 * magnitude(inn.r.*); }, .Leaf => |leaf| { total += leaf.val; }, } return total; } pub fn assertParentPointers(number: Self) void { switch (number) { .Inner => |inn| { if (inn.l.parent() != &number) @panic("Left parent pointer invalid"); if (inn.r.parent() != &number) @panic("Right parent pointer invalid"); inn.l.assertParentPointers(); inn.r.assertParentPointers(); }, .Leaf => return, } } }; /// I L /// L L L ----> L+1 /// fn explodePair(self: *Node, allocator: Allocator) void { assert(self.isPair()); const leftVal = self.Inner.l.Leaf.val; // safe since we check above const rightVal = self.Inner.r.Leaf.val; // safe since we check above if (self.moveLeft()) |lOf| { lOf.val += leftVal; } if (self.moveRight()) |rOf| { rOf.val += rightVal; } const parent = self.Inner.p; // free the children allocator.destroy(self.Inner.l); allocator.destroy(self.Inner.r); // Overwrite self. Note that the old self is now invalid! self.* = Node{ .Leaf = .{ .p = parent, .val = 0, } }; } fn splitLeaf(self: *Node, allocator: Allocator) !void { assert(self.isLeaf()); const val = self.Leaf.val; assert(val >= 10); const leftVal = val / 2; const rightVal = leftVal + @rem(val, 2); var leftLeaf = try makeLeaf(leftVal, allocator); leftLeaf.setParent(self); var rightLeaf = try makeLeaf(rightVal, allocator); rightLeaf.setParent(self); const parent = self.Leaf.p; // Overwrite self. Note that self.val / self.p are now invalid! self.* = Node{ .Inner = .{ .p = parent, .l = leftLeaf, .r = rightLeaf, } }; } fn reduceSnailfishNumber(number: *Node, allocator: Allocator) !void { outer: while (true) { if (builtin.is_test) { number.assertParentPointers(); } // First, we iterate over the pairs and explode them if needed { var pairsIt = try number.pairIterator(allocator); defer pairsIt.deinit(); while (try pairsIt.next()) |pairAndDepth| { if (pairAndDepth.depth > 3) { explodePair(pairAndDepth.node, allocator); } } } // Then, we iterate over the leaves and split them if needed { var leavesIt = try number.leafIterator(allocator); defer leavesIt.deinit(); while (try leavesIt.next()) |leaf| { if (leaf.Leaf.val >= 10) { try splitLeaf(leaf, allocator); continue :outer; // A split may cause a explosion. For simplicity, we just restart the process. } } } return; } } fn addSnailfishNumber(l: *Node, r: *Node, allocator: Allocator) !*Node { var result = try makePair(l, r, allocator); try reduceSnailfishNumber(result, allocator); return result; } fn partOne(input: Str, allocator: Allocator) !usize { var it = tokenize(u8, input, "\n"); var num = try parseSnailfishNumber(it.next().?, allocator); while (it.next()) |line| { var nextNum = try parseSnailfishNumber(line, allocator); num = try addSnailfishNumber(num, nextNum, allocator); } return num.magnitude(); } fn partTwo(_: Str) usize { return 0; } pub fn main() !void { // Standard boilerplate for Aoc problems const stdout = std.io.getStdOut().writer(); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; var gpaAllocator = gpa.allocator(); defer assert(!gpa.deinit()); // Check for memory leaks var arena = std.heap.ArenaAllocator.init(gpaAllocator); defer arena.deinit(); var allocator = arena.allocator(); try stdout.print("Part 1: {d}Part2: {d}\n", .{ partOne(inputFile, allocator), partTwo(inputFile) }); } fn makePair(left: *Node, right: *Node, allocator: Allocator) !*Node { assert(left.parent() == null); assert(right.parent() == null); var newParent = try allocator.create(Node); newParent.* = Node{ .Inner = .{ .p = null, .l = left, .r = right } }; left.setParent(newParent); right.setParent(newParent); return newParent; } fn makeLeaf(val: u8, allocator: Allocator) !*Node { var x = try allocator.create(Node); x.* = Node{ .Leaf = .{ .p = null, .val = val } }; return x; } // ----------------- Parser ----------------------- /// [[1, 0], 0] fn parseSnailfishNumber(input: Str, allocator: Allocator) !*Node { // essentially this is parsing a very limited subset of JSON. var reader = std.io.fixedBufferStream(input).reader(); return parseNode(&reader, allocator); } const SnailfishReader = std.io.FixedBufferStream(Str).Reader; fn parseNode(reader: *SnailfishReader, allocator: Allocator) !*Node { const firstByte = try reader.readByte(); return switch (firstByte) { '0'...'9' => try makeLeaf(firstByte - '0', allocator), '[' => try parsePair(reader, allocator), else => unreachable, }; } fn parsePair(reader: *SnailfishReader, allocator: Allocator) error{ OutOfMemory, EndOfStream }!*Node { const firstNode = try parseNode(reader, allocator); assert((try reader.readByte()) == ','); const secondNode = try parseNode(reader, allocator); assert((try reader.readByte()) == ']'); return makePair(firstNode, secondNode, allocator); } test "Parse" { var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); var allocator = arena.allocator(); const simple = "[1,[1,0]]"; const res = try parseSnailfishNumber(simple, allocator); try std.testing.expectEqual(@as(u64, 1), res.Inner.l.Leaf.val); try std.testing.expectEqual(@as(u64, 1), res.Inner.r.Inner.l.Leaf.val); try std.testing.expectEqual(@as(u64, 0), res.Inner.r.Inner.r.Leaf.val); const longer = "[[[[6,0],[8,2]],[[9,0],[8,7]]],[3,[6,[8,8]]]]"; _ = try parseSnailfishNumber(longer, allocator); } test "Parsed Explode Pair" { // p p // l2 p2 ==> (l2+l) 0 // l r var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); var allocator = arena.allocator(); const inputStr = "[7,[3,5]]"; const p = try parseSnailfishNumber(inputStr, allocator); explodePair(p.Inner.r, allocator); try std.testing.expectEqual(@as(u64, 3 + 7), p.Inner.l.Leaf.val); try std.testing.expectEqual(@as(u64, 0), p.Inner.r.Leaf.val); } test "Parsed Split Pair" { // p p // l2 p2 ==> (l2+l) 0 // l r var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); var allocator = arena.allocator(); const inputStr = "[9,[3,5]]"; var p = try parseSnailfishNumber(inputStr, allocator); p.Inner.l.Leaf.val += 6; try splitLeaf(p.Inner.l, allocator); try std.testing.expectEqual(@as(u64, 7), p.Inner.l.Inner.l.Leaf.val); try std.testing.expectEqual(@as(u64, 8), p.Inner.l.Inner.r.Leaf.val); } test "Explode Pair" { // p p // l2 p2 ==> (l2+l) 0 // l r var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); var allocator = arena.allocator(); const l = try makeLeaf(3, allocator); const r = try makeLeaf(5, allocator); const p2 = try makePair(l, r, allocator); const l2 = try makeLeaf(7, allocator); const p = try makePair(l2, p2, allocator); explodePair(p2, allocator); try std.testing.expectEqual(@as(u64, 3 + 7), p.Inner.l.Leaf.val); try std.testing.expectEqual(@as(u64, 0), p.Inner.r.Leaf.val); } test "Explode Pair complex" { // p11 // p21 p22 // l31 p32 p33 l34 // l41 l42 l43 l44 var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); var allocator = arena.allocator(); const l41 = try makeLeaf(41, allocator); const l42 = try makeLeaf(42, allocator); const p32 = try makePair(l41, l42, allocator); const l43 = try makeLeaf(43, allocator); const l44 = try makeLeaf(44, allocator); const p33 = try makePair(l43, l44, allocator); const l31 = try makeLeaf(31, allocator); const p21 = try makePair(l31, p32, allocator); const l34 = try makeLeaf(34, allocator); const p22 = try makePair(p33, l34, allocator); _ = try makePair(p21, p22, allocator); explodePair(p32, allocator); try std.testing.expectEqual(@as(u64, 31 + 41), l31.Leaf.val); try std.testing.expectEqual(@as(u64, 43 + 42), l43.Leaf.val); try std.testing.expectEqual(@as(u64, 0), p21.Inner.r.Leaf.val); } test "Add snailfish numbers" { var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); var allocator = arena.allocator(); const first = try parseSnailfishNumber("[[[[4,3],4],4],[7,[[8,4],9]]]", allocator); const second = try parseSnailfishNumber("[1,1]", allocator); const result = try addSnailfishNumber(first, second, allocator); try std.testing.expectEqualSlices(u8, try result.toString(allocator), "[[[[0,7],4],[[7,8],[6,0]]],[8,1]]"); } test "part one simple" { const input = \\[1,1] \\[2,2] \\[3,3] \\[4,4] \\[5,5] \\[6,6] \\ ; var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); var allocator = arena.allocator(); try std.testing.expectEqual(@as(usize, 1137), try partOne(input, allocator)); } test "Part one" { const input = \\[[[0,[4,5]],[0,0]],[[[4,5],[2,6]],[9,5]]] \\[7,[[[3,7],[4,3]],[[6,3],[8,8]]]] \\[[2,[[0,8],[3,4]]],[[[6,7],1],[7,[1,6]]]] \\[[[[2,4],7],[6,[0,5]]],[[[6,8],[2,8]],[[2,1],[4,5]]]] \\[7,[5,[[3,8],[1,4]]]] \\[[2,[2,2]],[8,[8,1]]] \\[2,9] \\[1,[[[9,3],9],[[9,0],[0,7]]]] \\[[[5,[7,4]],7],1] \\[[[[4,2],2],6],[8,7]] \\ ; var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); var allocator = arena.allocator(); try std.testing.expectEqual(@as(usize, 3488), try partOne(input, allocator)); }
src/day18.zig