code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const basic_type = @import("basic_type.zig"); const Grid = @import("Grid.zig"); const DynamicTree = @import("DynamicTree.zig"); const Rect = basic_type.Rect; const Vec2 = basic_type.Vec2; const Index = basic_type.Index; const BroadPhase = @This(); const EntityType = enum { small, big, }; pub const Proxy = union(EntityType) { /// Index is entity small: Index, /// Index is node_id in DynamicTree big: Index, }; const GridKey = packed struct { x: i16, y: i16, fn toKey(p: GridKey) i32 { return @bitCast(i32, p); } fn eql(k1: GridKey, k2: GridKey) bool { return k1.x == k2.x and k1.y == k2.y; } fn toVec2(p: GridKey) Vec2 { return Vec2.new( @intToFloat(f32, p.x), @intToFloat(f32, p.y), ); } fn new(x: i16, y: i16) GridKey { return .{ .x = x, .y = y, }; } }; pub const QueryCallback = struct { stack: std.ArrayList(Index), total: u32 = 0, pub fn init(allocator: *std.mem.Allocator) QueryCallback { return .{ .stack = std.ArrayList(Index).init(allocator), }; } pub fn deinit(q: *QueryCallback) void { q.stack.deinit(); } pub fn onOverlap(self: *@This(), payload: u32, entity: u32) void { if (payload >= entity) return; self.total += 1; } }; const GridMap = std.AutoHashMap(i32, Grid); const cell_size: f32 = 6.0; const grid_rows = 150; const grid_cols = 150; const inv_grid_w: f32 = 1.0 / (cell_size * grid_rows); const inv_grid_h: f32 = 1.0 / (cell_size * grid_cols); pub const half_element_size = Vec2.new(cell_size / 4, cell_size / 4); const num_cols = grid_cols; const num_rows = grid_rows; grid_map: GridMap, tree: DynamicTree, allocator: *std.mem.Allocator, pub fn init(allocator: *std.mem.Allocator) BroadPhase { return .{ .grid_map = GridMap.init(allocator), .tree = DynamicTree.init(allocator), .allocator = allocator, }; } pub fn deinit(bp: *BroadPhase) void { bp.tree.deinit(); var it = bp.grid_map.iterator(); while (it.next()) |kv| { kv.value_ptr.deinit(); } bp.grid_map.deinit(); } pub fn createProxy(bp: *BroadPhase, m_pos: Vec2, h_size: Vec2, entity: Index) Proxy { switch (sizeToType(h_size)) { .small => { const grid_key = posToGridKey(m_pos); bp.getOrCreateGrid(grid_key, m_pos).insert(entity, m_pos); return .{ .small = entity }; }, .big => { const aabb = Rect.newFromCenter(m_pos, h_size); return .{ .big = bp.tree.addNode(aabb, entity) }; }, } } pub fn destroyProxy(bp: *BroadPhase, proxy: Proxy, m_pos: Vec2) void { switch (proxy) { .small => |entity| { const grid_key = posToGridKey(m_pos); bp.getGrid(grid_key).remove(entity, m_pos); }, .big => |node_id| { bp.tree.removeNode(node_id); }, } } pub fn moveProxy(bp: *BroadPhase, proxy: Proxy, from_pos: Vec2, to_pos: Vec2, h_size: Vec2) void { switch (proxy) { .small => |entity| { var from_grid_key = posToGridKey(from_pos); var to_grid_key = posToGridKey(to_pos); if (from_grid_key.eql(to_grid_key)) { bp.getGrid(from_grid_key).move(entity, from_pos, to_pos); } else { bp.getGrid(from_grid_key).remove(entity, from_pos); bp.getOrCreateGrid(to_grid_key, to_pos).insert(entity, to_pos); } }, .big => |node_id| { const aabb = Rect.newFromCenter(to_pos, h_size); _ = bp.tree.moveNode(node_id, aabb); }, } } /// TODO: split query for .small and .big? pub fn query( bp: *BroadPhase, m_pos: Vec2, h_size: Vec2, proxy: Proxy, payload: anytype, callback: anytype, ) !void { const aabb = Rect.newFromCenter(m_pos, h_size); if (proxy == .big) { try bp.tree.query(&callback.stack, aabb, payload, callback); } const extended_aabb = aabb.extent(half_element_size); bp.queryGrid(extended_aabb, m_pos, h_size, payload, callback); } pub fn userQuery(bp: *BroadPhase, m_pos: Vec2, h_size: Vec2, payload: anytype, callback: anytype) !void { const aabb = Rect.newFromCenter(m_pos, h_size); try bp.tree.query(&callback.stack, aabb, payload, callback); const extended_aabb = aabb.extent(half_element_size); bp.queryGrid(extended_aabb, m_pos, h_size, payload, callback); } pub fn queryGrid( bp: *BroadPhase, extended_aabb: Rect, m_pos: Vec2, h_size: Vec2, payload: anytype, callback: anytype, ) void { const top_right = posToGridKey(extended_aabb.topRight()); const bottom_left = posToGridKey(extended_aabb.bottomLeft()); var bl_grid = bp.getGridOrNull(bottom_left); if (bl_grid) |grid| { grid.query(m_pos, h_size, payload, callback); } if (bottom_left.eql(top_right)) return; if (bp.getGridOrNull(top_right)) |grid| { grid.query(m_pos, h_size, payload, callback); } const top_left = posToGridKey(extended_aabb.topLeft()); if (top_left.eql(bottom_left) or top_left.eql(top_right)) return; const bottom_right = posToGridKey(extended_aabb.bottomRight()); if (bp.getGridOrNull(bottom_right)) |grid| { grid.query(m_pos, h_size, payload, callback); } if (bp.getGridOrNull(top_left)) |grid| { grid.query(m_pos, h_size, payload, callback); } } /// TODO: split to getGrid and createGrid function? fn getOrCreateGrid(bp: *BroadPhase, grid_key: GridKey, m_pos: Vec2) *Grid { const key = grid_key.toKey(); const node_ptr = bp.grid_map.getPtr(key); if (node_ptr) |node| { return node; } bp.grid_map.putNoClobber(key, Grid.init( bp.allocator, gridPos(m_pos), half_element_size, cell_size, num_rows, num_cols, )) catch unreachable; return bp.grid_map.getPtr(key).?; } fn getGrid(bp: *BroadPhase, grid_key: GridKey) *Grid { const key = grid_key.toKey(); return bp.grid_map.getPtr(key).?; } fn getGridOrNull(bp: *BroadPhase, grid_key: GridKey) ?*Grid { const key = grid_key.toKey(); return bp.grid_map.getPtr(key); } fn sizeToType(h_size: Vec2) EntityType { const size = if (h_size.x > h_size.y) h_size.x else h_size.y; return if (size > half_element_size.x) .big else .small; } fn gridPos(pos: Vec2) Vec2 { return Vec2.new( @floor(pos.x * inv_grid_w) * cell_size * grid_rows, @floor(pos.y * inv_grid_h) * cell_size * grid_cols, ); } fn posToGridKey(pos: Vec2) GridKey { return GridKey.new( @floatToInt(i16, @floor(pos.x * inv_grid_w)), @floatToInt(i16, @floor(pos.y * inv_grid_h)), ); } fn randomPos(random: std.rand.Random, min: f32, max: f32) Vec2 { return Vec2.new( std.math.max(random.float(f32) * max, min), std.math.max(random.float(f32) * max, min), ); } test "Behavior" { std.debug.print("\n", .{}); const allocator = std.testing.allocator; var bp = BroadPhase.init(allocator); defer bp.deinit(); var random = std.rand.Xoshiro256.init(0).random(); const Entity = std.MultiArrayList(struct { entity: u32, pos: Vec2, half_size: Vec2, proxy: Proxy = undefined, }); var manager = Entity{}; defer manager.deinit(allocator); const total_small = 10_000; const total_big = 1_000; const max_x: f32 = 10_000; const min_size: f32 = 5.0; const max_size: f32 = 50; // bp.preCreateGrid(Vec2.zero(), Vec2.new(max_x, max_x)); try manager.setCapacity(allocator, total_big + total_small); // Init entities { var entity: u32 = 0; while (entity < total_small) : (entity += 1) { try manager.append(allocator, .{ .entity = entity, .pos = randomPos(random, 0, max_x), .half_size = BroadPhase.half_element_size, }); } while (entity < total_small + total_big) : (entity += 1) { try manager.append(allocator, .{ .entity = entity, .pos = randomPos(random, 0, max_x), .half_size = randomPos(random, min_size, max_size), }); } } var slice = manager.slice(); var entities = slice.items(.entity); var position = slice.items(.pos); var proxy = slice.items(.proxy); var h_size = slice.items(.half_size); { var timer = try std.time.Timer.start(); var index: u32 = 0; while (index < total_small) : (index += 1) { const p = bp.createProxy(position[index], h_size[index], entities[index]); std.debug.assert(p == .small); proxy[index] = p; } var time_0 = timer.read(); std.debug.print("add {} entity to grid take {}ms\n", .{ total_small, time_0 / std.time.ns_per_ms }); timer = try std.time.Timer.start(); while (index < slice.len) : (index += 1) { const p = bp.createProxy(position[index], h_size[index], entities[index]); std.debug.assert(p == .big); proxy[index] = p; } time_0 = timer.read(); std.debug.print("add {} entity to tree take {}ms\n", .{ total_big, time_0 / std.time.ns_per_ms }); } { var timer = try std.time.Timer.start(); var index: u32 = 0; while (index < total_small) : (index += 1) { bp.destroyProxy(proxy[index], position[index]); } var time_0 = timer.read(); std.debug.print("destroyed {} entity to grid take {}ms\n", .{ total_small, time_0 / std.time.ns_per_ms }); timer = try std.time.Timer.start(); while (index < slice.len) : (index += 1) { bp.destroyProxy(proxy[index], position[index]); } time_0 = timer.read(); std.debug.print("destroyed {} entity to tree take {}ms\n", .{ total_big, time_0 / std.time.ns_per_ms }); } { var timer = try std.time.Timer.start(); var index: u32 = 0; while (index < total_small) : (index += 1) { const p = bp.createProxy(position[index], h_size[index], entities[index]); std.debug.assert(p == .small); proxy[index] = p; } var time_0 = timer.read(); std.debug.print("add {} entity to grid take {}ms\n", .{ total_small, time_0 / std.time.ns_per_ms }); timer = try std.time.Timer.start(); while (index < slice.len) : (index += 1) { const p = bp.createProxy(position[index], h_size[index], entities[index]); std.debug.assert(p == .big); proxy[index] = p; } time_0 = timer.read(); std.debug.print("add {} entity to tree take {}ms\n", .{ total_big, time_0 / std.time.ns_per_ms }); } const total_loop = 10; var current_loop: u32 = 0; var move_time: u64 = 0; var query_time: u64 = 0; var callback = QueryCallback.init(allocator); defer callback.deinit(); while (current_loop < total_loop) : (current_loop += 1) { { var timer = try std.time.Timer.start(); var index: u32 = 0; while (index < total_big + total_small) : (index += 1) { const pos = randomPos(random, 0, max_x); bp.moveProxy(proxy[index], position[index], pos, h_size[index]); position[index] = pos; } const time_0 = timer.read(); move_time += time_0 / std.time.ns_per_ms; } { var index: u32 = 0; var timer = try std.time.Timer.start(); while (index < slice.len) : (index += 1) { try bp.query(position[index], h_size[index], proxy[index], entities[index], &callback); } const time_0 = timer.read(); query_time += time_0 / std.time.ns_per_ms; } } std.debug.print("move take {}ms\n", .{move_time / total_loop}); std.debug.print("query take {}ms\n", .{query_time / total_loop}); std.debug.print("grids: {}\n", .{bp.grid_map.count()}); }
src/physic/BroadPhase.zig
const std = @import("std"); const testing = std.testing; const allocator = std.heap.page_allocator; pub const Map = struct { const SIZE = 100; const Pos = struct { x: usize, y: usize, pub fn init(x: usize, y: usize) Pos { var self = Pos{ .x = x, .y = y, }; return self; } }; pub const Tile = struct { id: usize, data: [SIZE][SIZE]u8, size: Pos, borders: [4]usize, pub fn init() Tile { var self = Tile{ .id = 0, .data = undefined, .size = Pos.init(0, 0), .borders = undefined, }; return self; } pub fn deinit(self: *Tile) void { _ = self; } pub fn set(self: *Tile, data: []const u8) void { var it = std.mem.split(u8, data, "\n"); while (it.next()) |line| { for (line) |c, j| { const t = if (c == '.') '.' else c; self.data[j][self.size.y] = t; if (self.size.y == 0) self.size.x += 1; } self.size.y += 1; } self.compute_borders(); } pub fn show(self: Tile) void { if (self.id <= 0) { std.debug.warn("Image {} x {}\n", .{ self.size.x, self.size.y }); } else { std.debug.warn("Tile id {}, {} x {}, borders", .{ self.id, self.size.x, self.size.y }); var b: usize = 0; while (b < 4) : (b += 1) { std.debug.warn(" {}", .{self.borders[b]}); } std.debug.warn("\n", .{}); } var y: usize = 0; while (y < self.size.y) : (y += 1) { var x: usize = 0; while (x < self.size.x) : (x += 1) { std.debug.warn("{c}", .{self.data[x][y]}); } std.debug.warn("\n", .{}); } } fn mask_row(self: *Tile, row: usize) usize { var mask: usize = 0; var p: usize = 0; while (p < self.size.x) : (p += 1) { const what = self.data[p][row]; const bit = if (what == '#' or what == 'X') @as(u1, 1) else @as(u1, 0); mask <<= @as(u1, 1); mask |= bit; } return mask; } fn mask_col(self: *Tile, col: usize) usize { var mask: usize = 0; var p: usize = 0; while (p < self.size.y) : (p += 1) { const what = self.data[col][p]; const bit = if (what == '#' or what == 'X') @as(u1, 1) else @as(u1, 0); mask <<= @as(u1, 1); mask |= bit; } return mask; } fn compute_borders(self: *Tile) void { if (self.id <= 0) return; self.borders[0] = self.mask_row(0); self.borders[1] = self.mask_col(9); self.borders[2] = self.mask_row(9); self.borders[3] = self.mask_col(0); } pub fn rotate_right(self: *Tile) void { var data = self.data; var y: usize = 0; while (y < self.size.y) : (y += 1) { var x: usize = 0; while (x < self.size.x) : (x += 1) { self.data[self.size.y - 1 - y][x] = data[x][y]; } } const t = self.size.y; self.size.y = self.size.x; self.size.x = t; self.compute_borders(); } pub fn reflect_horizontal(self: *Tile) void { var data = self.data; var y: usize = 0; while (y < self.size.y) : (y += 1) { var x: usize = 0; while (x < self.size.x) : (x += 1) { self.data[x][y] = data[x][self.size.y - 1 - y]; } } self.compute_borders(); } pub fn reflect_vertical(self: *Tile) void { var data = self.data; var y: usize = 0; while (y < self.size.y) : (y += 1) { var x: usize = 0; while (x < self.size.x) : (x += 1) { self.data[x][y] = data[self.size.x - 1 - x][y]; } } self.compute_borders(); } }; const Grid = struct { tiles: std.AutoHashMap(Pos, usize), // pos => tile id min: Pos, max: Pos, data: [SIZE][SIZE]u8, size: Pos, pub fn init() Grid { var self = Grid{ .tiles = std.AutoHashMap(Pos, usize).init(allocator), .min = Pos.init(std.math.maxInt(usize), std.math.maxInt(usize)), .max = Pos.init(0, 0), .data = undefined, .size = Pos.init(0, 0), }; return self; } pub fn deinit(self: *Grid) void { self.tiles.deinit(); } pub fn put(self: *Grid, pos: Pos, id: usize) void { _ = self.tiles.put(pos, id) catch unreachable; if (self.min.x > pos.x) self.min.x = pos.x; if (self.min.y > pos.y) self.min.y = pos.y; if (self.max.x < pos.x) self.max.x = pos.x; if (self.max.y < pos.y) self.max.y = pos.y; } pub fn show(self: Grid) void { std.debug.warn("Grid {} x {}\n", .{ self.size.x, self.size.y }); var y: usize = 0; while (y < self.size.y) : (y += 1) { var x: usize = 0; while (x < self.size.x) : (x += 1) { std.debug.warn("{c}", .{self.data[x][y]}); } std.debug.warn("\n", .{}); } } }; tiles: std.AutoHashMap(usize, Tile), tile_size: Pos, size: usize, grid: Grid, current_tile: Tile, pub fn init() Map { var self = Map{ .tiles = std.AutoHashMap(usize, Tile).init(allocator), .tile_size = Pos.init(0, 0), .size = 0, .grid = Grid.init(), .current_tile = Tile.init(), }; return self; } pub fn deinit(self: *Map) void { self.grid.deinit(); self.tiles.deinit(); } pub fn add_line(self: *Map, line: []const u8) void { if (line.len == 0) { self.current_tile = Tile.init(); return; } if (line[0] == 'T') { var it = std.mem.tokenize(u8, line, " :"); _ = it.next().?; self.current_tile.id = std.fmt.parseInt(usize, it.next().?, 10) catch unreachable; return; } for (line) |c, j| { self.current_tile.data[j][self.current_tile.size.y] = c; if (self.current_tile.size.y == 0) self.current_tile.size.x += 1; } self.current_tile.size.y += 1; if (self.current_tile.size.y == self.current_tile.size.x) { self.current_tile.compute_borders(); _ = self.tiles.put(self.current_tile.id, self.current_tile) catch unreachable; if (self.tile_size.x <= 0 or self.tile_size.y <= 0) { self.tile_size.x = self.current_tile.size.x; self.tile_size.y = self.current_tile.size.y; } else if (self.tile_size.x != self.current_tile.size.x or self.tile_size.y != self.current_tile.size.y) { @panic("JAGGED"); } } } pub fn show(self: *Map) void { std.debug.warn("Map with {} tiles\n", .{self.tiles.count()}); var it = self.tiles.iterator(); while (it.next()) |kv| { kv.value_ptr.*.show(); } } pub fn find_layout(self: *Map) void { self.grid.tiles.clearRetainingCapacity(); var pending = std.AutoHashMap(Pos, void).init(allocator); defer pending.deinit(); var used = std.AutoHashMap(usize, void).init(allocator); defer used.deinit(); _ = pending.put(Pos.init(1000, 1000), {}) catch unreachable; while (true) { if (self.grid.tiles.count() == self.tiles.count()) break; // all tiles placed // std.debug.warn("CHECKING GRID, tiles {}, placed {}, pending empties {}\n", .{ self.tiles.count(), self.grid.tiles.count(), pending.count() }); var empty = true; var pos: Pos = undefined; var itp = pending.iterator(); while (itp.next()) |kvp| { pos = kvp.key_ptr.*; empty = false; _ = pending.remove(pos); break; } if (empty) break; // no pending empty positions var itt = self.tiles.iterator(); while (itt.next()) |kvt| { var tile = &kvt.value_ptr.*; if (used.contains(tile.id)) continue; // tile already placed const posU = Pos.init(pos.x - 0, pos.y - 1); const entryU = self.grid.tiles.getEntry(posU); const posD = Pos.init(pos.x - 0, pos.y + 1); const entryD = self.grid.tiles.getEntry(posD); const posL = Pos.init(pos.x - 1, pos.y - 0); const entryL = self.grid.tiles.getEntry(posL); const posR = Pos.init(pos.x + 1, pos.y - 0); const entryR = self.grid.tiles.getEntry(posR); // check if tile fits in pos var fits = true; if (entryU) |e| fits = fits and self.fits_neighbor(tile, e.value_ptr.*, 0); if (entryD) |e| fits = fits and self.fits_neighbor(tile, e.value_ptr.*, 2); if (entryL) |e| fits = fits and self.fits_neighbor(tile, e.value_ptr.*, 3); if (entryR) |e| fits = fits and self.fits_neighbor(tile, e.value_ptr.*, 1); if (!fits) continue; // tile did not fit in // std.debug.warn("MATCH {} for pos {}\n", .{ tile.id, pos }); // tile.show(); self.grid.put(pos, tile.id); // put tile in grid _ = used.put(tile.id, {}) catch unreachable; // remember tile as used // add four neighbors to pending, if they are empty if (entryU) |_| {} else { _ = pending.put(posU, {}) catch unreachable; } if (entryD) |_| {} else { _ = pending.put(posD, {}) catch unreachable; } if (entryL) |_| {} else { _ = pending.put(posL, {}) catch unreachable; } if (entryR) |_| {} else { _ = pending.put(posR, {}) catch unreachable; } break; } } // std.debug.warn("Found correct layout: {} {} - {} {}\n", .{ self.grid.min.x, self.grid.min.y, self.grid.max.x, self.grid.max.y }); var gy: usize = self.grid.min.y; while (gy <= self.grid.max.y) : (gy += 1) { var gx: usize = self.grid.min.x; while (gx <= self.grid.max.x) : (gx += 1) { const pos = Pos.init(gx, gy); const id = self.grid.tiles.get(pos).?; const tile = self.tiles.get(id).?; // std.debug.warn(" {}", .{id}); var py = (gy - self.grid.min.y) * (self.tile_size.y - 2); var ty: usize = 0; while (ty < self.tile_size.y) : (ty += 1) { var px = (gx - self.grid.min.x) * (self.tile_size.x - 2); if (ty == 0 or ty == self.tile_size.y - 1) continue; var tx: usize = 0; while (tx < self.tile_size.x) : (tx += 1) { if (tx == 0 or tx == self.tile_size.x - 1) continue; // std.debug.warn("DATA {} {} = TILE {} {}\n", .{ px, py, tx, ty }); self.grid.data[px][py] = tile.data[tx][ty]; px += 1; } py += 1; } } // std.debug.warn("\n", .{}); } self.grid.size = Pos.init( (self.tile_size.x - 2) * (self.grid.max.x - self.grid.min.x + 1), (self.tile_size.y - 2) * (self.grid.max.y - self.grid.min.y + 1), ); // self.grid.show(); } // TODO: should not always rotate tile; only the first time? fn fits_neighbor(self: *Map, tile: *Tile, fixed_id: usize, dir: usize) bool { const fixed_tile = self.tiles.get(fixed_id).?; const fixed_dir = (dir + 2) % 4; const fixed_border = fixed_tile.borders[fixed_dir]; // std.debug.warn("FITS CHECK tile {} dir {} and fixed {} dir {} = {}\n", .{ tile.id, dir, fixed_id, fixed_dir, fixed_border }); var op: usize = 0; while (op < 13) : (op += 1) { switch (op) { 0 => {}, 1 => { tile.reflect_horizontal(); }, 2 => { tile.reflect_horizontal(); tile.reflect_vertical(); }, 3 => { tile.reflect_vertical(); tile.rotate_right(); }, 4 => { tile.reflect_horizontal(); }, 5 => { tile.reflect_horizontal(); tile.reflect_vertical(); }, 6 => { tile.reflect_vertical(); tile.rotate_right(); }, 7 => { tile.reflect_horizontal(); }, 8 => { tile.reflect_horizontal(); tile.reflect_vertical(); }, 9 => { tile.reflect_vertical(); tile.rotate_right(); }, 10 => { tile.reflect_horizontal(); }, 11 => { tile.reflect_horizontal(); tile.reflect_vertical(); }, 12 => { tile.reflect_vertical(); tile.rotate_right(); }, else => @panic("OP"), } // tile.show(); const tile_border = tile.borders[dir]; const fits = tile_border == fixed_border; // std.debug.warn(" border {}, fixed {}: {}\n", .{ tile_border, fixed_border, fits }); if (fits) return true; } return false; } pub fn product_four_corners(self: *Map) usize { var product: usize = 1; product *= self.grid.tiles.get(Pos.init(self.grid.min.x, self.grid.min.y)).?; product *= self.grid.tiles.get(Pos.init(self.grid.min.x, self.grid.max.y)).?; product *= self.grid.tiles.get(Pos.init(self.grid.max.x, self.grid.min.y)).?; product *= self.grid.tiles.get(Pos.init(self.grid.max.x, self.grid.max.y)).?; return product; } pub fn find_image_in_grid(self: *Map, image: *Tile) usize { var total_found: usize = 0; var total_roughness: usize = 0; var counts: [SIZE][SIZE]usize = undefined; { var y: usize = 0; while (y < self.grid.size.y) : (y += 1) { var x: usize = 0; while (x < self.grid.size.y) : (x += 1) { counts[x][y] = 0; if (self.grid.data[x][y] == '.') continue; counts[x][y] = 1; total_roughness += 1; } } } // std.debug.warn("Searching image {} x {} in grid {} x {} (initial roughness {})\n", .{ image.size.x, image.size.y, self.grid.size.x, self.grid.size.y, total_roughness }); var op: usize = 0; while (op < 13) : (op += 1) { switch (op) { 0 => {}, 1 => { image.reflect_horizontal(); }, 2 => { image.reflect_horizontal(); image.reflect_vertical(); }, 3 => { image.reflect_vertical(); image.rotate_right(); }, 4 => { image.reflect_horizontal(); }, 5 => { image.reflect_horizontal(); image.reflect_vertical(); }, 6 => { image.reflect_vertical(); image.rotate_right(); }, 7 => { image.reflect_horizontal(); }, 8 => { image.reflect_horizontal(); image.reflect_vertical(); }, 9 => { image.reflect_vertical(); image.rotate_right(); }, 10 => { image.reflect_horizontal(); }, 11 => { image.reflect_horizontal(); image.reflect_vertical(); }, 12 => { image.reflect_vertical(); image.rotate_right(); }, else => @panic("OP"), } // std.debug.warn("CURRENT IMAGE {} x {}\n", .{ image.size.x, image.size.y }); var y: usize = 0; while (y < self.grid.size.y) : (y += 1) { if (y + image.size.y >= self.grid.size.y) break; var x: usize = 0; while (x < self.grid.size.x) : (x += 1) { if (x + image.size.x >= self.grid.size.y) break; // std.debug.warn("CORNER {} {}\n", .{ x, y }); var found = true; var iy: usize = 0; IMAGE: while (iy < image.size.y) : (iy += 1) { var ix: usize = 0; while (ix < image.size.x) : (ix += 1) { if (image.data[ix][iy] == '.') continue; if (self.grid.data[x + ix][y + iy] == '.') { found = false; break :IMAGE; } } } if (!found) continue; total_found += 1; iy = 0; while (iy < image.size.y) : (iy += 1) { var ix: usize = 0; while (ix < image.size.x) : (ix += 1) { if (image.data[ix][iy] == '.') continue; counts[x + ix][y + iy] = 0; self.grid.data[x + ix][y + iy] = 'O'; } } } } } total_roughness = 0; { var y: usize = 0; while (y < self.grid.size.y) : (y += 1) { var x: usize = 0; while (x < self.grid.size.x) : (x += 1) { total_roughness += counts[x][y]; } } } // std.debug.warn("Searched image and found {} copies, total roughness {}\n", .{ total_found, total_roughness }); // self.grid.show(); return total_roughness; } }; test "sample part a" { const data: []const u8 = \\Tile 2311: \\..##.#..#. \\##..#..... \\#...##..#. \\####.#...# \\##.##.###. \\##...#.### \\.#.#.#..## \\..#....#.. \\###...#.#. \\..###..### \\ \\Tile 1951: \\#.##...##. \\#.####...# \\.....#..## \\#...###### \\.##.#....# \\.###.##### \\###.##.##. \\.###....#. \\..#.#..#.# \\#...##.#.. \\ \\Tile 1171: \\####...##. \\#..##.#..# \\##.#..#.#. \\.###.####. \\..###.#### \\.##....##. \\.#...####. \\#.##.####. \\####..#... \\.....##... \\ \\Tile 1427: \\###.##.#.. \\.#..#.##.. \\.#.##.#..# \\#.#.#.##.# \\....#...## \\...##..##. \\...#.##### \\.#.####.#. \\..#..###.# \\..##.#..#. \\ \\Tile 1489: \\##.#.#.... \\..##...#.. \\.##..##... \\..#...#... \\#####...#. \\#..#.#.#.# \\...#.#.#.. \\##.#...##. \\..##.##.## \\###.##.#.. \\ \\Tile 2473: \\#....####. \\#..#.##... \\#.##..#... \\######.#.# \\.#...#.#.# \\.######### \\.###.#..#. \\########.# \\##...##.#. \\..###.#.#. \\ \\Tile 2971: \\..#.#....# \\#...###... \\#.#.###... \\##.##..#.. \\.#####..## \\.#..####.# \\#..#.#..#. \\..####.### \\..#.#.###. \\...#.#.#.# \\ \\Tile 2729: \\...#.#.#.# \\####.#.... \\..#.#..... \\....#..#.# \\.##..##.#. \\.#.####... \\####.#.#.. \\##.####... \\##..#.##.. \\#.##...##. \\ \\Tile 3079: \\#.#.#####. \\.#..###### \\..#....... \\######.... \\####.#..#. \\.#...#.##. \\#.#####.## \\..#.###... \\..#....... \\..#.###... ; var map = Map.init(); defer map.deinit(); var it = std.mem.split(u8, data, "\n"); while (it.next()) |line| { map.add_line(line); } // map.show(); map.find_layout(); const product = map.product_four_corners(); try testing.expect(product == 20899048083289); } test "sample part b" { const data: []const u8 = \\Tile 2311: \\..##.#..#. \\##..#..... \\#...##..#. \\####.#...# \\##.##.###. \\##...#.### \\.#.#.#..## \\..#....#.. \\###...#.#. \\..###..### \\ \\Tile 1951: \\#.##...##. \\#.####...# \\.....#..## \\#...###### \\.##.#....# \\.###.##### \\###.##.##. \\.###....#. \\..#.#..#.# \\#...##.#.. \\ \\Tile 1171: \\####...##. \\#..##.#..# \\##.#..#.#. \\.###.####. \\..###.#### \\.##....##. \\.#...####. \\#.##.####. \\####..#... \\.....##... \\ \\Tile 1427: \\###.##.#.. \\.#..#.##.. \\.#.##.#..# \\#.#.#.##.# \\....#...## \\...##..##. \\...#.##### \\.#.####.#. \\..#..###.# \\..##.#..#. \\ \\Tile 1489: \\##.#.#.... \\..##...#.. \\.##..##... \\..#...#... \\#####...#. \\#..#.#.#.# \\...#.#.#.. \\##.#...##. \\..##.##.## \\###.##.#.. \\ \\Tile 2473: \\#....####. \\#..#.##... \\#.##..#... \\######.#.# \\.#...#.#.# \\.######### \\.###.#..#. \\########.# \\##...##.#. \\..###.#.#. \\ \\Tile 2971: \\..#.#....# \\#...###... \\#.#.###... \\##.##..#.. \\.#####..## \\.#..####.# \\#..#.#..#. \\..####.### \\..#.#.###. \\...#.#.#.# \\ \\Tile 2729: \\...#.#.#.# \\####.#.... \\..#.#..... \\....#..#.# \\.##..##.#. \\.#.####... \\####.#.#.. \\##.####... \\##..#.##.. \\#.##...##. \\ \\Tile 3079: \\#.#.#####. \\.#..###### \\..#....... \\######.... \\####.#..#. \\.#...#.##. \\#.#####.## \\..#.###... \\..#....... \\..#.###... ; const dragon: []const u8 = \\..................#. \\#....##....##....### \\.#..#..#..#..#..#... ; var image = Map.Tile.init(); defer image.deinit(); image.set(dragon); // image.show(); var map = Map.init(); defer map.deinit(); var it = std.mem.split(u8, data, "\n"); while (it.next()) |line| { map.add_line(line); } // map.show(); map.find_layout(); const roughness = map.find_image_in_grid(&image); try testing.expect(roughness == 273); }
2020/p20/map.zig
const std = @import("std"); const zfetch = @import("zfetch"); const json = @import("json"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const alloc = &gpa.allocator; const f = try std.fs.cwd().createFile("src/lib.zig", .{}); const w = f.writer(); std.log.info("spdx", .{}); const val = try simple_fetch(alloc, "https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json"); try w.writeAll("// SPDX License Text data generated from https://github.com/spdx/license-list-data\n"); try w.writeAll("//\n"); try w.print("// Last generated from version {s}\n", .{val.get("licenseListVersion").?.String}); try w.writeAll("//\n"); try w.writeAll("\n"); try w.writeAll( \\const std = @import("std"); \\ \\pub fn find(name: []const u8) ?[]const u8 { \\ for (spdx) |item| { \\ if (std.mem.eql(u8, item[0], name)) { \\ return item[1]; \\ } \\ } \\ return null; \\} \\ ); var licenses = val.get("licenses").?.Array; std.sort.sort(json.Value, licenses, {}, spdxlicenseLessThan); try w.writeAll("\n"); try w.writeAll("pub const spdx = [_][2][]const u8{\n"); for (licenses) |lic| { std.debug.print("|", .{}); const licID = lic.get("licenseId").?.String; var arena = std.heap.ArenaAllocator.init(alloc); defer arena.deinit(); const aalloc = &arena.allocator; const innerurl = try std.fmt.allocPrint(aalloc, "https://spdx.org/licenses/{s}.json", .{licID}); const innerval = try simple_fetch(aalloc, innerurl); var fulltext = (innerval.get("licenseText") orelse json.Value{ .String = "" }).String; fulltext = try std.mem.replaceOwned(u8, aalloc, fulltext, "\\u0026", "&"); fulltext = try std.mem.replaceOwned(u8, aalloc, fulltext, "\\u0027", "'"); fulltext = try std.mem.replaceOwned(u8, aalloc, fulltext, "\\u003c", "<"); fulltext = try std.mem.replaceOwned(u8, aalloc, fulltext, "\\u003d", "="); fulltext = try std.mem.replaceOwned(u8, aalloc, fulltext, "\\u003e", ">"); fulltext = try std.mem.replaceOwned(u8, aalloc, fulltext, "\\u2028", "\\n"); try w.print(" .{{ \"{s}\", \"{s}\" }},\n", .{ licID, fulltext }); } try w.writeAll("};\n"); std.debug.print("\n", .{}); } pub fn simple_fetch(alloc: *std.mem.Allocator, url: []const u8) !json.Value { const req = try zfetch.Request.init(alloc, url, null); defer req.deinit(); try req.do(.GET, null, null); if (req.status.code != 200) return json.Value{ .Object = &.{}, }; const r = req.reader(); const body_content = try r.readAllAlloc(alloc, std.math.maxInt(usize)); const val = try json.parse(alloc, body_content); return val; } fn spdxlicenseLessThan(context: void, lhs: json.Value, rhs: json.Value) bool { _ = context; const l = lhs.get("licenseId").?.String; const r = rhs.get("licenseId").?.String; return std.mem.lessThan(u8, l, r); }
generate.zig
const std = @import("std"); const bench = @import("bench"); const debug = std.debug; const mem = std.mem; pub fn StringSwitchOriginal(comptime strings: []const []const u8) type { for (strings[1..]) |_, i| { if (mem.lessThan(u8, strings[i], strings[i + 1])) continue; @compileError("Input not sorted (assert(\"" ++ strings[i] ++ "\" < \"" ++ strings[i + 1] ++ "\"))"); } return struct { pub fn match(str: []const u8) usize { var curr: usize = 0; next: for (strings) |s, i| { while (curr < s.len) : (curr += 1) { const a = str[curr]; const b = s[curr]; if (a != b) continue :next; } if (s.len == str.len) return i; } return strings.len; } pub fn case(comptime str: []const u8) usize { const i = match(str); debug.assert(i < strings.len); return i; } }; } pub fn StringSwitchMemEql(comptime strings: []const []const u8) type { return struct { pub fn match(str: []const u8) usize { inline for (strings) |s, i| { if (mem.eql(u8, str, s)) { return i; } } return strings.len; } pub fn case(comptime str: []const u8) usize { const i = match(str); debug.assert(i < strings.len); return i; } }; } pub fn StringSwitchComptimeMap(comptime strings: []const []const u8) type { const Map = std.ComptimeStringMap(usize, blk: { var entries: [strings.len]std.meta.Tuple(&.{ []const u8, usize }) = undefined; inline for (strings) |s, i| { entries[i] = .{ s, i }; } break :blk entries; }); return struct { pub fn match(str: []const u8) usize { return Map.get(str) orelse strings.len; } pub fn case(comptime str: []const u8) usize { const i = match(str); debug.assert(i < strings.len); return i; } }; } test "match.StringSwitchOriginal.benchmark" { try bench.benchmark(struct { pub const args = [_][]const u8{ "A" ** 1, "A" ** 2, "A" ** 4, "A" ** 8, "A" ** 16, "A" ** 32, "A" ** 64, "A" ** 128, "A" ** 256, "A" ** 512, "A" ** 1024, "abcd" ** 8, "abcd" ** 16, "abcd" ** 32, "abcd" ** 64, "abcd" ** 128, "abcd" ** 256, "abcd" ** 512, "abcd" ** 1024, }; // copy of strings so that mem.eql has to compare strings byte by byte, // rather than just comparing pointers. pub const strings = [_][]const u8{ "A" ** 1, "A" ** 2, "A" ** 4, "A" ** 8, "A" ** 16, "A" ** 32, "A" ** 64, "A" ** 128, "A" ** 256, "A" ** 512, "A" ** 1024, "abcd" ** 8, "abcd" ** 16, "abcd" ** 32, "abcd" ** 64, "abcd" ** 128, "abcd" ** 256, "abcd" ** 512, "abcd" ** 1024, }; pub fn switch_StringSwitchOriginal(str: []const u8) usize { @setEvalBranchQuota(100000); const sw = StringSwitchOriginal(&strings); return switch (sw.match(str)) { sw.case("A" ** 1) => 21, sw.case("A" ** 2) => 15, sw.case("A" ** 4) => 31, sw.case("A" ** 8) => 111, sw.case("A" ** 16) => 400, sw.case("A" ** 32) => 2, sw.case("A" ** 64) => 100000, sw.case("A" ** 128) => 12345, sw.case("A" ** 256) => 1, sw.case("A" ** 512) => 35, sw.case("A" ** 1024) => 99999999, sw.case("abcd" ** 8) => 4, sw.case("abcd" ** 16) => 1512, sw.case("abcd" ** 32) => 152222, sw.case("abcd" ** 64) => 42566, sw.case("abcd" ** 128) => 66477, sw.case("abcd" ** 256) => 345377, sw.case("abcd" ** 512) => 745745, sw.case("abcd" ** 1024) => 3444, else => 2241255, }; } pub fn switch_StringSwitchMemEql(str: []const u8) usize { @setEvalBranchQuota(100000); const sw = StringSwitchMemEql(&strings); return switch (sw.match(str)) { sw.case("A" ** 1) => 21, sw.case("A" ** 2) => 15, sw.case("A" ** 4) => 31, sw.case("A" ** 8) => 111, sw.case("A" ** 16) => 400, sw.case("A" ** 32) => 2, sw.case("A" ** 64) => 100000, sw.case("A" ** 128) => 12345, sw.case("A" ** 256) => 1, sw.case("A" ** 512) => 35, sw.case("A" ** 1024) => 99999999, sw.case("abcd" ** 8) => 4, sw.case("abcd" ** 16) => 1512, sw.case("abcd" ** 32) => 152222, sw.case("abcd" ** 64) => 42566, sw.case("abcd" ** 128) => 66477, sw.case("abcd" ** 256) => 345377, sw.case("abcd" ** 512) => 745745, sw.case("abcd" ** 1024) => 3444, else => 2241255, }; } pub fn switch_mem_eql(str: []const u8) usize { if (mem.eql(u8, "A" ** 1, str)) { return 21; } else if (mem.eql(u8, "A" ** 2, str)) { return 15; } else if (mem.eql(u8, "A" ** 4, str)) { return 31; } else if (mem.eql(u8, "A" ** 8, str)) { return 111; } else if (mem.eql(u8, "A" ** 16, str)) { return 400; } else if (mem.eql(u8, "A" ** 32, str)) { return 2; } else if (mem.eql(u8, "A" ** 64, str)) { return 100000; } else if (mem.eql(u8, "A" ** 128, str)) { return 12345; } else if (mem.eql(u8, "A" ** 256, str)) { return 1; } else if (mem.eql(u8, "A" ** 512, str)) { return 35; } else if (mem.eql(u8, "A" ** 1024, str)) { return 99999999; } else if (mem.eql(u8, "abcd" ** 8, str)) { return 4; } else if (mem.eql(u8, "abcd" ** 16, str)) { return 1512; } else if (mem.eql(u8, "abcd" ** 32, str)) { return 152222; } else if (mem.eql(u8, "abcd" ** 64, str)) { return 42566; } else if (mem.eql(u8, "abcd" ** 128, str)) { return 66477; } else if (mem.eql(u8, "abcd" ** 256, str)) { return 345377; } else if (mem.eql(u8, "abcd" ** 512, str)) { return 745745; } else if (mem.eql(u8, "abcd" ** 1024, str)) { return 3444; } else { return 2241255; } } pub fn switch_StringSwitchComptimeMap(str: []const u8) usize { @setEvalBranchQuota(100000); const sw = StringSwitchComptimeMap(&strings); return switch (sw.match(str)) { sw.case("A" ** 1) => 21, sw.case("A" ** 2) => 15, sw.case("A" ** 4) => 31, sw.case("A" ** 8) => 111, sw.case("A" ** 16) => 400, sw.case("A" ** 32) => 2, sw.case("A" ** 64) => 100000, sw.case("A" ** 128) => 12345, sw.case("A" ** 256) => 1, sw.case("A" ** 512) => 35, sw.case("A" ** 1024) => 99999999, sw.case("abcd" ** 8) => 4, sw.case("abcd" ** 16) => 1512, sw.case("abcd" ** 32) => 152222, sw.case("abcd" ** 64) => 42566, sw.case("abcd" ** 128) => 66477, sw.case("abcd" ** 256) => 345377, sw.case("abcd" ** 512) => 745745, sw.case("abcd" ** 1024) => 3444, else => 2241255, }; } }); }
string-switch.zig
const std = @import("std"); const math = std.math; const common = @import("common.zig"); const FloatInfo = @import("FloatInfo.zig"); const BiasedFp = common.BiasedFp; const Number = common.Number; /// Compute a float using an extended-precision representation. /// /// Fast conversion of a the significant digits and decimal exponent /// a float to an extended representation with a binary float. This /// algorithm will accurately parse the vast majority of cases, /// and uses a 128-bit representation (with a fallback 192-bit /// representation). /// /// This algorithm scales the exponent by the decimal exponent /// using pre-computed powers-of-5, and calculates if the /// representation can be unambiguously rounded to the nearest /// machine float. Near-halfway cases are not handled here, /// and are represented by a negative, biased binary exponent. /// /// The algorithm is described in detail in "<NAME>, Number Parsing /// at a Gigabyte per Second" in section 5, "Fast Algorithm", and /// section 6, "Exact Numbers And Ties", available online: /// <https://arxiv.org/abs/2101.11408.pdf>. pub fn convertEiselLemire(comptime T: type, q: i64, w_: u64) ?BiasedFp(f64) { std.debug.assert(T == f16 or T == f32 or T == f64); var w = w_; const float_info = FloatInfo.from(T); // Short-circuit if the value can only be a literal 0 or infinity. if (w == 0 or q < float_info.smallest_power_of_ten) { return BiasedFp(f64).zero(); } else if (q > float_info.largest_power_of_ten) { return BiasedFp(f64).inf(T); } // Normalize our significant digits, so the most-significant bit is set. const lz = @clz(u64, @bitCast(u64, w)); w = math.shl(u64, w, lz); const r = computeProductApprox(q, w, float_info.mantissa_explicit_bits + 3); if (r.lo == 0xffff_ffff_ffff_ffff) { // If we have failed to approximate w x 5^-q with our 128-bit value. // Since the addition of 1 could lead to an overflow which could then // round up over the half-way point, this can lead to improper rounding // of a float. // // However, this can only occur if q ∈ [-27, 55]. The upper bound of q // is 55 because 5^55 < 2^128, however, this can only happen if 5^q > 2^64, // since otherwise the product can be represented in 64-bits, producing // an exact result. For negative exponents, rounding-to-even can // only occur if 5^-q < 2^64. // // For detailed explanations of rounding for negative exponents, see // <https://arxiv.org/pdf/2101.11408.pdf#section.9.1>. For detailed // explanations of rounding for positive exponents, see // <https://arxiv.org/pdf/2101.11408.pdf#section.8>. const inside_safe_exponent = q >= -27 and q <= 55; if (!inside_safe_exponent) { return null; } } const upper_bit = @intCast(i32, r.hi >> 63); var mantissa = math.shr(u64, r.hi, upper_bit + 64 - @intCast(i32, float_info.mantissa_explicit_bits) - 3); var power2 = power(@intCast(i32, q)) + upper_bit - @intCast(i32, lz) - float_info.minimum_exponent; if (power2 <= 0) { if (-power2 + 1 >= 64) { // Have more than 64 bits below the minimum exponent, must be 0. return BiasedFp(f64).zero(); } // Have a subnormal value. mantissa = math.shr(u64, mantissa, -power2 + 1); mantissa += mantissa & 1; mantissa >>= 1; power2 = @boolToInt(mantissa >= (1 << float_info.mantissa_explicit_bits)); return BiasedFp(f64){ .f = mantissa, .e = power2 }; } // Need to handle rounding ties. Normally, we need to round up, // but if we fall right in between and and we have an even basis, we // need to round down. // // This will only occur if: // 1. The lower 64 bits of the 128-bit representation is 0. // IE, 5^q fits in single 64-bit word. // 2. The least-significant bit prior to truncated mantissa is odd. // 3. All the bits truncated when shifting to mantissa bits + 1 are 0. // // Or, we may fall between two floats: we are exactly halfway. if (r.lo <= 1 and q >= float_info.min_exponent_round_to_even and q <= float_info.max_exponent_round_to_even and mantissa & 3 == 1 and math.shl(u64, mantissa, (upper_bit + 64 - @intCast(i32, float_info.mantissa_explicit_bits) - 3)) == r.hi) { // Zero the lowest bit, so we don't round up. mantissa &= ~@as(u64, 1); } // Round-to-even, then shift the significant digits into place. mantissa += mantissa & 1; mantissa >>= 1; if (mantissa >= 2 << float_info.mantissa_explicit_bits) { // Rounding up overflowed, so the carry bit is set. Set the // mantissa to 1 (only the implicit, hidden bit is set) and // increase the exponent. mantissa = 1 << float_info.mantissa_explicit_bits; power2 += 1; } // Zero out the hidden bit mantissa &= ~(@as(u64, 1) << float_info.mantissa_explicit_bits); if (power2 >= float_info.infinite_power) { // Exponent is above largest normal value, must be infinite return BiasedFp(f64).inf(T); } return BiasedFp(f64){ .f = mantissa, .e = power2 }; } /// Calculate a base 2 exponent from a decimal exponent. /// This uses a pre-computed integer approximation for /// log2(10), where 217706 / 2^16 is accurate for the /// entire range of non-finite decimal exponents. fn power(q: i32) i32 { return ((q *% (152170 + 65536)) >> 16) + 63; } const U128 = struct { lo: u64, hi: u64, pub fn new(lo: u64, hi: u64) U128 { return .{ .lo = lo, .hi = hi }; } pub fn mul(a: u64, b: u64) U128 { const x = @as(u128, a) * b; return .{ .hi = @truncate(u64, x >> 64), .lo = @truncate(u64, x), }; } }; // This will compute or rather approximate w * 5**q and return a pair of 64-bit words // approximating the result, with the "high" part corresponding to the most significant // bits and the low part corresponding to the least significant bits. fn computeProductApprox(q: i64, w: u64, comptime precision: usize) U128 { std.debug.assert(q >= eisel_lemire_smallest_power_of_five); std.debug.assert(q <= eisel_lemire_largest_power_of_five); std.debug.assert(precision <= 64); const mask = if (precision < 64) 0xffff_ffff_ffff_ffff >> precision else 0xffff_ffff_ffff_ffff; // 5^q < 2^64, then the multiplication always provides an exact value. // That means whenever we need to round ties to even, we always have // an exact value. const index = @intCast(usize, q - @intCast(i64, eisel_lemire_smallest_power_of_five)); const pow5 = eisel_lemire_table_powers_of_five_128[index]; // Only need one multiplication as long as there is 1 zero but // in the explicit mantissa bits, +1 for the hidden bit, +1 to // determine the rounding direction, +1 for if the computed // product has a leading zero. var first = U128.mul(w, pow5.lo); if (first.hi & mask == mask) { // Need to do a second multiplication to get better precision // for the lower product. This will always be exact // where q is < 55, since 5^55 < 2^128. If this wraps, // then we need to need to round up the hi product. const second = U128.mul(w, pow5.hi); first.lo +%= second.hi; if (second.hi > first.lo) { first.hi += 1; } } return .{ .lo = first.lo, .hi = first.hi }; } // Eisel-Lemire tables ~10Kb const eisel_lemire_smallest_power_of_five = -342; const eisel_lemire_largest_power_of_five = 308; const eisel_lemire_table_powers_of_five_128 = [_]U128{ U128.new(0xeef453d6923bd65a, 0x113faa2906a13b3f), // 5^-342 U128.new(0x9558b4661b6565f8, 0x4ac7ca59a424c507), // 5^-341 U128.new(0xbaaee17fa23ebf76, 0x5d79bcf00d2df649), // 5^-340 U128.new(0xe95a99df8ace6f53, 0xf4d82c2c107973dc), // 5^-339 U128.new(0x91d8a02bb6c10594, 0x79071b9b8a4be869), // 5^-338 U128.new(0xb64ec836a47146f9, 0x9748e2826cdee284), // 5^-337 U128.new(0xe3e27a444d8d98b7, 0xfd1b1b2308169b25), // 5^-336 U128.new(0x8e6d8c6ab0787f72, 0xfe30f0f5e50e20f7), // 5^-335 U128.new(0xb208ef855c969f4f, 0xbdbd2d335e51a935), // 5^-334 U128.new(0xde8b2b66b3bc4723, 0xad2c788035e61382), // 5^-333 U128.new(0x8b16fb203055ac76, 0x4c3bcb5021afcc31), // 5^-332 U128.new(0xaddcb9e83c6b1793, 0xdf4abe242a1bbf3d), // 5^-331 U128.new(0xd953e8624b85dd78, 0xd71d6dad34a2af0d), // 5^-330 U128.new(0x87d4713d6f33aa6b, 0x8672648c40e5ad68), // 5^-329 U128.new(0xa9c98d8ccb009506, 0x680efdaf511f18c2), // 5^-328 U128.new(0xd43bf0effdc0ba48, 0x212bd1b2566def2), // 5^-327 U128.new(0x84a57695fe98746d, 0x14bb630f7604b57), // 5^-326 U128.new(0xa5ced43b7e3e9188, 0x419ea3bd35385e2d), // 5^-325 U128.new(0xcf42894a5dce35ea, 0x52064cac828675b9), // 5^-324 U128.new(0x818995ce7aa0e1b2, 0x7343efebd1940993), // 5^-323 U128.new(0xa1ebfb4219491a1f, 0x1014ebe6c5f90bf8), // 5^-322 U128.new(0xca66fa129f9b60a6, 0xd41a26e077774ef6), // 5^-321 U128.new(0xfd00b897478238d0, 0x8920b098955522b4), // 5^-320 U128.new(0x9e20735e8cb16382, 0x55b46e5f5d5535b0), // 5^-319 U128.new(0xc5a890362fddbc62, 0xeb2189f734aa831d), // 5^-318 U128.new(0xf712b443bbd52b7b, 0xa5e9ec7501d523e4), // 5^-317 U128.new(0x9a6bb0aa55653b2d, 0x47b233c92125366e), // 5^-316 U128.new(0xc1069cd4eabe89f8, 0x999ec0bb696e840a), // 5^-315 U128.new(0xf148440a256e2c76, 0xc00670ea43ca250d), // 5^-314 U128.new(0x96cd2a865764dbca, 0x380406926a5e5728), // 5^-313 U128.new(0xbc807527ed3e12bc, 0xc605083704f5ecf2), // 5^-312 U128.new(0xeba09271e88d976b, 0xf7864a44c633682e), // 5^-311 U128.new(0x93445b8731587ea3, 0x7ab3ee6afbe0211d), // 5^-310 U128.new(0xb8157268fdae9e4c, 0x5960ea05bad82964), // 5^-309 U128.new(0xe61acf033d1a45df, 0x6fb92487298e33bd), // 5^-308 U128.new(0x8fd0c16206306bab, 0xa5d3b6d479f8e056), // 5^-307 U128.new(0xb3c4f1ba87bc8696, 0x8f48a4899877186c), // 5^-306 U128.new(0xe0b62e2929aba83c, 0x331acdabfe94de87), // 5^-305 U128.new(0x8c71dcd9ba0b4925, 0x9ff0c08b7f1d0b14), // 5^-304 U128.new(0xaf8e5410288e1b6f, 0x7ecf0ae5ee44dd9), // 5^-303 U128.new(0xdb71e91432b1a24a, 0xc9e82cd9f69d6150), // 5^-302 U128.new(0x892731ac9faf056e, 0xbe311c083a225cd2), // 5^-301 U128.new(0xab70fe17c79ac6ca, 0x6dbd630a48aaf406), // 5^-300 U128.new(0xd64d3d9db981787d, 0x92cbbccdad5b108), // 5^-299 U128.new(0x85f0468293f0eb4e, 0x25bbf56008c58ea5), // 5^-298 U128.new(0xa76c582338ed2621, 0xaf2af2b80af6f24e), // 5^-297 U128.new(0xd1476e2c07286faa, 0x1af5af660db4aee1), // 5^-296 U128.new(0x82cca4db847945ca, 0x50d98d9fc890ed4d), // 5^-295 U128.new(0xa37fce126597973c, 0xe50ff107bab528a0), // 5^-294 U128.new(0xcc5fc196fefd7d0c, 0x1e53ed49a96272c8), // 5^-293 U128.new(0xff77b1fcbebcdc4f, 0x25e8e89c13bb0f7a), // 5^-292 U128.new(0x9faacf3df73609b1, 0x77b191618c54e9ac), // 5^-291 U128.new(0xc795830d75038c1d, 0xd59df5b9ef6a2417), // 5^-290 U128.new(0xf97ae3d0d2446f25, 0x4b0573286b44ad1d), // 5^-289 U128.new(0x9becce62836ac577, 0x4ee367f9430aec32), // 5^-288 U128.new(0xc2e801fb244576d5, 0x229c41f793cda73f), // 5^-287 U128.new(0xf3a20279ed56d48a, 0x6b43527578c1110f), // 5^-286 U128.new(0x9845418c345644d6, 0x830a13896b78aaa9), // 5^-285 U128.new(0xbe5691ef416bd60c, 0x23cc986bc656d553), // 5^-284 U128.new(0xedec366b11c6cb8f, 0x2cbfbe86b7ec8aa8), // 5^-283 U128.new(0x94b3a202eb1c3f39, 0x7bf7d71432f3d6a9), // 5^-282 U128.new(0xb9e08a83a5e34f07, 0xdaf5ccd93fb0cc53), // 5^-281 U128.new(0xe858ad248f5c22c9, 0xd1b3400f8f9cff68), // 5^-280 U128.new(0x91376c36d99995be, 0x23100809b9c21fa1), // 5^-279 U128.new(0xb58547448ffffb2d, 0xabd40a0c2832a78a), // 5^-278 U128.new(0xe2e69915b3fff9f9, 0x16c90c8f323f516c), // 5^-277 U128.new(0x8dd01fad907ffc3b, 0xae3da7d97f6792e3), // 5^-276 U128.new(0xb1442798f49ffb4a, 0x99cd11cfdf41779c), // 5^-275 U128.new(0xdd95317f31c7fa1d, 0x40405643d711d583), // 5^-274 U128.new(0x8a7d3eef7f1cfc52, 0x482835ea666b2572), // 5^-273 U128.new(0xad1c8eab5ee43b66, 0xda3243650005eecf), // 5^-272 U128.new(0xd863b256369d4a40, 0x90bed43e40076a82), // 5^-271 U128.new(0x873e4f75e2224e68, 0x5a7744a6e804a291), // 5^-270 U128.new(0xa90de3535aaae202, 0x711515d0a205cb36), // 5^-269 U128.new(0xd3515c2831559a83, 0xd5a5b44ca873e03), // 5^-268 U128.new(0x8412d9991ed58091, 0xe858790afe9486c2), // 5^-267 U128.new(0xa5178fff668ae0b6, 0x626e974dbe39a872), // 5^-266 U128.new(0xce5d73ff402d98e3, 0xfb0a3d212dc8128f), // 5^-265 U128.new(0x80fa687f881c7f8e, 0x7ce66634bc9d0b99), // 5^-264 U128.new(0xa139029f6a239f72, 0x1c1fffc1ebc44e80), // 5^-263 U128.new(0xc987434744ac874e, 0xa327ffb266b56220), // 5^-262 U128.new(0xfbe9141915d7a922, 0x4bf1ff9f0062baa8), // 5^-261 U128.new(0x9d71ac8fada6c9b5, 0x6f773fc3603db4a9), // 5^-260 U128.new(0xc4ce17b399107c22, 0xcb550fb4384d21d3), // 5^-259 U128.new(0xf6019da07f549b2b, 0x7e2a53a146606a48), // 5^-258 U128.new(0x99c102844f94e0fb, 0x2eda7444cbfc426d), // 5^-257 U128.new(0xc0314325637a1939, 0xfa911155fefb5308), // 5^-256 U128.new(0xf03d93eebc589f88, 0x793555ab7eba27ca), // 5^-255 U128.new(0x96267c7535b763b5, 0x4bc1558b2f3458de), // 5^-254 U128.new(0xbbb01b9283253ca2, 0x9eb1aaedfb016f16), // 5^-253 U128.new(0xea9c227723ee8bcb, 0x465e15a979c1cadc), // 5^-252 U128.new(0x92a1958a7675175f, 0xbfacd89ec191ec9), // 5^-251 U128.new(0xb749faed14125d36, 0xcef980ec671f667b), // 5^-250 U128.new(0xe51c79a85916f484, 0x82b7e12780e7401a), // 5^-249 U128.new(0x8f31cc0937ae58d2, 0xd1b2ecb8b0908810), // 5^-248 U128.new(0xb2fe3f0b8599ef07, 0x861fa7e6dcb4aa15), // 5^-247 U128.new(0xdfbdcece67006ac9, 0x67a791e093e1d49a), // 5^-246 U128.new(0x8bd6a141006042bd, 0xe0c8bb2c5c6d24e0), // 5^-245 U128.new(0xaecc49914078536d, 0x58fae9f773886e18), // 5^-244 U128.new(0xda7f5bf590966848, 0xaf39a475506a899e), // 5^-243 U128.new(0x888f99797a5e012d, 0x6d8406c952429603), // 5^-242 U128.new(0xaab37fd7d8f58178, 0xc8e5087ba6d33b83), // 5^-241 U128.new(0xd5605fcdcf32e1d6, 0xfb1e4a9a90880a64), // 5^-240 U128.new(0x855c3be0a17fcd26, 0x5cf2eea09a55067f), // 5^-239 U128.new(0xa6b34ad8c9dfc06f, 0xf42faa48c0ea481e), // 5^-238 U128.new(0xd0601d8efc57b08b, 0xf13b94daf124da26), // 5^-237 U128.new(0x823c12795db6ce57, 0x76c53d08d6b70858), // 5^-236 U128.new(0xa2cb1717b52481ed, 0x54768c4b0c64ca6e), // 5^-235 U128.new(0xcb7ddcdda26da268, 0xa9942f5dcf7dfd09), // 5^-234 U128.new(0xfe5d54150b090b02, 0xd3f93b35435d7c4c), // 5^-233 U128.new(0x9efa548d26e5a6e1, 0xc47bc5014a1a6daf), // 5^-232 U128.new(0xc6b8e9b0709f109a, 0x359ab6419ca1091b), // 5^-231 U128.new(0xf867241c8cc6d4c0, 0xc30163d203c94b62), // 5^-230 U128.new(0x9b407691d7fc44f8, 0x79e0de63425dcf1d), // 5^-229 U128.new(0xc21094364dfb5636, 0x985915fc12f542e4), // 5^-228 U128.new(0xf294b943e17a2bc4, 0x3e6f5b7b17b2939d), // 5^-227 U128.new(0x979cf3ca6cec5b5a, 0xa705992ceecf9c42), // 5^-226 U128.new(0xbd8430bd08277231, 0x50c6ff782a838353), // 5^-225 U128.new(0xece53cec4a314ebd, 0xa4f8bf5635246428), // 5^-224 U128.new(0x940f4613ae5ed136, 0x871b7795e136be99), // 5^-223 U128.new(0xb913179899f68584, 0x28e2557b59846e3f), // 5^-222 U128.new(0xe757dd7ec07426e5, 0x331aeada2fe589cf), // 5^-221 U128.new(0x9096ea6f3848984f, 0x3ff0d2c85def7621), // 5^-220 U128.new(0xb4bca50b065abe63, 0xfed077a756b53a9), // 5^-219 U128.new(0xe1ebce4dc7f16dfb, 0xd3e8495912c62894), // 5^-218 U128.new(0x8d3360f09cf6e4bd, 0x64712dd7abbbd95c), // 5^-217 U128.new(0xb080392cc4349dec, 0xbd8d794d96aacfb3), // 5^-216 U128.new(0xdca04777f541c567, 0xecf0d7a0fc5583a0), // 5^-215 U128.new(0x89e42caaf9491b60, 0xf41686c49db57244), // 5^-214 U128.new(0xac5d37d5b79b6239, 0x311c2875c522ced5), // 5^-213 U128.new(0xd77485cb25823ac7, 0x7d633293366b828b), // 5^-212 U128.new(0x86a8d39ef77164bc, 0xae5dff9c02033197), // 5^-211 U128.new(0xa8530886b54dbdeb, 0xd9f57f830283fdfc), // 5^-210 U128.new(0xd267caa862a12d66, 0xd072df63c324fd7b), // 5^-209 U128.new(0x8380dea93da4bc60, 0x4247cb9e59f71e6d), // 5^-208 U128.new(0xa46116538d0deb78, 0x52d9be85f074e608), // 5^-207 U128.new(0xcd795be870516656, 0x67902e276c921f8b), // 5^-206 U128.new(0x806bd9714632dff6, 0xba1cd8a3db53b6), // 5^-205 U128.new(0xa086cfcd97bf97f3, 0x80e8a40eccd228a4), // 5^-204 U128.new(0xc8a883c0fdaf7df0, 0x6122cd128006b2cd), // 5^-203 U128.new(0xfad2a4b13d1b5d6c, 0x796b805720085f81), // 5^-202 U128.new(0x9cc3a6eec6311a63, 0xcbe3303674053bb0), // 5^-201 U128.new(0xc3f490aa77bd60fc, 0xbedbfc4411068a9c), // 5^-200 U128.new(0xf4f1b4d515acb93b, 0xee92fb5515482d44), // 5^-199 U128.new(0x991711052d8bf3c5, 0x751bdd152d4d1c4a), // 5^-198 U128.new(0xbf5cd54678eef0b6, 0xd262d45a78a0635d), // 5^-197 U128.new(0xef340a98172aace4, 0x86fb897116c87c34), // 5^-196 U128.new(0x9580869f0e7aac0e, 0xd45d35e6ae3d4da0), // 5^-195 U128.new(0xbae0a846d2195712, 0x8974836059cca109), // 5^-194 U128.new(0xe998d258869facd7, 0x2bd1a438703fc94b), // 5^-193 U128.new(0x91ff83775423cc06, 0x7b6306a34627ddcf), // 5^-192 U128.new(0xb67f6455292cbf08, 0x1a3bc84c17b1d542), // 5^-191 U128.new(0xe41f3d6a7377eeca, 0x20caba5f1d9e4a93), // 5^-190 U128.new(0x8e938662882af53e, 0x547eb47b7282ee9c), // 5^-189 U128.new(0xb23867fb2a35b28d, 0xe99e619a4f23aa43), // 5^-188 U128.new(0xdec681f9f4c31f31, 0x6405fa00e2ec94d4), // 5^-187 U128.new(0x8b3c113c38f9f37e, 0xde83bc408dd3dd04), // 5^-186 U128.new(0xae0b158b4738705e, 0x9624ab50b148d445), // 5^-185 U128.new(0xd98ddaee19068c76, 0x3badd624dd9b0957), // 5^-184 U128.new(0x87f8a8d4cfa417c9, 0xe54ca5d70a80e5d6), // 5^-183 U128.new(0xa9f6d30a038d1dbc, 0x5e9fcf4ccd211f4c), // 5^-182 U128.new(0xd47487cc8470652b, 0x7647c3200069671f), // 5^-181 U128.new(0x84c8d4dfd2c63f3b, 0x29ecd9f40041e073), // 5^-180 U128.new(0xa5fb0a17c777cf09, 0xf468107100525890), // 5^-179 U128.new(0xcf79cc9db955c2cc, 0x7182148d4066eeb4), // 5^-178 U128.new(0x81ac1fe293d599bf, 0xc6f14cd848405530), // 5^-177 U128.new(0xa21727db38cb002f, 0xb8ada00e5a506a7c), // 5^-176 U128.new(0xca9cf1d206fdc03b, 0xa6d90811f0e4851c), // 5^-175 U128.new(0xfd442e4688bd304a, 0x908f4a166d1da663), // 5^-174 U128.new(0x9e4a9cec15763e2e, 0x9a598e4e043287fe), // 5^-173 U128.new(0xc5dd44271ad3cdba, 0x40eff1e1853f29fd), // 5^-172 U128.new(0xf7549530e188c128, 0xd12bee59e68ef47c), // 5^-171 U128.new(0x9a94dd3e8cf578b9, 0x82bb74f8301958ce), // 5^-170 U128.new(0xc13a148e3032d6e7, 0xe36a52363c1faf01), // 5^-169 U128.new(0xf18899b1bc3f8ca1, 0xdc44e6c3cb279ac1), // 5^-168 U128.new(0x96f5600f15a7b7e5, 0x29ab103a5ef8c0b9), // 5^-167 U128.new(0xbcb2b812db11a5de, 0x7415d448f6b6f0e7), // 5^-166 U128.new(0xebdf661791d60f56, 0x111b495b3464ad21), // 5^-165 U128.new(0x936b9fcebb25c995, 0xcab10dd900beec34), // 5^-164 U128.new(0xb84687c269ef3bfb, 0x3d5d514f40eea742), // 5^-163 U128.new(0xe65829b3046b0afa, 0xcb4a5a3112a5112), // 5^-162 U128.new(0x8ff71a0fe2c2e6dc, 0x47f0e785eaba72ab), // 5^-161 U128.new(0xb3f4e093db73a093, 0x59ed216765690f56), // 5^-160 U128.new(0xe0f218b8d25088b8, 0x306869c13ec3532c), // 5^-159 U128.new(0x8c974f7383725573, 0x1e414218c73a13fb), // 5^-158 U128.new(0xafbd2350644eeacf, 0xe5d1929ef90898fa), // 5^-157 U128.new(0xdbac6c247d62a583, 0xdf45f746b74abf39), // 5^-156 U128.new(0x894bc396ce5da772, 0x6b8bba8c328eb783), // 5^-155 U128.new(0xab9eb47c81f5114f, 0x66ea92f3f326564), // 5^-154 U128.new(0xd686619ba27255a2, 0xc80a537b0efefebd), // 5^-153 U128.new(0x8613fd0145877585, 0xbd06742ce95f5f36), // 5^-152 U128.new(0xa798fc4196e952e7, 0x2c48113823b73704), // 5^-151 U128.new(0xd17f3b51fca3a7a0, 0xf75a15862ca504c5), // 5^-150 U128.new(0x82ef85133de648c4, 0x9a984d73dbe722fb), // 5^-149 U128.new(0xa3ab66580d5fdaf5, 0xc13e60d0d2e0ebba), // 5^-148 U128.new(0xcc963fee10b7d1b3, 0x318df905079926a8), // 5^-147 U128.new(0xffbbcfe994e5c61f, 0xfdf17746497f7052), // 5^-146 U128.new(0x9fd561f1fd0f9bd3, 0xfeb6ea8bedefa633), // 5^-145 U128.new(0xc7caba6e7c5382c8, 0xfe64a52ee96b8fc0), // 5^-144 U128.new(0xf9bd690a1b68637b, 0x3dfdce7aa3c673b0), // 5^-143 U128.new(0x9c1661a651213e2d, 0x6bea10ca65c084e), // 5^-142 U128.new(0xc31bfa0fe5698db8, 0x486e494fcff30a62), // 5^-141 U128.new(0xf3e2f893dec3f126, 0x5a89dba3c3efccfa), // 5^-140 U128.new(0x986ddb5c6b3a76b7, 0xf89629465a75e01c), // 5^-139 U128.new(0xbe89523386091465, 0xf6bbb397f1135823), // 5^-138 U128.new(0xee2ba6c0678b597f, 0x746aa07ded582e2c), // 5^-137 U128.new(0x94db483840b717ef, 0xa8c2a44eb4571cdc), // 5^-136 U128.new(0xba121a4650e4ddeb, 0x92f34d62616ce413), // 5^-135 U128.new(0xe896a0d7e51e1566, 0x77b020baf9c81d17), // 5^-134 U128.new(0x915e2486ef32cd60, 0xace1474dc1d122e), // 5^-133 U128.new(0xb5b5ada8aaff80b8, 0xd819992132456ba), // 5^-132 U128.new(0xe3231912d5bf60e6, 0x10e1fff697ed6c69), // 5^-131 U128.new(0x8df5efabc5979c8f, 0xca8d3ffa1ef463c1), // 5^-130 U128.new(0xb1736b96b6fd83b3, 0xbd308ff8a6b17cb2), // 5^-129 U128.new(0xddd0467c64bce4a0, 0xac7cb3f6d05ddbde), // 5^-128 U128.new(0x8aa22c0dbef60ee4, 0x6bcdf07a423aa96b), // 5^-127 U128.new(0xad4ab7112eb3929d, 0x86c16c98d2c953c6), // 5^-126 U128.new(0xd89d64d57a607744, 0xe871c7bf077ba8b7), // 5^-125 U128.new(0x87625f056c7c4a8b, 0x11471cd764ad4972), // 5^-124 U128.new(0xa93af6c6c79b5d2d, 0xd598e40d3dd89bcf), // 5^-123 U128.new(0xd389b47879823479, 0x4aff1d108d4ec2c3), // 5^-122 U128.new(0x843610cb4bf160cb, 0xcedf722a585139ba), // 5^-121 U128.new(0xa54394fe1eedb8fe, 0xc2974eb4ee658828), // 5^-120 U128.new(0xce947a3da6a9273e, 0x733d226229feea32), // 5^-119 U128.new(0x811ccc668829b887, 0x806357d5a3f525f), // 5^-118 U128.new(0xa163ff802a3426a8, 0xca07c2dcb0cf26f7), // 5^-117 U128.new(0xc9bcff6034c13052, 0xfc89b393dd02f0b5), // 5^-116 U128.new(0xfc2c3f3841f17c67, 0xbbac2078d443ace2), // 5^-115 U128.new(0x9d9ba7832936edc0, 0xd54b944b84aa4c0d), // 5^-114 U128.new(0xc5029163f384a931, 0xa9e795e65d4df11), // 5^-113 U128.new(0xf64335bcf065d37d, 0x4d4617b5ff4a16d5), // 5^-112 U128.new(0x99ea0196163fa42e, 0x504bced1bf8e4e45), // 5^-111 U128.new(0xc06481fb9bcf8d39, 0xe45ec2862f71e1d6), // 5^-110 U128.new(0xf07da27a82c37088, 0x5d767327bb4e5a4c), // 5^-109 U128.new(0x964e858c91ba2655, 0x3a6a07f8d510f86f), // 5^-108 U128.new(0xbbe226efb628afea, 0x890489f70a55368b), // 5^-107 U128.new(0xeadab0aba3b2dbe5, 0x2b45ac74ccea842e), // 5^-106 U128.new(0x92c8ae6b464fc96f, 0x3b0b8bc90012929d), // 5^-105 U128.new(0xb77ada0617e3bbcb, 0x9ce6ebb40173744), // 5^-104 U128.new(0xe55990879ddcaabd, 0xcc420a6a101d0515), // 5^-103 U128.new(0x8f57fa54c2a9eab6, 0x9fa946824a12232d), // 5^-102 U128.new(0xb32df8e9f3546564, 0x47939822dc96abf9), // 5^-101 U128.new(0xdff9772470297ebd, 0x59787e2b93bc56f7), // 5^-100 U128.new(0x8bfbea76c619ef36, 0x57eb4edb3c55b65a), // 5^-99 U128.new(0xaefae51477a06b03, 0xede622920b6b23f1), // 5^-98 U128.new(0xdab99e59958885c4, 0xe95fab368e45eced), // 5^-97 U128.new(0x88b402f7fd75539b, 0x11dbcb0218ebb414), // 5^-96 U128.new(0xaae103b5fcd2a881, 0xd652bdc29f26a119), // 5^-95 U128.new(0xd59944a37c0752a2, 0x4be76d3346f0495f), // 5^-94 U128.new(0x857fcae62d8493a5, 0x6f70a4400c562ddb), // 5^-93 U128.new(0xa6dfbd9fb8e5b88e, 0xcb4ccd500f6bb952), // 5^-92 U128.new(0xd097ad07a71f26b2, 0x7e2000a41346a7a7), // 5^-91 U128.new(0x825ecc24c873782f, 0x8ed400668c0c28c8), // 5^-90 U128.new(0xa2f67f2dfa90563b, 0x728900802f0f32fa), // 5^-89 U128.new(0xcbb41ef979346bca, 0x4f2b40a03ad2ffb9), // 5^-88 U128.new(0xfea126b7d78186bc, 0xe2f610c84987bfa8), // 5^-87 U128.new(0x9f24b832e6b0f436, 0xdd9ca7d2df4d7c9), // 5^-86 U128.new(0xc6ede63fa05d3143, 0x91503d1c79720dbb), // 5^-85 U128.new(0xf8a95fcf88747d94, 0x75a44c6397ce912a), // 5^-84 U128.new(0x9b69dbe1b548ce7c, 0xc986afbe3ee11aba), // 5^-83 U128.new(0xc24452da229b021b, 0xfbe85badce996168), // 5^-82 U128.new(0xf2d56790ab41c2a2, 0xfae27299423fb9c3), // 5^-81 U128.new(0x97c560ba6b0919a5, 0xdccd879fc967d41a), // 5^-80 U128.new(0xbdb6b8e905cb600f, 0x5400e987bbc1c920), // 5^-79 U128.new(0xed246723473e3813, 0x290123e9aab23b68), // 5^-78 U128.new(0x9436c0760c86e30b, 0xf9a0b6720aaf6521), // 5^-77 U128.new(0xb94470938fa89bce, 0xf808e40e8d5b3e69), // 5^-76 U128.new(0xe7958cb87392c2c2, 0xb60b1d1230b20e04), // 5^-75 U128.new(0x90bd77f3483bb9b9, 0xb1c6f22b5e6f48c2), // 5^-74 U128.new(0xb4ecd5f01a4aa828, 0x1e38aeb6360b1af3), // 5^-73 U128.new(0xe2280b6c20dd5232, 0x25c6da63c38de1b0), // 5^-72 U128.new(0x8d590723948a535f, 0x579c487e5a38ad0e), // 5^-71 U128.new(0xb0af48ec79ace837, 0x2d835a9df0c6d851), // 5^-70 U128.new(0xdcdb1b2798182244, 0xf8e431456cf88e65), // 5^-69 U128.new(0x8a08f0f8bf0f156b, 0x1b8e9ecb641b58ff), // 5^-68 U128.new(0xac8b2d36eed2dac5, 0xe272467e3d222f3f), // 5^-67 U128.new(0xd7adf884aa879177, 0x5b0ed81dcc6abb0f), // 5^-66 U128.new(0x86ccbb52ea94baea, 0x98e947129fc2b4e9), // 5^-65 U128.new(0xa87fea27a539e9a5, 0x3f2398d747b36224), // 5^-64 U128.new(0xd29fe4b18e88640e, 0x8eec7f0d19a03aad), // 5^-63 U128.new(0x83a3eeeef9153e89, 0x1953cf68300424ac), // 5^-62 U128.new(0xa48ceaaab75a8e2b, 0x5fa8c3423c052dd7), // 5^-61 U128.new(0xcdb02555653131b6, 0x3792f412cb06794d), // 5^-60 U128.new(0x808e17555f3ebf11, 0xe2bbd88bbee40bd0), // 5^-59 U128.new(0xa0b19d2ab70e6ed6, 0x5b6aceaeae9d0ec4), // 5^-58 U128.new(0xc8de047564d20a8b, 0xf245825a5a445275), // 5^-57 U128.new(0xfb158592be068d2e, 0xeed6e2f0f0d56712), // 5^-56 U128.new(0x9ced737bb6c4183d, 0x55464dd69685606b), // 5^-55 U128.new(0xc428d05aa4751e4c, 0xaa97e14c3c26b886), // 5^-54 U128.new(0xf53304714d9265df, 0xd53dd99f4b3066a8), // 5^-53 U128.new(0x993fe2c6d07b7fab, 0xe546a8038efe4029), // 5^-52 U128.new(0xbf8fdb78849a5f96, 0xde98520472bdd033), // 5^-51 U128.new(0xef73d256a5c0f77c, 0x963e66858f6d4440), // 5^-50 U128.new(0x95a8637627989aad, 0xdde7001379a44aa8), // 5^-49 U128.new(0xbb127c53b17ec159, 0x5560c018580d5d52), // 5^-48 U128.new(0xe9d71b689dde71af, 0xaab8f01e6e10b4a6), // 5^-47 U128.new(0x9226712162ab070d, 0xcab3961304ca70e8), // 5^-46 U128.new(0xb6b00d69bb55c8d1, 0x3d607b97c5fd0d22), // 5^-45 U128.new(0xe45c10c42a2b3b05, 0x8cb89a7db77c506a), // 5^-44 U128.new(0x8eb98a7a9a5b04e3, 0x77f3608e92adb242), // 5^-43 U128.new(0xb267ed1940f1c61c, 0x55f038b237591ed3), // 5^-42 U128.new(0xdf01e85f912e37a3, 0x6b6c46dec52f6688), // 5^-41 U128.new(0x8b61313bbabce2c6, 0x2323ac4b3b3da015), // 5^-40 U128.new(0xae397d8aa96c1b77, 0xabec975e0a0d081a), // 5^-39 U128.new(0xd9c7dced53c72255, 0x96e7bd358c904a21), // 5^-38 U128.new(0x881cea14545c7575, 0x7e50d64177da2e54), // 5^-37 U128.new(0xaa242499697392d2, 0xdde50bd1d5d0b9e9), // 5^-36 U128.new(0xd4ad2dbfc3d07787, 0x955e4ec64b44e864), // 5^-35 U128.new(0x84ec3c97da624ab4, 0xbd5af13bef0b113e), // 5^-34 U128.new(0xa6274bbdd0fadd61, 0xecb1ad8aeacdd58e), // 5^-33 U128.new(0xcfb11ead453994ba, 0x67de18eda5814af2), // 5^-32 U128.new(0x81ceb32c4b43fcf4, 0x80eacf948770ced7), // 5^-31 U128.new(0xa2425ff75e14fc31, 0xa1258379a94d028d), // 5^-30 U128.new(0xcad2f7f5359a3b3e, 0x96ee45813a04330), // 5^-29 U128.new(0xfd87b5f28300ca0d, 0x8bca9d6e188853fc), // 5^-28 U128.new(0x9e74d1b791e07e48, 0x775ea264cf55347e), // 5^-27 U128.new(0xc612062576589dda, 0x95364afe032a819e), // 5^-26 U128.new(0xf79687aed3eec551, 0x3a83ddbd83f52205), // 5^-25 U128.new(0x9abe14cd44753b52, 0xc4926a9672793543), // 5^-24 U128.new(0xc16d9a0095928a27, 0x75b7053c0f178294), // 5^-23 U128.new(0xf1c90080baf72cb1, 0x5324c68b12dd6339), // 5^-22 U128.new(0x971da05074da7bee, 0xd3f6fc16ebca5e04), // 5^-21 U128.new(0xbce5086492111aea, 0x88f4bb1ca6bcf585), // 5^-20 U128.new(0xec1e4a7db69561a5, 0x2b31e9e3d06c32e6), // 5^-19 U128.new(0x9392ee8e921d5d07, 0x3aff322e62439fd0), // 5^-18 U128.new(0xb877aa3236a4b449, 0x9befeb9fad487c3), // 5^-17 U128.new(0xe69594bec44de15b, 0x4c2ebe687989a9b4), // 5^-16 U128.new(0x901d7cf73ab0acd9, 0xf9d37014bf60a11), // 5^-15 U128.new(0xb424dc35095cd80f, 0x538484c19ef38c95), // 5^-14 U128.new(0xe12e13424bb40e13, 0x2865a5f206b06fba), // 5^-13 U128.new(0x8cbccc096f5088cb, 0xf93f87b7442e45d4), // 5^-12 U128.new(0xafebff0bcb24aafe, 0xf78f69a51539d749), // 5^-11 U128.new(0xdbe6fecebdedd5be, 0xb573440e5a884d1c), // 5^-10 U128.new(0x89705f4136b4a597, 0x31680a88f8953031), // 5^-9 U128.new(0xabcc77118461cefc, 0xfdc20d2b36ba7c3e), // 5^-8 U128.new(0xd6bf94d5e57a42bc, 0x3d32907604691b4d), // 5^-7 U128.new(0x8637bd05af6c69b5, 0xa63f9a49c2c1b110), // 5^-6 U128.new(0xa7c5ac471b478423, 0xfcf80dc33721d54), // 5^-5 U128.new(0xd1b71758e219652b, 0xd3c36113404ea4a9), // 5^-4 U128.new(0x83126e978d4fdf3b, 0x645a1cac083126ea), // 5^-3 U128.new(0xa3d70a3d70a3d70a, 0x3d70a3d70a3d70a4), // 5^-2 U128.new(0xcccccccccccccccc, 0xcccccccccccccccd), // 5^-1 U128.new(0x8000000000000000, 0x0), // 5^0 U128.new(0xa000000000000000, 0x0), // 5^1 U128.new(0xc800000000000000, 0x0), // 5^2 U128.new(0xfa00000000000000, 0x0), // 5^3 U128.new(0x9c40000000000000, 0x0), // 5^4 U128.new(0xc350000000000000, 0x0), // 5^5 U128.new(0xf424000000000000, 0x0), // 5^6 U128.new(0x9896800000000000, 0x0), // 5^7 U128.new(0xbebc200000000000, 0x0), // 5^8 U128.new(0xee6b280000000000, 0x0), // 5^9 U128.new(0x9502f90000000000, 0x0), // 5^10 U128.new(0xba43b74000000000, 0x0), // 5^11 U128.new(0xe8d4a51000000000, 0x0), // 5^12 U128.new(0x9184e72a00000000, 0x0), // 5^13 U128.new(0xb5e620f480000000, 0x0), // 5^14 U128.new(0xe35fa931a0000000, 0x0), // 5^15 U128.new(0x8e1bc9bf04000000, 0x0), // 5^16 U128.new(0xb1a2bc2ec5000000, 0x0), // 5^17 U128.new(0xde0b6b3a76400000, 0x0), // 5^18 U128.new(0x8ac7230489e80000, 0x0), // 5^19 U128.new(0xad78ebc5ac620000, 0x0), // 5^20 U128.new(0xd8d726b7177a8000, 0x0), // 5^21 U128.new(0x878678326eac9000, 0x0), // 5^22 U128.new(0xa968163f0a57b400, 0x0), // 5^23 U128.new(0xd3c21bcecceda100, 0x0), // 5^24 U128.new(0x84595161401484a0, 0x0), // 5^25 U128.new(0xa56fa5b99019a5c8, 0x0), // 5^26 U128.new(0xcecb8f27f4200f3a, 0x0), // 5^27 U128.new(0x813f3978f8940984, 0x4000000000000000), // 5^28 U128.new(0xa18f07d736b90be5, 0x5000000000000000), // 5^29 U128.new(0xc9f2c9cd04674ede, 0xa400000000000000), // 5^30 U128.new(0xfc6f7c4045812296, 0x4d00000000000000), // 5^31 U128.new(0x9dc5ada82b70b59d, 0xf020000000000000), // 5^32 U128.new(0xc5371912364ce305, 0x6c28000000000000), // 5^33 U128.new(0xf684df56c3e01bc6, 0xc732000000000000), // 5^34 U128.new(0x9a130b963a6c115c, 0x3c7f400000000000), // 5^35 U128.new(0xc097ce7bc90715b3, 0x4b9f100000000000), // 5^36 U128.new(0xf0bdc21abb48db20, 0x1e86d40000000000), // 5^37 U128.new(0x96769950b50d88f4, 0x1314448000000000), // 5^38 U128.new(0xbc143fa4e250eb31, 0x17d955a000000000), // 5^39 U128.new(0xeb194f8e1ae525fd, 0x5dcfab0800000000), // 5^40 U128.new(0x92efd1b8d0cf37be, 0x5aa1cae500000000), // 5^41 U128.new(0xb7abc627050305ad, 0xf14a3d9e40000000), // 5^42 U128.new(0xe596b7b0c643c719, 0x6d9ccd05d0000000), // 5^43 U128.new(0x8f7e32ce7bea5c6f, 0xe4820023a2000000), // 5^44 U128.new(0xb35dbf821ae4f38b, 0xdda2802c8a800000), // 5^45 U128.new(0xe0352f62a19e306e, 0xd50b2037ad200000), // 5^46 U128.new(0x8c213d9da502de45, 0x4526f422cc340000), // 5^47 U128.new(0xaf298d050e4395d6, 0x9670b12b7f410000), // 5^48 U128.new(0xdaf3f04651d47b4c, 0x3c0cdd765f114000), // 5^49 U128.new(0x88d8762bf324cd0f, 0xa5880a69fb6ac800), // 5^50 U128.new(0xab0e93b6efee0053, 0x8eea0d047a457a00), // 5^51 U128.new(0xd5d238a4abe98068, 0x72a4904598d6d880), // 5^52 U128.new(0x85a36366eb71f041, 0x47a6da2b7f864750), // 5^53 U128.new(0xa70c3c40a64e6c51, 0x999090b65f67d924), // 5^54 U128.new(0xd0cf4b50cfe20765, 0xfff4b4e3f741cf6d), // 5^55 U128.new(0x82818f1281ed449f, 0xbff8f10e7a8921a4), // 5^56 U128.new(0xa321f2d7226895c7, 0xaff72d52192b6a0d), // 5^57 U128.new(0xcbea6f8ceb02bb39, 0x9bf4f8a69f764490), // 5^58 U128.new(0xfee50b7025c36a08, 0x2f236d04753d5b4), // 5^59 U128.new(0x9f4f2726179a2245, 0x1d762422c946590), // 5^60 U128.new(0xc722f0ef9d80aad6, 0x424d3ad2b7b97ef5), // 5^61 U128.new(0xf8ebad2b84e0d58b, 0xd2e0898765a7deb2), // 5^62 U128.new(0x9b934c3b330c8577, 0x63cc55f49f88eb2f), // 5^63 U128.new(0xc2781f49ffcfa6d5, 0x3cbf6b71c76b25fb), // 5^64 U128.new(0xf316271c7fc3908a, 0x8bef464e3945ef7a), // 5^65 U128.new(0x97edd871cfda3a56, 0x97758bf0e3cbb5ac), // 5^66 U128.new(0xbde94e8e43d0c8ec, 0x3d52eeed1cbea317), // 5^67 U128.new(0xed63a231d4c4fb27, 0x4ca7aaa863ee4bdd), // 5^68 U128.new(0x945e455f24fb1cf8, 0x8fe8caa93e74ef6a), // 5^69 U128.new(0xb975d6b6ee39e436, 0xb3e2fd538e122b44), // 5^70 U128.new(0xe7d34c64a9c85d44, 0x60dbbca87196b616), // 5^71 U128.new(0x90e40fbeea1d3a4a, 0xbc8955e946fe31cd), // 5^72 U128.new(0xb51d13aea4a488dd, 0x6babab6398bdbe41), // 5^73 U128.new(0xe264589a4dcdab14, 0xc696963c7eed2dd1), // 5^74 U128.new(0x8d7eb76070a08aec, 0xfc1e1de5cf543ca2), // 5^75 U128.new(0xb0de65388cc8ada8, 0x3b25a55f43294bcb), // 5^76 U128.new(0xdd15fe86affad912, 0x49ef0eb713f39ebe), // 5^77 U128.new(0x8a2dbf142dfcc7ab, 0x6e3569326c784337), // 5^78 U128.new(0xacb92ed9397bf996, 0x49c2c37f07965404), // 5^79 U128.new(0xd7e77a8f87daf7fb, 0xdc33745ec97be906), // 5^80 U128.new(0x86f0ac99b4e8dafd, 0x69a028bb3ded71a3), // 5^81 U128.new(0xa8acd7c0222311bc, 0xc40832ea0d68ce0c), // 5^82 U128.new(0xd2d80db02aabd62b, 0xf50a3fa490c30190), // 5^83 U128.new(0x83c7088e1aab65db, 0x792667c6da79e0fa), // 5^84 U128.new(0xa4b8cab1a1563f52, 0x577001b891185938), // 5^85 U128.new(0xcde6fd5e09abcf26, 0xed4c0226b55e6f86), // 5^86 U128.new(0x80b05e5ac60b6178, 0x544f8158315b05b4), // 5^87 U128.new(0xa0dc75f1778e39d6, 0x696361ae3db1c721), // 5^88 U128.new(0xc913936dd571c84c, 0x3bc3a19cd1e38e9), // 5^89 U128.new(0xfb5878494ace3a5f, 0x4ab48a04065c723), // 5^90 U128.new(0x9d174b2dcec0e47b, 0x62eb0d64283f9c76), // 5^91 U128.new(0xc45d1df942711d9a, 0x3ba5d0bd324f8394), // 5^92 U128.new(0xf5746577930d6500, 0xca8f44ec7ee36479), // 5^93 U128.new(0x9968bf6abbe85f20, 0x7e998b13cf4e1ecb), // 5^94 U128.new(0xbfc2ef456ae276e8, 0x9e3fedd8c321a67e), // 5^95 U128.new(0xefb3ab16c59b14a2, 0xc5cfe94ef3ea101e), // 5^96 U128.new(0x95d04aee3b80ece5, 0xbba1f1d158724a12), // 5^97 U128.new(0xbb445da9ca61281f, 0x2a8a6e45ae8edc97), // 5^98 U128.new(0xea1575143cf97226, 0xf52d09d71a3293bd), // 5^99 U128.new(0x924d692ca61be758, 0x593c2626705f9c56), // 5^100 U128.new(0xb6e0c377cfa2e12e, 0x6f8b2fb00c77836c), // 5^101 U128.new(0xe498f455c38b997a, 0xb6dfb9c0f956447), // 5^102 U128.new(0x8edf98b59a373fec, 0x4724bd4189bd5eac), // 5^103 U128.new(0xb2977ee300c50fe7, 0x58edec91ec2cb657), // 5^104 U128.new(0xdf3d5e9bc0f653e1, 0x2f2967b66737e3ed), // 5^105 U128.new(0x8b865b215899f46c, 0xbd79e0d20082ee74), // 5^106 U128.new(0xae67f1e9aec07187, 0xecd8590680a3aa11), // 5^107 U128.new(0xda01ee641a708de9, 0xe80e6f4820cc9495), // 5^108 U128.new(0x884134fe908658b2, 0x3109058d147fdcdd), // 5^109 U128.new(0xaa51823e34a7eede, 0xbd4b46f0599fd415), // 5^110 U128.new(0xd4e5e2cdc1d1ea96, 0x6c9e18ac7007c91a), // 5^111 U128.new(0x850fadc09923329e, 0x3e2cf6bc604ddb0), // 5^112 U128.new(0xa6539930bf6bff45, 0x84db8346b786151c), // 5^113 U128.new(0xcfe87f7cef46ff16, 0xe612641865679a63), // 5^114 U128.new(0x81f14fae158c5f6e, 0x4fcb7e8f3f60c07e), // 5^115 U128.new(0xa26da3999aef7749, 0xe3be5e330f38f09d), // 5^116 U128.new(0xcb090c8001ab551c, 0x5cadf5bfd3072cc5), // 5^117 U128.new(0xfdcb4fa002162a63, 0x73d9732fc7c8f7f6), // 5^118 U128.new(0x9e9f11c4014dda7e, 0x2867e7fddcdd9afa), // 5^119 U128.new(0xc646d63501a1511d, 0xb281e1fd541501b8), // 5^120 U128.new(0xf7d88bc24209a565, 0x1f225a7ca91a4226), // 5^121 U128.new(0x9ae757596946075f, 0x3375788de9b06958), // 5^122 U128.new(0xc1a12d2fc3978937, 0x52d6b1641c83ae), // 5^123 U128.new(0xf209787bb47d6b84, 0xc0678c5dbd23a49a), // 5^124 U128.new(0x9745eb4d50ce6332, 0xf840b7ba963646e0), // 5^125 U128.new(0xbd176620a501fbff, 0xb650e5a93bc3d898), // 5^126 U128.new(0xec5d3fa8ce427aff, 0xa3e51f138ab4cebe), // 5^127 U128.new(0x93ba47c980e98cdf, 0xc66f336c36b10137), // 5^128 U128.new(0xb8a8d9bbe123f017, 0xb80b0047445d4184), // 5^129 U128.new(0xe6d3102ad96cec1d, 0xa60dc059157491e5), // 5^130 U128.new(0x9043ea1ac7e41392, 0x87c89837ad68db2f), // 5^131 U128.new(0xb454e4a179dd1877, 0x29babe4598c311fb), // 5^132 U128.new(0xe16a1dc9d8545e94, 0xf4296dd6fef3d67a), // 5^133 U128.new(0x8ce2529e2734bb1d, 0x1899e4a65f58660c), // 5^134 U128.new(0xb01ae745b101e9e4, 0x5ec05dcff72e7f8f), // 5^135 U128.new(0xdc21a1171d42645d, 0x76707543f4fa1f73), // 5^136 U128.new(0x899504ae72497eba, 0x6a06494a791c53a8), // 5^137 U128.new(0xabfa45da0edbde69, 0x487db9d17636892), // 5^138 U128.new(0xd6f8d7509292d603, 0x45a9d2845d3c42b6), // 5^139 U128.new(0x865b86925b9bc5c2, 0xb8a2392ba45a9b2), // 5^140 U128.new(0xa7f26836f282b732, 0x8e6cac7768d7141e), // 5^141 U128.new(0xd1ef0244af2364ff, 0x3207d795430cd926), // 5^142 U128.new(0x8335616aed761f1f, 0x7f44e6bd49e807b8), // 5^143 U128.new(0xa402b9c5a8d3a6e7, 0x5f16206c9c6209a6), // 5^144 U128.new(0xcd036837130890a1, 0x36dba887c37a8c0f), // 5^145 U128.new(0x802221226be55a64, 0xc2494954da2c9789), // 5^146 U128.new(0xa02aa96b06deb0fd, 0xf2db9baa10b7bd6c), // 5^147 U128.new(0xc83553c5c8965d3d, 0x6f92829494e5acc7), // 5^148 U128.new(0xfa42a8b73abbf48c, 0xcb772339ba1f17f9), // 5^149 U128.new(0x9c69a97284b578d7, 0xff2a760414536efb), // 5^150 U128.new(0xc38413cf25e2d70d, 0xfef5138519684aba), // 5^151 U128.new(0xf46518c2ef5b8cd1, 0x7eb258665fc25d69), // 5^152 U128.new(0x98bf2f79d5993802, 0xef2f773ffbd97a61), // 5^153 U128.new(0xbeeefb584aff8603, 0xaafb550ffacfd8fa), // 5^154 U128.new(0xeeaaba2e5dbf6784, 0x95ba2a53f983cf38), // 5^155 U128.new(0x952ab45cfa97a0b2, 0xdd945a747bf26183), // 5^156 U128.new(0xba756174393d88df, 0x94f971119aeef9e4), // 5^157 U128.new(0xe912b9d1478ceb17, 0x7a37cd5601aab85d), // 5^158 U128.new(0x91abb422ccb812ee, 0xac62e055c10ab33a), // 5^159 U128.new(0xb616a12b7fe617aa, 0x577b986b314d6009), // 5^160 U128.new(0xe39c49765fdf9d94, 0xed5a7e85fda0b80b), // 5^161 U128.new(0x8e41ade9fbebc27d, 0x14588f13be847307), // 5^162 U128.new(0xb1d219647ae6b31c, 0x596eb2d8ae258fc8), // 5^163 U128.new(0xde469fbd99a05fe3, 0x6fca5f8ed9aef3bb), // 5^164 U128.new(0x8aec23d680043bee, 0x25de7bb9480d5854), // 5^165 U128.new(0xada72ccc20054ae9, 0xaf561aa79a10ae6a), // 5^166 U128.new(0xd910f7ff28069da4, 0x1b2ba1518094da04), // 5^167 U128.new(0x87aa9aff79042286, 0x90fb44d2f05d0842), // 5^168 U128.new(0xa99541bf57452b28, 0x353a1607ac744a53), // 5^169 U128.new(0xd3fa922f2d1675f2, 0x42889b8997915ce8), // 5^170 U128.new(0x847c9b5d7c2e09b7, 0x69956135febada11), // 5^171 U128.new(0xa59bc234db398c25, 0x43fab9837e699095), // 5^172 U128.new(0xcf02b2c21207ef2e, 0x94f967e45e03f4bb), // 5^173 U128.new(0x8161afb94b44f57d, 0x1d1be0eebac278f5), // 5^174 U128.new(0xa1ba1ba79e1632dc, 0x6462d92a69731732), // 5^175 U128.new(0xca28a291859bbf93, 0x7d7b8f7503cfdcfe), // 5^176 U128.new(0xfcb2cb35e702af78, 0x5cda735244c3d43e), // 5^177 U128.new(0x9defbf01b061adab, 0x3a0888136afa64a7), // 5^178 U128.new(0xc56baec21c7a1916, 0x88aaa1845b8fdd0), // 5^179 U128.new(0xf6c69a72a3989f5b, 0x8aad549e57273d45), // 5^180 U128.new(0x9a3c2087a63f6399, 0x36ac54e2f678864b), // 5^181 U128.new(0xc0cb28a98fcf3c7f, 0x84576a1bb416a7dd), // 5^182 U128.new(0xf0fdf2d3f3c30b9f, 0x656d44a2a11c51d5), // 5^183 U128.new(0x969eb7c47859e743, 0x9f644ae5a4b1b325), // 5^184 U128.new(0xbc4665b596706114, 0x873d5d9f0dde1fee), // 5^185 U128.new(0xeb57ff22fc0c7959, 0xa90cb506d155a7ea), // 5^186 U128.new(0x9316ff75dd87cbd8, 0x9a7f12442d588f2), // 5^187 U128.new(0xb7dcbf5354e9bece, 0xc11ed6d538aeb2f), // 5^188 U128.new(0xe5d3ef282a242e81, 0x8f1668c8a86da5fa), // 5^189 U128.new(0x8fa475791a569d10, 0xf96e017d694487bc), // 5^190 U128.new(0xb38d92d760ec4455, 0x37c981dcc395a9ac), // 5^191 U128.new(0xe070f78d3927556a, 0x85bbe253f47b1417), // 5^192 U128.new(0x8c469ab843b89562, 0x93956d7478ccec8e), // 5^193 U128.new(0xaf58416654a6babb, 0x387ac8d1970027b2), // 5^194 U128.new(0xdb2e51bfe9d0696a, 0x6997b05fcc0319e), // 5^195 U128.new(0x88fcf317f22241e2, 0x441fece3bdf81f03), // 5^196 U128.new(0xab3c2fddeeaad25a, 0xd527e81cad7626c3), // 5^197 U128.new(0xd60b3bd56a5586f1, 0x8a71e223d8d3b074), // 5^198 U128.new(0x85c7056562757456, 0xf6872d5667844e49), // 5^199 U128.new(0xa738c6bebb12d16c, 0xb428f8ac016561db), // 5^200 U128.new(0xd106f86e69d785c7, 0xe13336d701beba52), // 5^201 U128.new(0x82a45b450226b39c, 0xecc0024661173473), // 5^202 U128.new(0xa34d721642b06084, 0x27f002d7f95d0190), // 5^203 U128.new(0xcc20ce9bd35c78a5, 0x31ec038df7b441f4), // 5^204 U128.new(0xff290242c83396ce, 0x7e67047175a15271), // 5^205 U128.new(0x9f79a169bd203e41, 0xf0062c6e984d386), // 5^206 U128.new(0xc75809c42c684dd1, 0x52c07b78a3e60868), // 5^207 U128.new(0xf92e0c3537826145, 0xa7709a56ccdf8a82), // 5^208 U128.new(0x9bbcc7a142b17ccb, 0x88a66076400bb691), // 5^209 U128.new(0xc2abf989935ddbfe, 0x6acff893d00ea435), // 5^210 U128.new(0xf356f7ebf83552fe, 0x583f6b8c4124d43), // 5^211 U128.new(0x98165af37b2153de, 0xc3727a337a8b704a), // 5^212 U128.new(0xbe1bf1b059e9a8d6, 0x744f18c0592e4c5c), // 5^213 U128.new(0xeda2ee1c7064130c, 0x1162def06f79df73), // 5^214 U128.new(0x9485d4d1c63e8be7, 0x8addcb5645ac2ba8), // 5^215 U128.new(0xb9a74a0637ce2ee1, 0x6d953e2bd7173692), // 5^216 U128.new(0xe8111c87c5c1ba99, 0xc8fa8db6ccdd0437), // 5^217 U128.new(0x910ab1d4db9914a0, 0x1d9c9892400a22a2), // 5^218 U128.new(0xb54d5e4a127f59c8, 0x2503beb6d00cab4b), // 5^219 U128.new(0xe2a0b5dc971f303a, 0x2e44ae64840fd61d), // 5^220 U128.new(0x8da471a9de737e24, 0x5ceaecfed289e5d2), // 5^221 U128.new(0xb10d8e1456105dad, 0x7425a83e872c5f47), // 5^222 U128.new(0xdd50f1996b947518, 0xd12f124e28f77719), // 5^223 U128.new(0x8a5296ffe33cc92f, 0x82bd6b70d99aaa6f), // 5^224 U128.new(0xace73cbfdc0bfb7b, 0x636cc64d1001550b), // 5^225 U128.new(0xd8210befd30efa5a, 0x3c47f7e05401aa4e), // 5^226 U128.new(0x8714a775e3e95c78, 0x65acfaec34810a71), // 5^227 U128.new(0xa8d9d1535ce3b396, 0x7f1839a741a14d0d), // 5^228 U128.new(0xd31045a8341ca07c, 0x1ede48111209a050), // 5^229 U128.new(0x83ea2b892091e44d, 0x934aed0aab460432), // 5^230 U128.new(0xa4e4b66b68b65d60, 0xf81da84d5617853f), // 5^231 U128.new(0xce1de40642e3f4b9, 0x36251260ab9d668e), // 5^232 U128.new(0x80d2ae83e9ce78f3, 0xc1d72b7c6b426019), // 5^233 U128.new(0xa1075a24e4421730, 0xb24cf65b8612f81f), // 5^234 U128.new(0xc94930ae1d529cfc, 0xdee033f26797b627), // 5^235 U128.new(0xfb9b7cd9a4a7443c, 0x169840ef017da3b1), // 5^236 U128.new(0x9d412e0806e88aa5, 0x8e1f289560ee864e), // 5^237 U128.new(0xc491798a08a2ad4e, 0xf1a6f2bab92a27e2), // 5^238 U128.new(0xf5b5d7ec8acb58a2, 0xae10af696774b1db), // 5^239 U128.new(0x9991a6f3d6bf1765, 0xacca6da1e0a8ef29), // 5^240 U128.new(0xbff610b0cc6edd3f, 0x17fd090a58d32af3), // 5^241 U128.new(0xeff394dcff8a948e, 0xddfc4b4cef07f5b0), // 5^242 U128.new(0x95f83d0a1fb69cd9, 0x4abdaf101564f98e), // 5^243 U128.new(0xbb764c4ca7a4440f, 0x9d6d1ad41abe37f1), // 5^244 U128.new(0xea53df5fd18d5513, 0x84c86189216dc5ed), // 5^245 U128.new(0x92746b9be2f8552c, 0x32fd3cf5b4e49bb4), // 5^246 U128.new(0xb7118682dbb66a77, 0x3fbc8c33221dc2a1), // 5^247 U128.new(0xe4d5e82392a40515, 0xfabaf3feaa5334a), // 5^248 U128.new(0x8f05b1163ba6832d, 0x29cb4d87f2a7400e), // 5^249 U128.new(0xb2c71d5bca9023f8, 0x743e20e9ef511012), // 5^250 U128.new(0xdf78e4b2bd342cf6, 0x914da9246b255416), // 5^251 U128.new(0x8bab8eefb6409c1a, 0x1ad089b6c2f7548e), // 5^252 U128.new(0xae9672aba3d0c320, 0xa184ac2473b529b1), // 5^253 U128.new(0xda3c0f568cc4f3e8, 0xc9e5d72d90a2741e), // 5^254 U128.new(0x8865899617fb1871, 0x7e2fa67c7a658892), // 5^255 U128.new(0xaa7eebfb9df9de8d, 0xddbb901b98feeab7), // 5^256 U128.new(0xd51ea6fa85785631, 0x552a74227f3ea565), // 5^257 U128.new(0x8533285c936b35de, 0xd53a88958f87275f), // 5^258 U128.new(0xa67ff273b8460356, 0x8a892abaf368f137), // 5^259 U128.new(0xd01fef10a657842c, 0x2d2b7569b0432d85), // 5^260 U128.new(0x8213f56a67f6b29b, 0x9c3b29620e29fc73), // 5^261 U128.new(0xa298f2c501f45f42, 0x8349f3ba91b47b8f), // 5^262 U128.new(0xcb3f2f7642717713, 0x241c70a936219a73), // 5^263 U128.new(0xfe0efb53d30dd4d7, 0xed238cd383aa0110), // 5^264 U128.new(0x9ec95d1463e8a506, 0xf4363804324a40aa), // 5^265 U128.new(0xc67bb4597ce2ce48, 0xb143c6053edcd0d5), // 5^266 U128.new(0xf81aa16fdc1b81da, 0xdd94b7868e94050a), // 5^267 U128.new(0x9b10a4e5e9913128, 0xca7cf2b4191c8326), // 5^268 U128.new(0xc1d4ce1f63f57d72, 0xfd1c2f611f63a3f0), // 5^269 U128.new(0xf24a01a73cf2dccf, 0xbc633b39673c8cec), // 5^270 U128.new(0x976e41088617ca01, 0xd5be0503e085d813), // 5^271 U128.new(0xbd49d14aa79dbc82, 0x4b2d8644d8a74e18), // 5^272 U128.new(0xec9c459d51852ba2, 0xddf8e7d60ed1219e), // 5^273 U128.new(0x93e1ab8252f33b45, 0xcabb90e5c942b503), // 5^274 U128.new(0xb8da1662e7b00a17, 0x3d6a751f3b936243), // 5^275 U128.new(0xe7109bfba19c0c9d, 0xcc512670a783ad4), // 5^276 U128.new(0x906a617d450187e2, 0x27fb2b80668b24c5), // 5^277 U128.new(0xb484f9dc9641e9da, 0xb1f9f660802dedf6), // 5^278 U128.new(0xe1a63853bbd26451, 0x5e7873f8a0396973), // 5^279 U128.new(0x8d07e33455637eb2, 0xdb0b487b6423e1e8), // 5^280 U128.new(0xb049dc016abc5e5f, 0x91ce1a9a3d2cda62), // 5^281 U128.new(0xdc5c5301c56b75f7, 0x7641a140cc7810fb), // 5^282 U128.new(0x89b9b3e11b6329ba, 0xa9e904c87fcb0a9d), // 5^283 U128.new(0xac2820d9623bf429, 0x546345fa9fbdcd44), // 5^284 U128.new(0xd732290fbacaf133, 0xa97c177947ad4095), // 5^285 U128.new(0x867f59a9d4bed6c0, 0x49ed8eabcccc485d), // 5^286 U128.new(0xa81f301449ee8c70, 0x5c68f256bfff5a74), // 5^287 U128.new(0xd226fc195c6a2f8c, 0x73832eec6fff3111), // 5^288 U128.new(0x83585d8fd9c25db7, 0xc831fd53c5ff7eab), // 5^289 U128.new(0xa42e74f3d032f525, 0xba3e7ca8b77f5e55), // 5^290 U128.new(0xcd3a1230c43fb26f, 0x28ce1bd2e55f35eb), // 5^291 U128.new(0x80444b5e7aa7cf85, 0x7980d163cf5b81b3), // 5^292 U128.new(0xa0555e361951c366, 0xd7e105bcc332621f), // 5^293 U128.new(0xc86ab5c39fa63440, 0x8dd9472bf3fefaa7), // 5^294 U128.new(0xfa856334878fc150, 0xb14f98f6f0feb951), // 5^295 U128.new(0x9c935e00d4b9d8d2, 0x6ed1bf9a569f33d3), // 5^296 U128.new(0xc3b8358109e84f07, 0xa862f80ec4700c8), // 5^297 U128.new(0xf4a642e14c6262c8, 0xcd27bb612758c0fa), // 5^298 U128.new(0x98e7e9cccfbd7dbd, 0x8038d51cb897789c), // 5^299 U128.new(0xbf21e44003acdd2c, 0xe0470a63e6bd56c3), // 5^300 U128.new(0xeeea5d5004981478, 0x1858ccfce06cac74), // 5^301 U128.new(0x95527a5202df0ccb, 0xf37801e0c43ebc8), // 5^302 U128.new(0xbaa718e68396cffd, 0xd30560258f54e6ba), // 5^303 U128.new(0xe950df20247c83fd, 0x47c6b82ef32a2069), // 5^304 U128.new(0x91d28b7416cdd27e, 0x4cdc331d57fa5441), // 5^305 U128.new(0xb6472e511c81471d, 0xe0133fe4adf8e952), // 5^306 U128.new(0xe3d8f9e563a198e5, 0x58180fddd97723a6), // 5^307 U128.new(0x8e679c2f5e44ff8f, 0x570f09eaa7ea7648), // 5^308 };
lib/std/fmt/parse_float/convert_eisel_lemire.zig
const std = @import("std"); const Dir = std.fs.Dir; const warn = std.debug.warn; const rt = @import("../runtime.zig"); const FnDecl = rt.TypeInfo.Declaration.Data.FnDecl; const FnMeta = rt.TypeInfo.Fn; const StructMeta = rt.TypeInfo.Struct; const EnumMeta = rt.TypeInfo.Enum; const UnionMeta = rt.TypeInfo.Union; const SymbolPhase = @import("ordered.zig").SymbolPhase; pub const Python_Generator = struct { pub const symbols_order: bool = false; file: std.fs.File, const Self = @This(); pub fn init(comptime src_file: []const u8, dst_dir: *Dir) Self { comptime const filebaseext = std.fs.path.basename(src_file); // The .len - 4 assumes a .zig extension comptime const filebase = filebaseext[0 .. filebaseext.len - 4]; var file = dst_dir.createFile(filebase ++ ".py", .{}) catch @panic("Failed to create header file for source: " ++ src_file); var res = Self{ .file = file }; res.write( \\import ctypes \\import enum \\ ); res.write("lib = ctypes.cdll.LoadLibrary(\"" ++ filebase ++ ".dll\")\n\n"); return res; } pub fn deinit(self: *Self) void { self.file.close(); } pub fn gen_func(self: *Self, name: []const u8, meta: FnMeta) void { self.print("lib.{}.argtypes = [", .{name}); for (meta.args) |arg, i| { if (arg.arg_type) |t| { self.writeType(t.*); } else { self.write("None"); } if (i != meta.args.len - 1) { self.write(", "); } } self.write("]\n"); self.print("lib.{}.restype = ", .{name}); if (meta.return_type) |return_type| { self.writeType(return_type.*); } else { self.write("None"); } self.write("\n\n"); } pub fn _gen_fields(self: *Self, name: []const u8, fields: anytype, phase: SymbolPhase) void { comptime const prefix = "\t "; if (phase == .Body) { self.print("{}._fields_ = [", .{name}); } else { self.write("\t_fields_ = ["); } for (fields) |field, i| { if (i > 0) { self.write(prefix); } self.print("(\"{}\", ", .{field.name}); self.writeType(field.field_type.*); self.write(")"); if (i != fields.len - 1) { self.write(",\n"); } } self.write("]\n"); } pub fn gen_struct(self: *Self, name: []const u8, meta: StructMeta, phase: SymbolPhase) void { if (phase != .Body) { self.print("class {}(ctypes.Structure):\n", .{name}); if (meta.layout == .Packed) { self.write("\t_pack_ = 1\n"); } } if (phase != .Signature) { self._gen_fields(name, meta.fields, phase); } else if (meta.layout != .Packed) { self.write("\tpass\n"); } self.write("\n"); } pub fn gen_enum(self: *Self, name: []const u8, meta: EnumMeta, phase: SymbolPhase) void { self.print("class {}(enum.IntEnum):\n", .{name}); for (meta.fields) |field, i| { self.write("\t"); self.writeScreamingSnakeCase(field.name); self.print(" = {}\n", .{field.value}); } if (meta.fields.len == 0) { self.write("\tpass"); } self.write("\n"); } pub fn gen_union(self: *Self, name: []const u8, meta: UnionMeta, phase: SymbolPhase) void { if (phase != .Body) { self.print("class {}(ctypes.Union):\n", .{name}); } if (phase != .Signature) { self._gen_fields(name, meta.fields, phase); } else { self.write("\tpass\n"); } self.write("\n"); } fn writeType(self: *Self, meta: rt.TypeInfo) void { switch (meta) { .Void => self.write("None"), .Bool => self.write("ctypes.c_bool"), // .usize => self.writeCtype("c_usize"), // TODO // .isize => self.writeCtype("c_isize"), // TODO .Int => |i| { switch (i.is_signed) { true => self.print("ctypes.c_int{}", .{i.bits}), false => self.print("ctypes.c_uint{}", .{i.bits}), } }, .Float => |f| { switch (f.bits) { 32 => self.write("c_float"), 64 => self.write("c_double"), 128 => self.write("c_longdouble"), else => self.print("ctypes.c_f{}", .{f.bits}), } }, .Struct => |s| self.write(s.name orelse "__unknown__"), .Union => |s| self.write(s.name orelse "__unknown__"), .Enum => |s| self.write(s.name orelse "__unknown__"), .Pointer => |p| { const childmeta = p.child.*; self.writeCtype("POINTER("); if (childmeta == .Struct and childmeta.Struct.layout != .Extern) { self.writeCtype("c_size_t"); } else { self.writeType(childmeta); } self.write(")"); }, .Optional => self.writeType(meta.Optional.child.*), .Array => |a| { self.writeType(a.child.*); self.print(" * {}", .{a.len}); }, else => self.write(@tagName(meta)), // TODO!!!!! } } fn writeScreamingSnakeCase(self: *Self, str: []const u8) void { var new_word: bool = false; var was_lower: bool = false; var is_upper: bool = undefined; for (str) |char, i| { is_upper = std.ascii.isUpper(char); if (char == '_' and i > 0) { new_word = true; continue; } if (new_word == true or (is_upper and was_lower)) { new_word = false; was_lower = false; self.writeChar('_'); } else { was_lower = !is_upper; } self.writeChar(std.ascii.toUpper(char)); } } fn writeCtype(self: *Self, comptime str: []const u8) void { self.write("ctypes." ++ str); } fn writeChar(self: *Self, char: u8) void { self.write(&[1]u8{char}); } fn print(self: *Self, comptime fmt: []const u8, args: anytype) void { self.file.writer().print(fmt, args) catch unreachable; } fn write(self: *Self, str: []const u8) void { _ = self.file.writeAll(str) catch unreachable; } };
src/generators/python.zig
const std = @import("std"); const BufferedInStreamCustom = std.io.BufferedInStreamCustom; const BufferedOutStreamCustom = std.io.BufferedOutStreamCustom; const File = std.os.File; const InStreamError = File.ReadError; const OutStreamError = File.WriteError; const InStream = std.io.InStream(InStreamError); const OutStream = std.io.OutStream(OutStreamError); pub fn main() !void { // Get standard error var stderr_file: File = try std.io.getStdErr(); var stderr: *OutStream = &std.io.FileOutStream.init(&stderr_file).stream; // Get a buffered stream for stdout and be sure we flush when done, error or not var stdout_file = try std.io.getStdOut(); var stdout = &std.io.FileOutStream.init(&stdout_file).stream; const buffered_stdout = &BufferedOutStreamCustom(std.os.page_size, OutStreamError).init(stdout); var stdout_bs: *OutStream = &buffered_stdout.stream; defer buffered_stdout.flush() catch {}; // Get a buffered stream for stdin var stdin_file = try std.io.getStdIn(); var stdin: *InStream = &std.io.FileInStream.init(&stdin_file).stream; const buffered_stdin = &BufferedInStreamCustom(std.os.page_size, InStreamError).init(stdin); var stdin_bs = &buffered_stdin.stream; // Declare counter and then when the program ends, error or not we'll print the count var count: u64 = 0; defer stderr.print("count={}\n", count) catch {}; // Loop to read/write a byte while (true) { if (true) { // A little faster, 303-312ms for 4M file, reading into an array var byte: [1]u8 = undefined; stdin_bs.readNoEof(byte[0..]) catch |err| switch (err) { error.EndOfStream => return, // I don't like the comma's here, should be semi-colon else => return err, }; try stdout_bs.write(byte); } else { // A little slower 348-423ms for 4M file var byte = stdin_bs.readByte() catch |err| switch (err) { error.EndOfStream => return, // I don't like the comma's here, should be semi-colon else => return err, }; try stdout_bs.writeByte(byte); } count += 1; } }
streams/main.zig
const std = @import("std"); const meta = std.meta; const trait = meta.trait; const Allocator = std.mem.Allocator; const testing = std.testing; const assert = std.debug.assert; const mustache = @import("../mustache.zig"); const RenderOptions = mustache.options.RenderOptions; const TemplateOptions = mustache.options.TemplateOptions; const RenderTemplateOptions = mustache.options.RenderTemplateOptions; const RenderTextOptions = mustache.options.RenderTextOptions; const RenderFileOptions = mustache.options.RenderFileOptions; const Delimiters = mustache.Delimiters; const Element = mustache.Element; const ParseError = mustache.ParseError; const Template = mustache.Template; const TemplateLoader = @import("../template.zig").TemplateLoader; const context = @import("context.zig"); const Escape = context.Escape; const invoker = @import("invoker.zig"); const Fields = invoker.Fields; const indent = @import("indent.zig"); const map = @import("partials_map.zig"); const FileError = std.fs.File.OpenError || std.fs.File.ReadError; const BufError = std.io.FixedBufferStream([]u8).WriteError; pub const LambdaContext = @import("lambda.zig").LambdaContext; /// Renders the `Template` with the given `data` to a `writer`. pub fn render(template: Template, data: anytype, writer: anytype) !void { return try renderPartialsWithOptions(template, {}, data, writer, .{}); } /// Renders the `Template` with the given `data` to a `writer`. /// `options` defines the behavior of the render process pub fn renderWithOptions(template: Template, data: anytype, writer: anytype, comptime options: mustache.options.RenderTemplateOptions) !void { return try renderPartialsWithOptions(template, {}, data, writer, options); } /// Renders the `Template` with the given `data` to a `writer`. /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the `Template` as value pub fn renderPartials(template: Template, partials: anytype, data: anytype, writer: anytype) !void { return try renderPartialsWithOptions(template, partials, data, writer, .{}); } /// Renders the `Template` with the given `data` to a `writer`. /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the `Template` as value /// `options` defines the behavior of the render process pub fn renderPartialsWithOptions(template: Template, partials: anytype, data: anytype, writer: anytype, comptime options: mustache.options.RenderTemplateOptions) !void { const render_options = RenderOptions{ .Template = options }; try internalRender(template, partials, data, writer, render_options); } /// Renders the `Template` with the given `data` and returns an owned slice with the content. /// Caller must free the memory pub fn allocRender(allocator: Allocator, template: Template, data: anytype) Allocator.Error![]const u8 { return try allocRenderPartialsWithOptions(allocator, template, {}, data, .{}); } /// Renders the `Template` with the given `data` and returns an owned slice with the content. /// `options` defines the behavior of the render process /// Caller must free the memory pub fn allocRenderWithOptions(allocator: Allocator, template: Template, data: anytype, comptime options: mustache.options.RenderTemplateOptions) Allocator.Error![]const u8 { return try allocRenderPartialsWithOptions(allocator, template, {}, data, options); } /// Renders the `Template` with the given `data` to a writer. /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the `Template` as value /// Caller must free the memory pub fn allocRenderPartials(allocator: Allocator, template: Template, partials: anytype, data: anytype) Allocator.Error![]const u8 { return try allocRenderPartialsWithOptions(allocator, template, partials, data, .{}); } /// Renders the `Template` with the given `data` to a writer. /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the `Template` as value /// `options` defines the behavior of the render process /// Caller must free the memory pub fn allocRenderPartialsWithOptions(allocator: Allocator, template: Template, partials: anytype, data: anytype, comptime options: mustache.options.RenderTemplateOptions) Allocator.Error![]const u8 { const render_options = RenderOptions{ .Template = options }; return try internalAllocRender(allocator, template, partials, data, render_options, null); } /// Renders the `Template` with the given `data` and returns an owned sentinel-terminated slice with the content. /// Caller must free the memory pub fn allocRenderZ(allocator: Allocator, template: Template, data: anytype) Allocator.Error![:0]const u8 { return try allocRenderZPartialsWithOptions(allocator, template, {}, data, .{}); } /// Renders the `Template` with the given `data` and returns an owned sentinel-terminated slice with the content. /// `options` defines the behavior of the render process /// Caller must free the memory pub fn allocRenderZWithOptions(allocator: Allocator, template: Template, data: anytype, comptime options: mustache.options.RenderTemplateOptions) Allocator.Error![:0]const u8 { return try allocRenderZPartialsWithOptions(allocator, template, {}, data, options); } /// Renders the `Template` with the given `data` and returns an owned sentinel-terminated slice with the content. /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the `Template` as value /// Caller must free the memory pub fn allocRenderZPartials(allocator: Allocator, template: Template, partials: anytype, data: anytype) Allocator.Error![:0]const u8 { return try allocRenderZPartialsWithOptions(allocator, template, partials, data, .{}); } /// Renders the `Template` with the given `data` and returns an owned sentinel-terminated slice with the content. /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the `Template` as value /// `options` defines the behavior of the render process /// Caller must free the memory pub fn allocRenderZPartialsWithOptions(allocator: Allocator, template: Template, partials: anytype, data: anytype, comptime options: mustache.options.RenderTemplateOptions) Allocator.Error![:0]const u8 { const render_options = RenderOptions{ .Template = options }; return try internalAllocRender(allocator, template, partials, data, render_options, '\x00'); } /// Renders the `Template` with the given `data` to a buffer. /// Returns a slice pointing to the underlying buffer pub fn bufRender(buf: []u8, template: Template, data: anytype) (Allocator.Error || BufError)![]const u8 { return try bufRenderPartialsWithOptions(buf, template, {}, data, .{}); } /// Renders the `Template` with the given `data` to a buffer. /// `options` defines the behavior of the render process /// Returns a slice pointing to the underlying buffer pub fn bufRenderWithOptions(buf: []u8, template: Template, data: anytype, comptime options: mustache.options.RenderTemplateOptions) (Allocator.Error || BufError)![]const u8 { return try bufRenderPartialsWithOptions(buf, template, {}, data, options); } /// Renders the `Template` with the given `data` to a buffer. /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the `Template` as value /// Returns a slice pointing to the underlying buffer pub fn bufRenderPartials(buf: []u8, template: Template, partials: anytype, data: anytype) (Allocator.Error || BufError)![]const u8 { return bufRenderPartialsWithOptions(buf, template, partials, data, .{}); } /// Renders the `Template` with the given `data` to a buffer. /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the `Template` as value /// `options` defines the behavior of the render process /// Returns a slice pointing to the underlying buffer pub fn bufRenderPartialsWithOptions(buf: []u8, template: Template, partials: anytype, data: anytype, comptime options: mustache.options.RenderTemplateOptions) (Allocator.Error || BufError)![]const u8 { var fbs = std.io.fixedBufferStream(buf); try renderPartialsWithOptions(template, partials, data, fbs.writer(), options); return fbs.getWritten(); } /// Renders the `Template` with the given `data` to a buffer, terminated by the zero sentinel. /// Returns a slice pointing to the underlying buffer pub fn bufRenderZ(buf: []u8, template: Template, data: anytype) (Allocator.Error || BufError)![:0]const u8 { return try bufRenderZPartialsWithOptions(buf, template, {}, data, .{}); } /// Renders the `Template` with the given `data` to a buffer, terminated by the zero sentinel. /// `options` defines the behavior of the render process /// Returns a slice pointing to the underlying buffer pub fn bufRenderZWithOptions(buf: []u8, template: Template, data: anytype, comptime options: mustache.options.RenderTemplateOptions) (Allocator.Error || BufError)![:0]const u8 { return try bufRenderZPartialsWithOptions(buf, template, {}, data, options); } /// Renders the `Template` with the given `data` to a buffer, terminated by the zero sentinel. /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the `Template` as value /// Returns a slice pointing to the underlying buffer pub fn bufRenderZPartials(buf: []u8, template: Template, partials: anytype, data: anytype) (Allocator.Error || BufError)![:0]const u8 { return try bufRenderZPartialsWithOptions(buf, template, partials, data, .{}); } /// Renders the `Template` with the given `data` to a buffer, terminated by the zero sentinel. /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the `Template` as value /// `options` defines the behavior of the render process /// Returns a slice pointing to the underlying buffer pub fn bufRenderZPartialsWithOptions(buf: []u8, template: Template, partials: anytype, data: anytype, comptime options: mustache.options.RenderTemplateOptions) (Allocator.Error || BufError)![:0]const u8 { var ret = try bufRenderPartialsWithOptions(buf, template, partials, data, options); if (ret.len < buf.len) { buf[ret.len] = '\x00'; return buf[0..ret.len :0]; } else { return BufError.NoSpaceLeft; } } /// Parses the `template_text` and renders with the given `data` to a `writer` pub fn renderText(allocator: Allocator, template_text: []const u8, data: anytype, writer: anytype) (Allocator.Error || ParseError || @TypeOf(writer).Error)!void { try renderTextPartialsWithOptions(allocator, template_text, {}, data, writer, .{}); } /// Parses the `template_text` and renders with the given `data` to a `writer` /// `options` defines the behavior of the parser and render process pub fn renderTextWithOptions(allocator: Allocator, template_text: []const u8, data: anytype, writer: anytype, comptime options: mustache.options.RenderTextOptions) (Allocator.Error || ParseError || @TypeOf(writer).Error)!void { try renderTextPartialsWithOptions(allocator, template_text, {}, data, writer, options); } /// Parses the `template_text` and renders with the given `data` to a `writer` /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the template text as value pub fn renderTextPartials(allocator: Allocator, template_text: []const u8, partials: anytype, data: anytype, writer: anytype) (Allocator.Error || ParseError || @TypeOf(writer).Error)!void { try renderTextPartialsWithOptions(allocator, template_text, partials, data, writer, .{}); } /// Parses the `template_text` and renders with the given `data` to a `writer` /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the template text as value /// `options` defines the behavior of the parser and render process pub fn renderTextPartialsWithOptions(allocator: Allocator, template_text: []const u8, partials: anytype, data: anytype, writer: anytype, comptime options: mustache.options.RenderTextOptions) (Allocator.Error || ParseError || @TypeOf(writer).Error)!void { const render_options = RenderOptions{ .Text = options }; try internalCollect(allocator, template_text, partials, data, writer, render_options); } /// Parses the `template_text` and renders with the given `data` and returns an owned slice with the content. /// Caller must free the memory pub fn allocRenderText(allocator: Allocator, template_text: []const u8, data: anytype) (Allocator.Error || ParseError)![]const u8 { return try allocRenderTextPartialsWithOptions(allocator, template_text, {}, data, .{}); } /// Parses the `template_text` and renders with the given `data` and returns an owned slice with the content. /// `options` defines the behavior of the parser and render process /// Caller must free the memory pub fn allocRenderTextWithOptions(allocator: Allocator, template_text: []const u8, data: anytype, comptime options: mustache.options.RenderTextOptions) (Allocator.Error || ParseError)![]const u8 { return try allocRenderTextPartialsWithOptions(allocator, template_text, {}, data, options); } /// Parses the `template_text` and renders with the given `data` and returns an owned slice with the content. /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the template text as value /// Caller must free the memory pub fn allocRenderTextPartials(allocator: Allocator, template_text: []const u8, partials: anytype, data: anytype) (Allocator.Error || ParseError)![]const u8 { return try allocRenderTextPartialsWithOptions(allocator, template_text, partials, data, .{}); } /// Parses the `template_text` and renders with the given `data` and returns an owned slice with the content. /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the template text as value /// `options` defines the behavior of the parser and render process /// Caller must free the memory pub fn allocRenderTextPartialsWithOptions(allocator: Allocator, template_text: []const u8, partials: anytype, data: anytype, comptime options: mustache.options.RenderTextOptions) (Allocator.Error || ParseError)![]const u8 { const render_options = RenderOptions{ .Text = options }; return try internalAllocCollect(allocator, template_text, partials, data, render_options, null); } /// Parses the `template_text` and renders with the given `data` and returns an owned sentinel-terminated slice with the content. /// Caller must free the memory pub fn allocRenderTextZ(allocator: Allocator, template_text: []const u8, data: anytype) (Allocator.Error || ParseError)![:0]const u8 { return try allocRenderTextZPartialsWithOptions(allocator, template_text, {}, data, .{}); } /// Parses the `template_text` and renders with the given `data` and returns an owned sentinel-terminated slice with the content. /// `options` defines the behavior of the parser and render process /// Caller must free the memory pub fn allocRenderTextZWithOptions(allocator: Allocator, template_text: []const u8, data: anytype, comptime options: mustache.options.RenderTextOptions) (Allocator.Error || ParseError)![:0]const u8 { return try allocRenderTextZPartialsWithOptions(allocator, template_text, {}, data, options); } /// Parses the `template_text` and renders with the given `data` and returns an owned sentinel-terminated slice with the content. /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the template text as value /// Caller must free the memory pub fn allocRenderTextZPartials(allocator: Allocator, template_text: []const u8, partials: anytype, data: anytype) (Allocator.Error || ParseError)![:0]const u8 { return try allocRenderTextZPartialsWithOptions(allocator, template_text, partials, data, .{}); } /// Parses the `template_text` and renders with the given `data` and returns an owned sentinel-terminated slice with the content. /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the template text as value /// `options` defines the behavior of the parser and render process /// Caller must free the memory pub fn allocRenderTextZPartialsWithOptions(allocator: Allocator, template_text: []const u8, partials: anytype, data: anytype, comptime options: mustache.options.RenderTextOptions) (Allocator.Error || ParseError)![:0]const u8 { const render_options = RenderOptions{ .Text = options }; return try internalAllocCollect(allocator, template_text, partials, data, render_options, '\x00'); } /// Parses the file indicated by `template_absolute_path` and renders with the given `data` to a `writer` pub fn renderFile(allocator: Allocator, template_absolute_path: []const u8, data: anytype, writer: anytype) (Allocator.Error || ParseError || FileError || @TypeOf(writer).Error)!void { try renderFilePartialsWithOptions(allocator, template_absolute_path, {}, data, writer, .{}); } /// Parses the file indicated by `template_absolute_path` and renders with the given `data` to a `writer` /// `options` defines the behavior of the parser and render process pub fn renderFileWithOptions(allocator: Allocator, template_absolute_path: []const u8, data: anytype, writer: anytype, comptime options: mustache.options.RenderFileOptions) (Allocator.Error || ParseError || FileError || @TypeOf(writer).Error)!void { try renderFilePartialsWithOptions(allocator, template_absolute_path, {}, data, writer, options); } /// Parses the file indicated by `template_absolute_path` and renders with the given `data` to a `writer` /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the template absolute path as value pub fn renderFilePartials(allocator: Allocator, template_absolute_path: []const u8, partials: anytype, data: anytype, writer: anytype) (Allocator.Error || ParseError || FileError || @TypeOf(writer).Error)!void { try renderFilePartialsWithOptions(allocator, template_absolute_path, partials, data, writer, .{}); } /// Parses the file indicated by `template_absolute_path` and renders with the given `data` to a `writer` /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the template absolute path as value /// `options` defines the behavior of the parser and render process pub fn renderFilePartialsWithOptions(allocator: Allocator, template_absolute_path: []const u8, partials: anytype, data: anytype, writer: anytype, comptime options: mustache.options.RenderFileOptions) (Allocator.Error || ParseError || FileError || @TypeOf(writer).Error)!void { const render_options = RenderOptions{ .File = options }; try internalCollect(allocator, template_absolute_path, partials, data, writer, render_options); } /// Parses the file indicated by `template_absolute_path` and renders with the given `data` and returns an owned slice with the content. /// Caller must free the memory pub fn allocRenderFile(allocator: Allocator, template_absolute_path: []const u8, data: anytype) (Allocator.Error || ParseError || FileError)![]const u8 { return try allocRenderFilePartialsWithOptions(allocator, template_absolute_path, {}, data, .{}); } /// Parses the file indicated by `template_absolute_path` and renders with the given `data` and returns an owned slice with the content. /// `options` defines the behavior of the parser and render process /// Caller must free the memory pub fn allocRenderFileWithOptions(allocator: Allocator, template_absolute_path: []const u8, data: anytype, comptime options: mustache.options.RenderFileOptions) (Allocator.Error || ParseError || FileError)![]const u8 { return try allocRenderFilePartialsWithOptions(allocator, template_absolute_path, {}, data, options); } /// Parses the file indicated by `template_absolute_path` and renders with the given `data` and returns an owned slice with the content. /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the template absolute path as value /// Caller must free the memory pub fn allocRenderFilePartials(allocator: Allocator, template_absolute_path: []const u8, partials: anytype, data: anytype) (Allocator.Error || ParseError || FileError)![]const u8 { return try allocRenderFilePartialsWithOptions(allocator, template_absolute_path, partials, data, .{}); } /// Parses the file indicated by `template_absolute_path` and renders with the given `data` and returns an owned slice with the content. /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the template absolute path as value /// `options` defines the behavior of the parser and render process /// Caller must free the memory pub fn allocRenderFilePartialsWithOptions(allocator: Allocator, template_absolute_path: []const u8, partials: anytype, data: anytype, comptime options: mustache.options.RenderFileOptions) (Allocator.Error || ParseError || FileError)![]const u8 { const render_options = RenderOptions{ .File = options }; return try internalAllocCollect(allocator, template_absolute_path, partials, data, render_options, null); } /// Parses the file indicated by `template_absolute_path` and renders with the given `data` and returns an owned slice with the content. /// Caller must free the memory pub fn allocRenderFileZ(allocator: Allocator, template_absolute_path: []const u8, data: anytype) (Allocator.Error || ParseError || FileError)![]const u8 { return try allocRenderFileZPartialsWithOptions(allocator, template_absolute_path, {}, data, .{}); } /// Parses the file indicated by `template_absolute_path` and renders with the given `data` and returns an owned slice with the content. /// `options` defines the behavior of the parser and render process /// Caller must free the memory pub fn allocRenderFileZWithOptions(allocator: Allocator, template_absolute_path: []const u8, data: anytype, comptime options: mustache.options.RenderFileOptions) (Allocator.Error || ParseError || FileError)![]const u8 { return try allocRenderFileZPartialsWithOptions(allocator, template_absolute_path, {}, data, options); } /// Parses the file indicated by `template_absolute_path` and renders with the given `data` and returns an owned slice with the content. /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the template absolute path as value /// Caller must free the memory pub fn allocRenderFileZPartials(allocator: Allocator, template_absolute_path: []const u8, partials: anytype, data: anytype) (Allocator.Error || ParseError || FileError)![]const u8 { return try allocRenderFileZPartialsWithOptions(allocator, template_absolute_path, partials, data, .{}); } /// Parses the file indicated by `template_absolute_path` and renders with the given `data` and returns an owned sentinel-terminated slice with the content. /// `partials` can be a tuple, an array, slice or a HashMap containing the partial's name as key and the template absolute path as value /// `options` defines the behavior of the parser and render process /// Caller must free the memory pub fn allocRenderFileZPartialsWithOptions(allocator: Allocator, template_absolute_path: []const u8, partials: anytype, data: anytype, comptime options: mustache.options.RenderFileOptions) (Allocator.Error || ParseError || FileError)![:0]const u8 { const render_options = RenderOptions{ .File = options }; return try internalAllocCollect(allocator, template_absolute_path, partials, data, render_options, '\x00'); } fn internalRender(template: Template, partials: anytype, data: anytype, writer: anytype, comptime options: RenderOptions) !void { comptime assert(options == .Template); const PartialsMap = map.PartialsMap(@TypeOf(partials), options); const Engine = RenderEngine(@TypeOf(writer), PartialsMap, options); try Engine.render(template, data, writer, PartialsMap.init(partials)); } fn internalAllocRender(allocator: Allocator, template: Template, partials: anytype, data: anytype, comptime options: RenderOptions, comptime sentinel: ?u8) !if (sentinel) |z| [:z]const u8 else []const u8 { comptime assert(options == .Template); var list = std.ArrayList(u8).init(allocator); defer list.deinit(); const Writer = @TypeOf(std.io.null_writer); const PartialsMap = map.PartialsMap(@TypeOf(partials), options); const Engine = RenderEngine(Writer, PartialsMap, options); try Engine.bufRender(list.writer(), template, data, PartialsMap.init(partials)); return if (comptime sentinel) |z| list.toOwnedSliceSentinel(z) else list.toOwnedSlice(); } fn internalCollect(allocator: Allocator, template: []const u8, partials: anytype, data: anytype, writer: anytype, comptime options: RenderOptions) !void { comptime assert(options != .Template); const PartialsMap = map.PartialsMap(@TypeOf(partials), options); const Engine = RenderEngine(@TypeOf(writer), PartialsMap, options); try Engine.collect(allocator, template, data, writer, PartialsMap.init(allocator, partials)); } fn internalAllocCollect(allocator: Allocator, template: []const u8, partials: anytype, data: anytype, comptime options: RenderOptions, comptime sentinel: ?u8) !if (sentinel) |z| [:z]const u8 else []const u8 { comptime assert(options != .Template); var list = std.ArrayList(u8).init(allocator); defer list.deinit(); const Writer = @TypeOf(std.io.null_writer); const PartialsMap = map.PartialsMap(@TypeOf(partials), options); const Engine = RenderEngine(Writer, PartialsMap, options); try Engine.bufCollect(allocator, list.writer(), template, data, PartialsMap.init(allocator, partials)); return if (comptime sentinel) |z| list.toOwnedSliceSentinel(z) else list.toOwnedSlice(); } /// Group functions and structs that are denpendent of Writer and RenderOptions pub fn RenderEngine(comptime Writer: type, comptime PartialsMap: type, comptime options: RenderOptions) type { return struct { pub const Context = context.Context(Writer, PartialsMap, options); pub const ContextStack = Context.ContextStack; pub const PartialsMap = PartialsMap; pub const IndentationQueue = if (!PartialsMap.isEmpty()) indent.IndentationQueue else indent.IndentationQueue.Null; pub const Invoker = invoker.Invoker(Writer, PartialsMap, options); /// Provides the ability to choose between two writers /// while keeping the static dispatch interface. pub const OutWriter = union(enum) { /// Render directly to the underlying stream Writer: Writer, /// Render to a intermediate buffer /// for processing lambda expansions Buffer: std.ArrayList(u8).Writer, }; pub const DataRender = struct { const Self = @This(); pub const Error = Allocator.Error || Writer.Error; out_writer: OutWriter, stack: *const ContextStack, partials_map: PartialsMap, indentation_queue: *IndentationQueue, template_options: if (options == .Template) *const TemplateOptions else void, pub fn collect(self: *Self, allocator: Allocator, template: []const u8) !void { switch (comptime options) { .Text => |text_options| { const template_options = mustache.options.TemplateOptions{ .source = .{ .String = .{ .copy_strings = false } }, .output = .Render, .features = text_options.features, .load_mode = .runtime_loaded, }; var template_loader = TemplateLoader(template_options){ .allocator = allocator, }; errdefer template_loader.deinit(); try template_loader.collectElements(template, self); }, .File => |file_options| { const render_file_options = TemplateOptions{ .source = .{ .Stream = .{ .read_buffer_size = file_options.read_buffer_size } }, .output = .Render, .features = file_options.features, .load_mode = .runtime_loaded, }; var template_loader = TemplateLoader(render_file_options){ .allocator = allocator, }; errdefer template_loader.deinit(); try template_loader.collectElements(template, self); }, .Template => unreachable, } } pub fn render(self: *Self, elements: []const Element) !void { switch (self.out_writer) { .Buffer => |writer| { var list = writer.context; const capacity_hint = self.levelCapacityHint(elements); try list.ensureUnusedCapacity(capacity_hint); }, else => {}, } try self.renderLevel(elements); } inline fn lambdasSupported(self: *Self) bool { return switch (options) { .Template => self.template_options.features.lambdas == .Enabled, .Text => |text| text.features.lambdas == .Enabled, .File => |file| file.features.lambdas == .Enabled, }; } inline fn preseveLineBreaksAndIndentation(self: *Self) bool { return !PartialsMap.isEmpty() and switch (options) { .Template => self.template_options.features.preseve_line_breaks_and_indentation, .Text => |text| text.features.preseve_line_breaks_and_indentation, .File => |file| file.features.preseve_line_breaks_and_indentation, }; } fn renderLevel( self: *Self, elements: []const Element, ) (Allocator.Error || Writer.Error)!void { var index: usize = 0; while (index < elements.len) { const element = elements[index]; index += 1; switch (element) { .static_text => |content| _ = try self.write(content, .Unescaped), .interpolation => |path| try self.interpolate(path, .Escaped), .unescaped_interpolation => |path| try self.interpolate(path, .Unescaped), .section => |section| { const section_children = elements[index .. index + section.children_count]; index += section.children_count; if (self.getIterator(section.path)) |*iterator| { if (self.lambdasSupported()) { if (iterator.lambda()) |lambda_ctx| { assert(section.inner_text != null); assert(section.delimiters != null); const expand_result = try lambda_ctx.expandLambda(self, &.{}, section.inner_text.?, .Unescaped, section.delimiters.?); assert(expand_result == .Lambda); continue; } } while (iterator.next()) |item_ctx| { var current_level = self.stack; self.stack = &ContextStack{ .parent = current_level, .ctx = item_ctx, }; defer self.stack = current_level; try self.renderLevel(section_children); } } }, .inverted_section => |section| { const section_children = elements[index .. index + section.children_count]; index += section.children_count; // Lambdas aways evaluate as "true" for inverted section // Broken paths, empty lists, null and false evaluates as "false" const truthy = if (self.getIterator(section.path)) |iterator| iterator.truthy() else false; if (!truthy) { try self.renderLevel(section_children); } }, .partial => |partial| { if (comptime PartialsMap.isEmpty()) continue; if (self.partials_map.get(partial.key)) |partial_template| { if (self.preseveLineBreaksAndIndentation()) { if (partial.indentation) |value| { const prev_has_pending = self.indentation_queue.has_pending; self.indentation_queue.indent(&IndentationQueue.Node{ .indentation = value }); self.indentation_queue.has_pending = true; defer { self.indentation_queue.unindent(); self.indentation_queue.has_pending = prev_has_pending; } try self.renderLevelPartials(partial_template); continue; } } try self.renderLevelPartials(partial_template); } }, //TODO Parent, Block else => {}, } } } fn renderLevelPartials( self: *Self, partial_template: PartialsMap.Template, ) !void { comptime assert(!PartialsMap.isEmpty()); switch (options) { .Template => { try self.render(partial_template.elements); }, .Text, .File => { self.collect(self.partials_map.allocator, partial_template) catch unreachable; }, } } fn interpolate( self: *Self, path: Element.Path, escape: Escape, ) (Allocator.Error || Writer.Error)!void { var level: ?*const ContextStack = self.stack; while (level) |current| : (level = current.parent) { const path_resolution = try current.ctx.interpolate(self, path, escape); switch (path_resolution) { .Field => { // Success, break the loop break; }, .Lambda => { // Expand the lambda against the current context and break the loop const expand_result = try current.ctx.expandLambda(self, path, "", escape, .{}); assert(expand_result == .Lambda); break; }, .IteratorConsumed, .ChainBroken => { // Not rendered, but should NOT try against the parent context break; }, .NotFoundInContext => { // Not rendered, should try against the parent context continue; }, } } } fn getIterator( self: *Self, path: Element.Path, ) ?Context.Iterator { var level: ?*const ContextStack = self.stack; while (level) |current| : (level = current.parent) { switch (current.ctx.iterator(path)) { .Field => |found| return found, .Lambda => |found| return found, .IteratorConsumed, .ChainBroken => { // Not found, but should NOT try against the parent context break; }, .NotFoundInContext => { // Should try against the parent context continue; }, } } return null; } pub fn write( self: *Self, value: anytype, escape: Escape, ) (Allocator.Error || Writer.Error)!void { switch (self.out_writer) { .Writer => |writer| switch (escape) { .Escaped => try self.recursiveWrite(writer, value, .Escaped), .Unescaped => try self.recursiveWrite(writer, value, .Unescaped), }, .Buffer => |writer| switch (escape) { .Escaped => try self.recursiveWrite(writer, value, .Escaped), .Unescaped => try self.recursiveWrite(writer, value, .Unescaped), }, } } pub fn countWrite( self: *Self, value: anytype, escape: Escape, ) (Allocator.Error || Writer.Error)!usize { switch (self.out_writer) { .Writer => |writer| { var counter = std.io.countingWriter(writer); switch (escape) { .Escaped => try self.recursiveWrite(counter.writer(), value, .Escaped), .Unescaped => try self.recursiveWrite(counter.writer(), value, .Unescaped), } return counter.bytes_written; }, .Buffer => |writer| { var counter = std.io.countingWriter(writer); switch (escape) { .Escaped => try self.recursiveWrite(counter.writer(), value, .Escaped), .Unescaped => try self.recursiveWrite(counter.writer(), value, .Unescaped), } return counter.bytes_written; }, } } fn recursiveWrite( self: *DataRender, writer: anytype, value: anytype, comptime escape: Escape, ) (Allocator.Error || Writer.Error)!void { const TValue = @TypeOf(value); switch (@typeInfo(TValue)) { .Bool => try self.flushToWriter(writer, if (value) "true" else "false", escape), .Int, .ComptimeInt => { var buf: [128]u8 = undefined; const size = std.fmt.formatIntBuf(&buf, value, 10, .lower, .{}); try self.flushToWriter(writer, buf[0..size], escape); }, .Float, .ComptimeFloat => { var buf: [128]u8 = undefined; var fbs = std.io.fixedBufferStream(&buf); std.fmt.formatFloatDecimal(value, .{}, fbs.writer()) catch unreachable; try self.flushToWriter(writer, buf[0..fbs.pos], escape); }, .Enum => try self.flushToWriter(writer, @tagName(value), escape), .Pointer => |info| switch (info.size) { .One => return try self.recursiveWrite(writer, value.*, escape), .Slice => { if (info.child == u8) { try self.flushToWriter(writer, value, escape); } }, .Many => @compileError("[*] pointers not supported"), .C => @compileError("[*c] pointers not supported"), }, .Array => |info| { if (info.child == u8) { try self.flushToWriter(writer, &value, escape); } }, .Optional => { if (value) |not_null| { try self.recursiveWrite(writer, not_null, escape); } }, else => {}, } } fn flushToWriter( self: *Self, writer: anytype, value: []const u8, comptime escape: Escape, ) @TypeOf(writer).Error!void { const escaped = escape == .Escaped; const indentation_supported = comptime !PartialsMap.isEmpty(); if (comptime escaped or indentation_supported) { const indentation_empty: if (indentation_supported) bool else void = if (indentation_supported) self.indentation_queue.isEmpty() or !self.preseveLineBreaksAndIndentation() else {}; var index: usize = 0; var char_index: usize = 0; while (char_index < value.len) : (char_index += 1) { const char = value[char_index]; if (comptime indentation_supported and !indentation_empty) { // The indentation must be inserted after the line break // Supports both \n and \r\n if (self.indentation_queue.has_pending) { defer self.indentation_queue.has_pending = false; if (char_index > index) { const slice = value[index..char_index]; try writer.writeAll(slice); } try self.indentation_queue.write(writer); index = char_index; } else if (char == '\n') { self.indentation_queue.has_pending = true; continue; } } if (comptime escaped) { const replace = switch (char) { '<' => "&lt;", '>' => "&gt;", '&' => "&amp;", '"' => "&quot;", else => continue, }; if (char_index > index) { const slice = value[index..char_index]; try writer.writeAll(slice); } try writer.writeAll(replace); index = char_index + 1; } } if (index < value.len) { const slice = value[index..]; try writer.writeAll(slice); } } else { try writer.writeAll(value); } } fn levelCapacityHint( self: *Self, elements: []const Element, ) usize { var size: usize = 0; var index: usize = 0; while (index < elements.len) { const element = elements[index]; index += 1; switch (element) { .static_text => |content| size += content.len, .interpolation, .unescaped_interpolation => |path| size += self.pathCapacityHint(path), .section => |section| { const section_children = elements[index .. index + section.children_count]; index += section.children_count; if (self.getIterator(section.path)) |*iterator| { while (iterator.next()) |item_ctx| { var current_level = self.stack; self.stack = &ContextStack{ .parent = current_level, .ctx = item_ctx, }; defer self.stack = current_level; size += self.levelCapacityHint(section_children); } } }, .inverted_section => |section| { const section_children = elements[index .. index + section.children_count]; index += section.children_count; const truthy = if (self.getIterator(section.path)) |iterator| iterator.truthy() else false; if (!truthy) { size += self.levelCapacityHint(section_children); } }, else => {}, } } // Add extra 25% extra capacity for HTML escapes, indentation, etc return size + (size / 4); } fn pathCapacityHint( self: *Self, path: Element.Path, ) usize { var level: ?*const ContextStack = self.stack; while (level) |current| : (level = current.parent) { const path_resolution = current.ctx.capacityHint(self, path); switch (path_resolution) { .Field => |size| return size, .Lambda, .IteratorConsumed, .ChainBroken => { // No size can be counted break; }, .NotFoundInContext => { // Not rendered, should try against the parent context continue; }, } } return 0; } pub fn valueCapacityHint( self: *DataRender, value: anytype, ) usize { const TValue = @TypeOf(value); switch (@typeInfo(TValue)) { .Bool => return 5, .Int, .ComptimeInt, .Float, .ComptimeFloat, => return std.fmt.count("{d}", .{value}), .Enum => return @tagName(value).len, .Pointer => |info| switch (info.size) { .One => return self.valueCapacityHint(value.*), .Slice => { if (info.child == u8) { return value.len; } }, .Many => @compileError("[*] pointers not supported"), .C => @compileError("[*c] pointers not supported"), }, .Array => |info| { if (info.child == u8) { return value.len; } }, .Optional => { if (value) |not_null| { return self.valueCapacityHint(not_null); } }, else => {}, } return 0; } }; pub fn render(template: Template, data: anytype, writer: Writer, partials_map: PartialsMap) !void { comptime assert(options == .Template); const Data = @TypeOf(data); const by_value = comptime Fields.byValue(Data); var indentation_queue = IndentationQueue{}; var data_render = DataRender{ .out_writer = .{ .Writer = writer }, .partials_map = partials_map, .stack = &ContextStack{ .parent = null, .ctx = context.getContext( Writer, if (by_value) data else @as(*const Data, &data), PartialsMap, options, ), }, .indentation_queue = &indentation_queue, .template_options = template.options, }; try data_render.render(template.elements); } pub fn bufRender(writer: std.ArrayList(u8).Writer, template: Template, data: anytype, partials_map: PartialsMap) !void { comptime assert(options == .Template); const Data = @TypeOf(data); const by_value = comptime Fields.byValue(Data); var indentation_queue = IndentationQueue{}; var data_render = DataRender{ .out_writer = .{ .Buffer = writer }, .partials_map = partials_map, .stack = &ContextStack{ .parent = null, .ctx = context.getContext( Writer, if (by_value) data else @as(*const Data, &data), PartialsMap, options, ), }, .indentation_queue = &indentation_queue, .template_options = template.options, }; try data_render.render(template.elements); } pub fn collect(allocator: Allocator, template: []const u8, data: anytype, writer: Writer, partials_map: PartialsMap) !void { comptime assert(options != .Template); const Data = @TypeOf(data); const by_value = comptime Fields.byValue(Data); var indentation_queue = IndentationQueue{}; var data_render = DataRender{ .out_writer = .{ .Writer = writer }, .partials_map = partials_map, .stack = &ContextStack{ .parent = null, .ctx = context.getContext( Writer, if (by_value) data else @as(*const Data, &data), PartialsMap, options, ), }, .indentation_queue = &indentation_queue, .template_options = {}, }; try data_render.collect(allocator, template); } pub fn bufCollect(allocator: Allocator, writer: std.ArrayList(u8).Writer, template: []const u8, data: anytype, partials_map: PartialsMap) !void { comptime assert(options != .Template); const Data = @TypeOf(data); const by_value = comptime Fields.byValue(Data); var indentation_queue = IndentationQueue{}; var data_render = DataRender{ .out_writer = .{ .Buffer = writer }, .partials_map = partials_map, .stack = &ContextStack{ .parent = null, .ctx = context.getContext( Writer, if (by_value) data else @as(*const Data, &data), PartialsMap, options, ), }, .indentation_queue = &indentation_queue, .template_options = {}, }; try data_render.collect(allocator, template); } }; } test { _ = context; _ = map; _ = indent; _ = tests.spec; _ = tests.extra; _ = tests.api; _ = tests.escape_tests; } const tests = struct { const spec = struct { test { _ = interpolation; _ = sections; _ = inverted; _ = delimiters; _ = lambdas; _ = partials; } /// Those tests are a verbatim copy from /// https://github.com/mustache/spec/blob/master/specs/interpolation.yml const interpolation = struct { // Mustache-free templates should render as-is. test "No Interpolation" { const template_text = "Hello from {Mustache}!"; var data = .{}; try expectRender(template_text, data, "Hello from {Mustache}!"); } // Unadorned tags should interpolate content into the template. test "Basic Interpolation" { const template_text = "Hello, {{subject}}!"; var data = .{ .subject = "world", }; try expectRender(template_text, data, "Hello, world!"); } // Basic interpolation should be HTML escaped. test "HTML Escaping" { const template_text = "These characters should be HTML escaped: {{forbidden}}"; var data = .{ .forbidden = "& \" < >", }; try expectRender(template_text, data, "These characters should be HTML escaped: &amp; &quot; &lt; &gt;"); } // Triple mustaches should interpolate without HTML escaping. test "Triple Mustache" { const template_text = "These characters should not be HTML escaped: {{{forbidden}}}"; var data = .{ .forbidden = "& \" < >", }; try expectRender(template_text, data, "These characters should not be HTML escaped: & \" < >"); } // Ampersand should interpolate without HTML escaping. test "Ampersand" { const template_text = "These characters should not be HTML escaped: {{&forbidden}}"; var data = .{ .forbidden = "& \" < >", }; try expectRender(template_text, data, "These characters should not be HTML escaped: & \" < >"); } // Integers should interpolate seamlessly. test "Basic Integer Interpolation" { const template_text = "{{mph}} miles an hour!"; var data = .{ .mph = 85, }; try expectRender(template_text, data, "85 miles an hour!"); } // Integers should interpolate seamlessly. test "Triple Mustache Integer Interpolation" { const template_text = "{{{mph}}} miles an hour!"; var data = .{ .mph = 85, }; try expectRender(template_text, data, "85 miles an hour!"); } // Integers should interpolate seamlessly. test "Ampersand Integer Interpolation" { const template_text = "{{&mph}} miles an hour!"; var data = .{ .mph = 85, }; try expectRender(template_text, data, "85 miles an hour!"); } // Decimals should interpolate seamlessly with proper significance. test "Basic Decimal Interpolation" { if (true) return error.SkipZigTest; const template_text = "{{power}} jiggawatts!"; { // f32 const Data = struct { power: f32, }; var data = Data{ .power = 1.210, }; try expectRender(template_text, data, "1.21 jiggawatts!"); } { // f64 const Data = struct { power: f64, }; var data = Data{ .power = 1.210, }; try expectRender(template_text, data, "1.21 jiggawatts!"); } { // Comptime float var data = .{ .power = 1.210, }; try expectRender(template_text, data, "1.21 jiggawatts!"); } { // Comptime negative float var data = .{ .power = -1.210, }; try expectRender(template_text, data, "-1.21 jiggawatts!"); } } // Decimals should interpolate seamlessly with proper significance. test "Triple Mustache Decimal Interpolation" { const template_text = "{{{power}}} jiggawatts!"; { // Comptime float var data = .{ .power = 1.210, }; try expectRender(template_text, data, "1.21 jiggawatts!"); } { // Comptime negative float var data = .{ .power = -1.210, }; try expectRender(template_text, data, "-1.21 jiggawatts!"); } } // Decimals should interpolate seamlessly with proper significance. test "Ampersand Decimal Interpolation" { const template_text = "{{&power}} jiggawatts!"; { // Comptime float var data = .{ .power = 1.210, }; try expectRender(template_text, data, "1.21 jiggawatts!"); } } // Nulls should interpolate as the empty string. test "Basic Null Interpolation" { const template_text = "I ({{cannot}}) be seen!"; { // Optional null const Data = struct { cannot: ?[]const u8, }; var data = Data{ .cannot = null, }; try expectRender(template_text, data, "I () be seen!"); } { // Comptime null var data = .{ .cannot = null, }; try expectRender(template_text, data, "I () be seen!"); } } // Nulls should interpolate as the empty string. test "Triple Mustache Null Interpolation" { const template_text = "I ({{{cannot}}}) be seen!"; { // Optional null const Data = struct { cannot: ?[]const u8, }; var data = Data{ .cannot = null, }; try expectRender(template_text, data, "I () be seen!"); } { // Comptime null var data = .{ .cannot = null, }; try expectRender(template_text, data, "I () be seen!"); } } // Nulls should interpolate as the empty string. test "Ampersand Null Interpolation" { const template_text = "I ({{&cannot}}) be seen!"; { // Optional null const Data = struct { cannot: ?[]const u8, }; var data = Data{ .cannot = null, }; try expectRender(template_text, data, "I () be seen!"); } { // Comptime null var data = .{ .cannot = null, }; try expectRender(template_text, data, "I () be seen!"); } } // Failed context lookups should default to empty strings. test "Basic Context Miss Interpolation" { const template_text = "I ({{cannot}}) be seen!"; var data = .{}; try expectRender(template_text, data, "I () be seen!"); } // Failed context lookups should default to empty strings. test "Triple Mustache Context Miss Interpolation" { const template_text = "I ({{{cannot}}}) be seen!"; var data = .{}; try expectRender(template_text, data, "I () be seen!"); } // Failed context lookups should default to empty strings test "Ampersand Context Miss Interpolation" { const template_text = "I ({{&cannot}}) be seen!"; var data = .{}; try expectRender(template_text, data, "I () be seen!"); } // Dotted names should be considered a form of shorthand for sections. test "Dotted Names - Basic Interpolation" { const template_text = "'{{person.name}}' == '{{#person}}{{name}}{{/person}}'"; var data = .{ .person = .{ .name = "Joe", }, }; try expectRender(template_text, data, "'Joe' == 'Joe'"); } // Dotted names should be considered a form of shorthand for sections. test "Dotted Names - Triple Mustache Interpolation" { const template_text = "'{{{person.name}}}' == '{{#person}}{{{name}}}{{/person}}'"; var data = .{ .person = .{ .name = "Joe", }, }; try expectRender(template_text, data, "'Joe' == 'Joe'"); } // Dotted names should be considered a form of shorthand for sections. test "Dotted Names - Ampersand Interpolation" { const template_text = "'{{&person.name}}' == '{{#person}}{{&name}}{{/person}}'"; var data = .{ .person = .{ .name = "Joe", }, }; try expectRender(template_text, data, "'Joe' == 'Joe'"); } // Dotted names should be functional to any level of nesting. test "Dotted Names - Arbitrary Depth" { const template_text = "'{{a.b.c.d.e.name}}' == 'Phil'"; var data = .{ .a = .{ .b = .{ .c = .{ .d = .{ .e = .{ .name = "Phil" } } } } }, }; try expectRender(template_text, data, "'Phil' == 'Phil'"); } // Any falsey value prior to the last part of the name should yield '' test "Dotted Names - Broken Chains" { const template_text = "'{{a.b.c}}' == ''"; var data = .{ .a = .{}, }; try expectRender(template_text, data, "'' == ''"); } // Each part of a dotted name should resolve only against its parent. test "Dotted Names - Broken Chain Resolution" { const template_text = "'{{a.b.c.name}}' == ''"; var data = .{ .a = .{ .b = .{} }, .c = .{ .name = "Jim" }, }; try expectRender(template_text, data, "'' == ''"); } // The first part of a dotted name should resolve as any other name. test "Dotted Names - Initial Resolution" { const template_text = "'{{#a}}{{b.c.d.e.name}}{{/a}}' == 'Phil'"; var data = .{ .a = .{ .b = .{ .c = .{ .d = .{ .e = .{ .name = "Phil" } } } } }, .b = .{ .c = .{ .d = .{ .e = .{ .name = "Wrong" } } } }, }; try expectRender(template_text, data, "'Phil' == 'Phil'"); } // Dotted names should be resolved against former resolutions. test "Dotted Names - Context Precedence" { const template_text = "{{#a}}{{b.c}}{{/a}}"; var data = .{ .a = .{ .b = .{} }, .b = .{ .c = "ERROR" }, }; try expectRender(template_text, data, ""); } // Unadorned tags should interpolate content into the template. test "Implicit Iterators - Basic Interpolation" { const template_text = "Hello, {{.}}!"; var data = "world"; try expectRender(template_text, data, "Hello, world!"); } // Basic interpolation should be HTML escaped.. test "Implicit Iterators - HTML Escaping" { const template_text = "These characters should be HTML escaped: {{.}}"; var data = "& \" < >"; try expectRender(template_text, data, "These characters should be HTML escaped: &amp; &quot; &lt; &gt;"); } // Triple mustaches should interpolate without HTML escaping. test "Implicit Iterators - Triple Mustache" { const template_text = "These characters should not be HTML escaped: {{{.}}}"; var data = "& \" < >"; try expectRender(template_text, data, "These characters should not be HTML escaped: & \" < >"); } // Ampersand should interpolate without HTML escaping. test "Implicit Iterators - Ampersand" { const template_text = "These characters should not be HTML escaped: {{&.}}"; var data = "& \" < >"; try expectRender(template_text, data, "These characters should not be HTML escaped: & \" < >"); } // Integers should interpolate seamlessly. test "Implicit Iterators - Basic Integer Interpolation" { const template_text = "{{.}} miles an hour!"; { // runtime int const data: i32 = 85; try expectRender(template_text, data, "85 miles an hour!"); } } // Interpolation should not alter surrounding whitespace. test "Interpolation - Surrounding Whitespace" { const template_text = "| {{string}} |"; const data = .{ .string = "---", }; try expectRender(template_text, data, "| --- |"); } // Interpolation should not alter surrounding whitespace. test "Triple Mustache - Surrounding Whitespace" { const template_text = "| {{{string}}} |"; const data = .{ .string = "---", }; try expectRender(template_text, data, "| --- |"); } // Interpolation should not alter surrounding whitespace. test "Ampersand - Surrounding Whitespace" { const template_text = "| {{&string}} |"; const data = .{ .string = "---", }; try expectRender(template_text, data, "| --- |"); } // Standalone interpolation should not alter surrounding whitespace. test "Interpolation - Standalone" { const template_text = " {{string}}\n"; const data = .{ .string = "---", }; try expectRender(template_text, data, " ---\n"); } // Standalone interpolation should not alter surrounding whitespace. test "Triple Mustache - Standalone" { const template_text = " {{{string}}}\n"; const data = .{ .string = "---", }; try expectRender(template_text, data, " ---\n"); } // Standalone interpolation should not alter surrounding whitespace. test "Ampersand - Standalone" { const template_text = " {{&string}}\n"; const data = .{ .string = "---", }; try expectRender(template_text, data, " ---\n"); } // Superfluous in-tag whitespace should be ignored. test "Interpolation With Padding" { const template_text = "|{{ string }}|"; const data = .{ .string = "---", }; try expectRender(template_text, data, "|---|"); } // Superfluous in-tag whitespace should be ignored. test "Triple Mustache With Padding" { const template_text = "|{{{ string }}}|"; const data = .{ .string = "---", }; try expectRender(template_text, data, "|---|"); } // Superfluous in-tag whitespace should be ignored. test "Ampersand With Padding" { const template_text = "|{{& string }}|"; const data = .{ .string = "---", }; try expectRender(template_text, data, "|---|"); } }; /// Those tests are a verbatim copy from ///https://github.com/mustache/spec/blob/master/specs/sections.yml const sections = struct { // Truthy sections should have their contents rendered. test "Truthy" { const template_text = "{{#boolean}}This should be rendered.{{/boolean}}"; const expected = "This should be rendered."; { var data = .{ .boolean = true }; try expectRender(template_text, data, expected); } { const Data = struct { boolean: bool }; var data = Data{ .boolean = true }; try expectRender(template_text, data, expected); } } // Falsey sections should have their contents omitted. test "Falsey" { const template_text = "{{#boolean}}This should not be rendered.{{/boolean}}"; const expected = ""; { var data = .{ .boolean = false }; try expectRender(template_text, data, expected); } { const Data = struct { boolean: bool }; var data = Data{ .boolean = false }; try expectRender(template_text, data, expected); } } // Null is falsey. test "Null is falsey" { const template_text = "{{#null}}This should not be rendered.{{/null}}"; const expected = ""; { var data = .{ .@"null" = null }; try expectRender(template_text, data, expected); } { const Data = struct { @"null": ?[]i32 }; var data = Data{ .@"null" = null }; try expectRender(template_text, data, expected); } } // Objects and hashes should be pushed onto the context stack. test "Context" { const template_text = "{{#context}}Hi {{name}}.{{/context}}"; const expected = "Hi Joe."; { var data = .{ .context = .{ .name = "Joe" } }; try expectRender(template_text, data, expected); } { const Data = struct { context: struct { name: []const u8 } }; var data = Data{ .context = .{ .name = "Joe" } }; try expectRender(template_text, data, expected); } } // Names missing in the current context are looked up in the stack. test "Parent contexts" { const template_text = "{{#sec}}{{a}}, {{b}}, {{c.d}}{{/sec}}"; const expected = "foo, bar, baz"; { var data = .{ .a = "foo", .b = "wrong", .sec = .{ .b = "bar" }, .c = .{ .d = "baz" } }; try expectRender(template_text, data, expected); } { const Data = struct { a: []const u8, b: []const u8, sec: struct { b: []const u8 }, c: struct { d: []const u8 } }; var data = Data{ .a = "foo", .b = "wrong", .sec = .{ .b = "bar" }, .c = .{ .d = "baz" } }; try expectRender(template_text, data, expected); } } // Non-false sections have their value at the top of context, // accessible as {{.}} or through the parent context. This gives // a simple way to display content conditionally if a variable exists. test "Variable test" { const template_text = "{{#foo}}{{.}} is {{foo}}{{/foo}}"; const expected = "bar is bar"; { var data = .{ .foo = "bar" }; try expectRender(template_text, data, expected); } { const Data = struct { foo: []const u8 }; var data = Data{ .foo = "bar" }; try expectRender(template_text, data, expected); } } // All elements on the context stack should be accessible within lists. test "List Contexts" { const template_text = "{{#tops}}{{#middles}}{{tname.lower}}{{mname}}.{{#bottoms}}{{tname.upper}}{{mname}}{{bname}}.{{/bottoms}}{{/middles}}{{/tops}}"; const expected = "a1.A1x.A1y."; { // TODO: // All elements must be the same type in a tuple // Rework the iterator to solve that limitation const Bottom = struct { bname: []const u8, }; var data = .{ .tops = .{ .{ .tname = .{ .upper = "A", .lower = "a", }, .middles = .{ .{ .mname = "1", .bottoms = .{ Bottom{ .bname = "x" }, Bottom{ .bname = "y" }, }, }, }, }, }, }; try expectRender(template_text, data, expected); } { const Bottom = struct { bname: []const u8, }; const Middle = struct { mname: []const u8, bottoms: []const Bottom, }; const Top = struct { tname: struct { upper: []const u8, lower: []const u8, }, middles: []const Middle, }; const Data = struct { tops: []const Top, }; var data = Data{ .tops = &.{ .{ .tname = .{ .upper = "A", .lower = "a", }, .middles = &.{ .{ .mname = "1", .bottoms = &.{ .{ .bname = "x" }, .{ .bname = "y" }, }, }, }, }, }, }; try expectRender(template_text, data, expected); } } // All elements on the context stack should be accessible. test "Deeply Nested Contexts" { const template_text = \\{{#a}} \\{{one}} \\{{#b}} \\{{one}}{{two}}{{one}} \\{{#c}} \\{{one}}{{two}}{{three}}{{two}}{{one}} \\{{#d}} \\{{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}} \\{{#five}} \\{{one}}{{two}}{{three}}{{four}}{{five}}{{four}}{{three}}{{two}}{{one}} \\{{one}}{{two}}{{three}}{{four}}{{.}}6{{.}}{{four}}{{three}}{{two}}{{one}} \\{{one}}{{two}}{{three}}{{four}}{{five}}{{four}}{{three}}{{two}}{{one}} \\{{/five}} \\{{one}}{{two}}{{three}}{{four}}{{three}}{{two}}{{one}} \\{{/d}} \\{{one}}{{two}}{{three}}{{two}}{{one}} \\{{/c}} \\{{one}}{{two}}{{one}} \\{{/b}} \\{{one}} \\{{/a}} ; const expected = \\1 \\121 \\12321 \\1234321 \\123454321 \\12345654321 \\123454321 \\1234321 \\12321 \\121 \\1 \\ ; { var data = .{ .a = .{ .one = 1 }, .b = .{ .two = 2 }, .c = .{ .three = 3, .d = .{ .four = 4, .five = 5 } }, }; try expectRender(template_text, data, expected); } { const Data = struct { a: struct { one: u32 }, b: struct { two: i32 }, c: struct { three: usize, d: struct { four: u8, five: i16 } }, }; var data = Data{ .a = .{ .one = 1 }, .b = .{ .two = 2 }, .c = .{ .three = 3, .d = .{ .four = 4, .five = 5 } }, }; try expectRender(template_text, data, expected); } } // Lists should be iterated; list items should visit the context stack. test "List" { const template_text = "{{#list}}{{item}}{{/list}}"; const expected = "123"; { // slice const Data = struct { list: []const struct { item: u32 } }; var data = Data{ .list = &.{ .{ .item = 1 }, .{ .item = 2 }, .{ .item = 3 }, }, }; try expectRender(template_text, data, expected); } { // array const Data = struct { list: [3]struct { item: u32 } }; var data = Data{ .list = .{ .{ .item = 1 }, .{ .item = 2 }, .{ .item = 3 }, }, }; try expectRender(template_text, data, expected); } { // tuple var data = .{ .list = .{ .{ .item = 1 }, .{ .item = 2 }, .{ .item = 3 }, }, }; try expectRender(template_text, data, expected); } } // Empty lists should behave like falsey values. test "Empty List" { const template_text = "{{#list}}Yay lists!{{/list}}"; const expected = ""; { // slice const Data = struct { list: []const struct { item: u32 } }; var data = Data{ .list = &.{}, }; try expectRender(template_text, data, expected); } { // array const Data = struct { list: [0]struct { item: u32 } }; var data = Data{ .list = .{}, }; try expectRender(template_text, data, expected); } { // tuple var data = .{ .list = .{}, }; try expectRender(template_text, data, expected); } } // Multiple sections per template should be permitted. test "Doubled" { const template_text = \\{{#bool}} \\* first \\{{/bool}} \\* {{two}} \\{{#bool}} \\* third \\{{/bool}} ; const expected = \\* first \\* second \\* third \\ ; var data = .{ .bool = true, .two = "second" }; try expectRender(template_text, data, expected); } // Nested truthy sections should have their contents rendered. test "Nested (Truthy)" { const template_text = "| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |"; const expected = "| A B C D E |"; var data = .{ .bool = true }; try expectRender(template_text, data, expected); } // Nested falsey sections should be omitted. test "Nested (Falsey)" { const template_text = "| A {{#bool}}B {{#bool}}C{{/bool}} D{{/bool}} E |"; const expected = "| A E |"; var data = .{ .bool = false }; try expectRender(template_text, data, expected); } // Failed context lookups should be considered falsey. test "Context Misses" { const template_text = "[{{#missing}}Found key 'missing'!{{/missing}}]"; const expected = "[]"; var data = .{}; try expectRender(template_text, data, expected); } // Implicit iterators should directly interpolate strings. test "Implicit Iterator - String" { const template_text = "{{#list}}({{.}}){{/list}}"; const expected = "(a)(b)(c)(d)(e)"; { // slice const Data = struct { list: []const []const u8 }; var data = Data{ .list = &.{ "a", "b", "c", "d", "e" } }; try expectRender(template_text, data, expected); } { // array const Data = struct { list: [5][]const u8 }; var data = Data{ .list = .{ "a", "b", "c", "d", "e" } }; try expectRender(template_text, data, expected); } { // tuple var data = .{ .list = .{ "a", "b", "c", "d", "e" } }; try expectRender(template_text, data, expected); } } // Implicit iterators should cast integers to strings and interpolate. test "Implicit Iterator - Integer" { const template_text = "{{#list}}({{.}}){{/list}}"; const expected = "(1)(2)(3)(4)(5)"; { // slice const Data = struct { list: []const u32 }; var data = Data{ .list = &.{ 1, 2, 3, 4, 5 } }; try expectRender(template_text, data, expected); } { // array const Data = struct { list: [5]u32 }; var data = Data{ .list = .{ 1, 2, 3, 4, 5 } }; try expectRender(template_text, data, expected); } { // tuple var data = .{ .list = .{ 1, 2, 3, 4, 5 } }; try expectRender(template_text, data, expected); } } // Implicit iterators should cast decimals to strings and interpolate. test "Implicit Iterator - Decimal" { if (true) return error.SkipZigTest; const template_text = "{{#list}}({{.}}){{/list}}"; const expected = "(1.1)(2.2)(3.3)(4.4)(5.5)"; { // slice const Data = struct { list: []const f32 }; var data = Data{ .list = &.{ 1.1, 2.2, 3.3, 4.4, 5.5 } }; try expectRender(template_text, data, expected); } { // array const Data = struct { list: [5]f32 }; var data = Data{ .list = .{ 1.1, 2.2, 3.3, 4.4, 5.5 } }; try expectRender(template_text, data, expected); } { // tuple var data = .{ .list = .{ 1.1, 2.2, 3.3, 4.4, 5.5 } }; try expectRender(template_text, data, expected); } } // Implicit iterators should allow iterating over nested arrays. test "Implicit Iterator - Array" { const template_text = "{{#list}}({{#.}}{{.}}{{/.}}){{/list}}"; const expected = "(123)(456)"; { // slice const Data = struct { list: []const []const u32 }; var data = Data{ .list = &.{ &.{ 1, 2, 3 }, &.{ 4, 5, 6 }, } }; try expectRender(template_text, data, expected); } { // array const Data = struct { list: [2][3]u32 }; var data = Data{ .list = .{ .{ 1, 2, 3 }, .{ 4, 5, 6 }, } }; try expectRender(template_text, data, expected); } { // tuple var data = .{ .list = .{ .{ 1, 2, 3 }, .{ 4, 5, 6 }, } }; try expectRender(template_text, data, expected); } } // Implicit iterators should allow iterating over nested arrays. test "Implicit Iterator - Mixed Array" { const template_text = "{{#list}}({{#.}}{{.}}{{/.}}){{/list}}"; const expected = "(123)(abc)"; // Tuple is the only way to have mixed element types inside a list var data = .{ .list = .{ .{ 1, 2, 3 }, .{ "a", "b", "c" }, } }; try expectRender(template_text, data, expected); } // Dotted names should be valid for Section tags. test "Dotted Names - Truthy" { const template_text = "'{{#a.b.c}}Here{{/a.b.c}}' == 'Here'"; const expected = "'Here' == 'Here'"; var data = .{ .a = .{ .b = .{ .c = true } } }; try expectRender(template_text, data, expected); } // Dotted names should be valid for Section tags. test "Dotted Names - Falsey" { const template_text = "'{{#a.b.c}}Here{{/a.b.c}}' == ''"; const expected = "'' == ''"; var data = .{ .a = .{ .b = .{ .c = false } } }; try expectRender(template_text, data, expected); } // Dotted names that cannot be resolved should be considered falsey. test "Dotted Names - Broken Chains" { const template_text = "'{{#a.b.c}}Here{{/a.b.c}}' == ''"; const expected = "'' == ''"; var data = .{ .a = .{} }; try expectRender(template_text, data, expected); } // Sections should not alter surrounding whitespace. test "Surrounding Whitespace" { const template_text = " | {{#boolean}}\t|\t{{/boolean}} | \n"; const expected = " | \t|\t | \n"; var data = .{ .boolean = true }; try expectRender(template_text, data, expected); } // Sections should not alter internal whitespace. test "Internal Whitespace" { const template_text = " | {{#boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n"; const expected = " | \n | \n"; var data = .{ .boolean = true }; try expectRender(template_text, data, expected); } // Single-line sections should not alter surrounding whitespace. test "Indented Inline Sections" { const template_text = " {{#boolean}}YES{{/boolean}}\n {{#boolean}}GOOD{{/boolean}}\n"; const expected = " YES\n GOOD\n"; var data = .{ .boolean = true }; try expectRender(template_text, data, expected); } // Standalone lines should be removed from the template. test "Standalone Lines" { const template_text = \\| This Is \\{{#boolean}} \\| \\{{/boolean}} \\| A Line ; const expected = \\| This Is \\| \\| A Line ; var data = .{ .boolean = true }; try expectRender(template_text, data, expected); } // Indented standalone lines should be removed from the template. test "Indented Standalone Lines" { const template_text = \\| This Is \\ {{#boolean}} \\| \\ {{/boolean}} \\| A Line ; const expected = \\| This Is \\| \\| A Line ; var data = .{ .boolean = true }; try expectRender(template_text, data, expected); } // "\r\n" should be considered a newline for standalone tags. test "Standalone Line Endings" { const template_text = "|\r\n{{#boolean}}\r\n{{/boolean}}\r\n|"; const expected = "|\r\n|"; var data = .{ .boolean = true }; try expectRender(template_text, data, expected); } // Standalone tags should not require a newline to precede them. test "Standalone Line Endings" { const template_text = " {{#boolean}}\n#{{/boolean}}\n/"; const expected = "#\n/"; var data = .{ .boolean = true }; try expectRender(template_text, data, expected); } // Standalone tags should not require a newline to follow them. test "Standalone Without Newline" { const template_text = "#{{#boolean}}\n/\n {{/boolean}}"; const expected = "#\n/\n"; var data = .{ .boolean = true }; try expectRender(template_text, data, expected); } // Superfluous in-tag whitespace should be ignored. test "Padding" { const template_text = "|{{# boolean }}={{/ boolean }}|"; const expected = "|=|"; var data = .{ .boolean = true }; try expectRender(template_text, data, expected); } }; /// Those tests are a verbatim copy from /// https://github.com/mustache/spec/blob/master/specs/inverted.yml const inverted = struct { // Falsey sections should have their contents rendered. test "Falsey" { const template_text = "{{^boolean}}This should be rendered.{{/boolean}}"; const expected = "This should be rendered."; var data = .{ .boolean = false }; try expectRender(template_text, data, expected); } // Truthy sections should have their contents omitted. test "Truthy" { const template_text = "{{^boolean}}This should not be rendered.{{/boolean}}"; const expected = ""; var data = .{ .boolean = true }; try expectRender(template_text, data, expected); } // Null is falsey. test "Null is falsey" { const template_text = "{{^null}}This should be rendered.{{/null}}"; const expected = "This should be rendered."; { // comptime var data = .{ .@"null" = null }; try expectRender(template_text, data, expected); } { // runtime const Data = struct { @"null": ?u0 }; var data = Data{ .@"null" = null }; try expectRender(template_text, data, expected); } } // Objects and hashes should behave like truthy values. test "Context" { const template_text = "{{^context}}Hi {{name}}.{{/context}}"; const expected = ""; var data = .{ .context = .{ .name = "Joe" } }; try expectRender(template_text, data, expected); } // Lists should behave like truthy values. test "List" { const template_text = "{{^list}}{{n}}{{/list}}"; const expected = ""; { // Slice const Data = struct { list: []const struct { n: u32 } }; var data = Data{ .list = &.{ .{ .n = 1 }, .{ .n = 2 }, .{ .n = 3 } } }; try expectRender(template_text, data, expected); } { // Array const Data = struct { list: [3]struct { n: u32 } }; var data = Data{ .list = .{ .{ .n = 1 }, .{ .n = 2 }, .{ .n = 3 } } }; try expectRender(template_text, data, expected); } { // tuple var data = .{ .list = .{ .{ .n = 1 }, .{ .n = 2 }, .{ .n = 3 } } }; try expectRender(template_text, data, expected); } } // Empty lists should behave like falsey values. test "Empty List" { const template_text = "{{^list}}Yay lists!{{/list}}"; const expected = "Yay lists!"; { // Slice const Data = struct { list: []const struct { n: u32 } }; var data = Data{ .list = &.{} }; try expectRender(template_text, data, expected); } { // Array const Data = struct { list: [0]struct { n: u32 } }; var data = Data{ .list = .{} }; try expectRender(template_text, data, expected); } { // tuple var data = .{ .list = .{} }; try expectRender(template_text, data, expected); } } // Multiple sections per template should be permitted. test "Doubled" { const template_text = \\{{^bool}} \\* first \\{{/bool}} \\* {{two}} \\{{^bool}} \\* third \\{{/bool}} ; const expected = \\* first \\* second \\* third \\ ; var data = .{ .bool = false, .two = "second" }; try expectRender(template_text, data, expected); } // Nested falsey sections should have their contents rendered. test "Nested (Falsey)" { const template_text = "| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |"; const expected = "| A B C D E |"; var data = .{ .bool = false }; try expectRender(template_text, data, expected); } // Nested truthy sections should be omitted. test "Nested (Truthy)" { const template_text = "| A {{^bool}}B {{^bool}}C{{/bool}} D{{/bool}} E |"; const expected = "| A E |"; var data = .{ .bool = true }; try expectRender(template_text, data, expected); } // Failed context lookups should be considered falsey. test "Context Misses" { const template_text = "[{{^missing}}Cannot find key 'missing'!{{/missing}}]"; const expected = "[Cannot find key 'missing'!]"; var data = .{}; try expectRender(template_text, data, expected); } // Dotted names should be valid for Inverted Section tags. test "Dotted Names - Truthy" { const template_text = "'{{^a.b.c}}Not Here{{/a.b.c}}' == ''"; const expected = "'' == ''"; var data = .{ .a = .{ .b = .{ .c = true } } }; try expectRender(template_text, data, expected); } // Dotted names should be valid for Inverted Section tags. test "Dotted Names - Falsey" { const template_text = "'{{^a.b.c}}Not Here{{/a.b.c}}' == 'Not Here'"; const expected = "'Not Here' == 'Not Here'"; var data = .{ .a = .{ .b = .{ .c = false } } }; try expectRender(template_text, data, expected); } // Dotted names that cannot be resolved should be considered falsey. test "Dotted Names - Broken Chains" { const template_text = "'{{^a.b.c}}Not Here{{/a.b.c}}' == 'Not Here'"; const expected = "'Not Here' == 'Not Here'"; var data = .{ .a = .{} }; try expectRender(template_text, data, expected); } // Inverted sections should not alter surrounding whitespace. test "Surrounding Whitespace" { const template_text = " | {{^boolean}}\t|\t{{/boolean}} | \n"; const expected = " | \t|\t | \n"; var data = .{ .boolean = false }; try expectRender(template_text, data, expected); } // Inverted should not alter internal whitespace. test "Internal Whitespace" { const template_text = " | {{^boolean}} {{! Important Whitespace }}\n {{/boolean}} | \n"; const expected = " | \n | \n"; var data = .{ .boolean = false }; try expectRender(template_text, data, expected); } // Single-line sections should not alter surrounding whitespace. test "Indented Inline Sections" { const template_text = " {{^boolean}}NO{{/boolean}}\n {{^boolean}}WAY{{/boolean}}\n"; const expected = " NO\n WAY\n"; var data = .{ .boolean = false }; try expectRender(template_text, data, expected); } // Standalone lines should be removed from the template. test "Standalone Lines" { const template_text = \\| This Is \\{{^boolean}} \\| \\{{/boolean}} \\| A Line ; const expected = \\| This Is \\| \\| A Line ; var data = .{ .boolean = false }; try expectRender(template_text, data, expected); } // Standalone indented lines should be removed from the template. test "Standalone Indented Lines" { const template_text = \\| This Is \\ {{^boolean}} \\| \\ {{/boolean}} \\| A Line ; const expected = \\| This Is \\| \\| A Line ; var data = .{ .boolean = false }; try expectRender(template_text, data, expected); } // "\r\n" should be considered a newline for standalone tags. test "Standalone Line Endings" { const template_text = "|\r\n{{^boolean}}\r\n{{/boolean}}\r\n|"; const expected = "|\r\n|"; var data = .{ .boolean = false }; try expectRender(template_text, data, expected); } // Standalone tags should not require a newline to precede them. test "Standalone Without Previous Line" { const template_text = " {{^boolean}}\n^{{/boolean}}\n/"; const expected = "^\n/"; var data = .{ .boolean = false }; try expectRender(template_text, data, expected); } // Standalone tags should not require a newline to follow them. test "Standalone Without Newline" { const template_text = "^{{^boolean}}\n/\n {{/boolean}}"; const expected = "^\n/\n"; var data = .{ .boolean = false }; try expectRender(template_text, data, expected); } // Superfluous in-tag whitespace should be ignored. test "Padding" { const template_text = "|{{^ boolean }}={{/ boolean }}|"; const expected = "|=|"; var data = .{ .boolean = false }; try expectRender(template_text, data, expected); } }; /// Those tests are a verbatim copy from /// https://github.com/mustache/spec/blob/master/specs/delimiters.yml const delimiters = struct { // The equals sign (used on both sides) should permit delimiter changes. test "Pair Behavior" { const template_text = "{{=<% %>=}}(<%text%>)"; const expected = "(Hey!)"; var data = .{ .text = "Hey!" }; try expectRender(template_text, data, expected); } // Characters with special meaning regexen should be valid delimiters. test "Special Characters" { const template_text = "({{=[ ]=}}[text])"; const expected = "(It worked!)"; var data = .{ .text = "It worked!" }; try expectRender(template_text, data, expected); } // Delimiters set outside sections should persist. test "Sections" { const template_text = \\[ \\{{#section}} \\ {{data}} \\ |data| \\{{/section}} \\{{= | | =}} \\|#section| \\ {{data}} \\ |data| \\|/section| \\] ; const expected = \\[ \\ I got interpolated. \\ |data| \\ {{data}} \\ I got interpolated. \\] ; var data = .{ .section = true, .data = "I got interpolated." }; try expectRender(template_text, data, expected); } // Delimiters set outside inverted sections should persist. test "Inverted Sections" { const template_text = \\[ \\{{^section}} \\ {{data}} \\ |data| \\{{/section}} \\{{= | | =}} \\|^section| \\ {{data}} \\ |data| \\|/section| \\] ; const expected = \\[ \\ I got interpolated. \\ |data| \\ {{data}} \\ I got interpolated. \\] ; var data = .{ .section = false, .data = "I got interpolated." }; try expectRender(template_text, data, expected); } // Delimiters set in a parent template should not affect a partial. test "Partial Inheritence" { const template_text = \\[ {{>include}} ] \\{{= | | =}} \\[ |>include| ] ; const partials_text = .{ .{ "include", ".{{value}}.", }, }; const expected = \\[ .yes. ] \\[ .yes. ] ; var data = .{ .value = "yes" }; try expectRenderPartials(template_text, partials_text, data, expected); } // Delimiters set in a partial should not affect the parent template. test "Post-Partial Behavior" { const template_text = \\[ {{>include}} ] \\[ .{{value}}. .|value|. ] ; const partials_text = .{ .{ "include", ".{{value}}. {{= | | =}} .|value|.", }, }; const expected = \\[ .yes. .yes. ] \\[ .yes. .|value|. ] ; var data = .{ .value = "yes" }; try expectRenderPartials(template_text, partials_text, data, expected); } // Surrounding whitespace should be left untouched. test "Surrounding Whitespace" { const template_text = "| {{=@ @=}} |"; const expected = "| |"; var data = .{}; try expectRender(template_text, data, expected); } // Whitespace should be left untouched. test "Outlying Whitespace (Inline)" { const template_text = " | {{=@ @=}}\n"; const expected = " | \n"; var data = .{}; try expectRender(template_text, data, expected); } // Indented standalone lines should be removed from the template. test "Indented Standalone Tag" { const template_text = \\Begin. \\ {{=@ @=}} \\End. ; const expected = \\Begin. \\End. ; var data = .{}; try expectRender(template_text, data, expected); } // "\r\n" should be considered a newline for standalone tags. test "Standalone Line Endings" { const template_text = "|\r\n{{= @ @ =}}\r\n|"; const expected = "|\r\n|"; var data = .{}; try expectRender(template_text, data, expected); } // Standalone tags should not require a newline to precede them. test "Standalone Without Previous Line" { const template_text = " {{=@ @=}}\n="; const expected = "="; var data = .{}; try expectRender(template_text, data, expected); } // Standalone tags should not require a newline to follow them. test "Standalone Without Newline" { const template_text = "=\n {{=@ @=}}"; const expected = "=\n"; var data = .{}; try expectRender(template_text, data, expected); } // Superfluous in-tag whitespace should be ignored. test "Pair with Padding" { const template_text = "|{{= @ @ =}}|"; const expected = "||"; var data = .{}; try expectRender(template_text, data, expected); } }; /// Those tests are a verbatim copy from /// https://github.com/mustache/spec/blob/master/specs/~lambdas.yml const lambdas = struct { // A lambda's return value should be interpolated. test "Interpolation" { const Data = struct { text: []const u8, pub fn lambda(ctx: mustache.LambdaContext) !void { try ctx.write("world"); } }; const template_text = "Hello, {{lambda}}!"; const expected = "Hello, world!"; var data = Data{ .text = "Hey!" }; try expectRender(template_text, data, expected); } // A lambda's return value should be parsed. test "Interpolation - Expansion" { const Data = struct { planet: []const u8, pub fn lambda(ctx: mustache.LambdaContext) !void { try ctx.render(testing.allocator, "{{planet}}"); } }; const template_text = "Hello, {{lambda}}!"; const expected = "Hello, world!"; var data = Data{ .planet = "world" }; try expectRender(template_text, data, expected); } // A lambda's return value should parse with the default delimiters. test "Interpolation - Alternate Delimiters" { const Data = struct { planet: []const u8, pub fn lambda(ctx: mustache.LambdaContext) !void { try ctx.render(testing.allocator, "|planet| => {{planet}}"); } }; const template_text = "{{= | | =}}\nHello, (|&lambda|)!"; const expected = "Hello, (|planet| => world)!"; var data = Data{ .planet = "world" }; try expectRender(template_text, data, expected); } // Interpolated lambdas should not be cached. test "Interpolation - Multiple Calls" { const Data = struct { calls: u32 = 0, pub fn lambda(self: *@This(), ctx: mustache.LambdaContext) !void { self.calls += 1; try ctx.writeFormat("{}", .{self.calls}); } }; const template_text = "{{lambda}} == {{{lambda}}} == {{lambda}}"; const expected = "1 == 2 == 3"; var data1 = Data{}; try expectCachedRender(template_text, &data1, expected); var data2 = Data{}; try expectStreamedRender(template_text, &data2, expected); } // Lambda results should be appropriately escaped. test "Escaping" { const Data = struct { pub fn lambda(ctx: mustache.LambdaContext) !void { try ctx.write(">"); } }; const template_text = "<{{lambda}}{{{lambda}}}"; const expected = "<&gt;>"; var data = Data{}; try expectRender(template_text, data, expected); } // Lambdas used for sections should receive the raw section string. test "Section" { const Data = struct { pub fn lambda(ctx: mustache.LambdaContext) !void { if (std.mem.eql(u8, "{{x}}", ctx.inner_text)) { try ctx.write("yes"); } else { try ctx.write("no"); } } }; const template_text = "<{{#lambda}}{{x}}{{/lambda}}>"; const expected = "<yes>"; var data = Data{}; try expectRender(template_text, data, expected); } // Lambdas used for sections should have their results parsed. test "Section - Expansion" { const Data = struct { planet: []const u8, pub fn lambda(ctx: mustache.LambdaContext) !void { try ctx.renderFormat(testing.allocator, "{s}{s}{s}", .{ ctx.inner_text, "{{planet}}", ctx.inner_text }); } }; const template_text = "<{{#lambda}}-{{/lambda}}>"; const expected = "<-Earth->"; var data = Data{ .planet = "Earth" }; try expectRender(template_text, data, expected); } // Lambdas used for sections should parse with the current delimiters. test "Section - Alternate Delimiters" { const Data = struct { planet: []const u8, pub fn lambda(ctx: mustache.LambdaContext) !void { try ctx.renderFormat(testing.allocator, "{s}{s}{s}", .{ ctx.inner_text, "{{planet}} => |planet|", ctx.inner_text }); } }; const template_text = "{{= | | =}}<|#lambda|-|/lambda|>"; const expected = "<-{{planet}} => Earth->"; var data1 = Data{ .planet = "Earth" }; try expectRender(template_text, &data1, expected); } // Lambdas used for sections should not be cached. test "Section - Multiple Calls" { const Data = struct { pub fn lambda(ctx: mustache.LambdaContext) !void { try ctx.renderFormat(testing.allocator, "__{s}__", .{ctx.inner_text}); } }; const template_text = "{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}"; const expected = "__FILE__ != __LINE__"; var data = Data{}; try expectRender(template_text, data, expected); } // Lambdas used for inverted sections should be considered truthy. test "Inverted Section" { const Data = struct { static: []const u8, pub fn lambda(ctx: mustache.LambdaContext) !void { _ = ctx; } }; const template_text = "<{{^lambda}}{{static}}{{/lambda}}>"; const expected = "<>"; var data = Data{ .static = "static" }; try expectRender(template_text, data, expected); } }; /// Those tests are a verbatim copy from /// https://github.com/mustache/spec/blob/master/specs/partials.yml const partials = struct { // The greater-than operator should expand to the named partial. test "Basic Behavior" { const template_text = "'{{>text}}'"; const partials_template_text = .{ .{ "text", "from partial" }, }; const expected = "'from partial'"; var data = .{}; try expectRenderPartials(template_text, partials_template_text, data, expected); } // The greater-than operator should expand to the named partial. test "Failed Lookup" { const template_text = "'{{>text}}'"; const partials_template_text = .{}; const expected = "''"; var data = .{}; try expectRenderPartials(template_text, partials_template_text, data, expected); } // The greater-than operator should operate within the current context. test "Context" { const template_text = "'{{>partial}}'"; const partials_template_text = .{ .{ "partial", "*{{text}}*" }, }; const expected = "'*content*'"; var data = .{ .text = "content" }; try expectRenderPartials(template_text, partials_template_text, data, expected); } // The greater-than operator should properly recurse. test "Recursion" { const Content = struct { content: []const u8, nodes: []const @This(), }; const template_text = "{{>node}}"; const partials_template_text = .{ .{ "node", "{{content}}<{{#nodes}}{{>node}}{{/nodes}}>" }, }; const expected = "X<Y<>>"; var data = Content{ .content = "X", .nodes = &.{Content{ .content = "Y", .nodes = &.{} }} }; try expectRenderPartials(template_text, partials_template_text, data, expected); } // The greater-than operator should not alter surrounding whitespace. test "Surrounding Whitespace" { const template_text = "| {{>partial}} |"; const partials_template_text = .{ .{ "partial", "\t|\t" }, }; const expected = "| \t|\t |"; var data = .{}; try expectRenderPartials(template_text, partials_template_text, data, expected); } // Whitespace should be left untouched. test "Inline Indentation" { const template_text = " {{data}} {{> partial}}\n"; const partials_template_text = .{ .{ "partial", ">\n>" }, }; const expected = " | >\n>\n"; var data = .{ .data = "|" }; try expectRenderPartials(template_text, partials_template_text, data, expected); } // "\r\n" should be considered a newline for standalone tags. test "Standalone Line Endings" { const template_text = "|\r\n{{>partial}}\r\n|"; const partials_template_text = .{ .{ "partial", ">" }, }; const expected = "|\r\n>|"; var data = .{}; try expectRenderPartials(template_text, partials_template_text, data, expected); } // Standalone tags should not require a newline to precede them. test "Standalone Without Previous Line" { const template_text = " {{>partial}}\n>"; const partials_template_text = .{ .{ "partial", ">\n>" }, }; const expected = " >\n >>"; var data = .{}; try expectRenderPartials(template_text, partials_template_text, data, expected); } // Standalone tags should not require a newline to follow them. test "Standalone Without Newline" { const template_text = ">\n {{>partial}}"; const partials_template_text = .{ .{ "partial", ">\n>" }, }; const expected = ">\n >\n >"; var data = .{}; try expectRenderPartials(template_text, partials_template_text, data, expected); } // Each line of the partial should be indented before rendering. test "Standalone indentation" { const template_text = \\ \ \\ {{>partial}} \\ / \\ ; const partials_template_text = .{ .{ "partial", \\| \\{{{content}}} \\| \\ , }, }; const expected = \\ \ \\ | \\ < \\ -> \\ | \\ / \\ ; const data = .{ .content = "<\n->" }; try expectRenderPartials(template_text, partials_template_text, data, expected); } // Superfluous in-tag whitespace should be ignored. test "Padding Whitespace" { const template_text = "|{{> partial }}|"; const partials_template_text = .{ .{ "partial", "[]" }, }; const expected = "|[]|"; var data = .{ .boolean = true }; try expectRenderPartials(template_text, partials_template_text, data, expected); } }; }; const extra = struct { test "Emoji" { const template_text = "|👉={{emoji}}|"; const expected = "|👉=👈|"; var data = .{ .emoji = "👈" }; try expectRender(template_text, data, expected); } test "Emoji as delimiter" { const template_text = "{{=👉 👈=}}👉message👈"; const expected = "this is a message"; var data = .{ .message = "this is a message" }; try expectRender(template_text, data, expected); } test "UTF-8" { const template_text = "|mustache|{{arabic}}|{{japanese}}|{{russian}}|{{chinese}}|"; const expected = "|mustache|شوارب|口ひげ|усы|胡子|"; var data = .{ .arabic = "شوارب", .japanese = "口ひげ", .russian = "усы", .chinese = "胡子" }; try expectRender(template_text, data, expected); } test "Context stack resolution" { const Data = struct { name: []const u8 = "root field", a: struct { name: []const u8 = "a field", a1: struct { name: []const u8 = "a1 field", } = .{}, pub fn lambda(ctx: LambdaContext) !void { try ctx.write("a lambda"); } } = .{}, b: struct { pub fn lambda(ctx: LambdaContext) !void { try ctx.write("b lambda"); } } = .{}, pub fn lambda(ctx: LambdaContext) !void { try ctx.write("root lambda"); } }; const template_text = \\{{! Correct paths should render fields and lambdas }} \\'{{a.name}}' == 'a field' \\'{{b.lambda}}' == 'b lambda' \\{{! Broken path should render empty strings }} \\'{{b.name}}' == '' \\'{{a.a1.lamabda}}' == '' \\{{! Sections should resolve fields and lambdas }} \\'{{#a}}{{name}}{{/a}}' == 'a field' \\'{{#b}}{{lambda}}{{/b}}' == 'b lambda' \\{{! Sections should lookup on the parent }} \\'{{#a}}{{#a1}}{{lambda}}{{/a1}}{{/a}}' == 'a lambda' \\'{{#b}}{{name}}{{/b}}' == 'root field' ; const expected_text = \\'a field' == 'a field' \\'b lambda' == 'b lambda' \\'' == '' \\'' == '' \\'a field' == 'a field' \\'b lambda' == 'b lambda' \\'a lambda' == 'a lambda' \\'root field' == 'root field' ; try expectRender(template_text, Data{}, expected_text); } test "Lambda - lower" { const Data = struct { name: []const u8, pub fn lower(ctx: LambdaContext) !void { var text = try ctx.renderAlloc(testing.allocator, ctx.inner_text); defer testing.allocator.free(text); for (text) |char, i| { text[i] = std.ascii.toLower(char); } try ctx.write(text); } }; const template_text = "{{#lower}}Name={{name}}{{/lower}}"; const expected = "name=phill"; var data = Data{ .name = "Phill" }; try expectRender(template_text, data, expected); } test "Lambda - nested" { const Data = struct { name: []const u8, pub fn lower(ctx: LambdaContext) !void { var text = try ctx.renderAlloc(testing.allocator, ctx.inner_text); defer testing.allocator.free(text); for (text) |char, i| { text[i] = std.ascii.toLower(char); } try ctx.write(text); } pub fn upper(ctx: LambdaContext) !void { var text = try ctx.renderAlloc(testing.allocator, ctx.inner_text); defer testing.allocator.free(text); const expected = "name=phill"; try testing.expectEqualStrings(expected, text); for (text) |char, i| { text[i] = std.ascii.toUpper(char); } try ctx.write(text); } }; const template_text = "{{#upper}}{{#lower}}Name={{name}}{{/lower}}{{/upper}}"; const expected = "NAME=PHILL"; var data = Data{ .name = "Phill" }; try expectRender(template_text, data, expected); } test "Lambda - Pointer and Value" { const Person = struct { const Self = @This(); first_name: []const u8, last_name: []const u8, pub fn name1(self: *Self, ctx: LambdaContext) !void { try ctx.writeFormat("{s} {s}", .{ self.first_name, self.last_name }); } pub fn name2(self: Self, ctx: LambdaContext) !void { try ctx.writeFormat("{s} {s}", .{ self.first_name, self.last_name }); } }; const template_text = "Name1: {{name1}}, Name2: {{name2}}"; var data = Person{ .first_name = "John", .last_name = "Smith" }; // Value try expectRender(template_text, data, "Name1: , Name2: <NAME>"); // Pointer try expectRender(template_text, &data, "Name1: <NAME>, Name2: <NAME>"); } test "Lambda - processing" { const Header = struct { id: u32, content: []const u8, pub fn hash(ctx: LambdaContext) !void { var content = try ctx.renderAlloc(testing.allocator, ctx.inner_text); defer testing.allocator.free(content); const hash_value = std.hash.Crc32.hash(content); try ctx.writeFormat("{}", .{hash_value}); } }; const template_text = "<header id='{{id}}' hash='{{#hash}}{{id}}{{content}}{{/hash}}'/>"; var header = Header{ .id = 100, .content = "This is some content" }; try expectRender(template_text, header, "<header id='100' hash='4174482081'/>"); } test "Section Line breaks" { const template_text = \\TODO LIST \\{{#list}} \\- {{item}} \\{{/list}} \\DONE ; const expected = \\TODO LIST \\- 1 \\- 2 \\- 3 \\DONE ; var data = .{ .list = .{ .{ .item = 1 }, .{ .item = 2 }, .{ .item = 3 }, }, }; try expectRender(template_text, data, expected); } test "Nested partials with indentation" { const template_text = \\BOF \\ {{>todo}} \\EOF ; const partials = .{ .{ "todo", \\My tasks \\ {{>list}} \\Done! \\ }, .{ "list", \\|id |desc | \\-------------- \\{{#list}}{{>item}}{{/list}} \\-------------- \\ }, .{ "item", \\|{{id}} |{{desc}} | \\ }, }; const expected = \\BOF \\ My tasks \\ |id |desc | \\ -------------- \\ |1 |task a | \\ |2 |task b | \\ |3 |task c | \\ -------------- \\ Done! \\EOF ; var data = .{ .list = .{ .{ .id = 1, .desc = "task a" }, .{ .id = 2, .desc = "task b" }, .{ .id = 3, .desc = "task c" }, }, }; try expectRenderPartials(template_text, partials, data, expected); } }; const api = struct { test "render API" { var template = try expectParseTemplate("{{hello}}world"); defer template.deinit(testing.allocator); const options = RenderTemplateOptions{}; const data = .{ .hello = "hello " }; const partials = .{}; const expected = "hello world"; { var couting_writer = std.io.countingWriter(std.io.null_writer); try mustache.render(template, data, couting_writer.writer()); try testing.expect(couting_writer.bytes_written == expected.len); } { var couting_writer = std.io.countingWriter(std.io.null_writer); try mustache.renderPartials(template, partials, data, couting_writer.writer()); try testing.expect(couting_writer.bytes_written == expected.len); } { var couting_writer = std.io.countingWriter(std.io.null_writer); try mustache.renderWithOptions(template, data, couting_writer.writer(), options); try testing.expect(couting_writer.bytes_written == expected.len); } { var couting_writer = std.io.countingWriter(std.io.null_writer); try mustache.renderPartialsWithOptions(template, partials, data, couting_writer.writer(), options); try testing.expect(couting_writer.bytes_written == expected.len); } } test "allocRender API" { var template = try expectParseTemplate("{{hello}}world"); defer template.deinit(testing.allocator); const options = RenderTemplateOptions{}; const data = .{ .hello = "hello " }; const partials = .{}; const expected = "hello world"; { var ret = try mustache.allocRender(testing.allocator, template, data); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.allocRenderPartials(testing.allocator, template, partials, data); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.allocRenderWithOptions(testing.allocator, template, data, options); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.allocRenderPartialsWithOptions(testing.allocator, template, partials, data, options); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } } test "allocRenderZ API" { var template = try expectParseTemplate("{{hello}}world"); defer template.deinit(testing.allocator); const options = RenderTemplateOptions{}; const data = .{ .hello = "hello " }; const partials = .{}; const expected = "hello world"; { var ret = try mustache.allocRenderZ(testing.allocator, template, data); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.allocRenderZPartials(testing.allocator, template, partials, data); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.allocRenderZWithOptions(testing.allocator, template, data, options); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.allocRenderZPartialsWithOptions(testing.allocator, template, partials, data, options); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } } test "bufRender API" { var template = try expectParseTemplate("{{hello}}world"); defer template.deinit(testing.allocator); var buf: [11]u8 = undefined; const options = RenderTemplateOptions{}; const data = .{ .hello = "hello " }; const partials = .{}; const expected = "hello world"; { var ret = try mustache.bufRender(&buf, template, data); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.bufRenderPartials(&buf, template, partials, data); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.bufRenderWithOptions(&buf, template, data, options); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.bufRenderPartialsWithOptions(&buf, template, partials, data, options); try testing.expectEqualStrings(ret, expected); } } test "bufRenderZ API" { var template = try expectParseTemplate("{{hello}}world"); defer template.deinit(testing.allocator); var buf: [12]u8 = undefined; const options = RenderTemplateOptions{}; const data = .{ .hello = "hello " }; const partials = .{}; const expected = "hello world"; { var ret = try mustache.bufRenderZ(&buf, template, data); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.bufRenderZPartials(&buf, template, partials, data); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.bufRenderZWithOptions(&buf, template, data, options); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.bufRenderZPartialsWithOptions(&buf, template, partials, data, options); try testing.expectEqualStrings(ret, expected); } } test "bufRender error API" { var template = try expectParseTemplate("{{hello}}world"); defer template.deinit(testing.allocator); var buf: [5]u8 = undefined; const options = RenderTemplateOptions{}; const data = .{ .hello = "hello " }; const partials = .{}; blk: { _ = mustache.bufRender(&buf, template, data) catch |err| { try testing.expect(err == error.NoSpaceLeft); break :blk; }; try testing.expect(false); } blk: { _ = mustache.bufRenderPartials(&buf, template, partials, data) catch |err| { try testing.expect(err == error.NoSpaceLeft); break :blk; }; try testing.expect(false); } blk: { _ = mustache.bufRenderWithOptions(&buf, template, data, options) catch |err| { try testing.expect(err == error.NoSpaceLeft); break :blk; }; try testing.expect(false); } blk: { _ = mustache.bufRenderPartialsWithOptions(&buf, template, partials, data, options) catch |err| { try testing.expect(err == error.NoSpaceLeft); break :blk; }; try testing.expect(false); } } test "bufRenderZ error API" { var template = try expectParseTemplate("{{hello}}world"); defer template.deinit(testing.allocator); var buf: [5]u8 = undefined; const options = RenderTemplateOptions{}; const data = .{ .hello = "hello " }; const partials = .{}; blk: { _ = mustache.bufRenderZ(&buf, template, data) catch |err| { try testing.expect(err == error.NoSpaceLeft); break :blk; }; try testing.expect(false); } blk: { _ = mustache.bufRenderZPartials(&buf, template, partials, data) catch |err| { try testing.expect(err == error.NoSpaceLeft); break :blk; }; try testing.expect(false); } blk: { _ = mustache.bufRenderZWithOptions(&buf, template, data, options) catch |err| { try testing.expect(err == error.NoSpaceLeft); break :blk; }; try testing.expect(false); } blk: { _ = mustache.bufRenderZPartialsWithOptions(&buf, template, partials, data, options) catch |err| { try testing.expect(err == error.NoSpaceLeft); break :blk; }; try testing.expect(false); } } test "renderText API" { const template_text = "{{hello}}world"; const options = RenderTextOptions{}; const data = .{ .hello = "hello " }; const partials = .{}; const expected = "hello world"; { var couting_writer = std.io.countingWriter(std.io.null_writer); try mustache.renderText(testing.allocator, template_text, data, couting_writer.writer()); try testing.expect(couting_writer.bytes_written == expected.len); } { var couting_writer = std.io.countingWriter(std.io.null_writer); try mustache.renderTextPartials(testing.allocator, template_text, partials, data, couting_writer.writer()); try testing.expect(couting_writer.bytes_written == expected.len); } { var couting_writer = std.io.countingWriter(std.io.null_writer); try mustache.renderTextWithOptions(testing.allocator, template_text, data, couting_writer.writer(), options); try testing.expect(couting_writer.bytes_written == expected.len); } { var couting_writer = std.io.countingWriter(std.io.null_writer); try mustache.renderTextPartialsWithOptions(testing.allocator, template_text, partials, data, couting_writer.writer(), options); try testing.expect(couting_writer.bytes_written == expected.len); } } test "allocRenderText API" { const template_text = "{{hello}}world"; const options = RenderTextOptions{}; const data = .{ .hello = "hello " }; const partials = .{}; const expected = "hello world"; { var ret = try mustache.allocRenderText(testing.allocator, template_text, data); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.allocRenderTextPartials(testing.allocator, template_text, partials, data); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.allocRenderTextWithOptions(testing.allocator, template_text, data, options); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.allocRenderTextPartialsWithOptions(testing.allocator, template_text, partials, data, options); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } } test "allocRenderTextZ API" { const template_text = "{{hello}}world"; const options = RenderTextOptions{}; const data = .{ .hello = "hello " }; const partials = .{}; const expected = "hello world"; { var ret = try mustache.allocRenderTextZ(testing.allocator, template_text, data); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.allocRenderTextZPartials(testing.allocator, template_text, partials, data); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.allocRenderTextZWithOptions(testing.allocator, template_text, data, options); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.allocRenderTextZPartialsWithOptions(testing.allocator, template_text, partials, data, options); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } } test "renderFile API" { var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); const template_text = "{{hello}}world"; const options = RenderFileOptions{}; const data = .{ .hello = "hello " }; const partials = .{}; const expected = "hello world"; var absolute_path = try getTemplateFile(tmp.dir, "renderFile.mustache", template_text); defer testing.allocator.free(absolute_path); { var couting_writer = std.io.countingWriter(std.io.null_writer); try mustache.renderFile(testing.allocator, absolute_path, data, couting_writer.writer()); try testing.expect(couting_writer.bytes_written == expected.len); } { var couting_writer = std.io.countingWriter(std.io.null_writer); try mustache.renderFilePartials(testing.allocator, absolute_path, partials, data, couting_writer.writer()); try testing.expect(couting_writer.bytes_written == expected.len); } { var couting_writer = std.io.countingWriter(std.io.null_writer); try mustache.renderFileWithOptions(testing.allocator, absolute_path, data, couting_writer.writer(), options); try testing.expect(couting_writer.bytes_written == expected.len); } { var couting_writer = std.io.countingWriter(std.io.null_writer); try mustache.renderFilePartialsWithOptions(testing.allocator, absolute_path, partials, data, couting_writer.writer(), options); try testing.expect(couting_writer.bytes_written == expected.len); } } test "allocRenderFile API" { var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); const template_text = "{{hello}}world"; const options = RenderFileOptions{}; const data = .{ .hello = "hello " }; const partials = .{}; const expected = "hello world"; var absolute_path = try getTemplateFile(tmp.dir, "allocRenderFile.mustache", template_text); defer testing.allocator.free(absolute_path); { var ret = try mustache.allocRenderFile(testing.allocator, absolute_path, data); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.allocRenderFilePartials(testing.allocator, absolute_path, partials, data); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.allocRenderFileWithOptions(testing.allocator, absolute_path, data, options); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.allocRenderFilePartialsWithOptions(testing.allocator, absolute_path, partials, data, options); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } } test "allocRenderFileZ API" { var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); const template_text = "{{hello}}world"; const options = RenderFileOptions{}; const data = .{ .hello = "hello " }; const partials = .{}; const expected = "hello world"; var absolute_path = try getTemplateFile(tmp.dir, "allocRenderFile.mustache", template_text); defer testing.allocator.free(absolute_path); { var ret = try mustache.allocRenderFileZ(testing.allocator, absolute_path, data); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.allocRenderFileZPartials(testing.allocator, absolute_path, partials, data); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.allocRenderFileZWithOptions(testing.allocator, absolute_path, data, options); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } { var ret = try mustache.allocRenderFileZPartialsWithOptions(testing.allocator, absolute_path, partials, data, options); defer testing.allocator.free(ret); try testing.expectEqualStrings(ret, expected); } } }; const escape_tests = struct { const dummy_options = RenderOptions{ .Text = .{} }; const DummyPartialsMap = map.PartialsMap(@TypeOf(.{ "foo", "bar" }), dummy_options); const Engine = RenderEngine(std.ArrayList(u8).Writer, DummyPartialsMap, dummy_options); const IndentationQueue = Engine.IndentationQueue; test "Escape" { try expectEscape("&gt;abc", ">abc", .Escaped); try expectEscape("abc&lt;", "abc<", .Escaped); try expectEscape("&gt;abc&lt;", ">abc<", .Escaped); try expectEscape("ab&amp;cd", "ab&cd", .Escaped); try expectEscape("&gt;ab&amp;cd", ">ab&cd", .Escaped); try expectEscape("ab&amp;cd&lt;", "ab&cd<", .Escaped); try expectEscape("&gt;ab&amp;cd&lt;", ">ab&cd<", .Escaped); try expectEscape("&quot;ab&amp;cd&quot;", \\"ab&cd" , .Escaped); try expectEscape(">ab&cd<", ">ab&cd<", .Unescaped); } test "Escape and Indentation" { var indentation_queue = IndentationQueue{}; var node_1 = IndentationQueue.Node{ .indentation = ">>", }; indentation_queue.indent(&node_1); try expectEscapeAndIndent("&gt;a\n>>&gt;b\n>>&gt;c", ">a\n>b\n>c", .Escaped, &indentation_queue); try expectEscapeAndIndent("&gt;a\r\n>>&gt;b\r\n>>&gt;c", ">a\r\n>b\r\n>c", .Escaped, &indentation_queue); { var node_2 = IndentationQueue.Node{ .indentation = ">>", }; indentation_queue.indent(&node_2); defer indentation_queue.unindent(); try expectEscapeAndIndent("&gt;a\n>>>>&gt;b\n>>>>&gt;c", ">a\n>b\n>c", .Escaped, &indentation_queue); try expectEscapeAndIndent("&gt;a\r\n>>>>&gt;b\r\n>>>>&gt;c", ">a\r\n>b\r\n>c", .Escaped, &indentation_queue); } try expectEscapeAndIndent("&gt;a\n>>&gt;b\n>>&gt;c", ">a\n>b\n>c", .Escaped, &indentation_queue); try expectEscapeAndIndent("&gt;a\r\n>>&gt;b\r\n>>&gt;c", ">a\r\n>b\r\n>c", .Escaped, &indentation_queue); } test "Indentation" { var indentation_queue = IndentationQueue{}; var node_1 = IndentationQueue.Node{ .indentation = ">>", }; indentation_queue.indent(&node_1); try expectIndent("a\n>>b\n>>c", "a\nb\nc", &indentation_queue); try expectIndent("a\r\n>>b\r\n>>c", "a\r\nb\r\nc", &indentation_queue); { var node_2 = IndentationQueue.Node{ .indentation = ">>", }; indentation_queue.indent(&node_2); defer indentation_queue.unindent(); try expectIndent("a\n>>>>b\n>>>>c", "a\nb\nc", &indentation_queue); try expectIndent("a\r\n>>>>b\r\n>>>>c", "a\r\nb\r\nc", &indentation_queue); } try expectIndent("a\n>>b\n>>c", "a\nb\nc", &indentation_queue); try expectIndent("a\r\n>>b\r\n>>c", "a\r\nb\r\nc", &indentation_queue); } fn expectEscape(expected: []const u8, value: []const u8, escape: Escape) !void { var indentation_queue = IndentationQueue{}; try expectEscapeAndIndent(expected, value, escape, &indentation_queue); } fn expectIndent(expected: []const u8, value: []const u8, indentation_queue: *IndentationQueue) !void { try expectEscapeAndIndent(expected, value, .Unescaped, indentation_queue); } fn expectEscapeAndIndent(expected: []const u8, value: []const u8, escape: Escape, indentation_queue: *IndentationQueue) !void { const allocator = testing.allocator; var list = std.ArrayList(u8).init(allocator); defer list.deinit(); var data_render = Engine.DataRender{ .out_writer = .{ .Buffer = list.writer() }, .stack = undefined, .partials_map = undefined, .indentation_queue = indentation_queue, .template_options = {}, }; try data_render.write(value, escape); try testing.expectEqualStrings(expected, list.items); } }; fn expectRender(comptime template_text: []const u8, data: anytype, expected: []const u8) anyerror!void { try expectCachedRender(template_text, data, expected); try expectComptimeRender(template_text, data, expected); try expectStreamedRender(template_text, data, expected); } fn expectRenderPartials(comptime template_text: []const u8, comptime partials: anytype, data: anytype, expected: []const u8) anyerror!void { try expectCachedRenderPartials(template_text, partials, data, expected); try expectComptimeRenderPartials(template_text, partials, data, expected); try expectStreamedRenderPartials(template_text, partials, data, expected); } fn expectParseTemplate(template_text: []const u8) !Template { const allocator = testing.allocator; // Cached template render switch (try mustache.parseText(allocator, template_text, .{}, .{ .copy_strings = false })) { .success => |ret| return ret, .parse_error => { try testing.expect(false); unreachable; }, } } fn expectCachedRender(template_text: []const u8, data: anytype, expected: []const u8) anyerror!void { const allocator = testing.allocator; // Cached template render var cached_template = try expectParseTemplate(template_text); defer cached_template.deinit(allocator); var result = try allocRender(allocator, cached_template, data); defer allocator.free(result); try testing.expectEqualStrings(expected, result); } fn expectComptimeRender(comptime template_text: []const u8, data: anytype, expected: []const u8) anyerror!void { if (mustache.options.comptime_tests_enabled) { const allocator = testing.allocator; // Comptime template render var comptime_template = comptime mustache.parseComptime(template_text, .{}, .{}); var result = try allocRender(allocator, comptime_template, data); defer allocator.free(result); try testing.expectEqualStrings(expected, result); } } fn expectCachedRenderPartials(template_text: []const u8, partials: anytype, data: anytype, expected: []const u8) anyerror!void { const allocator = testing.allocator; // Cached template render var cached_template = try expectParseTemplate(template_text); defer cached_template.deinit(allocator); var hashMap = std.StringHashMap(Template).init(allocator); defer { var iterator = hashMap.valueIterator(); while (iterator.next()) |partial| { partial.deinit(allocator); } hashMap.deinit(); } inline for (partials) |item| { var partial_template = try expectParseTemplate(item[1]); errdefer partial_template.deinit(allocator); try hashMap.put(item[0], partial_template); } var result = try allocRenderPartials(allocator, cached_template, hashMap, data); defer allocator.free(result); try testing.expectEqualStrings(expected, result); } fn expectComptimeRenderPartials(comptime template_text: []const u8, comptime partials: anytype, data: anytype, expected: []const u8) anyerror!void { if (mustache.options.comptime_tests_enabled) { const allocator = testing.allocator; // Cached template render var comptime_template = comptime mustache.parseComptime(template_text, .{}, .{}); const PartialTuple = std.meta.Tuple(&[_]type{ []const u8, Template }); comptime var comptime_partials: [partials.len]PartialTuple = undefined; comptime { inline for (partials) |item, index| { var partial_template = mustache.parseComptime(item[1], .{}, .{}); comptime_partials[index] = .{ item[0], partial_template }; } } var result = try allocRenderPartials(allocator, comptime_template, comptime_partials, data); defer allocator.free(result); try testing.expectEqualStrings(expected, result); } } fn expectStreamedRenderPartials(template_text: []const u8, partials: anytype, data: anytype, expected: []const u8) anyerror!void { const allocator = testing.allocator; var result = try allocRenderTextPartials(allocator, template_text, partials, data); defer allocator.free(result); try testing.expectEqualStrings(expected, result); } fn expectStreamedRender(template_text: []const u8, data: anytype, expected: []const u8) anyerror!void { const allocator = testing.allocator; // Streamed template render var result = try allocRenderText(allocator, template_text, data); defer allocator.free(result); try testing.expectEqualStrings(expected, result); } fn getTemplateFile(dir: std.fs.Dir, file_name: []const u8, template_text: []const u8) ![]const u8 { var file = try dir.createFile(file_name, .{ .truncate = true }); defer file.close(); try file.writeAll(template_text); return try dir.realpathAlloc(testing.allocator, file_name); } };
src/rendering/rendering.zig
const std = @import("std.zig"); const root = @import("root"); const debug = std.debug; const assert = debug.assert; const testing = std.testing; const mem = std.mem; const os = std.os; const builtin = @import("builtin"); const c = std.c; const maxInt = std.math.maxInt; pub const LoggingAllocator = @import("heap/logging_allocator.zig").LoggingAllocator; pub const loggingAllocator = @import("heap/logging_allocator.zig").loggingAllocator; pub const ArenaAllocator = @import("heap/arena_allocator.zig").ArenaAllocator; pub const GeneralPurposeAllocator = @import("heap/general_purpose_allocator.zig").GeneralPurposeAllocator; const Allocator = mem.Allocator; const CAllocator = struct { comptime { if (!builtin.link_libc) { @compileError("C allocator is only available when linking against libc"); } } usingnamespace if (comptime @hasDecl(c, "malloc_size")) struct { pub const supports_malloc_size = true; pub const malloc_size = c.malloc_size; } else if (comptime @hasDecl(c, "malloc_usable_size")) struct { pub const supports_malloc_size = true; pub const malloc_size = c.malloc_usable_size; } else if (comptime @hasDecl(c, "_msize")) struct { pub const supports_malloc_size = true; pub const malloc_size = c._msize; } else struct { pub const supports_malloc_size = false; }; pub const supports_posix_memalign = @hasDecl(c, "posix_memalign"); fn getHeader(ptr: [*]u8) *[*]u8 { return @intToPtr(*[*]u8, @ptrToInt(ptr) - @sizeOf(usize)); } fn alignedAlloc(len: usize, alignment: usize) ?[*]u8 { if (supports_posix_memalign) { // The posix_memalign only accepts alignment values that are a // multiple of the pointer size const eff_alignment = std.math.max(alignment, @sizeOf(usize)); var aligned_ptr: ?*c_void = undefined; if (c.posix_memalign(&aligned_ptr, eff_alignment, len) != 0) return null; return @ptrCast([*]u8, aligned_ptr); } // Thin wrapper around regular malloc, overallocate to account for // alignment padding and store the orignal malloc()'ed pointer before // the aligned address. var unaligned_ptr = @ptrCast([*]u8, c.malloc(len + alignment - 1 + @sizeOf(usize)) orelse return null); const unaligned_addr = @ptrToInt(unaligned_ptr); const aligned_addr = mem.alignForward(unaligned_addr + @sizeOf(usize), alignment); var aligned_ptr = unaligned_ptr + (aligned_addr - unaligned_addr); getHeader(aligned_ptr).* = unaligned_ptr; return aligned_ptr; } fn alignedFree(ptr: [*]u8) void { if (supports_posix_memalign) { return c.free(ptr); } const unaligned_ptr = getHeader(ptr).*; c.free(unaligned_ptr); } fn alignedAllocSize(ptr: [*]u8) usize { if (supports_posix_memalign) { return malloc_size(ptr); } const unaligned_ptr = getHeader(ptr).*; const delta = @ptrToInt(ptr) - @ptrToInt(unaligned_ptr); return malloc_size(unaligned_ptr) - delta; } fn alloc( allocator: *Allocator, len: usize, alignment: u29, len_align: u29, return_address: usize, ) error{OutOfMemory}![]u8 { assert(len > 0); assert(std.math.isPowerOfTwo(alignment)); var ptr = alignedAlloc(len, alignment) orelse return error.OutOfMemory; if (len_align == 0) { return ptr[0..len]; } const full_len = init: { if (supports_malloc_size) { const s = alignedAllocSize(ptr); assert(s >= len); break :init s; } break :init len; }; return ptr[0..mem.alignBackwardAnyAlign(full_len, len_align)]; } fn resize( allocator: *Allocator, buf: []u8, buf_align: u29, new_len: usize, len_align: u29, return_address: usize, ) Allocator.Error!usize { if (new_len == 0) { alignedFree(buf.ptr); return 0; } if (new_len <= buf.len) { return mem.alignAllocLen(buf.len, new_len, len_align); } if (supports_malloc_size) { const full_len = alignedAllocSize(buf.ptr); if (new_len <= full_len) { return mem.alignAllocLen(full_len, new_len, len_align); } } return error.OutOfMemory; } }; /// Supports the full Allocator interface, including alignment, and exploiting /// `malloc_usable_size` if available. For an allocator that directly calls /// `malloc`/`free`, see `raw_c_allocator`. pub const c_allocator = &c_allocator_state; var c_allocator_state = Allocator{ .allocFn = CAllocator.alloc, .resizeFn = CAllocator.resize, }; /// Asserts allocations are within `@alignOf(std.c.max_align_t)` and directly calls /// `malloc`/`free`. Does not attempt to utilize `malloc_usable_size`. /// This allocator is safe to use as the backing allocator with /// `ArenaAllocator` and `GeneralPurposeAllocator`, and is more optimal in these cases /// than to using `c_allocator`. pub const raw_c_allocator = &raw_c_allocator_state; var raw_c_allocator_state = Allocator{ .allocFn = rawCAlloc, .resizeFn = rawCResize, }; fn rawCAlloc( self: *Allocator, len: usize, ptr_align: u29, len_align: u29, ret_addr: usize, ) Allocator.Error![]u8 { assert(ptr_align <= @alignOf(std.c.max_align_t)); const ptr = @ptrCast([*]u8, c.malloc(len) orelse return error.OutOfMemory); return ptr[0..len]; } fn rawCResize( self: *Allocator, buf: []u8, old_align: u29, new_len: usize, len_align: u29, ret_addr: usize, ) Allocator.Error!usize { if (new_len == 0) { c.free(buf.ptr); return 0; } if (new_len <= buf.len) { return mem.alignAllocLen(buf.len, new_len, len_align); } return error.OutOfMemory; } /// This allocator makes a syscall directly for every allocation and free. /// Thread-safe and lock-free. pub const page_allocator = if (std.Target.current.isWasm()) &wasm_page_allocator_state else if (std.Target.current.os.tag == .freestanding) root.os.heap.page_allocator else &page_allocator_state; var page_allocator_state = Allocator{ .allocFn = PageAllocator.alloc, .resizeFn = PageAllocator.resize, }; var wasm_page_allocator_state = Allocator{ .allocFn = WasmPageAllocator.alloc, .resizeFn = WasmPageAllocator.resize, }; /// Verifies that the adjusted length will still map to the full length pub fn alignPageAllocLen(full_len: usize, len: usize, len_align: u29) usize { const aligned_len = mem.alignAllocLen(full_len, len, len_align); assert(mem.alignForward(aligned_len, mem.page_size) == full_len); return aligned_len; } /// TODO Utilize this on Windows. pub var next_mmap_addr_hint: ?[*]align(mem.page_size) u8 = null; const PageAllocator = struct { fn alloc(allocator: *Allocator, n: usize, alignment: u29, len_align: u29, ra: usize) error{OutOfMemory}![]u8 { assert(n > 0); const aligned_len = mem.alignForward(n, mem.page_size); if (builtin.os.tag == .windows) { const w = os.windows; // Although officially it's at least aligned to page boundary, // Windows is known to reserve pages on a 64K boundary. It's // even more likely that the requested alignment is <= 64K than // 4K, so we're just allocating blindly and hoping for the best. // see https://devblogs.microsoft.com/oldnewthing/?p=42223 const addr = w.VirtualAlloc( null, aligned_len, w.MEM_COMMIT | w.MEM_RESERVE, w.PAGE_READWRITE, ) catch return error.OutOfMemory; // If the allocation is sufficiently aligned, use it. if (@ptrToInt(addr) & (alignment - 1) == 0) { return @ptrCast([*]u8, addr)[0..alignPageAllocLen(aligned_len, n, len_align)]; } // If it wasn't, actually do an explicitely aligned allocation. w.VirtualFree(addr, 0, w.MEM_RELEASE); const alloc_size = n + alignment - mem.page_size; while (true) { // Reserve a range of memory large enough to find a sufficiently // aligned address. const reserved_addr = w.VirtualAlloc( null, alloc_size, w.MEM_RESERVE, w.PAGE_NOACCESS, ) catch return error.OutOfMemory; const aligned_addr = mem.alignForward(@ptrToInt(reserved_addr), alignment); // Release the reserved pages (not actually used). w.VirtualFree(reserved_addr, 0, w.MEM_RELEASE); // At this point, it is possible that another thread has // obtained some memory space that will cause the next // VirtualAlloc call to fail. To handle this, we will retry // until it succeeds. const ptr = w.VirtualAlloc( @intToPtr(*c_void, aligned_addr), aligned_len, w.MEM_COMMIT | w.MEM_RESERVE, w.PAGE_READWRITE, ) catch continue; return @ptrCast([*]u8, ptr)[0..alignPageAllocLen(aligned_len, n, len_align)]; } } const max_drop_len = alignment - std.math.min(alignment, mem.page_size); const alloc_len = if (max_drop_len <= aligned_len - n) aligned_len else mem.alignForward(aligned_len + max_drop_len, mem.page_size); const hint = @atomicLoad(@TypeOf(next_mmap_addr_hint), &next_mmap_addr_hint, .Unordered); const slice = os.mmap( hint, alloc_len, os.PROT_READ | os.PROT_WRITE, os.MAP_PRIVATE | os.MAP_ANONYMOUS, -1, 0, ) catch return error.OutOfMemory; assert(mem.isAligned(@ptrToInt(slice.ptr), mem.page_size)); const aligned_addr = mem.alignForward(@ptrToInt(slice.ptr), alignment); const result_ptr = @alignCast(mem.page_size, @intToPtr([*]u8, aligned_addr)); // Unmap the extra bytes that were only requested in order to guarantee // that the range of memory we were provided had a proper alignment in // it somewhere. The extra bytes could be at the beginning, or end, or both. const drop_len = aligned_addr - @ptrToInt(slice.ptr); if (drop_len != 0) { os.munmap(slice[0..drop_len]); } // Unmap extra pages const aligned_buffer_len = alloc_len - drop_len; if (aligned_buffer_len > aligned_len) { os.munmap(result_ptr[aligned_len..aligned_buffer_len]); } const new_hint = @alignCast(mem.page_size, result_ptr + aligned_len); _ = @cmpxchgStrong(@TypeOf(next_mmap_addr_hint), &next_mmap_addr_hint, hint, new_hint, .Monotonic, .Monotonic); return result_ptr[0..alignPageAllocLen(aligned_len, n, len_align)]; } fn resize( allocator: *Allocator, buf_unaligned: []u8, buf_align: u29, new_size: usize, len_align: u29, return_address: usize, ) Allocator.Error!usize { const new_size_aligned = mem.alignForward(new_size, mem.page_size); if (builtin.os.tag == .windows) { const w = os.windows; if (new_size == 0) { // From the docs: // "If the dwFreeType parameter is MEM_RELEASE, this parameter // must be 0 (zero). The function frees the entire region that // is reserved in the initial allocation call to VirtualAlloc." // So we can only use MEM_RELEASE when actually releasing the // whole allocation. w.VirtualFree(buf_unaligned.ptr, 0, w.MEM_RELEASE); return 0; } if (new_size <= buf_unaligned.len) { const base_addr = @ptrToInt(buf_unaligned.ptr); const old_addr_end = base_addr + buf_unaligned.len; const new_addr_end = mem.alignForward(base_addr + new_size, mem.page_size); if (old_addr_end > new_addr_end) { // For shrinking that is not releasing, we will only // decommit the pages not needed anymore. w.VirtualFree( @intToPtr(*c_void, new_addr_end), old_addr_end - new_addr_end, w.MEM_DECOMMIT, ); } return alignPageAllocLen(new_size_aligned, new_size, len_align); } const old_size_aligned = mem.alignForward(buf_unaligned.len, mem.page_size); if (new_size_aligned <= old_size_aligned) { return alignPageAllocLen(new_size_aligned, new_size, len_align); } return error.OutOfMemory; } const buf_aligned_len = mem.alignForward(buf_unaligned.len, mem.page_size); if (new_size_aligned == buf_aligned_len) return alignPageAllocLen(new_size_aligned, new_size, len_align); if (new_size_aligned < buf_aligned_len) { const ptr = @intToPtr([*]align(mem.page_size) u8, @ptrToInt(buf_unaligned.ptr) + new_size_aligned); // TODO: if the next_mmap_addr_hint is within the unmapped range, update it os.munmap(ptr[0 .. buf_aligned_len - new_size_aligned]); if (new_size_aligned == 0) return 0; return alignPageAllocLen(new_size_aligned, new_size, len_align); } // TODO: call mremap // TODO: if the next_mmap_addr_hint is within the remapped range, update it return error.OutOfMemory; } }; const WasmPageAllocator = struct { comptime { if (!std.Target.current.isWasm()) { @compileError("WasmPageAllocator is only available for wasm32 arch"); } } const PageStatus = enum(u1) { used = 0, free = 1, pub const none_free: u8 = 0; }; const FreeBlock = struct { data: []u128, const Io = std.packed_int_array.PackedIntIo(u1, .Little); fn totalPages(self: FreeBlock) usize { return self.data.len * 128; } fn isInitialized(self: FreeBlock) bool { return self.data.len > 0; } fn getBit(self: FreeBlock, idx: usize) PageStatus { const bit_offset = 0; return @intToEnum(PageStatus, Io.get(mem.sliceAsBytes(self.data), idx, bit_offset)); } fn setBits(self: FreeBlock, start_idx: usize, len: usize, val: PageStatus) void { const bit_offset = 0; var i: usize = 0; while (i < len) : (i += 1) { Io.set(mem.sliceAsBytes(self.data), start_idx + i, bit_offset, @enumToInt(val)); } } // Use '0xFFFFFFFF' as a _missing_ sentinel // This saves ~50 bytes compared to returning a nullable // We can guarantee that conventional memory never gets this big, // and wasm32 would not be able to address this memory (32 GB > usize). // Revisit if this is settled: https://github.com/ziglang/zig/issues/3806 const not_found = std.math.maxInt(usize); fn useRecycled(self: FreeBlock, num_pages: usize, alignment: u29) usize { @setCold(true); for (self.data) |segment, i| { const spills_into_next = @bitCast(i128, segment) < 0; const has_enough_bits = @popCount(u128, segment) >= num_pages; if (!spills_into_next and !has_enough_bits) continue; var j: usize = i * 128; while (j < (i + 1) * 128) : (j += 1) { var count: usize = 0; while (j + count < self.totalPages() and self.getBit(j + count) == .free) { count += 1; const addr = j * mem.page_size; if (count >= num_pages and mem.isAligned(addr, alignment)) { self.setBits(j, num_pages, .used); return j; } } j += count; } } return not_found; } fn recycle(self: FreeBlock, start_idx: usize, len: usize) void { self.setBits(start_idx, len, .free); } }; var _conventional_data = [_]u128{0} ** 16; // Marking `conventional` as const saves ~40 bytes const conventional = FreeBlock{ .data = &_conventional_data }; var extended = FreeBlock{ .data = &[_]u128{} }; fn extendedOffset() usize { return conventional.totalPages(); } fn nPages(memsize: usize) usize { return mem.alignForward(memsize, mem.page_size) / mem.page_size; } fn alloc(allocator: *Allocator, len: usize, alignment: u29, len_align: u29, ra: usize) error{OutOfMemory}![]u8 { const page_count = nPages(len); const page_idx = try allocPages(page_count, alignment); return @intToPtr([*]u8, page_idx * mem.page_size)[0..alignPageAllocLen(page_count * mem.page_size, len, len_align)]; } fn allocPages(page_count: usize, alignment: u29) !usize { { const idx = conventional.useRecycled(page_count, alignment); if (idx != FreeBlock.not_found) { return idx; } } const idx = extended.useRecycled(page_count, alignment); if (idx != FreeBlock.not_found) { return idx + extendedOffset(); } const next_page_idx = @wasmMemorySize(0); const next_page_addr = next_page_idx * mem.page_size; const aligned_addr = mem.alignForward(next_page_addr, alignment); const drop_page_count = @divExact(aligned_addr - next_page_addr, mem.page_size); const result = @wasmMemoryGrow(0, @intCast(u32, drop_page_count + page_count)); if (result <= 0) return error.OutOfMemory; assert(result == next_page_idx); const aligned_page_idx = next_page_idx + drop_page_count; if (drop_page_count > 0) { freePages(next_page_idx, aligned_page_idx); } return @intCast(usize, aligned_page_idx); } fn freePages(start: usize, end: usize) void { if (start < extendedOffset()) { conventional.recycle(start, std.math.min(extendedOffset(), end) - start); } if (end > extendedOffset()) { var new_end = end; if (!extended.isInitialized()) { // Steal the last page from the memory currently being recycled // TODO: would it be better if we use the first page instead? new_end -= 1; extended.data = @intToPtr([*]u128, new_end * mem.page_size)[0 .. mem.page_size / @sizeOf(u128)]; // Since this is the first page being freed and we consume it, assume *nothing* is free. mem.set(u128, extended.data, PageStatus.none_free); } const clamped_start = std.math.max(extendedOffset(), start); extended.recycle(clamped_start - extendedOffset(), new_end - clamped_start); } } fn resize( allocator: *Allocator, buf: []u8, buf_align: u29, new_len: usize, len_align: u29, return_address: usize, ) error{OutOfMemory}!usize { const aligned_len = mem.alignForward(buf.len, mem.page_size); if (new_len > aligned_len) return error.OutOfMemory; const current_n = nPages(aligned_len); const new_n = nPages(new_len); if (new_n != current_n) { const base = nPages(@ptrToInt(buf.ptr)); freePages(base + new_n, base + current_n); } return if (new_len == 0) 0 else alignPageAllocLen(new_n * mem.page_size, new_len, len_align); } }; pub const HeapAllocator = switch (builtin.os.tag) { .windows => struct { allocator: Allocator, heap_handle: ?HeapHandle, const HeapHandle = os.windows.HANDLE; pub fn init() HeapAllocator { return HeapAllocator{ .allocator = Allocator{ .allocFn = alloc, .resizeFn = resize, }, .heap_handle = null, }; } pub fn deinit(self: *HeapAllocator) void { if (self.heap_handle) |heap_handle| { os.windows.HeapDestroy(heap_handle); } } fn getRecordPtr(buf: []u8) *align(1) usize { return @intToPtr(*align(1) usize, @ptrToInt(buf.ptr) + buf.len); } fn alloc( allocator: *Allocator, n: usize, ptr_align: u29, len_align: u29, return_address: usize, ) error{OutOfMemory}![]u8 { const self = @fieldParentPtr(HeapAllocator, "allocator", allocator); const amt = n + ptr_align - 1 + @sizeOf(usize); const optional_heap_handle = @atomicLoad(?HeapHandle, &self.heap_handle, builtin.AtomicOrder.SeqCst); const heap_handle = optional_heap_handle orelse blk: { const options = if (builtin.single_threaded) os.windows.HEAP_NO_SERIALIZE else 0; const hh = os.windows.kernel32.HeapCreate(options, amt, 0) orelse return error.OutOfMemory; const other_hh = @cmpxchgStrong(?HeapHandle, &self.heap_handle, null, hh, builtin.AtomicOrder.SeqCst, builtin.AtomicOrder.SeqCst) orelse break :blk hh; os.windows.HeapDestroy(hh); break :blk other_hh.?; // can't be null because of the cmpxchg }; const ptr = os.windows.kernel32.HeapAlloc(heap_handle, 0, amt) orelse return error.OutOfMemory; const root_addr = @ptrToInt(ptr); const aligned_addr = mem.alignForward(root_addr, ptr_align); const return_len = init: { if (len_align == 0) break :init n; const full_len = os.windows.kernel32.HeapSize(heap_handle, 0, ptr); assert(full_len != std.math.maxInt(usize)); assert(full_len >= amt); break :init mem.alignBackwardAnyAlign(full_len - (aligned_addr - root_addr) - @sizeOf(usize), len_align); }; const buf = @intToPtr([*]u8, aligned_addr)[0..return_len]; getRecordPtr(buf).* = root_addr; return buf; } fn resize( allocator: *Allocator, buf: []u8, buf_align: u29, new_size: usize, len_align: u29, return_address: usize, ) error{OutOfMemory}!usize { const self = @fieldParentPtr(HeapAllocator, "allocator", allocator); if (new_size == 0) { os.windows.HeapFree(self.heap_handle.?, 0, @intToPtr(*c_void, getRecordPtr(buf).*)); return 0; } const root_addr = getRecordPtr(buf).*; const align_offset = @ptrToInt(buf.ptr) - root_addr; const amt = align_offset + new_size + @sizeOf(usize); const new_ptr = os.windows.kernel32.HeapReAlloc( self.heap_handle.?, os.windows.HEAP_REALLOC_IN_PLACE_ONLY, @intToPtr(*c_void, root_addr), amt, ) orelse return error.OutOfMemory; assert(new_ptr == @intToPtr(*c_void, root_addr)); const return_len = init: { if (len_align == 0) break :init new_size; const full_len = os.windows.kernel32.HeapSize(self.heap_handle.?, 0, new_ptr); assert(full_len != std.math.maxInt(usize)); assert(full_len >= amt); break :init mem.alignBackwardAnyAlign(full_len - align_offset, len_align); }; getRecordPtr(buf.ptr[0..return_len]).* = root_addr; return return_len; } }, else => @compileError("Unsupported OS"), }; fn sliceContainsPtr(container: []u8, ptr: [*]u8) bool { return @ptrToInt(ptr) >= @ptrToInt(container.ptr) and @ptrToInt(ptr) < (@ptrToInt(container.ptr) + container.len); } fn sliceContainsSlice(container: []u8, slice: []u8) bool { return @ptrToInt(slice.ptr) >= @ptrToInt(container.ptr) and (@ptrToInt(slice.ptr) + slice.len) <= (@ptrToInt(container.ptr) + container.len); } pub const FixedBufferAllocator = struct { allocator: Allocator, end_index: usize, buffer: []u8, pub fn init(buffer: []u8) FixedBufferAllocator { return FixedBufferAllocator{ .allocator = Allocator{ .allocFn = alloc, .resizeFn = resize, }, .buffer = buffer, .end_index = 0, }; } pub fn ownsPtr(self: *FixedBufferAllocator, ptr: [*]u8) bool { return sliceContainsPtr(self.buffer, ptr); } pub fn ownsSlice(self: *FixedBufferAllocator, slice: []u8) bool { return sliceContainsSlice(self.buffer, slice); } /// NOTE: this will not work in all cases, if the last allocation had an adjusted_index /// then we won't be able to determine what the last allocation was. This is because /// the alignForward operation done in alloc is not reverisible. pub fn isLastAllocation(self: *FixedBufferAllocator, buf: []u8) bool { return buf.ptr + buf.len == self.buffer.ptr + self.end_index; } fn alloc(allocator: *Allocator, n: usize, ptr_align: u29, len_align: u29, ra: usize) ![]u8 { const self = @fieldParentPtr(FixedBufferAllocator, "allocator", allocator); const aligned_addr = mem.alignForward(@ptrToInt(self.buffer.ptr) + self.end_index, ptr_align); const adjusted_index = aligned_addr - @ptrToInt(self.buffer.ptr); const new_end_index = adjusted_index + n; if (new_end_index > self.buffer.len) { return error.OutOfMemory; } const result = self.buffer[adjusted_index..new_end_index]; self.end_index = new_end_index; return result; } fn resize( allocator: *Allocator, buf: []u8, buf_align: u29, new_size: usize, len_align: u29, return_address: usize, ) Allocator.Error!usize { const self = @fieldParentPtr(FixedBufferAllocator, "allocator", allocator); assert(self.ownsSlice(buf)); // sanity check if (!self.isLastAllocation(buf)) { if (new_size > buf.len) return error.OutOfMemory; return if (new_size == 0) 0 else mem.alignAllocLen(buf.len, new_size, len_align); } if (new_size <= buf.len) { const sub = buf.len - new_size; self.end_index -= sub; return if (new_size == 0) 0 else mem.alignAllocLen(buf.len - sub, new_size, len_align); } const add = new_size - buf.len; if (add + self.end_index > self.buffer.len) { return error.OutOfMemory; } self.end_index += add; return new_size; } pub fn reset(self: *FixedBufferAllocator) void { self.end_index = 0; } }; pub const ThreadSafeFixedBufferAllocator = blk: { if (builtin.single_threaded) { break :blk FixedBufferAllocator; } else { // lock free break :blk struct { allocator: Allocator, end_index: usize, buffer: []u8, pub fn init(buffer: []u8) ThreadSafeFixedBufferAllocator { return ThreadSafeFixedBufferAllocator{ .allocator = Allocator{ .allocFn = alloc, .resizeFn = Allocator.noResize, }, .buffer = buffer, .end_index = 0, }; } fn alloc(allocator: *Allocator, n: usize, ptr_align: u29, len_align: u29, ra: usize) ![]u8 { const self = @fieldParentPtr(ThreadSafeFixedBufferAllocator, "allocator", allocator); var end_index = @atomicLoad(usize, &self.end_index, builtin.AtomicOrder.SeqCst); while (true) { const addr = @ptrToInt(self.buffer.ptr) + end_index; const adjusted_addr = mem.alignForward(addr, ptr_align); const adjusted_index = end_index + (adjusted_addr - addr); const new_end_index = adjusted_index + n; if (new_end_index > self.buffer.len) { return error.OutOfMemory; } end_index = @cmpxchgWeak(usize, &self.end_index, end_index, new_end_index, builtin.AtomicOrder.SeqCst, builtin.AtomicOrder.SeqCst) orelse return self.buffer[adjusted_index..new_end_index]; } } pub fn reset(self: *ThreadSafeFixedBufferAllocator) void { self.end_index = 0; } }; } }; pub fn stackFallback(comptime size: usize, fallback_allocator: *Allocator) StackFallbackAllocator(size) { return StackFallbackAllocator(size){ .buffer = undefined, .fallback_allocator = fallback_allocator, .fixed_buffer_allocator = undefined, .allocator = Allocator{ .allocFn = StackFallbackAllocator(size).alloc, .resizeFn = StackFallbackAllocator(size).resize, }, }; } pub fn StackFallbackAllocator(comptime size: usize) type { return struct { const Self = @This(); buffer: [size]u8, allocator: Allocator, fallback_allocator: *Allocator, fixed_buffer_allocator: FixedBufferAllocator, pub fn get(self: *Self) *Allocator { self.fixed_buffer_allocator = FixedBufferAllocator.init(self.buffer[0..]); return &self.allocator; } fn alloc( allocator: *Allocator, len: usize, ptr_align: u29, len_align: u29, return_address: usize, ) error{OutOfMemory}![]u8 { const self = @fieldParentPtr(Self, "allocator", allocator); return FixedBufferAllocator.alloc(&self.fixed_buffer_allocator.allocator, len, ptr_align, len_align, return_address) catch return self.fallback_allocator.allocFn(self.fallback_allocator, len, ptr_align, len_align, return_address); } fn resize( allocator: *Allocator, buf: []u8, buf_align: u29, new_len: usize, len_align: u29, return_address: usize, ) error{OutOfMemory}!usize { const self = @fieldParentPtr(Self, "allocator", allocator); if (self.fixed_buffer_allocator.ownsPtr(buf.ptr)) { return FixedBufferAllocator.resize(&self.fixed_buffer_allocator.allocator, buf, buf_align, new_len, len_align, return_address); } else { return self.fallback_allocator.resizeFn(self.fallback_allocator, buf, buf_align, new_len, len_align, return_address); } } }; } test "c_allocator" { if (builtin.link_libc) { try testAllocator(c_allocator); try testAllocatorAligned(c_allocator); try testAllocatorLargeAlignment(c_allocator); try testAllocatorAlignedShrink(c_allocator); } } test "raw_c_allocator" { if (builtin.link_libc) { try testAllocator(raw_c_allocator); } } test "WasmPageAllocator internals" { if (comptime std.Target.current.isWasm()) { const conventional_memsize = WasmPageAllocator.conventional.totalPages() * mem.page_size; const initial = try page_allocator.alloc(u8, mem.page_size); testing.expect(@ptrToInt(initial.ptr) < conventional_memsize); // If this isn't conventional, the rest of these tests don't make sense. Also we have a serious memory leak in the test suite. var inplace = try page_allocator.realloc(initial, 1); testing.expectEqual(initial.ptr, inplace.ptr); inplace = try page_allocator.realloc(inplace, 4); testing.expectEqual(initial.ptr, inplace.ptr); page_allocator.free(inplace); const reuse = try page_allocator.alloc(u8, 1); testing.expectEqual(initial.ptr, reuse.ptr); page_allocator.free(reuse); // This segment may span conventional and extended which has really complex rules so we're just ignoring it for now. const padding = try page_allocator.alloc(u8, conventional_memsize); page_allocator.free(padding); const extended = try page_allocator.alloc(u8, conventional_memsize); testing.expect(@ptrToInt(extended.ptr) >= conventional_memsize); const use_small = try page_allocator.alloc(u8, 1); testing.expectEqual(initial.ptr, use_small.ptr); page_allocator.free(use_small); inplace = try page_allocator.realloc(extended, 1); testing.expectEqual(extended.ptr, inplace.ptr); page_allocator.free(inplace); const reuse_extended = try page_allocator.alloc(u8, conventional_memsize); testing.expectEqual(extended.ptr, reuse_extended.ptr); page_allocator.free(reuse_extended); } } test "PageAllocator" { const allocator = page_allocator; try testAllocator(allocator); try testAllocatorAligned(allocator); if (!std.Target.current.isWasm()) { try testAllocatorLargeAlignment(allocator); try testAllocatorAlignedShrink(allocator); } if (builtin.os.tag == .windows) { // Trying really large alignment. As mentionned in the implementation, // VirtualAlloc returns 64K aligned addresses. We want to make sure // PageAllocator works beyond that, as it's not tested by // `testAllocatorLargeAlignment`. const slice = try allocator.alignedAlloc(u8, 1 << 20, 128); slice[0] = 0x12; slice[127] = 0x34; allocator.free(slice); } { var buf = try allocator.alloc(u8, mem.page_size + 1); defer allocator.free(buf); buf = try allocator.realloc(buf, 1); // shrink past the page boundary } } test "HeapAllocator" { if (builtin.os.tag == .windows) { var heap_allocator = HeapAllocator.init(); defer heap_allocator.deinit(); const allocator = &heap_allocator.allocator; try testAllocator(allocator); try testAllocatorAligned(allocator); try testAllocatorLargeAlignment(allocator); try testAllocatorAlignedShrink(allocator); } } test "ArenaAllocator" { var arena_allocator = ArenaAllocator.init(page_allocator); defer arena_allocator.deinit(); try testAllocator(&arena_allocator.allocator); try testAllocatorAligned(&arena_allocator.allocator); try testAllocatorLargeAlignment(&arena_allocator.allocator); try testAllocatorAlignedShrink(&arena_allocator.allocator); } var test_fixed_buffer_allocator_memory: [800000 * @sizeOf(u64)]u8 = undefined; test "FixedBufferAllocator" { var fixed_buffer_allocator = mem.validationWrap(FixedBufferAllocator.init(test_fixed_buffer_allocator_memory[0..])); try testAllocator(&fixed_buffer_allocator.allocator); try testAllocatorAligned(&fixed_buffer_allocator.allocator); try testAllocatorLargeAlignment(&fixed_buffer_allocator.allocator); try testAllocatorAlignedShrink(&fixed_buffer_allocator.allocator); } test "FixedBufferAllocator.reset" { var buf: [8]u8 align(@alignOf(u64)) = undefined; var fba = FixedBufferAllocator.init(buf[0..]); const X = 0xeeeeeeeeeeeeeeee; const Y = 0xffffffffffffffff; var x = try fba.allocator.create(u64); x.* = X; testing.expectError(error.OutOfMemory, fba.allocator.create(u64)); fba.reset(); var y = try fba.allocator.create(u64); y.* = Y; // we expect Y to have overwritten X. testing.expect(x.* == y.*); testing.expect(y.* == Y); } test "StackFallbackAllocator" { const fallback_allocator = page_allocator; var stack_allocator = stackFallback(4096, fallback_allocator); try testAllocator(stack_allocator.get()); try testAllocatorAligned(stack_allocator.get()); try testAllocatorLargeAlignment(stack_allocator.get()); try testAllocatorAlignedShrink(stack_allocator.get()); } test "FixedBufferAllocator Reuse memory on realloc" { var small_fixed_buffer: [10]u8 = undefined; // check if we re-use the memory { var fixed_buffer_allocator = FixedBufferAllocator.init(small_fixed_buffer[0..]); var slice0 = try fixed_buffer_allocator.allocator.alloc(u8, 5); testing.expect(slice0.len == 5); var slice1 = try fixed_buffer_allocator.allocator.realloc(slice0, 10); testing.expect(slice1.ptr == slice0.ptr); testing.expect(slice1.len == 10); testing.expectError(error.OutOfMemory, fixed_buffer_allocator.allocator.realloc(slice1, 11)); } // check that we don't re-use the memory if it's not the most recent block { var fixed_buffer_allocator = FixedBufferAllocator.init(small_fixed_buffer[0..]); var slice0 = try fixed_buffer_allocator.allocator.alloc(u8, 2); slice0[0] = 1; slice0[1] = 2; var slice1 = try fixed_buffer_allocator.allocator.alloc(u8, 2); var slice2 = try fixed_buffer_allocator.allocator.realloc(slice0, 4); testing.expect(slice0.ptr != slice2.ptr); testing.expect(slice1.ptr != slice2.ptr); testing.expect(slice2[0] == 1); testing.expect(slice2[1] == 2); } } test "ThreadSafeFixedBufferAllocator" { var fixed_buffer_allocator = ThreadSafeFixedBufferAllocator.init(test_fixed_buffer_allocator_memory[0..]); try testAllocator(&fixed_buffer_allocator.allocator); try testAllocatorAligned(&fixed_buffer_allocator.allocator); try testAllocatorLargeAlignment(&fixed_buffer_allocator.allocator); try testAllocatorAlignedShrink(&fixed_buffer_allocator.allocator); } /// This one should not try alignments that exceed what C malloc can handle. pub fn testAllocator(base_allocator: *mem.Allocator) !void { var validationAllocator = mem.validationWrap(base_allocator); const allocator = &validationAllocator.allocator; var slice = try allocator.alloc(*i32, 100); testing.expect(slice.len == 100); for (slice) |*item, i| { item.* = try allocator.create(i32); item.*.* = @intCast(i32, i); } slice = try allocator.realloc(slice, 20000); testing.expect(slice.len == 20000); for (slice[0..100]) |item, i| { testing.expect(item.* == @intCast(i32, i)); allocator.destroy(item); } slice = allocator.shrink(slice, 50); testing.expect(slice.len == 50); slice = allocator.shrink(slice, 25); testing.expect(slice.len == 25); slice = allocator.shrink(slice, 0); testing.expect(slice.len == 0); slice = try allocator.realloc(slice, 10); testing.expect(slice.len == 10); allocator.free(slice); // Zero-length allocation var empty = try allocator.alloc(u8, 0); allocator.free(empty); // Allocation with zero-sized types const zero_bit_ptr = try allocator.create(u0); zero_bit_ptr.* = 0; allocator.destroy(zero_bit_ptr); const oversize = try allocator.allocAdvanced(u32, null, 5, .at_least); testing.expect(oversize.len >= 5); for (oversize) |*item| { item.* = 0xDEADBEEF; } allocator.free(oversize); } pub fn testAllocatorAligned(base_allocator: *mem.Allocator) !void { var validationAllocator = mem.validationWrap(base_allocator); const allocator = &validationAllocator.allocator; // Test a few alignment values, smaller and bigger than the type's one inline for ([_]u29{ 1, 2, 4, 8, 16, 32, 64 }) |alignment| { // initial var slice = try allocator.alignedAlloc(u8, alignment, 10); testing.expect(slice.len == 10); // grow slice = try allocator.realloc(slice, 100); testing.expect(slice.len == 100); // shrink slice = allocator.shrink(slice, 10); testing.expect(slice.len == 10); // go to zero slice = allocator.shrink(slice, 0); testing.expect(slice.len == 0); // realloc from zero slice = try allocator.realloc(slice, 100); testing.expect(slice.len == 100); // shrink with shrink slice = allocator.shrink(slice, 10); testing.expect(slice.len == 10); // shrink to zero slice = allocator.shrink(slice, 0); testing.expect(slice.len == 0); } } pub fn testAllocatorLargeAlignment(base_allocator: *mem.Allocator) mem.Allocator.Error!void { var validationAllocator = mem.validationWrap(base_allocator); const allocator = &validationAllocator.allocator; //Maybe a platform's page_size is actually the same as or // very near usize? if (mem.page_size << 2 > maxInt(usize)) return; const USizeShift = std.meta.Int(.unsigned, std.math.log2(std.meta.bitCount(usize))); const large_align = @as(u29, mem.page_size << 2); var align_mask: usize = undefined; _ = @shlWithOverflow(usize, ~@as(usize, 0), @as(USizeShift, @ctz(u29, large_align)), &align_mask); var slice = try allocator.alignedAlloc(u8, large_align, 500); testing.expect(@ptrToInt(slice.ptr) & align_mask == @ptrToInt(slice.ptr)); slice = allocator.shrink(slice, 100); testing.expect(@ptrToInt(slice.ptr) & align_mask == @ptrToInt(slice.ptr)); slice = try allocator.realloc(slice, 5000); testing.expect(@ptrToInt(slice.ptr) & align_mask == @ptrToInt(slice.ptr)); slice = allocator.shrink(slice, 10); testing.expect(@ptrToInt(slice.ptr) & align_mask == @ptrToInt(slice.ptr)); slice = try allocator.realloc(slice, 20000); testing.expect(@ptrToInt(slice.ptr) & align_mask == @ptrToInt(slice.ptr)); allocator.free(slice); } pub fn testAllocatorAlignedShrink(base_allocator: *mem.Allocator) mem.Allocator.Error!void { var validationAllocator = mem.validationWrap(base_allocator); const allocator = &validationAllocator.allocator; var debug_buffer: [1000]u8 = undefined; const debug_allocator = &FixedBufferAllocator.init(&debug_buffer).allocator; const alloc_size = mem.page_size * 2 + 50; var slice = try allocator.alignedAlloc(u8, 16, alloc_size); defer allocator.free(slice); var stuff_to_free = std.ArrayList([]align(16) u8).init(debug_allocator); // On Windows, VirtualAlloc returns addresses aligned to a 64K boundary, // which is 16 pages, hence the 32. This test may require to increase // the size of the allocations feeding the `allocator` parameter if they // fail, because of this high over-alignment we want to have. while (@ptrToInt(slice.ptr) == mem.alignForward(@ptrToInt(slice.ptr), mem.page_size * 32)) { try stuff_to_free.append(slice); slice = try allocator.alignedAlloc(u8, 16, alloc_size); } while (stuff_to_free.popOrNull()) |item| { allocator.free(item); } slice[0] = 0x12; slice[60] = 0x34; // realloc to a smaller size but with a larger alignment slice = try allocator.reallocAdvanced(slice, mem.page_size * 32, alloc_size / 2, .exact); testing.expect(slice[0] == 0x12); testing.expect(slice[60] == 0x34); } test "heap" { _ = @import("heap/logging_allocator.zig"); }
lib/std/heap.zig
const std = @import("std"); const netx = @import("netx.zig"); pub const io_mode = .evented; const Pingu = struct { source: union(enum) { none: void, ip: netx.Ipv4Host, iface: []const u8, }, target: []const u8, socket: ?std.fs.File = none, reply_frame: @Frame(handleReplies), fn parse(raw: []const u8) !Pingu { return Pingu{ .source = .none, .target = raw, .socket = null, .reply_frame = undefined, }; } }; var short_pid: u16 = undefined; pub fn main() anyerror!u8 { short_pid = @truncate(u16, std.math.absCast(std.os.system.getpid())); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const args = try std.process.argsAlloc(&gpa.allocator); defer std.process.argsFree(&gpa.allocator, args); // TODO: parse other args const hosts = args[1..]; if (hosts.len == 0) { std.debug.print("Usage: mping host [host2 ...]\n", .{}); return 1; } const pingus = try gpa.allocator.alloc(Pingu, hosts.len); defer gpa.allocator.free(pingus); for (hosts) |host, i| { pingus[i] = try Pingu.parse(host); } defer { for (hosts) |host| { if (host.socket) |sock| { sock.close(); } } } var seq: usize = 0; while (true) : (seq +%= 1) { var sleep_frame = async std.time.sleep(std.time.ns_per_s); defer await sleep_frame; const echo = netx.Icmp.initEcho(short_pid, @truncate(u16, seq), now()); for (pingus) |*pingu| { send(&gpa.allocator, pingu, echo) catch |err| { std.debug.print("{} {} cannot connect: {}\n", .{ seq, pingu.target, err }); if (pingu.socket) |socket| { // TODO: shutdown before closing socket.close(); pingu.socket = null; // TODO: ensure the listener is properly destroyed // await pingu.reply_frame catch |e| { // std.debug.print("Done! {}\n", .{e}); // }; } }; } } } pub fn send(allocator: *std.mem.Allocator, pingu: *Pingu, echo: netx.Icmp) !void { if (pingu.socket == null) { const socket = try netx.icmpConnectTo(allocator, pingu.target); pingu.socket = socket; pingu.reply_frame = async handleReplies(socket); } const written = try pingu.socket.?.write(std.mem.asBytes(&echo)); std.debug.assert(written == @sizeOf(netx.Icmp)); } pub fn handleReplies(fs: std.fs.File) !void { var buffer: [0x100]u8 align(4) = undefined; while (true) { const read = try fs.read(&buffer); const ip_header = @ptrCast(*const netx.IpHeader, &buffer); const reply = @ptrCast(*const netx.Icmp, buffer[@sizeOf(netx.IpHeader)..]); if (!reply.checksumValid() or reply.un.echo.id() != short_pid) { continue; } const sent = reply.data.getEchoTime(); const received = now(); const diff_us: u64 = us(received) - us(sent); std.debug.print("{} {} {}.{}ms\n", .{ reply.un.echo.sequence(), ip_header.src_addr, diff_us / 1000, diff_us % 1000 }); } } fn us(time: std.os.timeval) u64 { return @intCast(u64, time.tv_sec) * 1000000 + @intCast(u64, time.tv_usec); } fn now() std.os.timeval { var result: std.os.timeval = undefined; std.os.gettimeofday(&result, null); return result; }
src/main.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; \\pub export fn main() c_int { \\ _ = puts("hello world!"); \\ return 0; \\} , "hello world!" ++ std.cstr.line_sep); // Now change the message only case.addCompareOutput( \\extern fn puts(s: [*:0]const u8) c_int; \\pub export fn main() c_int { \\ _ = puts("yo"); \\ return 0; \\} , "yo" ++ std.cstr.line_sep); // Add an unused Decl case.addCompareOutput( \\extern fn puts(s: [*:0]const u8) c_int; \\pub export fn main() c_int { \\ _ = puts("yo!"); \\ return 0; \\} \\fn unused() void {} , "yo!" ++ std.cstr.line_sep); // Comptime return type and calling convention expected. case.addError( \\var x: i32 = 1234; \\pub export fn main() x { \\ return 0; \\} \\export fn foo() callconv(y) c_int { \\ return 0; \\} \\var y: i32 = 1234; , &.{ ":2:22: error: unable to resolve comptime value", ":5:26: error: unable to resolve comptime value", }); } { var case = ctx.exeFromCompiledC("var args", .{}); case.addCompareOutput( \\extern fn printf(format: [*:0]const u8, ...) c_int; \\ \\pub export fn main() c_int { \\ _ = printf("Hello, %s!\n", "world"); \\ return 0; \\} , "Hello, world!" ++ std.cstr.line_sep); } { var case = ctx.exeFromCompiledC("@intToError", .{}); case.addCompareOutput( \\pub export fn main() c_int { \\ // comptime checks \\ const a = error.A; \\ const b = error.B; \\ const c = @intToError(2); \\ const d = @intToError(1); \\ if (!(c == b)) unreachable; \\ if (!(a == d)) unreachable; \\ // runtime checks \\ var x = error.A; \\ var y = error.B; \\ var z = @intToError(2); \\ var f = @intToError(1); \\ if (!(y == z)) unreachable; \\ if (!(x == f)) unreachable; \\ return 0; \\} , ""); case.addError( \\pub export fn main() c_int { \\ _ = @intToError(0); \\ return 0; \\} , &.{":2:21: error: integer value 0 represents no error"}); case.addError( \\pub export fn main() c_int { \\ _ = @intToError(3); \\ return 0; \\} , &.{":2:21: error: integer value 3 represents no error"}); } { var case = ctx.exeFromCompiledC("x86_64-linux inline assembly", linux_x64); // Exit with 0 case.addCompareOutput( \\fn exitGood() noreturn { \\ asm volatile ("syscall" \\ : \\ : [number] "{rax}" (231), \\ [arg1] "{rdi}" (0) \\ ); \\ unreachable; \\} \\ \\pub export fn main() c_int { \\ exitGood(); \\} , ""); // Pass a usize parameter to exit case.addCompareOutput( \\pub export fn main() c_int { \\ exit(0); \\} \\ \\fn exit(code: usize) noreturn { \\ asm volatile ("syscall" \\ : \\ : [number] "{rax}" (231), \\ [arg1] "{rdi}" (code) \\ ); \\ unreachable; \\} , ""); // Change the parameter to u8 case.addCompareOutput( \\pub export fn main() c_int { \\ exit(0); \\} \\ \\fn exit(code: u8) noreturn { \\ asm volatile ("syscall" \\ : \\ : [number] "{rax}" (231), \\ [arg1] "{rdi}" (code) \\ ); \\ unreachable; \\} , ""); // Do some arithmetic at the exit callsite case.addCompareOutput( \\pub export fn main() c_int { \\ 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; \\} \\ , ""); // Invert the arithmetic case.addCompareOutput( \\pub export fn main() c_int { \\ 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; \\} \\ , ""); } { 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); \\} \\ \\pub 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; \\} \\ \\pub export fn main() c_int { \\ const x = add(1, 2); \\ var y = add(3, 0); \\ y -= x; \\ return y; \\} , ""); } // This will make a pretty deep call stack, so this test can only be enabled // on hosts where Zig's linking strategy can honor the 16 MiB (default) we // link the self-hosted compiler with. const host_supports_custom_stack_size = @import("builtin").target.os.tag == .linux; if (host_supports_custom_stack_size) { var case = ctx.exeFromCompiledC("@setEvalBranchQuota", .{}); case.addCompareOutput( \\pub export fn main() i32 { \\ @setEvalBranchQuota(1001); \\ const y = rec(1001); \\ return y - 1; \\} \\ \\fn rec(n: usize) callconv(.Inline) usize { \\ if (n <= 1) return n; \\ return rec(n - 1); \\} , ""); } { var case = ctx.exeFromCompiledC("control flow", .{}); // Simple while loop case.addCompareOutput( \\pub export fn main() c_int { \\ var a: c_int = 0; \\ while (a < 5) : (a+=1) {} \\ return a - 5; \\} , ""); case.addCompareOutput( \\pub export fn main() c_int { \\ var a = true; \\ while (!a) {} \\ return 0; \\} , ""); // If expression case.addCompareOutput( \\pub export fn main() c_int { \\ var cond: c_int = 0; \\ var a: c_int = @as(c_int, if (cond == 0) \\ 2 \\ else \\ 3) + 9; \\ return a - 11; \\} , ""); // If expression with breakpoint that does not get hit case.addCompareOutput( \\pub export fn main() c_int { \\ var x: i32 = 1; \\ if (x != 1) @breakpoint(); \\ return 0; \\} , ""); // Switch expression case.addCompareOutput( \\pub export fn main() c_int { \\ var cond: c_int = 0; \\ var a: c_int = switch (cond) { \\ 1 => 1, \\ 2 => 2, \\ 99...300, 12 => 3, \\ 0 => 4, \\ else => 5, \\ }; \\ return a - 4; \\} , ""); // Switch expression missing else case. case.addError( \\pub export fn main() c_int { \\ var cond: c_int = 0; \\ const a: c_int = switch (cond) { \\ 1 => 1, \\ 2 => 2, \\ 3 => 3, \\ 4 => 4, \\ }; \\ return a - 4; \\} , &.{":3:22: error: switch must handle all possibilities"}); // Switch expression, has an unreachable prong. case.addCompareOutput( \\pub export fn main() c_int { \\ var cond: c_int = 0; \\ const a: c_int = switch (cond) { \\ 1 => 1, \\ 2 => 2, \\ 99...300, 12 => 3, \\ 0 => 4, \\ 13 => unreachable, \\ else => 5, \\ }; \\ return a - 4; \\} , ""); // Switch expression, has an unreachable prong and prongs write // to result locations. case.addCompareOutput( \\pub export fn main() c_int { \\ var cond: c_int = 0; \\ var a: c_int = switch (cond) { \\ 1 => 1, \\ 2 => 2, \\ 99...300, 12 => 3, \\ 0 => 4, \\ 13 => unreachable, \\ else => 5, \\ }; \\ return a - 4; \\} , ""); // Integer switch expression has duplicate case value. case.addError( \\pub export fn main() c_int { \\ var cond: c_int = 0; \\ const a: c_int = switch (cond) { \\ 1 => 1, \\ 2 => 2, \\ 96, 11...13, 97 => 3, \\ 0 => 4, \\ 90, 12 => 100, \\ else => 5, \\ }; \\ return a - 4; \\} , &.{ ":8:13: error: duplicate switch value", ":6:15: note: previous value here", }); // Boolean switch expression has duplicate case value. case.addError( \\pub export fn main() c_int { \\ var a: bool = false; \\ const b: c_int = switch (a) { \\ false => 1, \\ true => 2, \\ false => 3, \\ }; \\ _ = b; \\} , &.{ ":6:9: error: duplicate switch value", }); // Sparse (no range capable) switch expression has duplicate case value. case.addError( \\pub export fn main() c_int { \\ const A: type = i32; \\ const b: c_int = switch (A) { \\ i32 => 1, \\ bool => 2, \\ f64, i32 => 3, \\ else => 4, \\ }; \\ _ = b; \\} , &.{ ":6:14: error: duplicate switch value", ":4:9: note: previous value here", }); // Ranges not allowed for some kinds of switches. case.addError( \\pub export fn main() c_int { \\ const A: type = i32; \\ const b: c_int = switch (A) { \\ i32 => 1, \\ bool => 2, \\ f16...f64 => 3, \\ else => 4, \\ }; \\ _ = b; \\} , &.{ ":3:30: error: ranges not allowed when switching on type 'type'", ":6:12: note: range here", }); // Switch expression has unreachable else prong. case.addError( \\pub export fn main() c_int { \\ var a: u2 = 0; \\ const b: i32 = switch (a) { \\ 0 => 10, \\ 1 => 20, \\ 2 => 30, \\ 3 => 40, \\ else => 50, \\ }; \\ _ = b; \\} , &.{ ":8:14: error: unreachable else prong; all cases already handled", }); } //{ // var case = ctx.exeFromCompiledC("optionals", .{}); // // Simple while loop // case.addCompareOutput( // \\pub export fn main() c_int { // \\ var count: c_int = 0; // \\ var opt_ptr: ?*c_int = &count; // \\ while (opt_ptr) |_| : (count += 1) { // \\ if (count == 4) opt_ptr = null; // \\ } // \\ return count - 5; // \\} // , ""); // // Same with non pointer optionals // case.addCompareOutput( // \\pub export fn main() c_int { // \\ var count: c_int = 0; // \\ var opt_ptr: ?c_int = count; // \\ while (opt_ptr) |_| : (count += 1) { // \\ if (count == 4) opt_ptr = null; // \\ } // \\ return count - 5; // \\} // , ""); //} { var case = ctx.exeFromCompiledC("errors", .{}); case.addCompareOutput( \\pub export fn main() c_int { \\ var e1 = error.Foo; \\ var e2 = error.Bar; \\ assert(e1 != e2); \\ assert(e1 == error.Foo); \\ assert(e2 == error.Bar); \\ return 0; \\} \\fn assert(b: bool) void { \\ if (!b) unreachable; \\} , ""); case.addCompareOutput( \\pub export fn main() c_int { \\ var e: anyerror!c_int = 0; \\ const i = e catch 69; \\ return i; \\} , ""); case.addCompareOutput( \\pub export fn main() c_int { \\ var e: anyerror!c_int = error.Foo; \\ const i = e catch 69; \\ return 69 - i; \\} , ""); } { var case = ctx.exeFromCompiledC("structs", .{}); case.addError( \\const Point = struct { x: i32, y: i32 }; \\pub export fn main() c_int { \\ var p: Point = .{ \\ .y = 24, \\ .x = 12, \\ .y = 24, \\ }; \\ return p.y - p.x - p.x; \\} , &.{ ":6:10: error: duplicate field", ":4:10: note: other field here", }); case.addError( \\const Point = struct { x: i32, y: i32 }; \\pub export fn main() c_int { \\ var p: Point = .{ \\ .y = 24, \\ }; \\ return p.y - p.x - p.x; \\} , &.{ ":3:21: error: missing struct field: x", ":1:15: note: struct 'tmp.Point' declared here", }); case.addError( \\const Point = struct { x: i32, y: i32 }; \\pub export fn main() c_int { \\ var p: Point = .{ \\ .x = 12, \\ .y = 24, \\ .z = 48, \\ }; \\ return p.y - p.x - p.x; \\} , &.{ ":6:10: error: no field named 'z' in struct 'tmp.Point'", ":1:15: note: struct declared here", }); case.addCompareOutput( \\const Point = struct { x: i32, y: i32 }; \\pub export fn main() c_int { \\ var p: Point = .{ \\ .x = 12, \\ .y = 24, \\ }; \\ return p.y - p.x - p.x; \\} , ""); } { var case = ctx.exeFromCompiledC("enums", .{}); case.addError( \\const E1 = packed enum { a, b, c }; \\const E2 = extern enum { a, b, c }; \\export fn foo() void { \\ _ = E1.a; \\} \\export fn bar() void { \\ _ = E2.a; \\} , &.{ ":1:12: error: enums do not support 'packed' or 'extern'; instead provide an explicit integer tag type", ":2:12: error: enums do not support 'packed' or 'extern'; instead provide an explicit integer tag type", }); // comptime and types are caught in AstGen. case.addError( \\const E1 = enum { \\ a, \\ comptime b, \\ c, \\}; \\const E2 = enum { \\ a, \\ b: i32, \\ c, \\}; \\export fn foo() void { \\ _ = E1.a; \\} \\export fn bar() void { \\ _ = E2.a; \\} , &.{ ":3:5: error: enum fields cannot be marked comptime", ":8:8: error: enum fields do not have types", ":6:12: note: consider 'union(enum)' here to make it a tagged union", }); // @enumToInt, @intToEnum, enum literal coercion, field access syntax, comparison, switch case.addCompareOutput( \\const Number = enum { One, Two, Three }; \\ \\pub export fn main() c_int { \\ var number1 = Number.One; \\ var number2: Number = .Two; \\ const number3 = @intToEnum(Number, 2); \\ if (number1 == number2) return 1; \\ if (number2 == number3) return 1; \\ if (@enumToInt(number1) != 0) return 1; \\ if (@enumToInt(number2) != 1) return 1; \\ if (@enumToInt(number3) != 2) return 1; \\ var x: Number = .Two; \\ if (number2 != x) return 1; \\ switch (x) { \\ .One => return 1, \\ .Two => return 0, \\ number3 => return 2, \\ } \\} , ""); // Specifying alignment is a parse error. // This also tests going from a successful build to a parse error. case.addError( \\const E1 = enum { \\ a, \\ b align(4), \\ c, \\}; \\export fn foo() void { \\ _ = E1.a; \\} , &.{ ":3:7: error: expected ',', found 'align'", }); // Redundant non-exhaustive enum mark. // This also tests going from a parse error to an AstGen error. case.addError( \\const E1 = enum { \\ a, \\ _, \\ b, \\ c, \\ _, \\}; \\export fn foo() void { \\ _ = E1.a; \\} , &.{ ":6:5: error: redundant non-exhaustive enum mark", ":3:5: note: other mark here", }); case.addError( \\const E1 = enum { \\ a, \\ b, \\ c, \\ _ = 10, \\}; \\export fn foo() void { \\ _ = E1.a; \\} , &.{ ":5:9: error: '_' is used to mark an enum as non-exhaustive and cannot be assigned a value", }); case.addError( \\const E1 = enum {}; \\export fn foo() void { \\ _ = E1.a; \\} , &.{ ":1:12: error: enum declarations must have at least one tag", }); case.addError( \\const E1 = enum { a, b, _ }; \\export fn foo() void { \\ _ = E1.a; \\} , &.{ ":1:12: error: non-exhaustive enum missing integer tag type", ":1:25: note: marked non-exhaustive here", }); case.addError( \\const E1 = enum { a, b, c, b, d }; \\pub export fn main() c_int { \\ _ = E1.a; \\} , &.{ ":1:28: error: duplicate enum tag", ":1:22: note: other tag here", }); case.addError( \\pub export fn main() c_int { \\ const a = true; \\ _ = @enumToInt(a); \\} , &.{ ":3:20: error: expected enum or tagged union, found bool", }); case.addError( \\pub export fn main() c_int { \\ const a = 1; \\ _ = @intToEnum(bool, a); \\} , &.{ ":3:20: error: expected enum, found bool", }); case.addError( \\const E = enum { a, b, c }; \\pub export fn main() c_int { \\ _ = @intToEnum(E, 3); \\} , &.{ ":3:9: error: enum 'tmp.E' has no tag with value 3", ":1:11: note: enum declared here", }); case.addError( \\const E = enum { a, b, c }; \\pub export fn main() c_int { \\ var x: E = .a; \\ switch (x) { \\ .a => {}, \\ .c => {}, \\ } \\} , &.{ ":4:5: error: switch must handle all possibilities", ":4:5: note: unhandled enumeration value: 'b'", ":1:11: note: enum 'tmp.E' declared here", }); case.addError( \\const E = enum { a, b, c }; \\pub export fn main() c_int { \\ var x: E = .a; \\ switch (x) { \\ .a => {}, \\ .b => {}, \\ .b => {}, \\ .c => {}, \\ } \\} , &.{ ":7:10: error: duplicate switch value", ":6:10: note: previous value here", }); case.addError( \\const E = enum { a, b, c }; \\pub export fn main() c_int { \\ var x: E = .a; \\ switch (x) { \\ .a => {}, \\ .b => {}, \\ .c => {}, \\ else => {}, \\ } \\} , &.{ ":8:14: error: unreachable else prong; all cases already handled", }); case.addError( \\const E = enum { a, b, c }; \\pub export fn main() c_int { \\ var x: E = .a; \\ switch (x) { \\ .a => {}, \\ .b => {}, \\ _ => {}, \\ } \\} , &.{ ":4:5: error: '_' prong only allowed when switching on non-exhaustive enums", ":7:11: note: '_' prong here", }); case.addError( \\const E = enum { a, b, c }; \\pub export fn main() c_int { \\ _ = E.d; \\} , &.{ ":3:10: error: enum 'tmp.E' has no member named 'd'", ":1:11: note: enum declared here", }); case.addError( \\const E = enum { a, b, c }; \\pub export fn main() c_int { \\ var x: E = .d; \\ _ = x; \\} , &.{ ":3:17: error: enum 'tmp.E' has no field named 'd'", ":1:11: note: enum declared here", }); } ctx.c("empty start function", linux_x64, \\export fn _start() noreturn { \\ unreachable; \\} , \\ZIG_EXTERN_C zig_noreturn void _start(void); \\ \\zig_noreturn void _start(void) { \\ zig_breakpoint(); \\ zig_unreachable(); \\} \\ ); ctx.h("simple header", linux_x64, \\export fn start() void{} , \\ZIG_EXTERN_C void start(void); \\ ); ctx.h("header with single param function", linux_x64, \\export fn start(a: u8) void{ \\ _ = a; \\} , \\ZIG_EXTERN_C void start(uint8_t a0); \\ ); ctx.h("header with multiple param function", linux_x64, \\export fn start(a: u8, b: u8, c: u8) void{ \\ _ = a; _ = b; _ = c; \\} , \\ZIG_EXTERN_C void start(uint8_t a0, uint8_t a1, uint8_t a2); \\ ); ctx.h("header with u32 param function", linux_x64, \\export fn start(a: u32) void{ _ = a; } , \\ZIG_EXTERN_C void start(uint32_t a0); \\ ); ctx.h("header with usize param function", linux_x64, \\export fn start(a: usize) void{ _ = a; } , \\ZIG_EXTERN_C void start(uintptr_t a0); \\ ); ctx.h("header with bool param function", linux_x64, \\export fn start(a: bool) void{_ = a;} , \\ZIG_EXTERN_C void start(bool a0); \\ ); ctx.h("header with noreturn function", linux_x64, \\export fn start() noreturn { \\ unreachable; \\} , \\ZIG_EXTERN_C 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{} , \\ZIG_EXTERN_C void a(void); \\ZIG_EXTERN_C void b(void); \\ZIG_EXTERN_C void c(void); \\ ); ctx.h("header with multiple includes", linux_x64, \\export fn start(a: u32, b: usize) void{ _ = a; _ = b; } , \\ZIG_EXTERN_C void start(uint32_t a0, uintptr_t a1); \\ ); }
test/stage2/cbe.zig
const std = @import("std"); const system = std.os.system; const assert = std.debug.assert; // https://vorbrodt.blog/2019/02/27/advanced-thread-pool/ pub fn main() !void { return benchPool(NewPool); } const REPS = 10; const SPREAD = 64; const COUNT = 10_000_000; var win_heap = std.heap.HeapAllocator.init(); fn benchPool(comptime Pool: type) !void { const allocator = if (std.builtin.os.tag == .windows) &win_heap.allocator else if (std.builtin.link_libc) std.heap.c_allocator else std.heap.page_allocator; const Impl = struct { const Task = struct { index: usize, spawner: *Spawner, runnable: Pool.Runnable = Pool.Runnable.init(run), fn run(runnable: *Pool.Runnable) void { const self = @fieldParentPtr(@This(), "runnable", runnable); defer { const counter = @atomicRmw(usize, &self.spawner.counter, .Sub, 1, .Monotonic); if (counter == 1) { if (@hasDecl(Pool, "Spawner")) self.spawner.s.deinit(); if (@atomicRmw(usize, &self.spawner.root.counter, .Sub, 1, .Monotonic) == 1) { if (@hasDecl(Pool, "shutdown")) { Pool.shutdown(); } } } } // std.time.sleep(1 * std.time.ns_per_us); var prng = std.rand.DefaultPrng.init(self.index); const rng = &prng.random; var x: usize = undefined; var reps: usize = REPS + (REPS * rng.uintLessThan(usize, 5)); while (reps > 0) : (reps -= 1) { x = self.index + rng.int(usize); } var keep: usize = undefined; @atomicStore(usize, &keep, x, .SeqCst); } }; const Spawner = struct { index: usize, tasks: []Task, counter: usize, root: *Root, runnable: Pool.Runnable = Pool.Runnable.init(run), s: if (@hasDecl(Pool, "Spawner")) Pool.Spawner else void = undefined, fn run(runnable: *Pool.Runnable) void { const self = @fieldParentPtr(@This(), "runnable", runnable); if (@hasDecl(Pool, "Spawner")) self.s.init(); for (self.tasks) |*task, offset| { task.* = Task{ .index = self.index + offset, .spawner = self, }; if (@hasDecl(Pool, "Spawner")) { self.s.schedule(&task.runnable); } else { Pool.schedule(&task.runnable); } } } }; const Root = struct { tasks: []Task, spawners: []Spawner, counter: usize, runnable: Pool.Runnable = Pool.Runnable.init(run), fn run(runnable: *Pool.Runnable) void { const self = @fieldParentPtr(@This(), "runnable", runnable); var offset: usize = 0; const chunk = self.tasks.len / self.spawners.len; for (self.spawners) |*spawner, index| { const tasks = self.tasks[offset..][0..chunk]; spawner.* = Spawner{ .index = index, .tasks = tasks, .counter = tasks.len, .root = self, }; offset += chunk; Pool.schedule(&spawner.runnable); } } }; }; const tasks = try allocator.alloc(Impl.Task, COUNT); defer allocator.free(tasks); const spawners = try allocator.alloc(Impl.Spawner, SPREAD); defer allocator.free(spawners); var root = Impl.Root{ .tasks = tasks, .spawners = spawners, .counter = spawners.len, }; try Pool.run(&root.runnable); } const BasicPool = struct { run_queue: ?*Runnable = null, const Runnable = struct { next: ?*Runnable = null, callback: fn (*Runnable) void, fn init(callback: fn (*Runnable) void) Runnable { return .{ .callback = callback }; } }; var tls_pool: ?*BasicPool = null; fn run(runnable: *Runnable) !void { var pool = BasicPool{}; pool.push(runnable); const old = tls_pool; tls_pool = &pool; defer tls_pool = old; while (pool.pop()) |next| (next.callback)(next); } fn schedule(runnable: *Runnable) void { tls_pool.?.push(runnable); } fn push(self: *BasicPool, runnable: *Runnable) void { runnable.next = self.run_queue; self.run_queue = runnable; } fn pop(self: *BasicPool) ?*Runnable { const runnable = self.run_queue orelse return null; self.run_queue = runnable.next; return runnable; } }; const NewPool = struct { const Pool = @import("./src/runtime/Pool.zig"); const Runnable = Pool.Runnable; var current: ?*Pool = null; var event: std.Thread.StaticResetEvent = .{}; fn run(runnable: *Runnable) !void { var pool = Pool.init(.{}); defer pool.deinit(); current = &pool; defer current = null; schedule(runnable); event.wait(); } fn schedule(runnable: *Runnable) void { current.?.schedule(.{}, runnable); } fn shutdown() void { event.set(); } }; const DistributedPool = struct { idle: usize = 0, workers: []Worker, run_queue: UnboundedQueue, semaphore: Semaphore = Semaphore.init(0), const Runnable = struct { next: ?*Runnable = null, callback: fn (*Runnable) void, fn init(callback: fn (*Runnable) void) Runnable { return .{ .callback = callback }; } }; fn run(runnable: *Runnable) !void { const threads = std.math.max(1, std.Thread.cpuCount() catch 1); const allocator = std.heap.page_allocator; var self = DistributedPool{ .workers = try allocator.alloc(Worker, threads), .run_queue = UnboundedQueue.init(), }; defer { self.semaphore.deinit(); self.run_queue.deinit(); allocator.free(self.workers); } for (self.workers) |*worker| worker.* = Worker.init(&self); defer for (self.workers) |*worker| worker.deinit(); self.run_queue.pushFront(Batch.from(runnable)); for (self.workers[1..]) |*worker| worker.thread = try std.Thread.spawn(worker, Worker.run); defer for (self.workers[1..]) |*worker| worker.thread.wait(); self.workers[0].run(); } fn schedule(runnable: *Runnable) void { const worker = @intToPtr(*Worker, TLS.get()); if (worker.run_queue.push(runnable)) |overflowed| worker.run_queue_overflow.pushFront(overflowed); worker.pool.notify(false); } const Idle = struct { state: State, waiting: usize, const State = enum(u2) { pending = 0, notified, waking, signalled, }; fn pack(self: Idle) usize { return @enumToInt(self.state) | (self.waiting << 2); } fn unpack(value: usize) Idle { return Idle{ .state = @intToEnum(State, @truncate(u2, value)), .waiting = value >> 2, }; } }; const Wait = enum { retry, waking, shutdown, }; fn wait(self: *DistributedPool, is_waking: bool) Wait { var idle = Idle.unpack(@atomicLoad(usize, &self.idle, .SeqCst)); while (true) { if (idle.waiting == self.workers.len - 1) { self.semaphore.post(); return Wait.shutdown; } const notified = switch (idle.state) { .notified => true, .signalled => is_waking, else => false, }; var new_idle = idle; if (notified) { new_idle.state = if (is_waking) .waking else .pending; } else { new_idle.waiting += 1; new_idle.state = if (is_waking) .notified else idle.state; } if (@cmpxchgWeak( usize, &self.idle, idle.pack(), new_idle.pack(), .SeqCst, .SeqCst, )) |updated| { idle = Idle.unpack(updated); continue; } if (notified and is_waking) return Wait.waking; if (notified) return Wait.retry; self.semaphore.wait(); return Wait.waking; } } fn notify(self: *DistributedPool, is_waking: bool) void { var idle = Idle.unpack(@atomicLoad(usize, &self.idle, .SeqCst)); while (true) { if (!is_waking and (idle.state == .notified or idle.state == .signalled)) return; var new_idle = idle; if (idle.waiting > 0 and (is_waking or idle.state == .pending)) { new_idle.waiting -= 1; new_idle.state = .waking; } else if (!is_waking and idle.state == .waking) { new_idle.state = .signalled; } else { new_idle.state = .notified; } if (@cmpxchgWeak( usize, &self.idle, idle.pack(), new_idle.pack(), .SeqCst, .SeqCst, )) |updated| { idle = Idle.unpack(updated); continue; } if (idle.waiting > new_idle.waiting) self.semaphore.post(); return; } } const Worker = struct { run_queue: BoundedQueue, run_queue_overflow: UnboundedQueue, thread: *std.Thread = undefined, pool: *DistributedPool, fn init(pool: *DistributedPool) Worker { return Worker{ .pool = pool, .run_queue = BoundedQueue.init(), .run_queue_overflow = UnboundedQueue.init(), }; } fn deinit(self: *Worker) void { self.run_queue.deinit(); self.run_queue_overflow.deinit(); } fn run(self: *Worker) void { const old = TLS.get(); TLS.set(@ptrToInt(self)); defer TLS.set(old); var waking = false; var tick = @ptrToInt(self); var prng = @truncate(u32, tick >> @sizeOf(usize)); while (true) { if (self.poll(.{ .tick = tick, .rand = &prng, })) |runnable| { if (waking) self.pool.notify(waking); tick +%= 1; waking = false; (runnable.callback)(runnable); continue; } waking = switch (self.pool.wait(waking)) { .retry => false, .waking => true, .shutdown => break, }; } } fn poll(self: *Worker, args: anytype) ?*Runnable { if (args.tick % 256 == 0) { if (self.steal(args)) |runnable| return runnable; } if (args.tick % 128 == 0) { if (self.run_queue.stealUnbounded(&self.pool.run_queue)) |runnable| return runnable; } if (args.tick % 64 == 0) { if (self.run_queue.stealUnbounded(&self.run_queue_overflow)) |runnable| return runnable; } if (self.run_queue.pop()) |runnable| return runnable; if (self.run_queue.stealUnbounded(&self.run_queue_overflow)) |runnable| return runnable; var attempts: u8 = 5; while (attempts > 0) : (attempts -= 1) { if (self.steal(args)) |runnable| return runnable; if (self.run_queue.stealUnbounded(&self.pool.run_queue)) |runnable| return runnable; std.os.sched_yield() catch spinLoopHint(); } return null; } fn steal(self: *Worker, args: anytype) ?*Runnable { var workers = self.pool.workers; var index = blk: { var x = args.rand.*; x ^= x << 13; x ^= x >> 17; x ^= x << 5; args.rand.* = x; break :blk x % workers.len; }; var iter = workers.len; while (iter > 0) : (iter -= 1) { const worker = &workers[index]; index += 1; if (index == workers.len) index = 0; if (worker == self) continue; if (self.run_queue.stealBounded(&worker.run_queue)) |runnable| return runnable; if (self.run_queue.stealUnbounded(&worker.run_queue_overflow)) |runnable| return runnable; } return null; } }; const Batch = struct { size: usize = 0, head: *Runnable = undefined, tail: *Runnable = undefined, fn isEmpty(self: Batch) bool { return self.size == 0; } fn from(runnable: *Runnable) Batch { runnable.next = null; return Batch{ .size = 1, .head = runnable, .tail = runnable, }; } fn pushBack(self: *Batch, batch: Batch) void { if (batch.isEmpty()) return; if (self.isEmpty()) { self.* = batch; } else { self.tail.next = batch.head; self.tail = batch.tail; self.size += batch.size; } } fn pushFront(self: *Batch, batch: Batch) void { if (batch.isEmpty()) return; if (self.isEmpty()) { self.* = batch; } else { batch.tail.next = self.head; self.head = batch.head; self.size += batch.size; } } fn popFront(self: *Batch) ?*Runnable { if (self.isEmpty()) return null; const runnable = self.head; self.head = runnable.next orelse undefined; self.size -= 1; return runnable; } }; const UnboundedQueue = struct { head: ?*Runnable = null, tail: usize = 0, stub: Runnable = Runnable.init(undefined), fn init() UnboundedQueue { return .{}; } fn deinit(self: *UnboundedQueue) void { self.* = undefined; } fn pushFront(self: *UnboundedQueue, batch: Batch) void { return self.push(batch); } fn push(self: *UnboundedQueue, batch: Batch) void { return self.pushBack(batch); } fn pushBack(self: *UnboundedQueue, batch: Batch) void { if (batch.isEmpty()) return; const head = @atomicRmw(?*Runnable, &self.head, .Xchg, batch.tail, .AcqRel); const prev = head orelse &self.stub; @atomicStore(?*Runnable, &prev.next, batch.head, .Release); } fn tryAcquireConsumer(self: *UnboundedQueue) ?Consumer { var tail = @atomicLoad(usize, &self.tail, .Monotonic); while (true) { const head = @atomicLoad(?*Runnable, &self.head, .Monotonic); if (head == null or head == &self.stub) return null; if (tail & 1 != 0) return null; tail = @cmpxchgWeak( usize, &self.tail, tail, tail | 1, .Acquire, .Monotonic, ) orelse return Consumer{ .queue = self, .tail = @intToPtr(?*Runnable, tail) orelse &self.stub, }; } } const Consumer = struct { queue: *UnboundedQueue, tail: *Runnable, fn release(self: Consumer) void { @atomicStore(usize, &self.queue.tail, @ptrToInt(self.tail), .Release); } fn pop(self: *Consumer) ?*Runnable { var tail = self.tail; var next = @atomicLoad(?*Runnable, &tail.next, .Acquire); if (tail == &self.queue.stub) { tail = next orelse return null; self.tail = tail; next = @atomicLoad(?*Runnable, &tail.next, .Acquire); } if (next) |runnable| { self.tail = runnable; return tail; } const head = @atomicLoad(?*Runnable, &self.queue.head, .Monotonic); if (tail != head) { return null; } self.queue.push(Batch.from(&self.queue.stub)); if (@atomicLoad(?*Runnable, &tail.next, .Acquire)) |runnable| { self.tail = runnable; return tail; } return null; } }; }; const BoundedQueue = struct { head: usize = 0, tail: usize = 0, buffer: [64]*Runnable = undefined, fn init() BoundedQueue { return .{}; } fn deinit(self: *BoundedQueue) void { self.* = undefined; } fn push(self: *BoundedQueue, runnable: *Runnable) ?Batch { var tail = self.tail; var head = @atomicLoad(usize, &self.head, .Monotonic); while (true) { if (tail -% head < self.buffer.len) { @atomicStore(*Runnable, &self.buffer[tail % self.buffer.len], runnable, .Unordered); @atomicStore(usize, &self.tail, tail +% 1, .Release); return null; } const new_head = head +% (self.buffer.len / 2); if (@cmpxchgWeak( usize, &self.head, head, new_head, .Acquire, .Monotonic, )) |updated| { head = updated; continue; } var batch = Batch{}; while (head != new_head) : (head +%= 1) batch.pushBack(Batch.from(self.buffer[head % self.buffer.len])); batch.pushBack(Batch.from(runnable)); return batch; } } fn pop(self: *BoundedQueue) ?*Runnable { var tail = self.tail; var head = @atomicLoad(usize, &self.head, .Monotonic); while (tail != head) { head = @cmpxchgWeak( usize, &self.head, head, head +% 1, .Acquire, .Monotonic, ) orelse return self.buffer[head % self.buffer.len]; } return null; } fn stealUnbounded(self: *BoundedQueue, target: *UnboundedQueue) ?*Runnable { var consumer = target.tryAcquireConsumer() orelse return null; defer consumer.release(); const first_runnable = consumer.pop(); const head = @atomicLoad(usize, &self.head, .Monotonic); const tail = self.tail; var new_tail = tail; while (new_tail -% head < self.buffer.len) { const runnable = consumer.pop() orelse break; @atomicStore(*Runnable, &self.buffer[new_tail % self.buffer.len], runnable, .Unordered); new_tail +%= 1; } if (new_tail != tail) @atomicStore(usize, &self.tail, new_tail, .Release); return first_runnable; } fn stealBounded(self: *BoundedQueue, target: *BoundedQueue) ?*Runnable { if (self == target) return self.pop(); const head = @atomicLoad(usize, &self.head, .Monotonic); const tail = self.tail; if (tail != head) return self.pop(); var target_head = @atomicLoad(usize, &target.head, .Monotonic); while (true) { const target_tail = @atomicLoad(usize, &target.tail, .Acquire); const target_size = target_tail -% target_head; if (target_size == 0) return null; var steal = target_size - (target_size / 2); if (steal > target.buffer.len / 2) { spinLoopHint(); target_head = @atomicLoad(usize, &target.head, .Monotonic); continue; } const first_runnable = @atomicLoad(*Runnable, &target.buffer[target_head % target.buffer.len], .Unordered); var new_target_head = target_head +% 1; var new_tail = tail; steal -= 1; while (steal > 0) : (steal -= 1) { const runnable = @atomicLoad(*Runnable, &target.buffer[new_target_head % target.buffer.len], .Unordered); new_target_head +%= 1; @atomicStore(*Runnable, &self.buffer[new_tail % self.buffer.len], runnable, .Unordered); new_tail +%= 1; } if (@cmpxchgWeak( usize, &target.head, target_head, new_target_head, .AcqRel, .Monotonic, )) |updated| { target_head = updated; continue; } if (new_tail != tail) @atomicStore(usize, &self.tail, new_tail, .Release); return first_runnable; } } }; }; const WindowsPool = struct { const Runnable = struct { callback: fn (*Runnable) void, fn init(callback: fn (*Runnable) void) Runnable { return .{ .callback = callback }; } }; var event = std.Thread.StaticResetEvent{}; fn run(runnable: *Runnable) !void { schedule(runnable); event.wait(); } fn schedule(runnable: *Runnable) void { const rc = TrySubmitThreadpoolCallback( struct { fn cb(ex: ?windows.PVOID, pt: ?windows.PVOID) callconv(.C) void { const r = @ptrCast(*Runnable, @alignCast(@alignOf(Runnable), pt.?)); (r.callback)(r); } }.cb, @ptrCast(windows.PVOID, runnable), null, ); if (rc == windows.FALSE) @panic("OOM"); } fn shutdown() void { event.set(); } const windows = std.os.windows; extern "kernel32" fn TrySubmitThreadpoolCallback( cb: fn (?windows.PVOID, ?windows.PVOID) callconv(.C) void, pv: ?windows.PVOID, ce: ?windows.PVOID, ) callconv(windows.WINAPI) windows.BOOL; }; const DispatchPool = struct { pub const Runnable = struct { next: ?*Runnable = null, callback: fn (*Runnable) void, pub fn init(callback: fn (*Runnable) void) Runnable { return .{ .callback = callback }; } }; var sem: ?dispatch_semaphore_t = null; pub fn run(runnable: *Runnable) !void { sem = dispatch_semaphore_create(0) orelse return error.SemaphoreCreate; defer dispatch_release(@ptrCast(*anyopaque, sem.?)); const queue = dispatch_queue_create(null, @ptrCast(?*anyopaque, &_dispatch_queue_attr_concurrent)) orelse return error.QueueCreate; defer dispatch_release(@ptrCast(*anyopaque, queue)); dispatch_async_f(queue, @ptrCast(*anyopaque, runnable), dispatchRun); _ = dispatch_semaphore_wait(sem.?, DISPATCH_TIME_FOREVER); } pub fn schedule(runnable: *Runnable) void { const queue = dispatch_get_current_queue() orelse unreachable; dispatch_async_f(queue, @ptrCast(*anyopaque, runnable), dispatchRun); } fn dispatchRun(ptr: ?*anyopaque) callconv(.C) void { const runnable_ptr = @ptrCast(?*Runnable, @alignCast(@alignOf(Runnable), ptr)); const runnable = runnable_ptr orelse unreachable; return (runnable.callback)(runnable); } pub fn shutdown() void { _ = dispatch_semaphore_signal(sem.?); } const dispatch_semaphore_t = *opaque {}; const dispatch_time_t = u64; const DISPATCH_TIME_NOW = @as(dispatch_time_t, 0); const DISPATCH_TIME_FOREVER = ~@as(dispatch_time_t, 0); extern "c" fn dispatch_semaphore_create(value: isize) ?dispatch_semaphore_t; extern "c" fn dispatch_semaphore_wait(dsema: dispatch_semaphore_t, timeout: dispatch_time_t) isize; extern "c" fn dispatch_semaphore_signal(dsema: dispatch_semaphore_t) isize; extern "c" fn dispatch_release(object: *anyopaque) void; const dispatch_queue_t = *opaque {}; const DISPATCH_QUEUE_PRIORITY_DEFAULT = 0; const dispatch_function_t = fn (?*anyopaque) callconv(.C) void; extern "c" var _dispatch_queue_attr_concurrent: usize; extern "c" fn dispatch_queue_create(label: ?[*:0]const u8, attr: ?*anyopaque) ?dispatch_queue_t; extern "c" fn dispatch_get_current_queue() ?dispatch_queue_t; extern "c" fn dispatch_async_f(queue: dispatch_queue_t, ctx: ?*anyopaque, work: dispatch_function_t) void; }; pub const Semaphore = struct { mutex: Mutex, cond: Condvar, permits: usize, pub fn init(permits: usize) Semaphore { return .{ .mutex = Mutex.init(), .cond = Condvar.init(), .permits = permits, }; } pub fn deinit(self: *Semaphore) void { self.mutex.deinit(); self.cond.deinit(); self.* = undefined; } pub fn wait(self: *Semaphore) void { self.mutex.lock(); defer self.mutex.unlock(); while (self.permits == 0) self.cond.wait(&self.mutex); self.permits -= 1; if (self.permits > 0) self.cond.signal(); } pub fn post(self: *Semaphore) void { self.mutex.lock(); defer self.mutex.unlock(); self.permits += 1; self.cond.signal(); } }; pub const Mutex = if (std.builtin.os.tag == .windows) struct { srwlock: SRWLOCK, pub fn init() Mutex { return .{ .srwlock = SRWLOCK_INIT }; } pub fn deinit(self: *Mutex) void { self.* = undefined; } pub fn tryLock(self: *Mutex) bool { return TryAcquireSRWLockExclusive(&self.srwlock) != system.FALSE; } pub fn lock(self: *Mutex) void { AcquireSRWLockExclusive(&self.srwlock); } pub fn unlock(self: *Mutex) void { ReleaseSRWLockExclusive(&self.srwlock); } const SRWLOCK = usize; const SRWLOCK_INIT: SRWLOCK = 0; extern "kernel32" fn TryAcquireSRWLockExclusive(s: *SRWLOCK) callconv(system.WINAPI) system.BOOL; extern "kernel32" fn AcquireSRWLockExclusive(s: *SRWLOCK) callconv(system.WINAPI) void; extern "kernel32" fn ReleaseSRWLockExclusive(s: *SRWLOCK) callconv(system.WINAPI) void; } else if (std.builtin.link_libc) struct { mutex: if (std.builtin.link_libc) std.c.pthread_mutex_t else void, pub fn init() Mutex { return .{ .mutex = std.c.PTHREAD_MUTEX_INITIALIZER }; } pub fn deinit(self: *Mutex) void { const safe_rc = switch (std.builtin.os.tag) { .dragonfly, .netbsd => std.os.EAGAIN, else => 0, }; const rc = std.c.pthread_mutex_destroy(&self.mutex); std.debug.assert(rc == 0 or rc == safe_rc); self.* = undefined; } pub fn tryLock(self: *Mutex) bool { return pthread_mutex_trylock(&self.mutex) == 0; } pub fn lock(self: *Mutex) void { const rc = std.c.pthread_mutex_lock(&self.mutex); if (rc != 0) std.debug.panic("pthread_mutex_lock() = {}\n", .{rc}); } pub fn unlock(self: *Mutex) void { const rc = std.c.pthread_mutex_unlock(&self.mutex); if (rc != 0) std.debug.panic("pthread_mutex_unlock() = {}\n", .{rc}); } extern "c" fn pthread_mutex_trylock(m: *std.c.pthread_mutex_t) callconv(.C) c_int; } else if (std.builtin.os.tag == .linux) struct { state: State, const State = enum(i32) { unlocked, locked, waiting, }; pub fn init() Mutex { return .{ .state = .unlocked }; } pub fn deinit(self: *Mutex) void { self.* = undefined; } pub fn tryLock(self: *Mutex) bool { return @cmpxchgStrong( State, &self.state, .unlocked, .locked, .Acquire, .Monotonic, ) == null; } pub fn lock(self: *Mutex) void { switch (@atomicRmw(State, &self.state, .Xchg, .locked, .Acquire)) { .unlocked => {}, else => |s| self.lockSlow(s), } } fn lockSlow(self: *Mutex, current_state: State) void { @setCold(true); var new_state = current_state; var spin: u8 = 0; while (spin < 100) : (spin += 1) { const state = @cmpxchgWeak( State, &self.state, .unlocked, new_state, .Acquire, .Monotonic, ) orelse return; switch (state) { .unlocked => {}, .locked => {}, .waiting => break, } var iter = std.math.min(32, spin + 1); while (iter > 0) : (iter -= 1) spinLoopHint(); } new_state = .waiting; while (true) { switch (@atomicRmw(State, &self.state, .Xchg, new_state, .Acquire)) { .unlocked => return, else => {}, } Futex.wait( @ptrCast(*const i32, &self.state), @enumToInt(new_state), ); } } pub fn unlock(self: *Mutex) void { switch (@atomicRmw(State, &self.state, .Xchg, .unlocked, .Release)) { .unlocked => unreachable, .locked => {}, .waiting => self.unlockSlow(), } } fn unlockSlow(self: *Mutex) void { @setCold(true); Futex.wake(@ptrCast(*const i32, &self.state)); } } else struct { is_locked: bool, pub fn init() Mutex { return .{ .is_locked = false }; } pub fn deinit(self: *Mutex) void { self.* = undefined; } pub fn tryLock(self: *Mutex) bool { return @atomicRmw(bool, &self.is_locked, .Xchg, true, .Acquire) == false; } pub fn lock(self: *Mutex) void { while (!self.tryLock()) spinLoopHint(); } pub fn unlock(self: *Mutex) void { @atomicStore(bool, &self.is_locked, false, .Release); } }; pub const Condvar = if (std.builtin.os.tag == .windows) struct { cond: CONDITION_VARIABLE, pub fn init() Condvar { return .{ .cond = CONDITION_VARIABLE_INIT }; } pub fn deinit(self: *Condvar) void { self.* = undefined; } pub fn wait(self: *Condvar, mutex: *Mutex) void { const rc = SleepConditionVariableSRW( &self.cond, &mutex.srwlock, system.INFINITE, @as(system.ULONG, 0), ); std.debug.assert(rc != system.FALSE); } pub fn signal(self: *Condvar) void { WakeConditionVariable(&self.cond); } pub fn broadcast(self: *Condvar) void { WakeAllConditionVariable(&self.cond); } const SRWLOCK = usize; const CONDITION_VARIABLE = usize; const CONDITION_VARIABLE_INIT: CONDITION_VARIABLE = 0; extern "kernel32" fn WakeAllConditionVariable(c: *CONDITION_VARIABLE) callconv(system.WINAPI) void; extern "kernel32" fn WakeConditionVariable(c: *CONDITION_VARIABLE) callconv(system.WINAPI) void; extern "kernel32" fn SleepConditionVariableSRW( c: *CONDITION_VARIABLE, s: *SRWLOCK, t: system.DWORD, f: system.ULONG, ) callconv(system.WINAPI) system.BOOL; } else if (std.builtin.link_libc) struct { cond: if (std.builtin.link_libc) std.c.pthread_cond_t else void, pub fn init() Condvar { return .{ .cond = std.c.PTHREAD_COND_INITIALIZER }; } pub fn deinit(self: *Condvar) void { const safe_rc = switch (std.builtin.os.tag) { .dragonfly, .netbsd => std.os.EAGAIN, else => 0, }; const rc = std.c.pthread_cond_destroy(&self.cond); std.debug.assert(rc == 0 or rc == safe_rc); self.* = undefined; } pub fn wait(self: *Condvar, mutex: *Mutex) void { const rc = std.c.pthread_cond_wait(&self.cond, &mutex.mutex); std.debug.assert(rc == 0); } pub fn signal(self: *Condvar) void { const rc = std.c.pthread_cond_signal(&self.cond); std.debug.assert(rc == 0); } pub fn broadcast(self: *Condvar) void { const rc = std.c.pthread_cond_broadcast(&self.cond); std.debug.assert(rc == 0); } } else struct { pending: bool, queue_mutex: Mutex, queue_list: std.SinglyLinkedList(struct { futex: i32 = 0, fn wait(self: *@This()) void { while (@atomicLoad(i32, &self.futex, .Acquire) == 0) { if (@hasDecl(Futex, "wait")) { Futex.wait(&self.futex, 0); } else { spinLoopHint(); } } } fn notify(self: *@This()) void { @atomicStore(i32, &self.futex, 1, .Release); if (@hasDecl(Futex, "wake")) Futex.wake(&self.futex); } }), pub fn init() Condvar { return .{ .pending = false, .queue_mutex = Mutex.init(), .queue_list = .{}, }; } pub fn deinit(self: *Condvar) void { self.queue_mutex.deinit(); self.* = undefined; } pub fn wait(self: *Condvar, mutex: *Mutex) void { var waiter = @TypeOf(self.queue_list).Node{ .data = .{} }; { self.queue_mutex.lock(); defer self.queue_mutex.unlock(); self.queue_list.prepend(&waiter); @atomicStore(bool, &self.pending, true, .SeqCst); } mutex.unlock(); waiter.data.wait(); mutex.lock(); } pub fn signal(self: *Condvar) void { if (@atomicLoad(bool, &self.pending, .SeqCst) == false) return; const maybe_waiter = blk: { self.queue_mutex.lock(); defer self.queue_mutex.unlock(); const maybe_waiter = self.queue_list.popFirst(); @atomicStore(bool, &self.pending, self.queue_list.first != null, .SeqCst); break :blk maybe_waiter; }; if (maybe_waiter) |waiter| waiter.data.notify(); } pub fn broadcast(self: *Condvar) void { if (@atomicLoad(bool, &self.pending, .SeqCst) == false) return; @atomicStore(bool, &self.pending, false, .SeqCst); var waiters = blk: { self.queue_mutex.lock(); defer self.queue_mutex.unlock(); const waiters = self.queue_list; self.queue_list = .{}; break :blk waiters; }; while (waiters.popFirst()) |waiter| waiter.data.notify(); } }; const Futex = switch (std.builtin.os.tag) { .linux => struct { fn wait(ptr: *const i32, cmp: i32) void { switch (system.getErrno(system.futex_wait( ptr, system.FUTEX_PRIVATE_FLAG | system.FUTEX_WAIT, cmp, null, ))) { 0 => {}, std.os.EINTR => {}, std.os.EAGAIN => {}, else => unreachable, } } fn wake(ptr: *const i32) void { switch (system.getErrno(system.futex_wake( ptr, system.FUTEX_PRIVATE_FLAG | system.FUTEX_WAKE, @as(i32, 1), ))) { 0 => {}, std.os.EFAULT => {}, else => unreachable, } } }, else => void, }; fn spinLoopHint() void { switch (std.builtin.arch) { .i386, .x86_64 => asm volatile ("pause" ::: "memory"), .arm, .aarch64 => asm volatile ("yield" ::: "memory"), else => {}, } } const is_apple_silicon = std.Target.current.isDarwin() and std.builtin.arch != .x86_64; const TLS = if (is_apple_silicon) DarwinTLS else DefaultTLS; const DefaultTLS = struct { threadlocal var tls: usize = 0; fn get() usize { return tls; } fn set(worker: usize) void { tls = worker; } }; const DarwinTLS = struct { fn get() usize { const key = getKey(); const ptr = pthread_getspecific(key); return @ptrToInt(ptr); } fn set(worker: usize) void { const key = getKey(); const rc = pthread_setspecific(key, @intToPtr(?*anyopaque, worker)); assert(rc == 0); } var tls_state: u8 = 0; var tls_key: pthread_key_t = undefined; const pthread_key_t = c_ulong; extern "c" fn pthread_key_create(key: *pthread_key_t, destructor: ?fn (value: *anyopaque) callconv(.C) void) c_int; extern "c" fn pthread_getspecific(key: pthread_key_t) ?*anyopaque; extern "c" fn pthread_setspecific(key: pthread_key_t, value: ?*anyopaque) c_int; fn getKey() pthread_key_t { var state = @atomicLoad(u8, &tls_state, .Acquire); while (true) { switch (state) { 0 => state = @cmpxchgWeak( u8, &tls_state, 0, 1, .Acquire, .Acquire, ) orelse break, 1 => { std.os.sched_yield() catch {}; state = @atomicLoad(u8, &tls_state, .Acquire); }, 2 => return tls_key, else => std.debug.panic("failed to get pthread_key_t", .{}), } } const rc = pthread_key_create(&tls_key, null); if (rc == 0) { @atomicStore(u8, &tls_state, 2, .Release); return tls_key; } @atomicStore(u8, &tls_state, 3, .Monotonic); std.debug.panic("failed to get pthread_key_t", .{}); } };
t.zig
const Builder = @import("std").build.Builder; 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(); const exe = b.addExecutable("rayray", "src/main.zig"); exe.setTarget(target); exe.setBuildMode(mode); // Libraries! exe.linkSystemLibrary("glfw3"); exe.linkSystemLibrary("png"); exe.linkSystemLibrary("freetype2"); exe.linkSystemLibrary("stdc++"); // needed for shaderc exe.addLibPath("vendor/wgpu"); exe.linkSystemLibrary("wgpu_native"); exe.addIncludeDir("vendor"); // "wgpu/wgpu.h" is the wgpu header exe.addLibPath("vendor/shaderc/lib"); exe.linkSystemLibrary("shaderc_combined"); exe.addIncludeDir("vendor/shaderc/include/"); exe.addIncludeDir("."); // for "extern/rayray.h" const c_args = [_][]const u8{ "-O3", "-DImDrawIdx=uint32_t", "-Ivendor/cimgui/imgui", // Force C linkage for imgui_impl_glfw.cpp "-DIMGUI_IMPL_API=extern \"C\"", }; const imgui_files = [_][]const u8{ "vendor/cimgui/cimgui.cpp", "vendor/cimgui/imgui/imgui.cpp", "vendor/cimgui/imgui/imgui_draw.cpp", "vendor/cimgui/imgui/imgui_demo.cpp", "vendor/cimgui/imgui/imgui_widgets.cpp", "vendor/cimgui/imgui/examples/imgui_impl_glfw.cpp", "vendor/cimgui/imgui/misc/freetype/imgui_freetype.cpp", "vendor/cimgui_ft/cimgui_ft.cpp", }; exe.addCSourceFiles(&imgui_files, &c_args); exe.install(); if (exe.target.isDarwin()) { exe.addFrameworkDir("/System/Library/Frameworks"); exe.linkFramework("Foundation"); exe.linkFramework("AppKit"); } const run_cmd = exe.run(); run_cmd.step.dependOn(b.getInstallStep()); const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step); }
build.zig
const std = @import("std"); const mem = std.mem; const Wide = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 4352, hi: u21 = 262141, pub fn init(allocator: *mem.Allocator) !Wide { var instance = Wide{ .allocator = allocator, .array = try allocator.alloc(bool, 257790), }; mem.set(bool, instance.array, false); var index: u21 = 0; index = 0; while (index <= 95) : (index += 1) { instance.array[index] = true; } index = 4634; while (index <= 4635) : (index += 1) { instance.array[index] = true; } instance.array[4649] = true; instance.array[4650] = true; index = 4841; while (index <= 4844) : (index += 1) { instance.array[index] = true; } instance.array[4848] = true; instance.array[4851] = true; index = 5373; while (index <= 5374) : (index += 1) { instance.array[index] = true; } index = 5396; while (index <= 5397) : (index += 1) { instance.array[index] = true; } index = 5448; while (index <= 5459) : (index += 1) { instance.array[index] = true; } instance.array[5503] = true; instance.array[5523] = true; instance.array[5537] = true; index = 5546; while (index <= 5547) : (index += 1) { instance.array[index] = true; } index = 5565; while (index <= 5566) : (index += 1) { instance.array[index] = true; } index = 5572; while (index <= 5573) : (index += 1) { instance.array[index] = true; } instance.array[5582] = true; instance.array[5588] = true; instance.array[5610] = true; index = 5618; while (index <= 5619) : (index += 1) { instance.array[index] = true; } instance.array[5621] = true; instance.array[5626] = true; instance.array[5629] = true; instance.array[5637] = true; index = 5642; while (index <= 5643) : (index += 1) { instance.array[index] = true; } instance.array[5672] = true; instance.array[5708] = true; instance.array[5710] = true; index = 5715; while (index <= 5717) : (index += 1) { instance.array[index] = true; } instance.array[5719] = true; index = 5781; while (index <= 5783) : (index += 1) { instance.array[index] = true; } instance.array[5808] = true; instance.array[5823] = true; index = 6683; while (index <= 6684) : (index += 1) { instance.array[index] = true; } instance.array[6736] = true; instance.array[6741] = true; index = 7552; while (index <= 7577) : (index += 1) { instance.array[index] = true; } index = 7579; while (index <= 7667) : (index += 1) { instance.array[index] = true; } index = 7680; while (index <= 7893) : (index += 1) { instance.array[index] = true; } index = 7920; while (index <= 7931) : (index += 1) { instance.array[index] = true; } index = 7937; while (index <= 7939) : (index += 1) { instance.array[index] = true; } instance.array[7940] = true; instance.array[7941] = true; instance.array[7942] = true; instance.array[7943] = true; instance.array[7944] = true; instance.array[7945] = true; instance.array[7946] = true; instance.array[7947] = true; instance.array[7948] = true; instance.array[7949] = true; instance.array[7950] = true; instance.array[7951] = true; instance.array[7952] = true; instance.array[7953] = true; index = 7954; while (index <= 7955) : (index += 1) { instance.array[index] = true; } instance.array[7956] = true; instance.array[7957] = true; instance.array[7958] = true; instance.array[7959] = true; instance.array[7960] = true; instance.array[7961] = true; instance.array[7962] = true; instance.array[7963] = true; instance.array[7964] = true; instance.array[7965] = true; index = 7966; while (index <= 7967) : (index += 1) { instance.array[index] = true; } instance.array[7968] = true; index = 7969; while (index <= 7977) : (index += 1) { instance.array[index] = true; } index = 7978; while (index <= 7981) : (index += 1) { instance.array[index] = true; } index = 7982; while (index <= 7983) : (index += 1) { instance.array[index] = true; } instance.array[7984] = true; index = 7985; while (index <= 7989) : (index += 1) { instance.array[index] = true; } index = 7990; while (index <= 7991) : (index += 1) { instance.array[index] = true; } index = 7992; while (index <= 7994) : (index += 1) { instance.array[index] = true; } instance.array[7995] = true; instance.array[7996] = true; instance.array[7997] = true; instance.array[7998] = true; index = 8001; while (index <= 8086) : (index += 1) { instance.array[index] = true; } index = 8089; while (index <= 8090) : (index += 1) { instance.array[index] = true; } index = 8091; while (index <= 8092) : (index += 1) { instance.array[index] = true; } index = 8093; while (index <= 8094) : (index += 1) { instance.array[index] = true; } instance.array[8095] = true; instance.array[8096] = true; index = 8097; while (index <= 8186) : (index += 1) { instance.array[index] = true; } instance.array[8187] = true; index = 8188; while (index <= 8190) : (index += 1) { instance.array[index] = true; } instance.array[8191] = true; index = 8197; while (index <= 8239) : (index += 1) { instance.array[index] = true; } index = 8241; while (index <= 8334) : (index += 1) { instance.array[index] = true; } index = 8336; while (index <= 8337) : (index += 1) { instance.array[index] = true; } index = 8338; while (index <= 8341) : (index += 1) { instance.array[index] = true; } index = 8342; while (index <= 8351) : (index += 1) { instance.array[index] = true; } index = 8352; while (index <= 8383) : (index += 1) { instance.array[index] = true; } index = 8384; while (index <= 8419) : (index += 1) { instance.array[index] = true; } index = 8432; while (index <= 8447) : (index += 1) { instance.array[index] = true; } index = 8448; while (index <= 8478) : (index += 1) { instance.array[index] = true; } index = 8480; while (index <= 8489) : (index += 1) { instance.array[index] = true; } index = 8490; while (index <= 8519) : (index += 1) { instance.array[index] = true; } instance.array[8528] = true; index = 8529; while (index <= 8543) : (index += 1) { instance.array[index] = true; } index = 8544; while (index <= 8575) : (index += 1) { instance.array[index] = true; } index = 8576; while (index <= 8585) : (index += 1) { instance.array[index] = true; } index = 8586; while (index <= 8624) : (index += 1) { instance.array[index] = true; } index = 8625; while (index <= 8639) : (index += 1) { instance.array[index] = true; } index = 8640; while (index <= 8959) : (index += 1) { instance.array[index] = true; } index = 8960; while (index <= 15551) : (index += 1) { instance.array[index] = true; } index = 15616; while (index <= 36604) : (index += 1) { instance.array[index] = true; } index = 36605; while (index <= 36607) : (index += 1) { instance.array[index] = true; } index = 36608; while (index <= 36628) : (index += 1) { instance.array[index] = true; } instance.array[36629] = true; index = 36630; while (index <= 37772) : (index += 1) { instance.array[index] = true; } index = 37776; while (index <= 37830) : (index += 1) { instance.array[index] = true; } index = 39008; while (index <= 39036) : (index += 1) { instance.array[index] = true; } index = 39680; while (index <= 50851) : (index += 1) { instance.array[index] = true; } index = 59392; while (index <= 59757) : (index += 1) { instance.array[index] = true; } index = 59758; while (index <= 59759) : (index += 1) { instance.array[index] = true; } index = 59760; while (index <= 59865) : (index += 1) { instance.array[index] = true; } index = 59866; while (index <= 59903) : (index += 1) { instance.array[index] = true; } index = 60688; while (index <= 60694) : (index += 1) { instance.array[index] = true; } instance.array[60695] = true; instance.array[60696] = true; instance.array[60697] = true; instance.array[60720] = true; index = 60721; while (index <= 60722) : (index += 1) { instance.array[index] = true; } index = 60723; while (index <= 60724) : (index += 1) { instance.array[index] = true; } instance.array[60725] = true; instance.array[60726] = true; instance.array[60727] = true; instance.array[60728] = true; instance.array[60729] = true; instance.array[60730] = true; instance.array[60731] = true; instance.array[60732] = true; instance.array[60733] = true; instance.array[60734] = true; instance.array[60735] = true; instance.array[60736] = true; instance.array[60737] = true; instance.array[60738] = true; instance.array[60739] = true; instance.array[60740] = true; index = 60741; while (index <= 60742) : (index += 1) { instance.array[index] = true; } instance.array[60743] = true; instance.array[60744] = true; index = 60745; while (index <= 60748) : (index += 1) { instance.array[index] = true; } index = 60749; while (index <= 60751) : (index += 1) { instance.array[index] = true; } index = 60752; while (index <= 60754) : (index += 1) { instance.array[index] = true; } index = 60756; while (index <= 60759) : (index += 1) { instance.array[index] = true; } instance.array[60760] = true; instance.array[60761] = true; instance.array[60762] = true; instance.array[60763] = true; instance.array[60764] = true; instance.array[60765] = true; instance.array[60766] = true; index = 60767; while (index <= 60769) : (index += 1) { instance.array[index] = true; } instance.array[60770] = true; instance.array[60771] = true; index = 60772; while (index <= 60774) : (index += 1) { instance.array[index] = true; } instance.array[60776] = true; instance.array[60777] = true; index = 60778; while (index <= 60779) : (index += 1) { instance.array[index] = true; } index = 89824; while (index <= 89825) : (index += 1) { instance.array[index] = true; } instance.array[89826] = true; instance.array[89827] = true; instance.array[89828] = true; index = 89840; while (index <= 89841) : (index += 1) { instance.array[index] = true; } index = 89856; while (index <= 95991) : (index += 1) { instance.array[index] = true; } index = 96000; while (index <= 97237) : (index += 1) { instance.array[index] = true; } index = 97280; while (index <= 97288) : (index += 1) { instance.array[index] = true; } index = 106240; while (index <= 106526) : (index += 1) { instance.array[index] = true; } index = 106576; while (index <= 106578) : (index += 1) { instance.array[index] = true; } index = 106596; while (index <= 106599) : (index += 1) { instance.array[index] = true; } index = 106608; while (index <= 107003) : (index += 1) { instance.array[index] = true; } instance.array[122628] = true; instance.array[122831] = true; instance.array[123022] = true; index = 123025; while (index <= 123034) : (index += 1) { instance.array[index] = true; } index = 123136; while (index <= 123138) : (index += 1) { instance.array[index] = true; } index = 123152; while (index <= 123195) : (index += 1) { instance.array[index] = true; } index = 123200; while (index <= 123208) : (index += 1) { instance.array[index] = true; } index = 123216; while (index <= 123217) : (index += 1) { instance.array[index] = true; } index = 123232; while (index <= 123237) : (index += 1) { instance.array[index] = true; } index = 123392; while (index <= 123424) : (index += 1) { instance.array[index] = true; } index = 123437; while (index <= 123445) : (index += 1) { instance.array[index] = true; } index = 123447; while (index <= 123516) : (index += 1) { instance.array[index] = true; } index = 123518; while (index <= 123539) : (index += 1) { instance.array[index] = true; } index = 123552; while (index <= 123594) : (index += 1) { instance.array[index] = true; } index = 123599; while (index <= 123603) : (index += 1) { instance.array[index] = true; } index = 123616; while (index <= 123632) : (index += 1) { instance.array[index] = true; } instance.array[123636] = true; index = 123640; while (index <= 123642) : (index += 1) { instance.array[index] = true; } index = 123643; while (index <= 123647) : (index += 1) { instance.array[index] = true; } index = 123648; while (index <= 123710) : (index += 1) { instance.array[index] = true; } instance.array[123712] = true; index = 123714; while (index <= 123900) : (index += 1) { instance.array[index] = true; } index = 123903; while (index <= 123965) : (index += 1) { instance.array[index] = true; } index = 123979; while (index <= 123982) : (index += 1) { instance.array[index] = true; } index = 123984; while (index <= 124007) : (index += 1) { instance.array[index] = true; } instance.array[124026] = true; index = 124053; while (index <= 124054) : (index += 1) { instance.array[index] = true; } instance.array[124068] = true; index = 124155; while (index <= 124239) : (index += 1) { instance.array[index] = true; } index = 124288; while (index <= 124357) : (index += 1) { instance.array[index] = true; } instance.array[124364] = true; index = 124368; while (index <= 124370) : (index += 1) { instance.array[index] = true; } index = 124373; while (index <= 124375) : (index += 1) { instance.array[index] = true; } index = 124395; while (index <= 124396) : (index += 1) { instance.array[index] = true; } index = 124404; while (index <= 124412) : (index += 1) { instance.array[index] = true; } index = 124640; while (index <= 124651) : (index += 1) { instance.array[index] = true; } index = 124940; while (index <= 124986) : (index += 1) { instance.array[index] = true; } index = 124988; while (index <= 124997) : (index += 1) { instance.array[index] = true; } index = 124999; while (index <= 125048) : (index += 1) { instance.array[index] = true; } index = 125050; while (index <= 125131) : (index += 1) { instance.array[index] = true; } index = 125133; while (index <= 125183) : (index += 1) { instance.array[index] = true; } index = 125296; while (index <= 125300) : (index += 1) { instance.array[index] = true; } index = 125304; while (index <= 125306) : (index += 1) { instance.array[index] = true; } index = 125312; while (index <= 125318) : (index += 1) { instance.array[index] = true; } index = 125328; while (index <= 125352) : (index += 1) { instance.array[index] = true; } index = 125360; while (index <= 125366) : (index += 1) { instance.array[index] = true; } index = 125376; while (index <= 125378) : (index += 1) { instance.array[index] = true; } index = 125392; while (index <= 125398) : (index += 1) { instance.array[index] = true; } index = 126720; while (index <= 169437) : (index += 1) { instance.array[index] = true; } index = 169438; while (index <= 169471) : (index += 1) { instance.array[index] = true; } index = 169472; while (index <= 173620) : (index += 1) { instance.array[index] = true; } index = 173621; while (index <= 173631) : (index += 1) { instance.array[index] = true; } index = 173632; while (index <= 173853) : (index += 1) { instance.array[index] = true; } index = 173854; while (index <= 173855) : (index += 1) { instance.array[index] = true; } index = 173856; while (index <= 179617) : (index += 1) { instance.array[index] = true; } index = 179618; while (index <= 179631) : (index += 1) { instance.array[index] = true; } index = 179632; while (index <= 187104) : (index += 1) { instance.array[index] = true; } index = 187105; while (index <= 190207) : (index += 1) { instance.array[index] = true; } index = 190208; while (index <= 190749) : (index += 1) { instance.array[index] = true; } index = 190750; while (index <= 192253) : (index += 1) { instance.array[index] = true; } index = 192256; while (index <= 197194) : (index += 1) { instance.array[index] = true; } index = 197195; while (index <= 257789) : (index += 1) { instance.array[index] = true; } // Placeholder: 0. Struct name, 1. Code point kind return instance; } pub fn deinit(self: *Wide) void { self.allocator.free(self.array); } // isWide checks if cp is of the kind Wide. pub fn isWide(self: Wide, 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/DerivedEastAsianWidth/Wide.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const List = std.ArrayList; const Map = std.AutoHashMap; const StrMap = std.StringHashMap; const BitSet = std.DynamicBitSet; const Str = []const u8; const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../data/day08.txt"); //const data = "acedgfb cdfbe gcdfa fbcad dab cefabd cdfgeb eafb cagedb ab | cdfeb fcadb cdfeb cdbaf"; const example_data = \\be cfbegad cbdgef fgaecd cgeb fdcge agebfd fecdb fabcd edb | fdgacbe cefdb cefbgd gcbe \\edbfga begcd cbg gc gcadebf fbgde acbgfd abcde gfcbed gfec | fcgedb cgb dgebacf gc \\fgaebd cg bdaec gdafb agbcfd gdcbef bgcad gfac gcb cdgabef | cg cg fdcagb cbg \\fbegcd cbd adcefb dageb afcb bc aefdc ecdab fgdeca fcdbega | efabcd cedba gadfec cb \\aecbfdg fbg gf bafeg dbefa fcge gcbea fcaegb dgceab fcbdga | gecf egdcabf bgf bfgea \\fgeab ca afcebg bdacfeg cfaedg gcfdb baec bfadeg bafgc acf | gebdcfa ecba ca fadegcb \\dbcfg fgd bdegcaf fgec aegbdf ecdfab fbedc dacgb gdcebf gf | cefg dcbef fcge gbcadfe \\bdfegc cbegaf gecbf dfcage bdacg ed bedf ced adcbefg gebcd | ed bcgafe cdgba cbgef \\egadfb cdbfeg cegd fecab cgb gbdefca cg fgcdab egfdb bfceg | gbdfcae bgc cg cgb \\gcafb gcf dcaebfg ecagb gf abcdeg gaef cafbge fdbac fegbdc | fgae cfgab fg bagce ; fn encodePattern(s: []const u8) u7 { var pattern: u7 = 0; for (s) |c| { assert(c >= 'a'); assert(c <= 'g'); const i: u3 = @truncate(u3, c - 'a'); pattern |= @as(u7, 1) << i; } return pattern; } fn letter(c: u8) u3 { assert(c >= 'a'); assert(c <= 'g'); return @truncate(u3, c - 'a'); } const Entry = struct { unique: [10]u7, output: [4]u7, }; pub fn main() !void { const input: []Entry = blk: { var lines = tokenize(u8, data, "\r\n"); var list = std.ArrayList(Entry).init(gpa); while (lines.next()) |line| { var entries = tokenize(u8, line, " |"); var entry: Entry = undefined; var index: usize = 0; while (entries.next()) |pattern| : (index += 1) { if (index < 10) { entry.unique[index] = encodePattern(pattern); } else { entry.output[index - 10] = encodePattern(pattern); } } try list.append(entry); } break :blk list.toOwnedSlice(); }; { // part 1 var count: u32 = 0; for (input) |entry| { for (entry.output) |pattern| { const segment_count = @popCount(u7, pattern); switch (segment_count) { 2, 4, 3, 7 => count += 1, else => {}, } } } assert(count == 349); print("{}\n", .{count}); } { // part 2 var answer: u32 = 0; for (input) |entry| { var patterns: [10]u7 = undefined; // how to light up each digit // fill out patterns for 1 4 7 8 for (entry.unique) |pattern| { switch (@popCount(u7, pattern)) { 2 => patterns[1] = pattern, 3 => patterns[7] = pattern, 4 => patterns[4] = pattern, 7 => patterns[8] = pattern, else => {}, } } // fill out patterns for remaining digits for (entry.unique) |pattern| { switch (@popCount(u7, pattern)) { 2, 3, 4, 7 => {}, // 1 4 7 8 done already 5 => { // 2 3 5 var index: usize = undefined; if (pattern | patterns[4] == patterns[8]) { index = 2; } else if (pattern | patterns[7] == pattern) { index = 3; } else { index = 5; } patterns[index] = pattern; }, 6 => { // 0 6 9 var index: usize = undefined; if (pattern | patterns[7] == patterns[8]) { index = 6; } else if (pattern | patterns[4] == patterns[8]) { index = 0; } else { index = 9; } patterns[index] = pattern; }, else => unreachable, } } // find corresponding digits for output section const output: u32 = blk: { var digits: [4]u8 = undefined; for (entry.output) |output, place| { for (patterns) |pattern, index| { if (output == pattern) { digits[place] = @truncate(u8, '0' + index); break; } } else unreachable; } break :blk try parseInt(u32, &digits, 10); }; answer += output; } assert(answer == 1070957); print("{d}\n", .{answer}); } } // 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/day08.zig
pub const OPC_E_NONCONFORMING_URI = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175231)); pub const OPC_E_RELATIVE_URI_REQUIRED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175230)); pub const OPC_E_RELATIONSHIP_URI_REQUIRED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175229)); pub const OPC_E_PART_CANNOT_BE_DIRECTORY = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175228)); pub const OPC_E_UNEXPECTED_CONTENT_TYPE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175227)); pub const OPC_E_INVALID_CONTENT_TYPE_XML = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175226)); pub const OPC_E_MISSING_CONTENT_TYPES = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175225)); pub const OPC_E_NONCONFORMING_CONTENT_TYPES_XML = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175224)); pub const OPC_E_NONCONFORMING_RELS_XML = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175223)); pub const OPC_E_INVALID_RELS_XML = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175222)); pub const OPC_E_DUPLICATE_PART = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175221)); pub const OPC_E_INVALID_OVERRIDE_PART_NAME = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175220)); pub const OPC_E_DUPLICATE_OVERRIDE_PART = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175219)); pub const OPC_E_INVALID_DEFAULT_EXTENSION = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175218)); pub const OPC_E_DUPLICATE_DEFAULT_EXTENSION = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175217)); pub const OPC_E_INVALID_RELATIONSHIP_ID = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175216)); pub const OPC_E_INVALID_RELATIONSHIP_TYPE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175215)); pub const OPC_E_INVALID_RELATIONSHIP_TARGET = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175214)); pub const OPC_E_DUPLICATE_RELATIONSHIP = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175213)); pub const OPC_E_CONFLICTING_SETTINGS = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175212)); pub const OPC_E_DUPLICATE_PIECE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175211)); pub const OPC_E_INVALID_PIECE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175210)); pub const OPC_E_MISSING_PIECE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175209)); pub const OPC_E_NO_SUCH_PART = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175208)); pub const OPC_E_DS_SIGNATURE_CORRUPT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175207)); pub const OPC_E_DS_DIGEST_VALUE_ERROR = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175206)); pub const OPC_E_DS_DUPLICATE_SIGNATURE_ORIGIN_RELATIONSHIP = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175205)); pub const OPC_E_DS_INVALID_SIGNATURE_ORIGIN_RELATIONSHIP = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175204)); pub const OPC_E_DS_INVALID_CERTIFICATE_RELATIONSHIP = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175203)); pub const OPC_E_DS_EXTERNAL_SIGNATURE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175202)); pub const OPC_E_DS_MISSING_SIGNATURE_ORIGIN_PART = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175201)); pub const OPC_E_DS_MISSING_SIGNATURE_PART = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175200)); pub const OPC_E_DS_INVALID_RELATIONSHIP_TRANSFORM_XML = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175199)); pub const OPC_E_DS_INVALID_CANONICALIZATION_METHOD = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175198)); pub const OPC_E_DS_INVALID_RELATIONSHIPS_SIGNING_OPTION = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175197)); pub const OPC_E_DS_INVALID_OPC_SIGNATURE_TIME_FORMAT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175196)); pub const OPC_E_DS_PACKAGE_REFERENCE_URI_RESERVED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175195)); pub const OPC_E_DS_MISSING_SIGNATURE_PROPERTIES_ELEMENT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175194)); pub const OPC_E_DS_MISSING_SIGNATURE_PROPERTY_ELEMENT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175193)); pub const OPC_E_DS_DUPLICATE_SIGNATURE_PROPERTY_ELEMENT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175192)); pub const OPC_E_DS_MISSING_SIGNATURE_TIME_PROPERTY = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175191)); pub const OPC_E_DS_INVALID_SIGNATURE_XML = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175190)); pub const OPC_E_DS_INVALID_SIGNATURE_COUNT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175189)); pub const OPC_E_DS_MISSING_SIGNATURE_ALGORITHM = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175188)); pub const OPC_E_DS_DUPLICATE_PACKAGE_OBJECT_REFERENCES = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175187)); pub const OPC_E_DS_MISSING_PACKAGE_OBJECT_REFERENCE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175186)); pub const OPC_E_DS_EXTERNAL_SIGNATURE_REFERENCE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175185)); pub const OPC_E_DS_REFERENCE_MISSING_CONTENT_TYPE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175184)); pub const OPC_E_DS_MULTIPLE_RELATIONSHIP_TRANSFORMS = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175183)); pub const OPC_E_DS_MISSING_CANONICALIZATION_TRANSFORM = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175182)); pub const OPC_E_MC_UNEXPECTED_ELEMENT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175181)); pub const OPC_E_MC_UNEXPECTED_REQUIRES_ATTR = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175180)); pub const OPC_E_MC_MISSING_REQUIRES_ATTR = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175179)); pub const OPC_E_MC_UNEXPECTED_ATTR = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175178)); pub const OPC_E_MC_INVALID_PREFIX_LIST = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175177)); pub const OPC_E_MC_INVALID_QNAME_LIST = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175176)); pub const OPC_E_MC_NESTED_ALTERNATE_CONTENT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175175)); pub const OPC_E_MC_UNEXPECTED_CHOICE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175174)); pub const OPC_E_MC_MISSING_CHOICE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175173)); pub const OPC_E_MC_INVALID_ENUM_TYPE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175172)); pub const OPC_E_MC_UNKNOWN_NAMESPACE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175170)); pub const OPC_E_MC_UNKNOWN_PREFIX = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175169)); pub const OPC_E_MC_INVALID_ATTRIBUTES_ON_IGNORABLE_ELEMENT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175168)); pub const OPC_E_MC_INVALID_XMLNS_ATTRIBUTE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175167)); pub const OPC_E_INVALID_XML_ENCODING = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175166)); pub const OPC_E_DS_SIGNATURE_REFERENCE_MISSING_URI = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175165)); pub const OPC_E_INVALID_CONTENT_TYPE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175164)); pub const OPC_E_DS_SIGNATURE_PROPERTY_MISSING_TARGET = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175163)); pub const OPC_E_DS_SIGNATURE_METHOD_NOT_SET = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175162)); pub const OPC_E_DS_DEFAULT_DIGEST_METHOD_NOT_SET = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175161)); pub const OPC_E_NO_SUCH_RELATIONSHIP = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175160)); pub const OPC_E_MC_MULTIPLE_FALLBACK_ELEMENTS = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175159)); pub const OPC_E_MC_INCONSISTENT_PROCESS_CONTENT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175158)); pub const OPC_E_MC_INCONSISTENT_PRESERVE_ATTRIBUTES = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175157)); pub const OPC_E_MC_INCONSISTENT_PRESERVE_ELEMENTS = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175156)); pub const OPC_E_INVALID_RELATIONSHIP_TARGET_MODE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175155)); pub const OPC_E_COULD_NOT_RECOVER = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175154)); pub const OPC_E_UNSUPPORTED_PACKAGE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175153)); pub const OPC_E_ENUM_COLLECTION_CHANGED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175152)); pub const OPC_E_ENUM_CANNOT_MOVE_NEXT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175151)); pub const OPC_E_ENUM_CANNOT_MOVE_PREVIOUS = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175150)); pub const OPC_E_ENUM_INVALID_POSITION = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175149)); pub const OPC_E_DS_SIGNATURE_ORIGIN_EXISTS = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175148)); pub const OPC_E_DS_UNSIGNED_PACKAGE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175147)); pub const OPC_E_DS_MISSING_CERTIFICATE_PART = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175146)); pub const OPC_E_NO_SUCH_SETTINGS = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142175145)); pub const OPC_E_ZIP_INCORRECT_DATA_SIZE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142171135)); pub const OPC_E_ZIP_CORRUPTED_ARCHIVE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142171134)); pub const OPC_E_ZIP_COMPRESSION_FAILED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142171133)); pub const OPC_E_ZIP_DECOMPRESSION_FAILED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142171132)); pub const OPC_E_ZIP_INCONSISTENT_FILEITEM = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142171131)); pub const OPC_E_ZIP_INCONSISTENT_DIRECTORY = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142171130)); pub const OPC_E_ZIP_MISSING_DATA_DESCRIPTOR = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142171129)); pub const OPC_E_ZIP_UNSUPPORTEDARCHIVE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142171128)); pub const OPC_E_ZIP_CENTRAL_DIRECTORY_TOO_LARGE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142171127)); pub const OPC_E_ZIP_NAME_TOO_LARGE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142171126)); pub const OPC_E_ZIP_DUPLICATE_NAME = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142171125)); pub const OPC_E_ZIP_COMMENT_TOO_LARGE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142171124)); pub const OPC_E_ZIP_EXTRA_FIELDS_TOO_LARGE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142171123)); pub const OPC_E_ZIP_FILE_HEADER_TOO_LARGE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142171122)); pub const OPC_E_ZIP_MISSING_END_OF_CENTRAL_DIRECTORY = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142171121)); pub const OPC_E_ZIP_REQUIRES_64_BIT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2142171120)); //-------------------------------------------------------------------------------- // Section: Types (43) //-------------------------------------------------------------------------------- const CLSID_OpcFactory_Value = Guid.initString("6b2d6ba0-9f3e-4f27-920b-313cc426a39e"); pub const CLSID_OpcFactory = &CLSID_OpcFactory_Value; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcUri_Value = Guid.initString("bc9c1b9b-d62c-49eb-aef0-3b4e0b28ebed"); pub const IID_IOpcUri = &IID_IOpcUri_Value; pub const IOpcUri = extern struct { pub const VTable = extern struct { base: IUri.VTable, GetRelationshipsPartUri: fn( self: *const IOpcUri, relationshipPartUri: ?*?*IOpcPartUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRelativeUri: fn( self: *const IOpcUri, targetPartUri: ?*IOpcPartUri, relativeUri: ?*?*IUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CombinePartUri: fn( self: *const IOpcUri, relativeUri: ?*IUri, combinedUri: ?*?*IOpcPartUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUri.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcUri_GetRelationshipsPartUri(self: *const T, relationshipPartUri: ?*?*IOpcPartUri) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcUri.VTable, self.vtable).GetRelationshipsPartUri(@ptrCast(*const IOpcUri, self), relationshipPartUri); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcUri_GetRelativeUri(self: *const T, targetPartUri: ?*IOpcPartUri, relativeUri: ?*?*IUri) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcUri.VTable, self.vtable).GetRelativeUri(@ptrCast(*const IOpcUri, self), targetPartUri, relativeUri); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcUri_CombinePartUri(self: *const T, relativeUri: ?*IUri, combinedUri: ?*?*IOpcPartUri) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcUri.VTable, self.vtable).CombinePartUri(@ptrCast(*const IOpcUri, self), relativeUri, combinedUri); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcPartUri_Value = Guid.initString("7d3babe7-88b2-46ba-85cb-4203cb016c87"); pub const IID_IOpcPartUri = &IID_IOpcPartUri_Value; pub const IOpcPartUri = extern struct { pub const VTable = extern struct { base: IOpcUri.VTable, ComparePartUri: fn( self: *const IOpcPartUri, partUri: ?*IOpcPartUri, comparisonResult: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSourceUri: fn( self: *const IOpcPartUri, sourceUri: ?*?*IOpcUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsRelationshipsPartUri: fn( self: *const IOpcPartUri, isRelationshipUri: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOpcUri.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcPartUri_ComparePartUri(self: *const T, partUri: ?*IOpcPartUri, comparisonResult: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcPartUri.VTable, self.vtable).ComparePartUri(@ptrCast(*const IOpcPartUri, self), partUri, comparisonResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcPartUri_GetSourceUri(self: *const T, sourceUri: ?*?*IOpcUri) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcPartUri.VTable, self.vtable).GetSourceUri(@ptrCast(*const IOpcPartUri, self), sourceUri); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcPartUri_IsRelationshipsPartUri(self: *const T, isRelationshipUri: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcPartUri.VTable, self.vtable).IsRelationshipsPartUri(@ptrCast(*const IOpcPartUri, self), isRelationshipUri); } };} pub usingnamespace MethodMixin(@This()); }; pub const OPC_URI_TARGET_MODE = enum(i32) { INTERNAL = 0, EXTERNAL = 1, }; pub const OPC_URI_TARGET_MODE_INTERNAL = OPC_URI_TARGET_MODE.INTERNAL; pub const OPC_URI_TARGET_MODE_EXTERNAL = OPC_URI_TARGET_MODE.EXTERNAL; pub const OPC_COMPRESSION_OPTIONS = enum(i32) { NONE = -1, NORMAL = 0, MAXIMUM = 1, FAST = 2, SUPERFAST = 3, }; pub const OPC_COMPRESSION_NONE = OPC_COMPRESSION_OPTIONS.NONE; pub const OPC_COMPRESSION_NORMAL = OPC_COMPRESSION_OPTIONS.NORMAL; pub const OPC_COMPRESSION_MAXIMUM = OPC_COMPRESSION_OPTIONS.MAXIMUM; pub const OPC_COMPRESSION_FAST = OPC_COMPRESSION_OPTIONS.FAST; pub const OPC_COMPRESSION_SUPERFAST = OPC_COMPRESSION_OPTIONS.SUPERFAST; pub const OPC_STREAM_IO_MODE = enum(i32) { READ = 1, WRITE = 2, }; pub const OPC_STREAM_IO_READ = OPC_STREAM_IO_MODE.READ; pub const OPC_STREAM_IO_WRITE = OPC_STREAM_IO_MODE.WRITE; pub const OPC_READ_FLAGS = enum(u32) { READ_DEFAULT = 0, VALIDATE_ON_LOAD = 1, CACHE_ON_ACCESS = 2, _, pub fn initFlags(o: struct { READ_DEFAULT: u1 = 0, VALIDATE_ON_LOAD: u1 = 0, CACHE_ON_ACCESS: u1 = 0, }) OPC_READ_FLAGS { return @intToEnum(OPC_READ_FLAGS, (if (o.READ_DEFAULT == 1) @enumToInt(OPC_READ_FLAGS.READ_DEFAULT) else 0) | (if (o.VALIDATE_ON_LOAD == 1) @enumToInt(OPC_READ_FLAGS.VALIDATE_ON_LOAD) else 0) | (if (o.CACHE_ON_ACCESS == 1) @enumToInt(OPC_READ_FLAGS.CACHE_ON_ACCESS) else 0) ); } }; pub const OPC_READ_DEFAULT = OPC_READ_FLAGS.READ_DEFAULT; pub const OPC_VALIDATE_ON_LOAD = OPC_READ_FLAGS.VALIDATE_ON_LOAD; pub const OPC_CACHE_ON_ACCESS = OPC_READ_FLAGS.CACHE_ON_ACCESS; pub const OPC_WRITE_FLAGS = enum(u32) { DEFAULT = 0, FORCE_ZIP32 = 1, _, pub fn initFlags(o: struct { DEFAULT: u1 = 0, FORCE_ZIP32: u1 = 0, }) OPC_WRITE_FLAGS { return @intToEnum(OPC_WRITE_FLAGS, (if (o.DEFAULT == 1) @enumToInt(OPC_WRITE_FLAGS.DEFAULT) else 0) | (if (o.FORCE_ZIP32 == 1) @enumToInt(OPC_WRITE_FLAGS.FORCE_ZIP32) else 0) ); } }; pub const OPC_WRITE_DEFAULT = OPC_WRITE_FLAGS.DEFAULT; pub const OPC_WRITE_FORCE_ZIP32 = OPC_WRITE_FLAGS.FORCE_ZIP32; pub const OPC_SIGNATURE_VALIDATION_RESULT = enum(i32) { VALID = 0, INVALID = -1, }; pub const OPC_SIGNATURE_VALID = OPC_SIGNATURE_VALIDATION_RESULT.VALID; pub const OPC_SIGNATURE_INVALID = OPC_SIGNATURE_VALIDATION_RESULT.INVALID; pub const OPC_CANONICALIZATION_METHOD = enum(i32) { NONE = 0, C14N = 1, C14N_WITH_COMMENTS = 2, }; pub const OPC_CANONICALIZATION_NONE = OPC_CANONICALIZATION_METHOD.NONE; pub const OPC_CANONICALIZATION_C14N = OPC_CANONICALIZATION_METHOD.C14N; pub const OPC_CANONICALIZATION_C14N_WITH_COMMENTS = OPC_CANONICALIZATION_METHOD.C14N_WITH_COMMENTS; pub const OPC_RELATIONSHIP_SELECTOR = enum(i32) { ID = 0, TYPE = 1, }; pub const OPC_RELATIONSHIP_SELECT_BY_ID = OPC_RELATIONSHIP_SELECTOR.ID; pub const OPC_RELATIONSHIP_SELECT_BY_TYPE = OPC_RELATIONSHIP_SELECTOR.TYPE; pub const OPC_RELATIONSHIPS_SIGNING_OPTION = enum(i32) { USING_SELECTORS = 0, PART = 1, }; pub const OPC_RELATIONSHIP_SIGN_USING_SELECTORS = OPC_RELATIONSHIPS_SIGNING_OPTION.USING_SELECTORS; pub const OPC_RELATIONSHIP_SIGN_PART = OPC_RELATIONSHIPS_SIGNING_OPTION.PART; pub const OPC_CERTIFICATE_EMBEDDING_OPTION = enum(i32) { IN_CERTIFICATE_PART = 0, IN_SIGNATURE_PART = 1, NOT_EMBEDDED = 2, }; pub const OPC_CERTIFICATE_IN_CERTIFICATE_PART = OPC_CERTIFICATE_EMBEDDING_OPTION.IN_CERTIFICATE_PART; pub const OPC_CERTIFICATE_IN_SIGNATURE_PART = OPC_CERTIFICATE_EMBEDDING_OPTION.IN_SIGNATURE_PART; pub const OPC_CERTIFICATE_NOT_EMBEDDED = OPC_CERTIFICATE_EMBEDDING_OPTION.NOT_EMBEDDED; pub const OPC_SIGNATURE_TIME_FORMAT = enum(i32) { MILLISECONDS = 0, SECONDS = 1, MINUTES = 2, DAYS = 3, MONTHS = 4, YEARS = 5, }; pub const OPC_SIGNATURE_TIME_FORMAT_MILLISECONDS = OPC_SIGNATURE_TIME_FORMAT.MILLISECONDS; pub const OPC_SIGNATURE_TIME_FORMAT_SECONDS = OPC_SIGNATURE_TIME_FORMAT.SECONDS; pub const OPC_SIGNATURE_TIME_FORMAT_MINUTES = OPC_SIGNATURE_TIME_FORMAT.MINUTES; pub const OPC_SIGNATURE_TIME_FORMAT_DAYS = OPC_SIGNATURE_TIME_FORMAT.DAYS; pub const OPC_SIGNATURE_TIME_FORMAT_MONTHS = OPC_SIGNATURE_TIME_FORMAT.MONTHS; pub const OPC_SIGNATURE_TIME_FORMAT_YEARS = OPC_SIGNATURE_TIME_FORMAT.YEARS; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcPackage_Value = Guid.initString("42195949-3b79-4fc8-89c6-fc7fb979ee70"); pub const IID_IOpcPackage = &IID_IOpcPackage_Value; pub const IOpcPackage = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetPartSet: fn( self: *const IOpcPackage, partSet: ?*?*IOpcPartSet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRelationshipSet: fn( self: *const IOpcPackage, relationshipSet: ?*?*IOpcRelationshipSet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcPackage_GetPartSet(self: *const T, partSet: ?*?*IOpcPartSet) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcPackage.VTable, self.vtable).GetPartSet(@ptrCast(*const IOpcPackage, self), partSet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcPackage_GetRelationshipSet(self: *const T, relationshipSet: ?*?*IOpcRelationshipSet) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcPackage.VTable, self.vtable).GetRelationshipSet(@ptrCast(*const IOpcPackage, self), relationshipSet); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcPart_Value = Guid.initString("42195949-3b79-4fc8-89c6-fc7fb979ee71"); pub const IID_IOpcPart = &IID_IOpcPart_Value; pub const IOpcPart = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetRelationshipSet: fn( self: *const IOpcPart, relationshipSet: ?*?*IOpcRelationshipSet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetContentStream: fn( self: *const IOpcPart, stream: ?*?*IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetName: fn( self: *const IOpcPart, name: ?*?*IOpcPartUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetContentType: fn( self: *const IOpcPart, contentType: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCompressionOptions: fn( self: *const IOpcPart, compressionOptions: ?*OPC_COMPRESSION_OPTIONS, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcPart_GetRelationshipSet(self: *const T, relationshipSet: ?*?*IOpcRelationshipSet) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcPart.VTable, self.vtable).GetRelationshipSet(@ptrCast(*const IOpcPart, self), relationshipSet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcPart_GetContentStream(self: *const T, stream: ?*?*IStream) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcPart.VTable, self.vtable).GetContentStream(@ptrCast(*const IOpcPart, self), stream); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcPart_GetName(self: *const T, name: ?*?*IOpcPartUri) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcPart.VTable, self.vtable).GetName(@ptrCast(*const IOpcPart, self), name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcPart_GetContentType(self: *const T, contentType: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcPart.VTable, self.vtable).GetContentType(@ptrCast(*const IOpcPart, self), contentType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcPart_GetCompressionOptions(self: *const T, compressionOptions: ?*OPC_COMPRESSION_OPTIONS) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcPart.VTable, self.vtable).GetCompressionOptions(@ptrCast(*const IOpcPart, self), compressionOptions); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcRelationship_Value = Guid.initString("42195949-3b79-4fc8-89c6-fc7fb979ee72"); pub const IID_IOpcRelationship = &IID_IOpcRelationship_Value; pub const IOpcRelationship = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetId: fn( self: *const IOpcRelationship, relationshipIdentifier: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRelationshipType: fn( self: *const IOpcRelationship, relationshipType: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSourceUri: fn( self: *const IOpcRelationship, sourceUri: ?*?*IOpcUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTargetUri: fn( self: *const IOpcRelationship, targetUri: ?*?*IUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTargetMode: fn( self: *const IOpcRelationship, targetMode: ?*OPC_URI_TARGET_MODE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationship_GetId(self: *const T, relationshipIdentifier: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationship.VTable, self.vtable).GetId(@ptrCast(*const IOpcRelationship, self), relationshipIdentifier); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationship_GetRelationshipType(self: *const T, relationshipType: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationship.VTable, self.vtable).GetRelationshipType(@ptrCast(*const IOpcRelationship, self), relationshipType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationship_GetSourceUri(self: *const T, sourceUri: ?*?*IOpcUri) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationship.VTable, self.vtable).GetSourceUri(@ptrCast(*const IOpcRelationship, self), sourceUri); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationship_GetTargetUri(self: *const T, targetUri: ?*?*IUri) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationship.VTable, self.vtable).GetTargetUri(@ptrCast(*const IOpcRelationship, self), targetUri); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationship_GetTargetMode(self: *const T, targetMode: ?*OPC_URI_TARGET_MODE) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationship.VTable, self.vtable).GetTargetMode(@ptrCast(*const IOpcRelationship, self), targetMode); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcPartSet_Value = Guid.initString("42195949-3b79-4fc8-89c6-fc7fb979ee73"); pub const IID_IOpcPartSet = &IID_IOpcPartSet_Value; pub const IOpcPartSet = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetPart: fn( self: *const IOpcPartSet, name: ?*IOpcPartUri, part: ?*?*IOpcPart, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreatePart: fn( self: *const IOpcPartSet, name: ?*IOpcPartUri, contentType: ?[*:0]const u16, compressionOptions: OPC_COMPRESSION_OPTIONS, part: ?*?*IOpcPart, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeletePart: fn( self: *const IOpcPartSet, name: ?*IOpcPartUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PartExists: fn( self: *const IOpcPartSet, name: ?*IOpcPartUri, partExists: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEnumerator: fn( self: *const IOpcPartSet, partEnumerator: ?*?*IOpcPartEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcPartSet_GetPart(self: *const T, name: ?*IOpcPartUri, part: ?*?*IOpcPart) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcPartSet.VTable, self.vtable).GetPart(@ptrCast(*const IOpcPartSet, self), name, part); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcPartSet_CreatePart(self: *const T, name: ?*IOpcPartUri, contentType: ?[*:0]const u16, compressionOptions: OPC_COMPRESSION_OPTIONS, part: ?*?*IOpcPart) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcPartSet.VTable, self.vtable).CreatePart(@ptrCast(*const IOpcPartSet, self), name, contentType, compressionOptions, part); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcPartSet_DeletePart(self: *const T, name: ?*IOpcPartUri) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcPartSet.VTable, self.vtable).DeletePart(@ptrCast(*const IOpcPartSet, self), name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcPartSet_PartExists(self: *const T, name: ?*IOpcPartUri, partExists: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcPartSet.VTable, self.vtable).PartExists(@ptrCast(*const IOpcPartSet, self), name, partExists); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcPartSet_GetEnumerator(self: *const T, partEnumerator: ?*?*IOpcPartEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcPartSet.VTable, self.vtable).GetEnumerator(@ptrCast(*const IOpcPartSet, self), partEnumerator); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcRelationshipSet_Value = Guid.initString("42195949-3b79-4fc8-89c6-fc7fb979ee74"); pub const IID_IOpcRelationshipSet = &IID_IOpcRelationshipSet_Value; pub const IOpcRelationshipSet = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetRelationship: fn( self: *const IOpcRelationshipSet, relationshipIdentifier: ?[*:0]const u16, relationship: ?*?*IOpcRelationship, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateRelationship: fn( self: *const IOpcRelationshipSet, relationshipIdentifier: ?[*:0]const u16, relationshipType: ?[*:0]const u16, targetUri: ?*IUri, targetMode: OPC_URI_TARGET_MODE, relationship: ?*?*IOpcRelationship, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteRelationship: fn( self: *const IOpcRelationshipSet, relationshipIdentifier: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RelationshipExists: fn( self: *const IOpcRelationshipSet, relationshipIdentifier: ?[*:0]const u16, relationshipExists: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEnumerator: fn( self: *const IOpcRelationshipSet, relationshipEnumerator: ?*?*IOpcRelationshipEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEnumeratorForType: fn( self: *const IOpcRelationshipSet, relationshipType: ?[*:0]const u16, relationshipEnumerator: ?*?*IOpcRelationshipEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRelationshipsContentStream: fn( self: *const IOpcRelationshipSet, contents: ?*?*IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationshipSet_GetRelationship(self: *const T, relationshipIdentifier: ?[*:0]const u16, relationship: ?*?*IOpcRelationship) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipSet.VTable, self.vtable).GetRelationship(@ptrCast(*const IOpcRelationshipSet, self), relationshipIdentifier, relationship); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationshipSet_CreateRelationship(self: *const T, relationshipIdentifier: ?[*:0]const u16, relationshipType: ?[*:0]const u16, targetUri: ?*IUri, targetMode: OPC_URI_TARGET_MODE, relationship: ?*?*IOpcRelationship) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipSet.VTable, self.vtable).CreateRelationship(@ptrCast(*const IOpcRelationshipSet, self), relationshipIdentifier, relationshipType, targetUri, targetMode, relationship); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationshipSet_DeleteRelationship(self: *const T, relationshipIdentifier: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipSet.VTable, self.vtable).DeleteRelationship(@ptrCast(*const IOpcRelationshipSet, self), relationshipIdentifier); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationshipSet_RelationshipExists(self: *const T, relationshipIdentifier: ?[*:0]const u16, relationshipExists: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipSet.VTable, self.vtable).RelationshipExists(@ptrCast(*const IOpcRelationshipSet, self), relationshipIdentifier, relationshipExists); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationshipSet_GetEnumerator(self: *const T, relationshipEnumerator: ?*?*IOpcRelationshipEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipSet.VTable, self.vtable).GetEnumerator(@ptrCast(*const IOpcRelationshipSet, self), relationshipEnumerator); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationshipSet_GetEnumeratorForType(self: *const T, relationshipType: ?[*:0]const u16, relationshipEnumerator: ?*?*IOpcRelationshipEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipSet.VTable, self.vtable).GetEnumeratorForType(@ptrCast(*const IOpcRelationshipSet, self), relationshipType, relationshipEnumerator); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationshipSet_GetRelationshipsContentStream(self: *const T, contents: ?*?*IStream) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipSet.VTable, self.vtable).GetRelationshipsContentStream(@ptrCast(*const IOpcRelationshipSet, self), contents); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcPartEnumerator_Value = Guid.initString("42195949-3b79-4fc8-89c6-fc7fb979ee75"); pub const IID_IOpcPartEnumerator = &IID_IOpcPartEnumerator_Value; pub const IOpcPartEnumerator = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, MoveNext: fn( self: *const IOpcPartEnumerator, hasNext: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MovePrevious: fn( self: *const IOpcPartEnumerator, hasPrevious: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCurrent: fn( self: *const IOpcPartEnumerator, part: ?*?*IOpcPart, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IOpcPartEnumerator, copy: ?*?*IOpcPartEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcPartEnumerator_MoveNext(self: *const T, hasNext: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcPartEnumerator.VTable, self.vtable).MoveNext(@ptrCast(*const IOpcPartEnumerator, self), hasNext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcPartEnumerator_MovePrevious(self: *const T, hasPrevious: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcPartEnumerator.VTable, self.vtable).MovePrevious(@ptrCast(*const IOpcPartEnumerator, self), hasPrevious); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcPartEnumerator_GetCurrent(self: *const T, part: ?*?*IOpcPart) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcPartEnumerator.VTable, self.vtable).GetCurrent(@ptrCast(*const IOpcPartEnumerator, self), part); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcPartEnumerator_Clone(self: *const T, copy: ?*?*IOpcPartEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcPartEnumerator.VTable, self.vtable).Clone(@ptrCast(*const IOpcPartEnumerator, self), copy); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcRelationshipEnumerator_Value = Guid.initString("42195949-3b79-4fc8-89c6-fc7fb979ee76"); pub const IID_IOpcRelationshipEnumerator = &IID_IOpcRelationshipEnumerator_Value; pub const IOpcRelationshipEnumerator = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, MoveNext: fn( self: *const IOpcRelationshipEnumerator, hasNext: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MovePrevious: fn( self: *const IOpcRelationshipEnumerator, hasPrevious: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCurrent: fn( self: *const IOpcRelationshipEnumerator, relationship: ?*?*IOpcRelationship, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IOpcRelationshipEnumerator, copy: ?*?*IOpcRelationshipEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationshipEnumerator_MoveNext(self: *const T, hasNext: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipEnumerator.VTable, self.vtable).MoveNext(@ptrCast(*const IOpcRelationshipEnumerator, self), hasNext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationshipEnumerator_MovePrevious(self: *const T, hasPrevious: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipEnumerator.VTable, self.vtable).MovePrevious(@ptrCast(*const IOpcRelationshipEnumerator, self), hasPrevious); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationshipEnumerator_GetCurrent(self: *const T, relationship: ?*?*IOpcRelationship) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipEnumerator.VTable, self.vtable).GetCurrent(@ptrCast(*const IOpcRelationshipEnumerator, self), relationship); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationshipEnumerator_Clone(self: *const T, copy: ?*?*IOpcRelationshipEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipEnumerator.VTable, self.vtable).Clone(@ptrCast(*const IOpcRelationshipEnumerator, self), copy); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcSignaturePartReference_Value = Guid.initString("e24231ca-59f4-484e-b64b-36eeda36072c"); pub const IID_IOpcSignaturePartReference = &IID_IOpcSignaturePartReference_Value; pub const IOpcSignaturePartReference = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetPartName: fn( self: *const IOpcSignaturePartReference, partName: ?*?*IOpcPartUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetContentType: fn( self: *const IOpcSignaturePartReference, contentType: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDigestMethod: fn( self: *const IOpcSignaturePartReference, digestMethod: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDigestValue: fn( self: *const IOpcSignaturePartReference, digestValue: ?[*]?*u8, count: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTransformMethod: fn( self: *const IOpcSignaturePartReference, transformMethod: ?*OPC_CANONICALIZATION_METHOD, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignaturePartReference_GetPartName(self: *const T, partName: ?*?*IOpcPartUri) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignaturePartReference.VTable, self.vtable).GetPartName(@ptrCast(*const IOpcSignaturePartReference, self), partName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignaturePartReference_GetContentType(self: *const T, contentType: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignaturePartReference.VTable, self.vtable).GetContentType(@ptrCast(*const IOpcSignaturePartReference, self), contentType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignaturePartReference_GetDigestMethod(self: *const T, digestMethod: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignaturePartReference.VTable, self.vtable).GetDigestMethod(@ptrCast(*const IOpcSignaturePartReference, self), digestMethod); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignaturePartReference_GetDigestValue(self: *const T, digestValue: ?[*]?*u8, count: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignaturePartReference.VTable, self.vtable).GetDigestValue(@ptrCast(*const IOpcSignaturePartReference, self), digestValue, count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignaturePartReference_GetTransformMethod(self: *const T, transformMethod: ?*OPC_CANONICALIZATION_METHOD) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignaturePartReference.VTable, self.vtable).GetTransformMethod(@ptrCast(*const IOpcSignaturePartReference, self), transformMethod); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcSignatureRelationshipReference_Value = Guid.initString("57babac6-9d4a-4e50-8b86-e5d4051eae7c"); pub const IID_IOpcSignatureRelationshipReference = &IID_IOpcSignatureRelationshipReference_Value; pub const IOpcSignatureRelationshipReference = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetSourceUri: fn( self: *const IOpcSignatureRelationshipReference, sourceUri: ?*?*IOpcUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDigestMethod: fn( self: *const IOpcSignatureRelationshipReference, digestMethod: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDigestValue: fn( self: *const IOpcSignatureRelationshipReference, digestValue: ?[*]?*u8, count: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTransformMethod: fn( self: *const IOpcSignatureRelationshipReference, transformMethod: ?*OPC_CANONICALIZATION_METHOD, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRelationshipSigningOption: fn( self: *const IOpcSignatureRelationshipReference, relationshipSigningOption: ?*OPC_RELATIONSHIPS_SIGNING_OPTION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRelationshipSelectorEnumerator: fn( self: *const IOpcSignatureRelationshipReference, selectorEnumerator: ?*?*IOpcRelationshipSelectorEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureRelationshipReference_GetSourceUri(self: *const T, sourceUri: ?*?*IOpcUri) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureRelationshipReference.VTable, self.vtable).GetSourceUri(@ptrCast(*const IOpcSignatureRelationshipReference, self), sourceUri); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureRelationshipReference_GetDigestMethod(self: *const T, digestMethod: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureRelationshipReference.VTable, self.vtable).GetDigestMethod(@ptrCast(*const IOpcSignatureRelationshipReference, self), digestMethod); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureRelationshipReference_GetDigestValue(self: *const T, digestValue: ?[*]?*u8, count: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureRelationshipReference.VTable, self.vtable).GetDigestValue(@ptrCast(*const IOpcSignatureRelationshipReference, self), digestValue, count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureRelationshipReference_GetTransformMethod(self: *const T, transformMethod: ?*OPC_CANONICALIZATION_METHOD) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureRelationshipReference.VTable, self.vtable).GetTransformMethod(@ptrCast(*const IOpcSignatureRelationshipReference, self), transformMethod); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureRelationshipReference_GetRelationshipSigningOption(self: *const T, relationshipSigningOption: ?*OPC_RELATIONSHIPS_SIGNING_OPTION) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureRelationshipReference.VTable, self.vtable).GetRelationshipSigningOption(@ptrCast(*const IOpcSignatureRelationshipReference, self), relationshipSigningOption); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureRelationshipReference_GetRelationshipSelectorEnumerator(self: *const T, selectorEnumerator: ?*?*IOpcRelationshipSelectorEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureRelationshipReference.VTable, self.vtable).GetRelationshipSelectorEnumerator(@ptrCast(*const IOpcSignatureRelationshipReference, self), selectorEnumerator); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcRelationshipSelector_Value = Guid.initString("f8f26c7f-b28f-4899-84c8-5d5639ede75f"); pub const IID_IOpcRelationshipSelector = &IID_IOpcRelationshipSelector_Value; pub const IOpcRelationshipSelector = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetSelectorType: fn( self: *const IOpcRelationshipSelector, selector: ?*OPC_RELATIONSHIP_SELECTOR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSelectionCriterion: fn( self: *const IOpcRelationshipSelector, selectionCriterion: ?*?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 IOpcRelationshipSelector_GetSelectorType(self: *const T, selector: ?*OPC_RELATIONSHIP_SELECTOR) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipSelector.VTable, self.vtable).GetSelectorType(@ptrCast(*const IOpcRelationshipSelector, self), selector); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationshipSelector_GetSelectionCriterion(self: *const T, selectionCriterion: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipSelector.VTable, self.vtable).GetSelectionCriterion(@ptrCast(*const IOpcRelationshipSelector, self), selectionCriterion); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcSignatureReference_Value = Guid.initString("1b47005e-3011-4edc-be6f-0f65e5ab0342"); pub const IID_IOpcSignatureReference = &IID_IOpcSignatureReference_Value; pub const IOpcSignatureReference = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetId: fn( self: *const IOpcSignatureReference, referenceId: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUri: fn( self: *const IOpcSignatureReference, referenceUri: ?*?*IUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetType: fn( self: *const IOpcSignatureReference, type: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTransformMethod: fn( self: *const IOpcSignatureReference, transformMethod: ?*OPC_CANONICALIZATION_METHOD, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDigestMethod: fn( self: *const IOpcSignatureReference, digestMethod: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDigestValue: fn( self: *const IOpcSignatureReference, digestValue: ?[*]?*u8, count: ?*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 IOpcSignatureReference_GetId(self: *const T, referenceId: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureReference.VTable, self.vtable).GetId(@ptrCast(*const IOpcSignatureReference, self), referenceId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureReference_GetUri(self: *const T, referenceUri: ?*?*IUri) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureReference.VTable, self.vtable).GetUri(@ptrCast(*const IOpcSignatureReference, self), referenceUri); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureReference_GetType(self: *const T, type_: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureReference.VTable, self.vtable).GetType(@ptrCast(*const IOpcSignatureReference, self), type_); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureReference_GetTransformMethod(self: *const T, transformMethod: ?*OPC_CANONICALIZATION_METHOD) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureReference.VTable, self.vtable).GetTransformMethod(@ptrCast(*const IOpcSignatureReference, self), transformMethod); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureReference_GetDigestMethod(self: *const T, digestMethod: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureReference.VTable, self.vtable).GetDigestMethod(@ptrCast(*const IOpcSignatureReference, self), digestMethod); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureReference_GetDigestValue(self: *const T, digestValue: ?[*]?*u8, count: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureReference.VTable, self.vtable).GetDigestValue(@ptrCast(*const IOpcSignatureReference, self), digestValue, count); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcSignatureCustomObject_Value = Guid.initString("5d77a19e-62c1-44e7-becd-45da5ae51a56"); pub const IID_IOpcSignatureCustomObject = &IID_IOpcSignatureCustomObject_Value; pub const IOpcSignatureCustomObject = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetXml: fn( self: *const IOpcSignatureCustomObject, xmlMarkup: ?[*]?*u8, count: ?*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 IOpcSignatureCustomObject_GetXml(self: *const T, xmlMarkup: ?[*]?*u8, count: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureCustomObject.VTable, self.vtable).GetXml(@ptrCast(*const IOpcSignatureCustomObject, self), xmlMarkup, count); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcDigitalSignature_Value = Guid.initString("52ab21dd-1cd0-4949-bc80-0c1232d00cb4"); pub const IID_IOpcDigitalSignature = &IID_IOpcDigitalSignature_Value; pub const IOpcDigitalSignature = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetNamespaces: fn( self: *const IOpcDigitalSignature, prefixes: ?[*]?*?PWSTR, namespaces: ?[*]?*?PWSTR, count: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSignatureId: fn( self: *const IOpcDigitalSignature, signatureId: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSignaturePartName: fn( self: *const IOpcDigitalSignature, signaturePartName: ?*?*IOpcPartUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSignatureMethod: fn( self: *const IOpcDigitalSignature, signatureMethod: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCanonicalizationMethod: fn( self: *const IOpcDigitalSignature, canonicalizationMethod: ?*OPC_CANONICALIZATION_METHOD, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSignatureValue: fn( self: *const IOpcDigitalSignature, signatureValue: ?[*]?*u8, count: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSignaturePartReferenceEnumerator: fn( self: *const IOpcDigitalSignature, partReferenceEnumerator: ?*?*IOpcSignaturePartReferenceEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSignatureRelationshipReferenceEnumerator: fn( self: *const IOpcDigitalSignature, relationshipReferenceEnumerator: ?*?*IOpcSignatureRelationshipReferenceEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSigningTime: fn( self: *const IOpcDigitalSignature, signingTime: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTimeFormat: fn( self: *const IOpcDigitalSignature, timeFormat: ?*OPC_SIGNATURE_TIME_FORMAT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPackageObjectReference: fn( self: *const IOpcDigitalSignature, packageObjectReference: ?*?*IOpcSignatureReference, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCertificateEnumerator: fn( self: *const IOpcDigitalSignature, certificateEnumerator: ?*?*IOpcCertificateEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCustomReferenceEnumerator: fn( self: *const IOpcDigitalSignature, customReferenceEnumerator: ?*?*IOpcSignatureReferenceEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCustomObjectEnumerator: fn( self: *const IOpcDigitalSignature, customObjectEnumerator: ?*?*IOpcSignatureCustomObjectEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSignatureXml: fn( self: *const IOpcDigitalSignature, signatureXml: ?*?*u8, count: ?*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 IOpcDigitalSignature_GetNamespaces(self: *const T, prefixes: ?[*]?*?PWSTR, namespaces: ?[*]?*?PWSTR, count: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignature.VTable, self.vtable).GetNamespaces(@ptrCast(*const IOpcDigitalSignature, self), prefixes, namespaces, count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignature_GetSignatureId(self: *const T, signatureId: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignature.VTable, self.vtable).GetSignatureId(@ptrCast(*const IOpcDigitalSignature, self), signatureId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignature_GetSignaturePartName(self: *const T, signaturePartName: ?*?*IOpcPartUri) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignature.VTable, self.vtable).GetSignaturePartName(@ptrCast(*const IOpcDigitalSignature, self), signaturePartName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignature_GetSignatureMethod(self: *const T, signatureMethod: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignature.VTable, self.vtable).GetSignatureMethod(@ptrCast(*const IOpcDigitalSignature, self), signatureMethod); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignature_GetCanonicalizationMethod(self: *const T, canonicalizationMethod: ?*OPC_CANONICALIZATION_METHOD) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignature.VTable, self.vtable).GetCanonicalizationMethod(@ptrCast(*const IOpcDigitalSignature, self), canonicalizationMethod); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignature_GetSignatureValue(self: *const T, signatureValue: ?[*]?*u8, count: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignature.VTable, self.vtable).GetSignatureValue(@ptrCast(*const IOpcDigitalSignature, self), signatureValue, count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignature_GetSignaturePartReferenceEnumerator(self: *const T, partReferenceEnumerator: ?*?*IOpcSignaturePartReferenceEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignature.VTable, self.vtable).GetSignaturePartReferenceEnumerator(@ptrCast(*const IOpcDigitalSignature, self), partReferenceEnumerator); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignature_GetSignatureRelationshipReferenceEnumerator(self: *const T, relationshipReferenceEnumerator: ?*?*IOpcSignatureRelationshipReferenceEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignature.VTable, self.vtable).GetSignatureRelationshipReferenceEnumerator(@ptrCast(*const IOpcDigitalSignature, self), relationshipReferenceEnumerator); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignature_GetSigningTime(self: *const T, signingTime: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignature.VTable, self.vtable).GetSigningTime(@ptrCast(*const IOpcDigitalSignature, self), signingTime); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignature_GetTimeFormat(self: *const T, timeFormat: ?*OPC_SIGNATURE_TIME_FORMAT) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignature.VTable, self.vtable).GetTimeFormat(@ptrCast(*const IOpcDigitalSignature, self), timeFormat); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignature_GetPackageObjectReference(self: *const T, packageObjectReference: ?*?*IOpcSignatureReference) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignature.VTable, self.vtable).GetPackageObjectReference(@ptrCast(*const IOpcDigitalSignature, self), packageObjectReference); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignature_GetCertificateEnumerator(self: *const T, certificateEnumerator: ?*?*IOpcCertificateEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignature.VTable, self.vtable).GetCertificateEnumerator(@ptrCast(*const IOpcDigitalSignature, self), certificateEnumerator); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignature_GetCustomReferenceEnumerator(self: *const T, customReferenceEnumerator: ?*?*IOpcSignatureReferenceEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignature.VTable, self.vtable).GetCustomReferenceEnumerator(@ptrCast(*const IOpcDigitalSignature, self), customReferenceEnumerator); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignature_GetCustomObjectEnumerator(self: *const T, customObjectEnumerator: ?*?*IOpcSignatureCustomObjectEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignature.VTable, self.vtable).GetCustomObjectEnumerator(@ptrCast(*const IOpcDigitalSignature, self), customObjectEnumerator); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignature_GetSignatureXml(self: *const T, signatureXml: ?*?*u8, count: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignature.VTable, self.vtable).GetSignatureXml(@ptrCast(*const IOpcDigitalSignature, self), signatureXml, count); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcSigningOptions_Value = Guid.initString("50d2d6a5-7aeb-46c0-b241-43ab0e9b407e"); pub const IID_IOpcSigningOptions = &IID_IOpcSigningOptions_Value; pub const IOpcSigningOptions = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetSignatureId: fn( self: *const IOpcSigningOptions, signatureId: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSignatureId: fn( self: *const IOpcSigningOptions, signatureId: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSignatureMethod: fn( self: *const IOpcSigningOptions, signatureMethod: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSignatureMethod: fn( self: *const IOpcSigningOptions, signatureMethod: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDefaultDigestMethod: fn( self: *const IOpcSigningOptions, digestMethod: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetDefaultDigestMethod: fn( self: *const IOpcSigningOptions, digestMethod: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCertificateEmbeddingOption: fn( self: *const IOpcSigningOptions, embeddingOption: ?*OPC_CERTIFICATE_EMBEDDING_OPTION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCertificateEmbeddingOption: fn( self: *const IOpcSigningOptions, embeddingOption: OPC_CERTIFICATE_EMBEDDING_OPTION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTimeFormat: fn( self: *const IOpcSigningOptions, timeFormat: ?*OPC_SIGNATURE_TIME_FORMAT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetTimeFormat: fn( self: *const IOpcSigningOptions, timeFormat: OPC_SIGNATURE_TIME_FORMAT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSignaturePartReferenceSet: fn( self: *const IOpcSigningOptions, partReferenceSet: ?*?*IOpcSignaturePartReferenceSet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSignatureRelationshipReferenceSet: fn( self: *const IOpcSigningOptions, relationshipReferenceSet: ?*?*IOpcSignatureRelationshipReferenceSet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCustomObjectSet: fn( self: *const IOpcSigningOptions, customObjectSet: ?*?*IOpcSignatureCustomObjectSet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCustomReferenceSet: fn( self: *const IOpcSigningOptions, customReferenceSet: ?*?*IOpcSignatureReferenceSet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCertificateSet: fn( self: *const IOpcSigningOptions, certificateSet: ?*?*IOpcCertificateSet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSignaturePartName: fn( self: *const IOpcSigningOptions, signaturePartName: ?*?*IOpcPartUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSignaturePartName: fn( self: *const IOpcSigningOptions, signaturePartName: ?*IOpcPartUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSigningOptions_GetSignatureId(self: *const T, signatureId: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSigningOptions.VTable, self.vtable).GetSignatureId(@ptrCast(*const IOpcSigningOptions, self), signatureId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSigningOptions_SetSignatureId(self: *const T, signatureId: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSigningOptions.VTable, self.vtable).SetSignatureId(@ptrCast(*const IOpcSigningOptions, self), signatureId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSigningOptions_GetSignatureMethod(self: *const T, signatureMethod: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSigningOptions.VTable, self.vtable).GetSignatureMethod(@ptrCast(*const IOpcSigningOptions, self), signatureMethod); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSigningOptions_SetSignatureMethod(self: *const T, signatureMethod: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSigningOptions.VTable, self.vtable).SetSignatureMethod(@ptrCast(*const IOpcSigningOptions, self), signatureMethod); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSigningOptions_GetDefaultDigestMethod(self: *const T, digestMethod: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSigningOptions.VTable, self.vtable).GetDefaultDigestMethod(@ptrCast(*const IOpcSigningOptions, self), digestMethod); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSigningOptions_SetDefaultDigestMethod(self: *const T, digestMethod: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSigningOptions.VTable, self.vtable).SetDefaultDigestMethod(@ptrCast(*const IOpcSigningOptions, self), digestMethod); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSigningOptions_GetCertificateEmbeddingOption(self: *const T, embeddingOption: ?*OPC_CERTIFICATE_EMBEDDING_OPTION) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSigningOptions.VTable, self.vtable).GetCertificateEmbeddingOption(@ptrCast(*const IOpcSigningOptions, self), embeddingOption); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSigningOptions_SetCertificateEmbeddingOption(self: *const T, embeddingOption: OPC_CERTIFICATE_EMBEDDING_OPTION) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSigningOptions.VTable, self.vtable).SetCertificateEmbeddingOption(@ptrCast(*const IOpcSigningOptions, self), embeddingOption); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSigningOptions_GetTimeFormat(self: *const T, timeFormat: ?*OPC_SIGNATURE_TIME_FORMAT) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSigningOptions.VTable, self.vtable).GetTimeFormat(@ptrCast(*const IOpcSigningOptions, self), timeFormat); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSigningOptions_SetTimeFormat(self: *const T, timeFormat: OPC_SIGNATURE_TIME_FORMAT) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSigningOptions.VTable, self.vtable).SetTimeFormat(@ptrCast(*const IOpcSigningOptions, self), timeFormat); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSigningOptions_GetSignaturePartReferenceSet(self: *const T, partReferenceSet: ?*?*IOpcSignaturePartReferenceSet) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSigningOptions.VTable, self.vtable).GetSignaturePartReferenceSet(@ptrCast(*const IOpcSigningOptions, self), partReferenceSet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSigningOptions_GetSignatureRelationshipReferenceSet(self: *const T, relationshipReferenceSet: ?*?*IOpcSignatureRelationshipReferenceSet) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSigningOptions.VTable, self.vtable).GetSignatureRelationshipReferenceSet(@ptrCast(*const IOpcSigningOptions, self), relationshipReferenceSet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSigningOptions_GetCustomObjectSet(self: *const T, customObjectSet: ?*?*IOpcSignatureCustomObjectSet) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSigningOptions.VTable, self.vtable).GetCustomObjectSet(@ptrCast(*const IOpcSigningOptions, self), customObjectSet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSigningOptions_GetCustomReferenceSet(self: *const T, customReferenceSet: ?*?*IOpcSignatureReferenceSet) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSigningOptions.VTable, self.vtable).GetCustomReferenceSet(@ptrCast(*const IOpcSigningOptions, self), customReferenceSet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSigningOptions_GetCertificateSet(self: *const T, certificateSet: ?*?*IOpcCertificateSet) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSigningOptions.VTable, self.vtable).GetCertificateSet(@ptrCast(*const IOpcSigningOptions, self), certificateSet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSigningOptions_GetSignaturePartName(self: *const T, signaturePartName: ?*?*IOpcPartUri) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSigningOptions.VTable, self.vtable).GetSignaturePartName(@ptrCast(*const IOpcSigningOptions, self), signaturePartName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSigningOptions_SetSignaturePartName(self: *const T, signaturePartName: ?*IOpcPartUri) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSigningOptions.VTable, self.vtable).SetSignaturePartName(@ptrCast(*const IOpcSigningOptions, self), signaturePartName); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcDigitalSignatureManager_Value = Guid.initString("d5e62a0b-696d-462f-94df-72e33cef2659"); pub const IID_IOpcDigitalSignatureManager = &IID_IOpcDigitalSignatureManager_Value; pub const IOpcDigitalSignatureManager = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetSignatureOriginPartName: fn( self: *const IOpcDigitalSignatureManager, signatureOriginPartName: ?*?*IOpcPartUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSignatureOriginPartName: fn( self: *const IOpcDigitalSignatureManager, signatureOriginPartName: ?*IOpcPartUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSignatureEnumerator: fn( self: *const IOpcDigitalSignatureManager, signatureEnumerator: ?*?*IOpcDigitalSignatureEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveSignature: fn( self: *const IOpcDigitalSignatureManager, signaturePartName: ?*IOpcPartUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateSigningOptions: fn( self: *const IOpcDigitalSignatureManager, signingOptions: ?*?*IOpcSigningOptions, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Validate: fn( self: *const IOpcDigitalSignatureManager, signature: ?*IOpcDigitalSignature, certificate: ?*const CERT_CONTEXT, validationResult: ?*OPC_SIGNATURE_VALIDATION_RESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Sign: fn( self: *const IOpcDigitalSignatureManager, certificate: ?*const CERT_CONTEXT, signingOptions: ?*IOpcSigningOptions, digitalSignature: ?*?*IOpcDigitalSignature, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReplaceSignatureXml: fn( self: *const IOpcDigitalSignatureManager, signaturePartName: ?*IOpcPartUri, newSignatureXml: ?*const u8, count: u32, digitalSignature: ?*?*IOpcDigitalSignature, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignatureManager_GetSignatureOriginPartName(self: *const T, signatureOriginPartName: ?*?*IOpcPartUri) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignatureManager.VTable, self.vtable).GetSignatureOriginPartName(@ptrCast(*const IOpcDigitalSignatureManager, self), signatureOriginPartName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignatureManager_SetSignatureOriginPartName(self: *const T, signatureOriginPartName: ?*IOpcPartUri) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignatureManager.VTable, self.vtable).SetSignatureOriginPartName(@ptrCast(*const IOpcDigitalSignatureManager, self), signatureOriginPartName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignatureManager_GetSignatureEnumerator(self: *const T, signatureEnumerator: ?*?*IOpcDigitalSignatureEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignatureManager.VTable, self.vtable).GetSignatureEnumerator(@ptrCast(*const IOpcDigitalSignatureManager, self), signatureEnumerator); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignatureManager_RemoveSignature(self: *const T, signaturePartName: ?*IOpcPartUri) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignatureManager.VTable, self.vtable).RemoveSignature(@ptrCast(*const IOpcDigitalSignatureManager, self), signaturePartName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignatureManager_CreateSigningOptions(self: *const T, signingOptions: ?*?*IOpcSigningOptions) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignatureManager.VTable, self.vtable).CreateSigningOptions(@ptrCast(*const IOpcDigitalSignatureManager, self), signingOptions); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignatureManager_Validate(self: *const T, signature: ?*IOpcDigitalSignature, certificate: ?*const CERT_CONTEXT, validationResult: ?*OPC_SIGNATURE_VALIDATION_RESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignatureManager.VTable, self.vtable).Validate(@ptrCast(*const IOpcDigitalSignatureManager, self), signature, certificate, validationResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignatureManager_Sign(self: *const T, certificate: ?*const CERT_CONTEXT, signingOptions: ?*IOpcSigningOptions, digitalSignature: ?*?*IOpcDigitalSignature) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignatureManager.VTable, self.vtable).Sign(@ptrCast(*const IOpcDigitalSignatureManager, self), certificate, signingOptions, digitalSignature); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignatureManager_ReplaceSignatureXml(self: *const T, signaturePartName: ?*IOpcPartUri, newSignatureXml: ?*const u8, count: u32, digitalSignature: ?*?*IOpcDigitalSignature) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignatureManager.VTable, self.vtable).ReplaceSignatureXml(@ptrCast(*const IOpcDigitalSignatureManager, self), signaturePartName, newSignatureXml, count, digitalSignature); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcSignaturePartReferenceEnumerator_Value = Guid.initString("80eb1561-8c77-49cf-8266-459b356ee99a"); pub const IID_IOpcSignaturePartReferenceEnumerator = &IID_IOpcSignaturePartReferenceEnumerator_Value; pub const IOpcSignaturePartReferenceEnumerator = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, MoveNext: fn( self: *const IOpcSignaturePartReferenceEnumerator, hasNext: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MovePrevious: fn( self: *const IOpcSignaturePartReferenceEnumerator, hasPrevious: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCurrent: fn( self: *const IOpcSignaturePartReferenceEnumerator, partReference: ?*?*IOpcSignaturePartReference, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IOpcSignaturePartReferenceEnumerator, copy: ?*?*IOpcSignaturePartReferenceEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignaturePartReferenceEnumerator_MoveNext(self: *const T, hasNext: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignaturePartReferenceEnumerator.VTable, self.vtable).MoveNext(@ptrCast(*const IOpcSignaturePartReferenceEnumerator, self), hasNext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignaturePartReferenceEnumerator_MovePrevious(self: *const T, hasPrevious: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignaturePartReferenceEnumerator.VTable, self.vtable).MovePrevious(@ptrCast(*const IOpcSignaturePartReferenceEnumerator, self), hasPrevious); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignaturePartReferenceEnumerator_GetCurrent(self: *const T, partReference: ?*?*IOpcSignaturePartReference) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignaturePartReferenceEnumerator.VTable, self.vtable).GetCurrent(@ptrCast(*const IOpcSignaturePartReferenceEnumerator, self), partReference); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignaturePartReferenceEnumerator_Clone(self: *const T, copy: ?*?*IOpcSignaturePartReferenceEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignaturePartReferenceEnumerator.VTable, self.vtable).Clone(@ptrCast(*const IOpcSignaturePartReferenceEnumerator, self), copy); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcSignatureRelationshipReferenceEnumerator_Value = Guid.initString("773ba3e4-f021-48e4-aa04-9816db5d3495"); pub const IID_IOpcSignatureRelationshipReferenceEnumerator = &IID_IOpcSignatureRelationshipReferenceEnumerator_Value; pub const IOpcSignatureRelationshipReferenceEnumerator = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, MoveNext: fn( self: *const IOpcSignatureRelationshipReferenceEnumerator, hasNext: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MovePrevious: fn( self: *const IOpcSignatureRelationshipReferenceEnumerator, hasPrevious: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCurrent: fn( self: *const IOpcSignatureRelationshipReferenceEnumerator, relationshipReference: ?*?*IOpcSignatureRelationshipReference, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IOpcSignatureRelationshipReferenceEnumerator, copy: ?*?*IOpcSignatureRelationshipReferenceEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureRelationshipReferenceEnumerator_MoveNext(self: *const T, hasNext: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureRelationshipReferenceEnumerator.VTable, self.vtable).MoveNext(@ptrCast(*const IOpcSignatureRelationshipReferenceEnumerator, self), hasNext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureRelationshipReferenceEnumerator_MovePrevious(self: *const T, hasPrevious: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureRelationshipReferenceEnumerator.VTable, self.vtable).MovePrevious(@ptrCast(*const IOpcSignatureRelationshipReferenceEnumerator, self), hasPrevious); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureRelationshipReferenceEnumerator_GetCurrent(self: *const T, relationshipReference: ?*?*IOpcSignatureRelationshipReference) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureRelationshipReferenceEnumerator.VTable, self.vtable).GetCurrent(@ptrCast(*const IOpcSignatureRelationshipReferenceEnumerator, self), relationshipReference); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureRelationshipReferenceEnumerator_Clone(self: *const T, copy: ?*?*IOpcSignatureRelationshipReferenceEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureRelationshipReferenceEnumerator.VTable, self.vtable).Clone(@ptrCast(*const IOpcSignatureRelationshipReferenceEnumerator, self), copy); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcRelationshipSelectorEnumerator_Value = Guid.initString("5e50a181-a91b-48ac-88d2-bca3d8f8c0b1"); pub const IID_IOpcRelationshipSelectorEnumerator = &IID_IOpcRelationshipSelectorEnumerator_Value; pub const IOpcRelationshipSelectorEnumerator = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, MoveNext: fn( self: *const IOpcRelationshipSelectorEnumerator, hasNext: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MovePrevious: fn( self: *const IOpcRelationshipSelectorEnumerator, hasPrevious: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCurrent: fn( self: *const IOpcRelationshipSelectorEnumerator, relationshipSelector: ?*?*IOpcRelationshipSelector, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IOpcRelationshipSelectorEnumerator, copy: ?*?*IOpcRelationshipSelectorEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationshipSelectorEnumerator_MoveNext(self: *const T, hasNext: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipSelectorEnumerator.VTable, self.vtable).MoveNext(@ptrCast(*const IOpcRelationshipSelectorEnumerator, self), hasNext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationshipSelectorEnumerator_MovePrevious(self: *const T, hasPrevious: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipSelectorEnumerator.VTable, self.vtable).MovePrevious(@ptrCast(*const IOpcRelationshipSelectorEnumerator, self), hasPrevious); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationshipSelectorEnumerator_GetCurrent(self: *const T, relationshipSelector: ?*?*IOpcRelationshipSelector) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipSelectorEnumerator.VTable, self.vtable).GetCurrent(@ptrCast(*const IOpcRelationshipSelectorEnumerator, self), relationshipSelector); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationshipSelectorEnumerator_Clone(self: *const T, copy: ?*?*IOpcRelationshipSelectorEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipSelectorEnumerator.VTable, self.vtable).Clone(@ptrCast(*const IOpcRelationshipSelectorEnumerator, self), copy); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcSignatureReferenceEnumerator_Value = Guid.initString("cfa59a45-28b1-4868-969e-fa8097fdc12a"); pub const IID_IOpcSignatureReferenceEnumerator = &IID_IOpcSignatureReferenceEnumerator_Value; pub const IOpcSignatureReferenceEnumerator = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, MoveNext: fn( self: *const IOpcSignatureReferenceEnumerator, hasNext: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MovePrevious: fn( self: *const IOpcSignatureReferenceEnumerator, hasPrevious: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCurrent: fn( self: *const IOpcSignatureReferenceEnumerator, reference: ?*?*IOpcSignatureReference, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IOpcSignatureReferenceEnumerator, copy: ?*?*IOpcSignatureReferenceEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureReferenceEnumerator_MoveNext(self: *const T, hasNext: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureReferenceEnumerator.VTable, self.vtable).MoveNext(@ptrCast(*const IOpcSignatureReferenceEnumerator, self), hasNext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureReferenceEnumerator_MovePrevious(self: *const T, hasPrevious: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureReferenceEnumerator.VTable, self.vtable).MovePrevious(@ptrCast(*const IOpcSignatureReferenceEnumerator, self), hasPrevious); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureReferenceEnumerator_GetCurrent(self: *const T, reference: ?*?*IOpcSignatureReference) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureReferenceEnumerator.VTable, self.vtable).GetCurrent(@ptrCast(*const IOpcSignatureReferenceEnumerator, self), reference); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureReferenceEnumerator_Clone(self: *const T, copy: ?*?*IOpcSignatureReferenceEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureReferenceEnumerator.VTable, self.vtable).Clone(@ptrCast(*const IOpcSignatureReferenceEnumerator, self), copy); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcSignatureCustomObjectEnumerator_Value = Guid.initString("5ee4fe1d-e1b0-4683-8079-7ea0fcf80b4c"); pub const IID_IOpcSignatureCustomObjectEnumerator = &IID_IOpcSignatureCustomObjectEnumerator_Value; pub const IOpcSignatureCustomObjectEnumerator = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, MoveNext: fn( self: *const IOpcSignatureCustomObjectEnumerator, hasNext: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MovePrevious: fn( self: *const IOpcSignatureCustomObjectEnumerator, hasPrevious: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCurrent: fn( self: *const IOpcSignatureCustomObjectEnumerator, customObject: ?*?*IOpcSignatureCustomObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IOpcSignatureCustomObjectEnumerator, copy: ?*?*IOpcSignatureCustomObjectEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureCustomObjectEnumerator_MoveNext(self: *const T, hasNext: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureCustomObjectEnumerator.VTable, self.vtable).MoveNext(@ptrCast(*const IOpcSignatureCustomObjectEnumerator, self), hasNext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureCustomObjectEnumerator_MovePrevious(self: *const T, hasPrevious: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureCustomObjectEnumerator.VTable, self.vtable).MovePrevious(@ptrCast(*const IOpcSignatureCustomObjectEnumerator, self), hasPrevious); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureCustomObjectEnumerator_GetCurrent(self: *const T, customObject: ?*?*IOpcSignatureCustomObject) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureCustomObjectEnumerator.VTable, self.vtable).GetCurrent(@ptrCast(*const IOpcSignatureCustomObjectEnumerator, self), customObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureCustomObjectEnumerator_Clone(self: *const T, copy: ?*?*IOpcSignatureCustomObjectEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureCustomObjectEnumerator.VTable, self.vtable).Clone(@ptrCast(*const IOpcSignatureCustomObjectEnumerator, self), copy); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcCertificateEnumerator_Value = Guid.initString("85131937-8f24-421f-b439-59ab24d140b8"); pub const IID_IOpcCertificateEnumerator = &IID_IOpcCertificateEnumerator_Value; pub const IOpcCertificateEnumerator = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, MoveNext: fn( self: *const IOpcCertificateEnumerator, hasNext: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MovePrevious: fn( self: *const IOpcCertificateEnumerator, hasPrevious: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCurrent: fn( self: *const IOpcCertificateEnumerator, certificate: ?*const ?*CERT_CONTEXT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IOpcCertificateEnumerator, copy: ?*?*IOpcCertificateEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcCertificateEnumerator_MoveNext(self: *const T, hasNext: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcCertificateEnumerator.VTable, self.vtable).MoveNext(@ptrCast(*const IOpcCertificateEnumerator, self), hasNext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcCertificateEnumerator_MovePrevious(self: *const T, hasPrevious: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcCertificateEnumerator.VTable, self.vtable).MovePrevious(@ptrCast(*const IOpcCertificateEnumerator, self), hasPrevious); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcCertificateEnumerator_GetCurrent(self: *const T, certificate: ?*const ?*CERT_CONTEXT) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcCertificateEnumerator.VTable, self.vtable).GetCurrent(@ptrCast(*const IOpcCertificateEnumerator, self), certificate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcCertificateEnumerator_Clone(self: *const T, copy: ?*?*IOpcCertificateEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcCertificateEnumerator.VTable, self.vtable).Clone(@ptrCast(*const IOpcCertificateEnumerator, self), copy); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcDigitalSignatureEnumerator_Value = Guid.initString("967b6882-0ba3-4358-b9e7-b64c75063c5e"); pub const IID_IOpcDigitalSignatureEnumerator = &IID_IOpcDigitalSignatureEnumerator_Value; pub const IOpcDigitalSignatureEnumerator = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, MoveNext: fn( self: *const IOpcDigitalSignatureEnumerator, hasNext: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MovePrevious: fn( self: *const IOpcDigitalSignatureEnumerator, hasPrevious: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCurrent: fn( self: *const IOpcDigitalSignatureEnumerator, digitalSignature: ?*?*IOpcDigitalSignature, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IOpcDigitalSignatureEnumerator, copy: ?*?*IOpcDigitalSignatureEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignatureEnumerator_MoveNext(self: *const T, hasNext: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignatureEnumerator.VTable, self.vtable).MoveNext(@ptrCast(*const IOpcDigitalSignatureEnumerator, self), hasNext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignatureEnumerator_MovePrevious(self: *const T, hasPrevious: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignatureEnumerator.VTable, self.vtable).MovePrevious(@ptrCast(*const IOpcDigitalSignatureEnumerator, self), hasPrevious); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignatureEnumerator_GetCurrent(self: *const T, digitalSignature: ?*?*IOpcDigitalSignature) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignatureEnumerator.VTable, self.vtable).GetCurrent(@ptrCast(*const IOpcDigitalSignatureEnumerator, self), digitalSignature); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcDigitalSignatureEnumerator_Clone(self: *const T, copy: ?*?*IOpcDigitalSignatureEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcDigitalSignatureEnumerator.VTable, self.vtable).Clone(@ptrCast(*const IOpcDigitalSignatureEnumerator, self), copy); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcSignaturePartReferenceSet_Value = Guid.initString("6c9fe28c-ecd9-4b22-9d36-7fdde670fec0"); pub const IID_IOpcSignaturePartReferenceSet = &IID_IOpcSignaturePartReferenceSet_Value; pub const IOpcSignaturePartReferenceSet = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Create: fn( self: *const IOpcSignaturePartReferenceSet, partUri: ?*IOpcPartUri, digestMethod: ?[*:0]const u16, transformMethod: OPC_CANONICALIZATION_METHOD, partReference: ?*?*IOpcSignaturePartReference, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Delete: fn( self: *const IOpcSignaturePartReferenceSet, partReference: ?*IOpcSignaturePartReference, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEnumerator: fn( self: *const IOpcSignaturePartReferenceSet, partReferenceEnumerator: ?*?*IOpcSignaturePartReferenceEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignaturePartReferenceSet_Create(self: *const T, partUri: ?*IOpcPartUri, digestMethod: ?[*:0]const u16, transformMethod: OPC_CANONICALIZATION_METHOD, partReference: ?*?*IOpcSignaturePartReference) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignaturePartReferenceSet.VTable, self.vtable).Create(@ptrCast(*const IOpcSignaturePartReferenceSet, self), partUri, digestMethod, transformMethod, partReference); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignaturePartReferenceSet_Delete(self: *const T, partReference: ?*IOpcSignaturePartReference) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignaturePartReferenceSet.VTable, self.vtable).Delete(@ptrCast(*const IOpcSignaturePartReferenceSet, self), partReference); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignaturePartReferenceSet_GetEnumerator(self: *const T, partReferenceEnumerator: ?*?*IOpcSignaturePartReferenceEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignaturePartReferenceSet.VTable, self.vtable).GetEnumerator(@ptrCast(*const IOpcSignaturePartReferenceSet, self), partReferenceEnumerator); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcSignatureRelationshipReferenceSet_Value = Guid.initString("9f863ca5-3631-404c-828d-807e0715069b"); pub const IID_IOpcSignatureRelationshipReferenceSet = &IID_IOpcSignatureRelationshipReferenceSet_Value; pub const IOpcSignatureRelationshipReferenceSet = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Create: fn( self: *const IOpcSignatureRelationshipReferenceSet, sourceUri: ?*IOpcUri, digestMethod: ?[*:0]const u16, relationshipSigningOption: OPC_RELATIONSHIPS_SIGNING_OPTION, selectorSet: ?*IOpcRelationshipSelectorSet, transformMethod: OPC_CANONICALIZATION_METHOD, relationshipReference: ?*?*IOpcSignatureRelationshipReference, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateRelationshipSelectorSet: fn( self: *const IOpcSignatureRelationshipReferenceSet, selectorSet: ?*?*IOpcRelationshipSelectorSet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Delete: fn( self: *const IOpcSignatureRelationshipReferenceSet, relationshipReference: ?*IOpcSignatureRelationshipReference, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEnumerator: fn( self: *const IOpcSignatureRelationshipReferenceSet, relationshipReferenceEnumerator: ?*?*IOpcSignatureRelationshipReferenceEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureRelationshipReferenceSet_Create(self: *const T, sourceUri: ?*IOpcUri, digestMethod: ?[*:0]const u16, relationshipSigningOption: OPC_RELATIONSHIPS_SIGNING_OPTION, selectorSet: ?*IOpcRelationshipSelectorSet, transformMethod: OPC_CANONICALIZATION_METHOD, relationshipReference: ?*?*IOpcSignatureRelationshipReference) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureRelationshipReferenceSet.VTable, self.vtable).Create(@ptrCast(*const IOpcSignatureRelationshipReferenceSet, self), sourceUri, digestMethod, relationshipSigningOption, selectorSet, transformMethod, relationshipReference); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureRelationshipReferenceSet_CreateRelationshipSelectorSet(self: *const T, selectorSet: ?*?*IOpcRelationshipSelectorSet) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureRelationshipReferenceSet.VTable, self.vtable).CreateRelationshipSelectorSet(@ptrCast(*const IOpcSignatureRelationshipReferenceSet, self), selectorSet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureRelationshipReferenceSet_Delete(self: *const T, relationshipReference: ?*IOpcSignatureRelationshipReference) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureRelationshipReferenceSet.VTable, self.vtable).Delete(@ptrCast(*const IOpcSignatureRelationshipReferenceSet, self), relationshipReference); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureRelationshipReferenceSet_GetEnumerator(self: *const T, relationshipReferenceEnumerator: ?*?*IOpcSignatureRelationshipReferenceEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureRelationshipReferenceSet.VTable, self.vtable).GetEnumerator(@ptrCast(*const IOpcSignatureRelationshipReferenceSet, self), relationshipReferenceEnumerator); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcRelationshipSelectorSet_Value = Guid.initString("6e34c269-a4d3-47c0-b5c4-87ff2b3b6136"); pub const IID_IOpcRelationshipSelectorSet = &IID_IOpcRelationshipSelectorSet_Value; pub const IOpcRelationshipSelectorSet = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Create: fn( self: *const IOpcRelationshipSelectorSet, selector: OPC_RELATIONSHIP_SELECTOR, selectionCriterion: ?[*:0]const u16, relationshipSelector: ?*?*IOpcRelationshipSelector, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Delete: fn( self: *const IOpcRelationshipSelectorSet, relationshipSelector: ?*IOpcRelationshipSelector, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEnumerator: fn( self: *const IOpcRelationshipSelectorSet, relationshipSelectorEnumerator: ?*?*IOpcRelationshipSelectorEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationshipSelectorSet_Create(self: *const T, selector: OPC_RELATIONSHIP_SELECTOR, selectionCriterion: ?[*:0]const u16, relationshipSelector: ?*?*IOpcRelationshipSelector) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipSelectorSet.VTable, self.vtable).Create(@ptrCast(*const IOpcRelationshipSelectorSet, self), selector, selectionCriterion, relationshipSelector); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationshipSelectorSet_Delete(self: *const T, relationshipSelector: ?*IOpcRelationshipSelector) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipSelectorSet.VTable, self.vtable).Delete(@ptrCast(*const IOpcRelationshipSelectorSet, self), relationshipSelector); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcRelationshipSelectorSet_GetEnumerator(self: *const T, relationshipSelectorEnumerator: ?*?*IOpcRelationshipSelectorEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcRelationshipSelectorSet.VTable, self.vtable).GetEnumerator(@ptrCast(*const IOpcRelationshipSelectorSet, self), relationshipSelectorEnumerator); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcSignatureReferenceSet_Value = Guid.initString("f3b02d31-ab12-42dd-9e2f-2b16761c3c1e"); pub const IID_IOpcSignatureReferenceSet = &IID_IOpcSignatureReferenceSet_Value; pub const IOpcSignatureReferenceSet = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Create: fn( self: *const IOpcSignatureReferenceSet, referenceUri: ?*IUri, referenceId: ?[*:0]const u16, type: ?[*:0]const u16, digestMethod: ?[*:0]const u16, transformMethod: OPC_CANONICALIZATION_METHOD, reference: ?*?*IOpcSignatureReference, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Delete: fn( self: *const IOpcSignatureReferenceSet, reference: ?*IOpcSignatureReference, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEnumerator: fn( self: *const IOpcSignatureReferenceSet, referenceEnumerator: ?*?*IOpcSignatureReferenceEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureReferenceSet_Create(self: *const T, referenceUri: ?*IUri, referenceId: ?[*:0]const u16, type_: ?[*:0]const u16, digestMethod: ?[*:0]const u16, transformMethod: OPC_CANONICALIZATION_METHOD, reference: ?*?*IOpcSignatureReference) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureReferenceSet.VTable, self.vtable).Create(@ptrCast(*const IOpcSignatureReferenceSet, self), referenceUri, referenceId, type_, digestMethod, transformMethod, reference); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureReferenceSet_Delete(self: *const T, reference: ?*IOpcSignatureReference) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureReferenceSet.VTable, self.vtable).Delete(@ptrCast(*const IOpcSignatureReferenceSet, self), reference); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureReferenceSet_GetEnumerator(self: *const T, referenceEnumerator: ?*?*IOpcSignatureReferenceEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureReferenceSet.VTable, self.vtable).GetEnumerator(@ptrCast(*const IOpcSignatureReferenceSet, self), referenceEnumerator); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcSignatureCustomObjectSet_Value = Guid.initString("8f792ac5-7947-4e11-bc3d-2659ff046ae1"); pub const IID_IOpcSignatureCustomObjectSet = &IID_IOpcSignatureCustomObjectSet_Value; pub const IOpcSignatureCustomObjectSet = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Create: fn( self: *const IOpcSignatureCustomObjectSet, xmlMarkup: [*:0]const u8, count: u32, customObject: ?*?*IOpcSignatureCustomObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Delete: fn( self: *const IOpcSignatureCustomObjectSet, customObject: ?*IOpcSignatureCustomObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEnumerator: fn( self: *const IOpcSignatureCustomObjectSet, customObjectEnumerator: ?*?*IOpcSignatureCustomObjectEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureCustomObjectSet_Create(self: *const T, xmlMarkup: [*:0]const u8, count: u32, customObject: ?*?*IOpcSignatureCustomObject) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureCustomObjectSet.VTable, self.vtable).Create(@ptrCast(*const IOpcSignatureCustomObjectSet, self), xmlMarkup, count, customObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureCustomObjectSet_Delete(self: *const T, customObject: ?*IOpcSignatureCustomObject) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureCustomObjectSet.VTable, self.vtable).Delete(@ptrCast(*const IOpcSignatureCustomObjectSet, self), customObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcSignatureCustomObjectSet_GetEnumerator(self: *const T, customObjectEnumerator: ?*?*IOpcSignatureCustomObjectEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcSignatureCustomObjectSet.VTable, self.vtable).GetEnumerator(@ptrCast(*const IOpcSignatureCustomObjectSet, self), customObjectEnumerator); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcCertificateSet_Value = Guid.initString("56ea4325-8e2d-4167-b1a4-e486d24c8fa7"); pub const IID_IOpcCertificateSet = &IID_IOpcCertificateSet_Value; pub const IOpcCertificateSet = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Add: fn( self: *const IOpcCertificateSet, certificate: ?*const CERT_CONTEXT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Remove: fn( self: *const IOpcCertificateSet, certificate: ?*const CERT_CONTEXT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEnumerator: fn( self: *const IOpcCertificateSet, certificateEnumerator: ?*?*IOpcCertificateEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcCertificateSet_Add(self: *const T, certificate: ?*const CERT_CONTEXT) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcCertificateSet.VTable, self.vtable).Add(@ptrCast(*const IOpcCertificateSet, self), certificate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcCertificateSet_Remove(self: *const T, certificate: ?*const CERT_CONTEXT) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcCertificateSet.VTable, self.vtable).Remove(@ptrCast(*const IOpcCertificateSet, self), certificate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcCertificateSet_GetEnumerator(self: *const T, certificateEnumerator: ?*?*IOpcCertificateEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcCertificateSet.VTable, self.vtable).GetEnumerator(@ptrCast(*const IOpcCertificateSet, self), certificateEnumerator); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IOpcFactory_Value = Guid.initString("6d0b4446-cd73-4ab3-94f4-8ccdf6116154"); pub const IID_IOpcFactory = &IID_IOpcFactory_Value; pub const IOpcFactory = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreatePackageRootUri: fn( self: *const IOpcFactory, rootUri: ?*?*IOpcUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreatePartUri: fn( self: *const IOpcFactory, pwzUri: ?[*:0]const u16, partUri: ?*?*IOpcPartUri, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateStreamOnFile: fn( self: *const IOpcFactory, filename: ?[*:0]const u16, ioMode: OPC_STREAM_IO_MODE, securityAttributes: ?*SECURITY_ATTRIBUTES, dwFlagsAndAttributes: u32, stream: ?*?*IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreatePackage: fn( self: *const IOpcFactory, package: ?*?*IOpcPackage, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReadPackageFromStream: fn( self: *const IOpcFactory, stream: ?*IStream, flags: OPC_READ_FLAGS, package: ?*?*IOpcPackage, ) callconv(@import("std").os.windows.WINAPI) HRESULT, WritePackageToStream: fn( self: *const IOpcFactory, package: ?*IOpcPackage, flags: OPC_WRITE_FLAGS, stream: ?*IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateDigitalSignatureManager: fn( self: *const IOpcFactory, package: ?*IOpcPackage, signatureManager: ?*?*IOpcDigitalSignatureManager, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcFactory_CreatePackageRootUri(self: *const T, rootUri: ?*?*IOpcUri) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcFactory.VTable, self.vtable).CreatePackageRootUri(@ptrCast(*const IOpcFactory, self), rootUri); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcFactory_CreatePartUri(self: *const T, pwzUri: ?[*:0]const u16, partUri: ?*?*IOpcPartUri) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcFactory.VTable, self.vtable).CreatePartUri(@ptrCast(*const IOpcFactory, self), pwzUri, partUri); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcFactory_CreateStreamOnFile(self: *const T, filename: ?[*:0]const u16, ioMode: OPC_STREAM_IO_MODE, securityAttributes: ?*SECURITY_ATTRIBUTES, dwFlagsAndAttributes: u32, stream: ?*?*IStream) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcFactory.VTable, self.vtable).CreateStreamOnFile(@ptrCast(*const IOpcFactory, self), filename, ioMode, securityAttributes, dwFlagsAndAttributes, stream); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcFactory_CreatePackage(self: *const T, package: ?*?*IOpcPackage) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcFactory.VTable, self.vtable).CreatePackage(@ptrCast(*const IOpcFactory, self), package); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcFactory_ReadPackageFromStream(self: *const T, stream: ?*IStream, flags: OPC_READ_FLAGS, package: ?*?*IOpcPackage) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcFactory.VTable, self.vtable).ReadPackageFromStream(@ptrCast(*const IOpcFactory, self), stream, flags, package); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcFactory_WritePackageToStream(self: *const T, package: ?*IOpcPackage, flags: OPC_WRITE_FLAGS, stream: ?*IStream) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcFactory.VTable, self.vtable).WritePackageToStream(@ptrCast(*const IOpcFactory, self), package, flags, stream); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOpcFactory_CreateDigitalSignatureManager(self: *const T, package: ?*IOpcPackage, signatureManager: ?*?*IOpcDigitalSignatureManager) callconv(.Inline) HRESULT { return @ptrCast(*const IOpcFactory.VTable, self.vtable).CreateDigitalSignatureManager(@ptrCast(*const IOpcFactory, self), package, signatureManager); } };} 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 (9) //-------------------------------------------------------------------------------- const Guid = @import("../../zig.zig").Guid; const BOOL = @import("../../foundation.zig").BOOL; const CERT_CONTEXT = @import("../../security/cryptography.zig").CERT_CONTEXT; const HRESULT = @import("../../foundation.zig").HRESULT; const IStream = @import("../../system/com.zig").IStream; const IUnknown = @import("../../system/com.zig").IUnknown; const IUri = @import("../../system/com.zig").IUri; const PWSTR = @import("../../foundation.zig").PWSTR; const SECURITY_ATTRIBUTES = @import("../../security.zig").SECURITY_ATTRIBUTES; 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/storage/packaging/opc.zig
const std = @import("std"); pub const SinkId = struct { value: []const u8, pub fn eql(self: SinkId, other: SinkId) bool { return std.mem.eql(u8, self.value, other.value); } }; pub const Sink = struct { id: SinkId, volume: u8, muted: bool }; pub fn get_default_sink_id(buffer: []u8) error{NoDefaultSink}!SinkId { var it = std.mem.split(buffer, "\n"); while (it.next()) |line| { if (std.mem.startsWith(u8, line, "Default Sink:")) { return SinkId{ .value = line[14..] }; } } return error.NoDefaultSink; } // TODO: Parsing is done by stepping over lines, not looking after correct headers. // It's quite possible, that once pactl changes it's output, this program will no longer work as intended. // It might be better to rewrite it to parse after headers. pub fn get_all_sinks(allocator: *std.mem.Allocator, buffer: []u8) anyerror!std.ArrayList(Sink) { var list = std.ArrayList(Sink).init(allocator); var it = std.mem.split(buffer, "\n"); while (it.next()) |line| { const sinkHeader = std.mem.trim(u8, line, " \t"); if (!std.mem.startsWith(u8, sinkHeader, "Sink #")) { continue; } _ = it.next(); // Skip over State const idLine = std.mem.trim(u8, it.next() orelse unreachable, " \t"); _ = it.next(); // Skip over Description _ = it.next(); // Skip over Driver _ = it.next(); // Skip over Sample Specification _ = it.next(); // Skip over Channel Map _ = it.next(); // Skip over Owner Module const muteLine = std.mem.trim(u8, it.next() orelse unreachable, " \t"); var volumeLineParts = std.mem.tokenize(it.next() orelse unreachable, " \t"); const volumeDigit = while (volumeLineParts.next()) |part| { if (std.mem.endsWith(u8, part, "%")) { break std.mem.trimRight(u8, part, "%"); } } else unreachable; try list.append(Sink{ .id = SinkId{ .value = idLine[6..] }, .volume = try std.fmt.parseInt(u8, volumeDigit, 10), .muted = std.mem.eql(u8, muteLine, "Mute: yes"), }); continue; } return list; } pub fn get_sink(sinks: std.ArrayList(Sink), sink_id: SinkId) ?Sink { for (sinks.items) |current_sink| { if (sink_id.eql(current_sink.id)) { return current_sink; } } return null; }
src/pactl.zig
const std = @import("std"); const c = @import("internal/c.zig"); const internal = @import("internal/internal.zig"); const log = std.log.scoped(.git); const git = @import("git.zig"); pub const Blame = opaque { pub fn deinit(self: *Blame) void { log.debug("Blame.deinit called", .{}); c.git_blame_free(@ptrCast(*c.git_blame, self)); log.debug("blame freed successfully", .{}); } pub fn hunkCount(self: *Blame) u32 { log.debug("Blame.hunkCount called", .{}); const ret = c.git_blame_get_hunk_count(@ptrCast(*c.git_blame, self)); log.debug("blame hunk count: {}", .{ret}); return ret; } pub fn hunkByIndex(self: *Blame, index: u32) ?*const BlameHunk { log.debug("Blame.hunkByIndex called, index={}", .{index}); if (c.git_blame_get_hunk_byindex(@ptrCast(*c.git_blame, self), index)) |c_ret| { const ret = @ptrCast(*const git.BlameHunk, c_ret); log.debug("successfully fetched hunk: {*}", .{ret}); return ret; } return null; } pub fn hunkByLine(self: *Blame, line: usize) ?*const BlameHunk { log.debug("Blame.hunkByLine called, line={}", .{line}); if (c.git_blame_get_hunk_byline(@ptrCast(*c.git_blame, self), line)) |c_ret| { const ret = @ptrCast(*const git.BlameHunk, c_ret); log.debug("successfully fetched hunk: {*}", .{ret}); return ret; } return null; } /// Get blame data for a file that has been modified in memory. The `reference` parameter is a pre-calculated blame for the /// in-odb history of the file. This means that once a file blame is completed (which can be expensive), updating the buffer /// blame is very fast. /// /// Lines that differ between the buffer and the committed version are marked as having a zero OID for their final_commit_id. pub fn blameBuffer(self: *Blame, buffer: [:0]const u8) !*git.Blame { log.debug("Blame.blameBuffer called, buffer={s}", .{buffer}); var blame: *git.Blame = undefined; try internal.wrapCall("git_blame_buffer", .{ @ptrCast(*?*c.git_blame, &blame), @ptrCast(*c.git_blame, self), buffer.ptr, buffer.len, }); log.debug("successfully fetched blame buffer", .{}); return blame; } comptime { std.testing.refAllDecls(@This()); } }; pub const BlameHunk = extern struct { /// The number of lines in this hunk. lines_in_hunk: usize, /// The OID of the commit where this line was last changed. final_commit_id: git.Oid, /// The 1-based line number where this hunk begins, in the final version /// of the file. final_start_line_number: usize, /// The author of `final_commit_id`. If `GIT_BLAME_USE_MAILMAP` has been /// specified, it will contain the canonical real name and email address. final_signature: *git.Signature, /// The OID of the commit where this hunk was found. /// This will usually be the same as `final_commit_id`, except when /// `GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES` has been specified. orig_commit_id: git.Oid, /// The path to the file where this hunk originated, as of the commit /// specified by `orig_commit_id`. /// Use `origPath` z_orig_path: [*:0]const u8, /// The 1-based line number where this hunk begins in the file named by /// `orig_path` in the commit specified by `orig_commit_id`. orig_start_line_number: usize, /// The author of `orig_commit_id`. If `GIT_BLAME_USE_MAILMAP` has been /// specified, it will contain the canonical real name and email address. orig_signature: *git.Signature, /// The 1 iff the hunk has been tracked to a boundary commit (the root, /// or the commit specified in git_blame_options.oldest_commit) boundary: u8, pub fn origPath(self: BlameHunk) [:0]const u8 { return std.mem.sliceTo(self.z_orig_path, 0); } test { try std.testing.expectEqual(@sizeOf(c.git_blame_hunk), @sizeOf(BlameHunk)); try std.testing.expectEqual(@bitSizeOf(c.git_blame_hunk), @bitSizeOf(BlameHunk)); } comptime { std.testing.refAllDecls(@This()); } }; comptime { std.testing.refAllDecls(@This()); }
src/blame.zig
const sf = @import("../sfml.zig"); pub const Event = union(Event.Type) { const Self = @This(); pub const Type = enum(c_int) { closed, resized, lostFocus, gainedFocus, textEntered, keyPressed, keyReleased, mouseWheelScrolled, mouseButtonPressed, mouseButtonReleased, mouseMoved, mouseEntered, mouseLeft, joystickButtonPressed, joystickButtonReleased, joystickMoved, joystickConnected, joystickDisconnected, touchBegan, touchMoved, touchEnded, sensorChanged, }; // Big oof /// Creates this event from a csfml one pub fn fromCSFML(event: sf.c.sfEvent) Self { return switch (event.type) { sf.c.sfEventType.sfEvtClosed => .{ .closed = {} }, sf.c.sfEventType.sfEvtResized => .{ .resized = .{ .size = .{ .x = event.size.width, .y = event.size.height } } }, sf.c.sfEventType.sfEvtLostFocus => .{ .lostFocus = {} }, sf.c.sfEventType.sfEvtGainedFocus => .{ .gainedFocus = {} }, sf.c.sfEventType.sfEvtTextEntered => .{ .textEntered = .{ .unicode = event.text.unicode } }, sf.c.sfEventType.sfEvtKeyPressed => .{ .keyPressed = .{ .code = @intToEnum(sf.Keyboard.KeyCode, @enumToInt(event.key.code)), .alt = (event.key.alt != 0), .control = (event.key.control != 0), .shift = (event.key.shift != 0), .system = (event.key.system != 0) } }, sf.c.sfEventType.sfEvtKeyReleased => .{ .keyReleased = .{ .code = @intToEnum(sf.Keyboard.KeyCode, @enumToInt(event.key.code)), .alt = (event.key.alt != 0), .control = (event.key.control != 0), .shift = (event.key.shift != 0), .system = (event.key.system != 0) } }, sf.c.sfEventType.sfEvtMouseWheelMoved, sf.c.sfEventType.sfEvtMouseWheelScrolled => .{ .mouseWheelScrolled = .{ .wheel = @intToEnum(sf.Mouse.Wheel, @enumToInt(event.mouseWheelScroll.wheel)), .delta = event.mouseWheelScroll.delta, .pos = .{ .x = event.mouseWheelScroll.x, .y = event.mouseWheelScroll.y } } }, sf.c.sfEventType.sfEvtMouseButtonPressed => .{ .mouseButtonPressed = .{ .button = @intToEnum(sf.Mouse.Button, @enumToInt(event.mouseButton.button)), .pos = .{ .x = event.mouseButton.x, .y = event.mouseButton.y } } }, sf.c.sfEventType.sfEvtMouseButtonReleased => .{ .mouseButtonReleased = .{ .button = @intToEnum(sf.Mouse.Button, @enumToInt(event.mouseButton.button)), .pos = .{ .x = event.mouseButton.x, .y = event.mouseButton.y } } }, sf.c.sfEventType.sfEvtMouseMoved => .{ .mouseMoved = .{ .pos = .{ .x = event.mouseMove.x, .y = event.mouseMove.y } } }, sf.c.sfEventType.sfEvtMouseEntered => .{ .mouseEntered = {} }, sf.c.sfEventType.sfEvtMouseLeft => .{ .mouseLeft = {} }, sf.c.sfEventType.sfEvtJoystickButtonPressed => .{ .joystickButtonPressed = .{ .joystickId = event.joystickButton.joystickId, .button = event.joystickButton.button } }, sf.c.sfEventType.sfEvtJoystickButtonReleased => .{ .joystickButtonReleased = .{ .joystickId = event.joystickButton.joystickId, .button = event.joystickButton.button } }, sf.c.sfEventType.sfEvtJoystickMoved => .{ .joystickMoved = .{ .joystickId = event.joystickMove.joystickId, .axis = event.joystickMove.axis, .position = event.joystickMove.position } }, sf.c.sfEventType.sfEvtJoystickConnected => .{ .joystickConnected = .{ .joystickId = event.joystickConnect.joystickId } }, sf.c.sfEventType.sfEvtJoystickDisconnected => .{ .joystickDisconnected = .{ .joystickId = event.joystickConnect.joystickId } }, sf.c.sfEventType.sfEvtTouchBegan => .{ .touchBegan = .{ .finger = event.touch.finger, .pos = .{ .x = event.touch.x, .y = event.touch.y } } }, sf.c.sfEventType.sfEvtTouchMoved => .{ .touchMoved = .{ .finger = event.touch.finger, .pos = .{ .x = event.touch.x, .y = event.touch.y } } }, sf.c.sfEventType.sfEvtTouchEnded => .{ .touchEnded = .{ .finger = event.touch.finger, .pos = .{ .x = event.touch.x, .y = event.touch.y } } }, sf.c.sfEventType.sfEvtSensorChanged => .{ .sensorChanged = .{ .sensorType = event.sensor.sensorType, .vector = .{ .x = event.sensor.x, .y = event.sensor.y, .z = event.sensor.z } } }, sf.c.sfEventType.sfEvtCount => @panic("sfEvtCount should't exist as an event!"), else => @panic("Unknown event!"), }; } /// Gets how many types of event exist pub fn getEventCount() c_uint { return @enumToInt(sf.c.sfEventType.sfEvtCount); } /// Size events parameters pub const SizeEvent = struct { size: sf.Vector2u, }; /// Keyboard event parameters pub const KeyEvent = struct { code: sf.Keyboard.KeyCode, alt: bool, control: bool, shift: bool, system: bool, }; /// Text event parameters pub const TextEvent = struct { unicode: u32, }; /// Mouse move event parameters pub const MouseMoveEvent = struct { pos: sf.Vector2i, }; /// Mouse buttons events parameters pub const MouseButtonEvent = struct { button: sf.Mouse.Button, pos: sf.Vector2i, }; /// Mouse wheel events parameters pub const MouseWheelScrollEvent = struct { wheel: sf.Mouse.Wheel, delta: f32, pos: sf.Vector2i, }; /// Joystick axis move event parameters pub const JoystickMoveEvent = struct { joystickId: c_uint, axis: sf.c.sfJoystickAxis, position: f32, }; /// Joystick buttons events parameters pub const JoystickButtonEvent = struct { joystickId: c_uint, button: c_uint, }; /// Joystick connection/disconnection event parameters pub const JoystickConnectEvent = struct { joystickId: c_uint, }; /// Touch events parameters pub const TouchEvent = struct { finger: c_uint, pos: sf.Vector2i, }; /// Sensor event parameters pub const SensorEvent = struct { sensorType: sf.c.sfSensorType, vector: sf.Vector3f, }; // An event is one of those closed: void, resized: SizeEvent, lostFocus: void, gainedFocus: void, textEntered: TextEvent, keyPressed: KeyEvent, keyReleased: KeyEvent, mouseWheelScrolled: MouseWheelScrollEvent, mouseButtonPressed: MouseButtonEvent, mouseButtonReleased: MouseButtonEvent, mouseMoved: MouseMoveEvent, mouseEntered: void, mouseLeft: void, joystickButtonPressed: JoystickButtonEvent, joystickButtonReleased: JoystickButtonEvent, joystickMoved: JoystickMoveEvent, joystickConnected: JoystickConnectEvent, joystickDisconnected: JoystickConnectEvent, touchBegan: TouchEvent, touchMoved: TouchEvent, touchEnded: TouchEvent, sensorChanged: SensorEvent, };
src/sfml/window/event.zig
// DO NOT MODIFY. This is not actually a source file; it is a textual representation of generated code. // Use only for debugging purposes. // Auto-generated constructor // Access: public Method <init> : V ( // (no arguments) ) { ALOAD 0 // Method descriptor: ()V INVOKESPECIAL java/lang/Object#<init> RETURN } // Access: public Method deploy_0 : V ( arg 1 = Lio/quarkus/runtime/StartupContext;, arg 2 = [Ljava/lang/Object; ) { ** label1 NEW io/quarkus/arc/runtime/ArcRecorder DUP // Method descriptor: ()V INVOKESPECIAL io/quarkus/arc/runtime/ArcRecorder#<init> ASTORE 3 ALOAD 2 LDC (Integer) 0 ALOAD 3 AASTORE ALOAD 1 LDC (String) "io.quarkus.runtime.ShutdownContext" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Object; INVOKEVIRTUAL io/quarkus/runtime/StartupContext#getValue ASTORE 4 ALOAD 2 LDC (Integer) 0 AALOAD ASTORE 11 ALOAD 11 CHECKCAST io/quarkus/arc/runtime/ArcRecorder ALOAD 4 CHECKCAST io/quarkus/runtime/ShutdownContext // Method descriptor: (Lio/quarkus/runtime/ShutdownContext;)Lio/quarkus/arc/ArcContainer; INVOKEVIRTUAL io/quarkus/arc/runtime/ArcRecorder#getContainer ASTORE 5 ALOAD 1 LDC (String) "proxykey38" ALOAD 5 // Method descriptor: (Ljava/lang/String;Ljava/lang/Object;)V INVOKEVIRTUAL io/quarkus/runtime/StartupContext#putValue NEW java/util/ArrayList DUP // Method descriptor: ()V INVOKESPECIAL java/util/ArrayList#<init> ASTORE 6 ALOAD 2 LDC (Integer) 1 ALOAD 6 AASTORE ALOAD 2 LDC (Integer) 1 AALOAD ASTORE 7 ALOAD 2 LDC (Integer) 2 ALOAD 7 AASTORE NEW java/util/HashSet DUP // Method descriptor: ()V INVOKESPECIAL java/util/HashSet#<init> ASTORE 8 ALOAD 2 LDC (Integer) 3 ALOAD 8 AASTORE ALOAD 2 LDC (Integer) 3 AALOAD ASTORE 9 ALOAD 9 CHECKCAST java/util/Collection LDC (String) "java.lang.Float" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "java.lang.Double" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "java.lang.Integer" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "java.lang.Iterable" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "javax.servlet.http.HttpServletRequest" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "io.quarkus.arc.runtimebean.RuntimeBeanProducers" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "java.lang.Long" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "java.util.concurrent.ScheduledExecutorService" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "java.lang.Boolean" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "io.quarkus.undertow.runtime.ServletProducer" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "java.lang.String" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "java.lang.Number" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "java.util.concurrent.ExecutorService" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "javax.enterprise.context.control.RequestContextController" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "javax.servlet.ServletRequest" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "io.netty.channel.EventLoopGroup" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "java.lang.CharSequence" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "java.util.concurrent.Executor" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "java.util.Collection" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "javax.servlet.http.HttpServletResponse" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "io.quarkus.arc.InjectableRequestContextController" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "java.util.Set" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "org.eclipse.microprofile.config.Config" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "io.netty.util.concurrent.EventExecutorGroup" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "java.io.Serializable" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "java.util.List" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "javax.servlet.ServletResponse" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "io.quarkus.arc.runtime.QuarkusConfigProducer" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "java.util.Optional" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "java.lang.Comparable" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "java.lang.Object" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 9 CHECKCAST java/util/Collection LDC (String) "javax.servlet.ServletContext" // Method descriptor: (Ljava/lang/Object;)Z INVOKEINTERFACE java/util/Collection#add POP ALOAD 2 LDC (Integer) 4 ALOAD 9 AASTORE ALOAD 1 LDC (String) "proxykey38" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Object; INVOKEVIRTUAL io/quarkus/runtime/StartupContext#getValue ASTORE 10 ALOAD 2 LDC (Integer) 2 AALOAD ASTORE 12 ALOAD 2 LDC (Integer) 4 AALOAD ASTORE 13 ALOAD 11 CHECKCAST io/quarkus/arc/runtime/ArcRecorder ALOAD 10 CHECKCAST io/quarkus/arc/ArcContainer ALOAD 12 CHECKCAST java/util/List ALOAD 13 CHECKCAST java/util/Collection // Method descriptor: (Lio/quarkus/arc/ArcContainer;Ljava/util/List;Ljava/util/Collection;)Lio/quarkus/arc/runtime/BeanContainer; INVOKEVIRTUAL io/quarkus/arc/runtime/ArcRecorder#initBeanContainer ASTORE 14 ALOAD 1 LDC (String) "proxykey40" ALOAD 14 // Method descriptor: (Ljava/lang/String;Ljava/lang/Object;)V INVOKEVIRTUAL io/quarkus/runtime/StartupContext#putValue RETURN ** label2 } // Access: public Method deploy : V ( arg 1 = Lio/quarkus/runtime/StartupContext; ) { ** label1 LDC (Integer) 5 ANEWARRAY java/lang/Object ASTORE 2 ALOAD 0 ALOAD 1 ALOAD 2 // Method descriptor: (Lio/quarkus/runtime/StartupContext;[Ljava/lang/Object;)V INVOKEVIRTUAL io/quarkus/deployment/steps/ArcProcessor$generateResources19#deploy_0 RETURN ** label2 }
localproxyservice/target/generated-sources/gizmo/io/quarkus/deployment/steps/ArcProcessor$generateResources19.zig
const std = @import("std"); const utils = @import("../utils.zig"); const Atomic = std.atomic.Atomic; const Futex = std.Thread.Futex; pub const Lock = extern struct { pub const name = "futex_lock"; state: Atomic(u32) = Atomic(u32).init(UNLOCKED), const UNLOCKED = 0; const LOCKED = 0b01; const CONTENDED = 0b11; pub fn init(self: *Lock) void { self.* = Lock{}; } pub fn deinit(self: *Lock) void { self.* = undefined; } pub fn acquire(self: *Lock) void { if (self.acquireFast()) return; return self.acquireSlow(); } inline fn acquireFast(self: *Lock) bool { if (utils.is_x86) { return self.state.bitSet(@ctz(u32, LOCKED), .Acquire) == UNLOCKED; } return self.state.tryCompareAndSwap(UNLOCKED, LOCKED, .Acquire, .Monotonic) == null; } noinline fn acquireSlow(self: *Lock) void { @setCold(true); var spin = utils.SpinWait{}; while (spin.yield()) { switch (self.state.load(.Monotonic)) { 0 => if (self.acquireFast()) return, 1 => continue, 2 => break, else => continue, } } while (true) : (Futex.wait(&self.state, CONTENDED, null) catch unreachable) { if (utils.is_x86) { if (self.state.swap(CONTENDED, .Acquire) == 0) return; continue; } var state = self.state.load(.Monotonic); while (state != CONTENDED) { state = switch (state) { 0 => self.state.tryCompareAndSwap(state, CONTENDED, .Acquire, .Monotonic) orelse return, 1 => self.state.tryCompareAndSwap(state, CONTENDED, .Monotonic, .Monotonic) orelse break, else => unreachable, }; } } } pub fn release(self: *Lock) void { if (self.state.swap(UNLOCKED, .Release) != CONTENDED) return; return self.releaseSlow(); } noinline fn releaseSlow(self: *Lock) void { @setCold(true); Futex.wake(&self.state, 1); } };
locks/futex_lock.zig
const clap = @import("clap"); const format = @import("format"); const std = @import("std"); const ston = @import("ston"); const util = @import("util"); const ascii = std.ascii; const debug = std.debug; const fmt = std.fmt; const fs = std.fs; const heap = std.heap; const io = std.io; const math = std.math; const mem = std.mem; const os = std.os; const rand = std.rand; const testing = std.testing; const unicode = std.unicode; const Utf8 = util.unicode.Utf8View; const escape = util.escape; const parse = util.parse; const Program = @This(); allocator: mem.Allocator, options: struct { seed: u64, hms: bool, excluded_moves: []const []const u8, }, items: Items = Items{}, moves: Moves = Moves{}, tms: Machines = Machines{}, hms: Machines = Machines{}, pub const main = util.generateMain(Program); pub const version = "0.0.0"; pub const description = \\Randomizes the moves of tms. \\ ; pub const params = &[_]clap.Param(clap.Help){ clap.parseParam( "-h, --help " ++ "Display this help text and exit.", ) catch unreachable, clap.parseParam( " --hms " ++ "Also randomize hms (this may break your game).", ) catch unreachable, clap.parseParam( "-s, --seed <INT> " ++ "The seed to use for random numbers. A random seed will be picked if this is " ++ "not specified.", ) catch unreachable, clap.parseParam( "-e, --exclude <STRING>... " ++ "List of moves to never pick. Case insensitive. Supports wildcards like '*chop'.", ) catch unreachable, clap.parseParam( "-v, --version " ++ "Output version information and exit.", ) catch unreachable, }; pub fn init(allocator: mem.Allocator, args: anytype) !Program { const seed = try util.args.seed(args); const excluded_moves_arg = args.options("--exclude"); var excluded_moves = try std.ArrayList([]const u8).initCapacity( allocator, excluded_moves_arg.len, ); for (excluded_moves_arg) |exclude| excluded_moves.appendAssumeCapacity(try ascii.allocLowerString(allocator, exclude)); return Program{ .allocator = allocator, .options = .{ .seed = seed, .hms = args.flag("--hms"), .excluded_moves = excluded_moves.toOwnedSlice(), }, }; } pub fn run( program: *Program, comptime Reader: type, comptime Writer: type, stdio: util.CustomStdIoStreams(Reader, Writer), ) anyerror!void { try format.io(program.allocator, stdio.in, stdio.out, program, useGame); try program.randomize(); try program.output(stdio.out); } fn output(program: *Program, writer: anytype) !void { try ston.serialize(writer, .{ .tms = program.tms, .hms = program.hms, }); for (program.items.values()) |item, i| { try ston.serialize(writer, .{ .items = ston.index(program.items.keys()[i], .{ .description = ston.string(escape.default.escapeFmt(item.description)), }) }); } } fn useGame(program: *Program, parsed: format.Game) !void { const allocator = program.allocator; switch (parsed) { .tms => |tms| { _ = try program.tms.put(allocator, tms.index, tms.value); return; }, .hms => |ms| if (program.options.hms) { _ = try program.hms.put(allocator, ms.index, ms.value); return; } else { return error.DidNotConsumeData; }, .moves => |moves| { const move = (try program.moves.getOrPutValue(allocator, moves.index, .{})).value_ptr; switch (moves.value) { .pp => |pp| move.pp = pp, .name => |_name| { move.name = try escape.default.unescapeAlloc(allocator, _name); for (move.name) |*c| c.* = ascii.toLower(c.*); }, .description => |_desc| { const desc = try escape.default.unescapeAlloc(allocator, _desc); move.description = try Utf8.init(desc); }, else => {}, } return error.DidNotConsumeData; }, .items => |items| { const item = (try program.items.getOrPutValue(allocator, items.index, .{})).value_ptr; switch (items.value) { .pocket => |pocket| item.pocket = pocket, .name => |_name| item.name = try escape.default.unescapeAlloc(allocator, _name), .description => |_desc| { const desc = try escape.default.unescapeAlloc(allocator, _desc); item.description = try Utf8.init(desc); }, else => {}, } return error.DidNotConsumeData; }, .version, .game_title, .gamecode, .instant_text, .starters, .text_delays, .trainers, .pokemons, .abilities, .types, .pokedex, .maps, .wild_pokemons, .static_pokemons, .given_pokemons, .pokeball_items, .hidden_hollows, .text, => return error.DidNotConsumeData, } unreachable; } fn randomize(program: *Program) !void { const allocator = program.allocator; const random = rand.DefaultPrng.init(program.options.seed).random(); const pick_from = try program.getMoves(); randomizeMachines(random, pick_from.keys(), program.tms.values()); randomizeMachines(random, pick_from.keys(), program.hms.values()); // Find the maximum length of a line. Used to split descriptions into lines. var max_line_len: usize = 0; for (program.items.values()) |item| { var desc = item.description; while (mem.indexOf(u8, desc.bytes, "\n")) |index| { const line = Utf8.init(desc.bytes[0..index]) catch unreachable; max_line_len = math.max(line.len, max_line_len); desc = Utf8.init(desc.bytes[index + 1 ..]) catch unreachable; } max_line_len = math.max(description.len, max_line_len); } // HACK: The games does not used mono fonts, so actually, using the // max_line_len to destribute newlines will not actually be totally // correct. The best I can do here is to just reduce the max_line_len // by some amount and hope it is enough for all strings. max_line_len -|= 5; for (program.items.values()) |*item| { if (item.pocket != .tms_hms) continue; const is_tm = mem.startsWith(u8, item.name, "TM"); const is_hm = mem.startsWith(u8, item.name, "HM"); if (is_tm or is_hm) { const number = fmt.parseUnsigned(u8, item.name[2..], 10) catch continue; const machines = if (is_tm) program.tms else program.hms; const move_id = machines.get(number - 1) orelse continue; const move = program.moves.get(move_id) orelse continue; const new_desc = try util.unicode.splitIntoLines( allocator, max_line_len, move.description, ); item.description = new_desc.slice(0, item.description.len); } } } fn randomizeMachines( random: rand.Random, pick_from: []const u16, machines: []u16, ) void { for (machines) |*machine, i| while (true) { machine.* = util.random.item(random, pick_from).?.*; // Prevent duplicates if possible. We cannot prevent it if we have less moves to pick // from than there is machines if (pick_from.len < machines.len) break; if (mem.indexOfScalar(u16, machines[0..i], machine.*) == null) break; }; } fn getMoves(program: Program) !Set { var res = Set{}; for (program.moves.keys()) |move_id, i| { const move = program.moves.values()[i]; if (move.pp == 0) continue; if (util.glob.matchesOneOf(move.name, program.options.excluded_moves)) |_| continue; try res.putNoClobber(program.allocator, move_id, {}); } return res; } const Items = std.AutoArrayHashMapUnmanaged(u16, Item); const Machines = std.AutoArrayHashMapUnmanaged(u8, u16); const Moves = std.AutoArrayHashMapUnmanaged(u16, Move); const Set = std.AutoArrayHashMapUnmanaged(u16, void); const Item = struct { pocket: format.Pocket = .none, name: []const u8 = "", description: Utf8 = Utf8.init("") catch unreachable, }; const Move = struct { name: []u8 = "", description: Utf8 = Utf8.init("") catch unreachable, pp: u16 = 0, }; // // Testing // fn expectSameMachines(a: CollectedMachinesSet, b: CollectedMachinesSet) !void { try util.set.expectEqual(a, b); } fn expectDifferentMachines(a: CollectedMachinesSet, b: CollectedMachinesSet) !void { try testing.expect(!util.set.eql(a, b)); } fn expectNoMachineBeing(machines: CollectedMachinesSet, moves: []const u16) !void { for (moves) |move| { const found = for (machines.keys()) |machine| { if (machine.value == move) break true; } else false; try testing.expect(!found); } } const CollectedMachinesSet = std.AutoArrayHashMap(ston.Index(u8, u16), void); const CollectedMachines = struct { hms: CollectedMachinesSet, tms: CollectedMachinesSet, fn deinit(machines: *CollectedMachines) void { machines.hms.deinit(); machines.tms.deinit(); } }; fn runProgram(opt: util.testing.RunProgramOptions) !CollectedMachines { const res = try util.testing.runProgram(Program, opt); defer testing.allocator.free(res); return try collectMachines(res); } fn collectMachines(in: [:0]const u8) !CollectedMachines { var res = CollectedMachines{ .hms = CollectedMachinesSet.init(testing.allocator), .tms = CollectedMachinesSet.init(testing.allocator), }; errdefer res.deinit(); var parser = ston.Parser{ .str = in }; var des = ston.Deserializer(format.Game){ .parser = &parser }; while (des.next()) |line| switch (line) { .hms => |v| try testing.expect((try res.hms.fetchPut(v, {})) == null), .tms => |v| try testing.expect((try res.tms.fetchPut(v, {})) == null), else => {}, } else |_| { try testing.expectEqual(parser.str.len, parser.i); } return res; } test { const number_of_seeds = 40; const test_case = try util.testing.filter(util.testing.test_case, &.{ ".hms[*]=*", ".tms[*]=*", ".moves[*].name=*", ".moves[*].pp=*", }); defer testing.allocator.free(test_case); var original = try collectMachines(test_case); defer original.deinit(); var seed: usize = 0; while (seed < number_of_seeds) : (seed += 1) { var buf: [20]u8 = undefined; const seed_arg = std.fmt.bufPrint(&buf, "--seed={}", .{seed}) catch unreachable; var res = try runProgram(.{ .in = test_case, .args = &[_][]const u8{ "--exclude=struggle", "--exclude=surf", "--exclude=stomp", seed_arg, }, }); defer res.deinit(); try expectSameMachines(original.hms, res.hms); try expectDifferentMachines(original.tms, res.tms); try expectNoMachineBeing(res.tms, &.{ 23, // Stomp 57, // Surf 165, // Struggle }); } seed = 0; while (seed < number_of_seeds) : (seed += 1) { var buf: [20]u8 = undefined; const seed_arg = std.fmt.bufPrint(&buf, "--seed={}", .{seed}) catch unreachable; var res = try runProgram(.{ .in = test_case, .args = &[_][]const u8{ "--exclude=struggle", "--exclude=surf", "--exclude=stomp", seed_arg, "--hms", }, }); defer res.deinit(); try expectDifferentMachines(original.hms, res.hms); try expectDifferentMachines(original.tms, res.tms); try expectNoMachineBeing(res.tms, &.{ 23, // Stomp 57, // Surf 165, // Struggle }); try expectNoMachineBeing(res.hms, &.{ 23, // Stomp 57, // Surf 165, // Struggle }); } }
src/randomizers/tm35-rand-machines.zig
const std = @import("std"); const FloatStream = @This(); const common = @import("common.zig"); slice: []const u8, offset: usize, underscore_count: usize, pub fn init(s: []const u8) FloatStream { return .{ .slice = s, .offset = 0, .underscore_count = 0 }; } // Returns the offset from the start *excluding* any underscores that were found. pub fn offsetTrue(self: FloatStream) usize { return self.offset - self.underscore_count; } pub fn reset(self: *FloatStream) void { self.offset = 0; self.underscore_count = 0; } pub fn len(self: FloatStream) usize { if (self.offset > self.slice.len) { return 0; } return self.slice.len - self.offset; } pub fn hasLen(self: FloatStream, n: usize) bool { return self.offset + n <= self.slice.len; } pub fn firstUnchecked(self: FloatStream) u8 { return self.slice[self.offset]; } pub fn first(self: FloatStream) ?u8 { return if (self.hasLen(1)) return self.firstUnchecked() else null; } pub fn isEmpty(self: FloatStream) bool { return !self.hasLen(1); } pub fn firstIs(self: FloatStream, c: u8) bool { if (self.first()) |ok| { return ok == c; } return false; } pub fn firstIsLower(self: FloatStream, c: u8) bool { if (self.first()) |ok| { return ok | 0x20 == c; } return false; } pub fn firstIs2(self: FloatStream, c1: u8, c2: u8) bool { if (self.first()) |ok| { return ok == c1 or ok == c2; } return false; } pub fn firstIs3(self: FloatStream, c1: u8, c2: u8, c3: u8) bool { if (self.first()) |ok| { return ok == c1 or ok == c2 or ok == c3; } return false; } pub fn firstIsDigit(self: FloatStream, comptime base: u8) bool { comptime std.debug.assert(base == 10 or base == 16); if (self.first()) |ok| { return common.isDigit(ok, base); } return false; } pub fn advance(self: *FloatStream, n: usize) void { self.offset += n; } pub fn skipChars(self: *FloatStream, c: u8) void { while (self.firstIs(c)) : (self.advance(1)) {} } pub fn skipChars2(self: *FloatStream, c1: u8, c2: u8) void { while (self.firstIs2(c1, c2)) : (self.advance(1)) {} } pub fn readU64Unchecked(self: FloatStream) u64 { return std.mem.readIntSliceLittle(u64, self.slice[self.offset..]); } pub fn readU64(self: FloatStream) ?u64 { if (self.hasLen(8)) { return self.readU64Unchecked(); } return null; } pub fn atUnchecked(self: *FloatStream, i: usize) u8 { return self.slice[self.offset + i]; } pub fn scanDigit(self: *FloatStream, comptime base: u8) ?u8 { comptime std.debug.assert(base == 10 or base == 16); retry: while (true) { if (self.first()) |ok| { if ('0' <= ok and ok <= '9') { self.advance(1); return ok - '0'; } else if (base == 16 and 'a' <= ok and ok <= 'f') { self.advance(1); return ok - 'a' + 10; } else if (base == 16 and 'A' <= ok and ok <= 'F') { self.advance(1); return ok - 'A' + 10; } else if (ok == '_') { self.advance(1); self.underscore_count += 1; continue :retry; } } return null; } }
lib/std/fmt/parse_float/FloatStream.zig
const nds = @import("../nds/index.zig"); const fun = @import("../../lib/fun-with-zig/src/index.zig"); const lu16 = fun.platform.lu16; pub const Stats = packed struct { hp: u8, attack: u8, defense: u8, speed: u8, sp_attack: u8, sp_defense: u8, }; pub const MoveCategory = enum(u8) { Physical = 0x00, Status = 0x01, Special = 0x02, }; pub const GrowthRate = enum(u8) { MediumFast = 0x00, Erratic = 0x01, Fluctuating = 0x02, MediumSlow = 0x03, Fast = 0x04, Slow = 0x05, }; pub const EggGroup = enum(u4) { Invalid = 0x00, // TODO: Figure out if there is a 0x00 egg group Monster = 0x01, Water1 = 0x02, Bug = 0x03, Flying = 0x04, Field = 0x05, Fairy = 0x06, Grass = 0x07, HumanLike = 0x08, Water3 = 0x09, Mineral = 0x0A, Amorphous = 0x0B, Water2 = 0x0C, Ditto = 0x0D, Dragon = 0x0E, Undiscovered = 0x0F, }; pub const Color = enum(u7) { Red = 0x00, Blue = 0x01, Yellow = 0x02, Green = 0x03, Black = 0x04, Brown = 0x05, Purple = 0x06, Gray = 0x07, White = 0x08, Pink = 0x09, }; // TODO: Figure out if the this have the same layout in all games that have it. // They probably have, so let's assume that for now and if a bug // is ever encountered related to this, we figure it out. pub const EvYield = packed struct { hp: u2, attack: u2, defense: u2, speed: u2, sp_attack: u2, sp_defense: u2, padding: u4, }; pub const Evolution = packed struct { method: Evolution.Method, param: lu16, target: lu16, padding: [2]u8, pub const Method = enum(u16) { Unused = lu16.init(0x00).value(), FriendShip = lu16.init(0x01).value(), FriendShipDuringDay = lu16.init(0x02).value(), FriendShipDuringNight = lu16.init(0x03).value(), LevelUp = lu16.init(0x04).value(), Trade = lu16.init(0x05).value(), TradeHoldingItem = lu16.init(0x06).value(), UseItem = lu16.init(0x07).value(), AttackGthDefense = lu16.init(0x08).value(), AttackEqlDefense = lu16.init(0x09).value(), AttackLthDefense = lu16.init(0x0A).value(), PersonalityValue1 = lu16.init(0x0B).value(), PersonalityValue2 = lu16.init(0x0C).value(), LevelUpMaySpawnPokemon = lu16.init(0x0D).value(), LevelUpSpawnIfCond = lu16.init(0x0E).value(), Beauty = lu16.init(0x0F).value(), }; }; pub const legendaries = []u16{ 144, 145, 146, // Articuno, Zapdos, Moltres 150, 151, 243, // Mewtwo, Mew, Raikou 244, 245, 249, // Entei, Suicune, Lugia 250, 251, 377, // Ho-Oh, Celebi, Regirock 378, 379, 380, // Regice, Registeel, Latias 381, 382, 383, // Latios, Kyogre, Groudon, 384, 385, 386, // Rayquaza, Jirachi, Deoxys 480, 481, 482, // Uxie, Mesprit, Azelf 483, 484, 485, // Dialga, Palkia, Heatran 486, 487, 488, // Regigigas, Giratina, Cresselia 489, 490, 491, // Phione, Manaphy, Darkrai 492, 493, 494, // Shaymin, Arceus, Victini 638, 639, 640, // Cobalion, Terrakion, Virizion 641, 642, 643, // Tornadus, Thundurus, Reshiram 644, 645, 646, // Zekrom, Landorus, Kyurem 647, 648, 649, // Keldeo, Meloetta, Genesect 716, 717, 718, // Xerneas, Yveltal, Zygarde 719, 720, 721, // Diancie, Hoopa, Volcanion }; pub fn getNarc(file_system: *nds.fs.Nitro, path: []const u8) !*const nds.fs.Narc { const file = file_system.getFile(path) orelse return error.FileNotFound; const Tag = @TagType(nds.fs.Nitro.File); switch (file.*) { Tag.Binary => return error.FileNotNarc, Tag.Narc => |res| return res, } }
src/pokemon/common.zig
const GBA = @import("gba").GBA; const Input = @import("gba").Input; const LCD = @import("gba").LCD; const Background = @import("gba").Background; extern const ids8Tiles: [144]c_uint; extern const ids4Pal: [8]c_uint; extern const ids4Tiles: [40]c_uint; const CharacterBlock4 = 0; const ScreenBlock4 = 2; const CharacterBlock8 = 2; const ScreenBlock8 = 4; export var gameHeader linksection(".gbaheader") = GBA.Header.setup("CHARBLOCK", "ASBE", "00", 0); fn loadTiles() void { const tl = @intToPtr([*] align(4) Background.Tile, @ptrToInt(&ids4Tiles[0])); const tl8 = @intToPtr([*] align(4) Background.Tile8, @ptrToInt(&ids8Tiles[0])); // Loading tiles. 4-bit tiles to blocks 0 and 1 Background.TileMemory[0][1] = tl[1]; Background.TileMemory[0][2] = tl[2]; Background.TileMemory[1][0] = tl[3]; Background.TileMemory[1][1] = tl[4]; // and the 8-bit tiles to blocks 2 though 5 Background.Tile8Memory[2][1] = tl8[1]; Background.Tile8Memory[2][2] = tl8[2]; Background.Tile8Memory[3][0] = tl8[3]; Background.Tile8Memory[3][1] = tl8[4]; Background.Tile8Memory[4][0] = tl8[5]; Background.Tile8Memory[4][1] = tl8[6]; Background.Tile8Memory[5][0] = tl8[7]; Background.Tile8Memory[5][1] = tl8[8]; // Load palette GBA.memcpy32(GBA.BG_PALETTE_RAM, &ids4Pal, ids4Pal.len * @sizeOf(c_uint)); GBA.memcpy32(GBA.OBJ_PALETTE_RAM, &ids4Pal, ids4Pal.len * @sizeOf(c_uint)); } fn initMaps() void { // map coords (0,2) const screenEntry4 = @intToPtr([*]Background.TextScreenEntry, @ptrToInt(&Background.ScreenBlockMemory[ScreenBlock4][2*32])); // map coords (0, 8) const screenEntry8 = @intToPtr([*]Background.TextScreenEntry, @ptrToInt(&Background.ScreenBlockMemory[ScreenBlock8][8*32])); // Show first tiles of char-blocks available to background 0 // tiles 1, 2 of CharacterBlock4 screenEntry4[0x01].tileIndex = 0x0001; screenEntry4[0x02].tileIndex = 0x0002; // tiles 0, 1 of CharacterBlock4+1 screenEntry4[0x20].tileIndex = 0x0200; screenEntry4[0x21].tileIndex = 0x0201; // Show first tiles of char-blocks available to background 1 // tiles 1, 2 of CharacterBlock8 (== 2) screenEntry8[0x01].tileIndex = 0x0001; screenEntry8[0x02].tileIndex = 0x0002; // tiles 1, 2 of CharacterBlock8+1 screenEntry8[0x20].tileIndex = 0x0100; screenEntry8[0x21].tileIndex = 0x0101; // tiles 1, 2 of char-block CharacterBlock8+2 (== CBB_OBJ_LO) screenEntry8[0x40].tileIndex = 0x0200; screenEntry8[0x41].tileIndex = 0x0201; // tiles 1, 2 of char-block CharacterBlock8+3 (== CBB_OBJ_HI) screenEntry8[0x60].tileIndex = 0x0300; screenEntry8[0x61].tileIndex = 0x0301; } pub fn main() noreturn { loadTiles(); initMaps(); LCD.setupDisplayControl(.{ .mode = .Mode0, .backgroundLayer0 = .Show, .backgroundLayer1 = .Show, .objectLayer = .Show, }); Background.setupBackground(Background.Background0Control, .{ .characterBaseBlock = CharacterBlock4, .screenBaseBlock = ScreenBlock4, .paletteMode = .Color16, }); Background.setupBackground(Background.Background1Control, .{ .characterBaseBlock = CharacterBlock8, .screenBaseBlock = ScreenBlock8, .paletteMode = .Color256, }); while (true) { } }
examples/charBlock/charBlock.zig
const std = @import("std"); fn diffuse(xx: u64) u64 { var x = xx *% 0x6eed0e9da4d94a4f; const a = x >> 32; const b = x >> 60; x ^= a >> @intCast(u6, b); return x *% 0x6eed0e9da4d94a4f; } fn read_varint(buf: []const u8) u64 { return @as(u64, switch (@minimum(8, buf.len)) { else => unreachable, 1 => std.mem.readIntSliceLittle(u8, buf), 2 => std.mem.readIntSliceLittle(u16, buf), 3 => std.mem.readIntSliceLittle(u24, buf), 4 => std.mem.readIntSliceLittle(u32, buf), 5 => std.mem.readIntSliceLittle(u40, buf), 6 => std.mem.readIntSliceLittle(u48, buf), 7 => std.mem.readIntSliceLittle(u56, buf), 8 => std.mem.readIntSliceLittle(u64, buf), }); } pub fn seahash(buf: []const u8, aa: u64, bb: u64, cc: u64, dd: u64) u64 { const aligned = buf.len & ~@as(usize, 0x1F); var a = aa; var b = bb; var c = cc; var d = dd; { var offset: usize = 0; while (offset < aligned) { a ^= std.mem.readIntSliceLittle(u64, buf[offset..]); b ^= std.mem.readIntSliceLittle(u64, buf[8 + offset..]); c ^= std.mem.readIntSliceLittle(u64, buf[16 + offset..]); d ^= std.mem.readIntSliceLittle(u64, buf[24 + offset..]); offset += 32; a = diffuse(a); b = diffuse(b); c = diffuse(c); d = diffuse(d); } } { const l = buf.len - aligned; if (l != 0) { a = diffuse(a ^ read_varint(buf[aligned..])); if (l > 8) b = diffuse(b ^ read_varint(buf[8 + aligned..])); if (l > 16) c = diffuse(c ^ read_varint(buf[16 + aligned..])); if (l > 24) d = diffuse(d ^ read_varint(buf[24 + aligned..])); } } a ^= b; c ^= d; a ^= c; a ^= buf.len; return diffuse(a); } export fn hash(ptr: [*]u8, len: usize, a: u64, b: u64, c: u64, d: u64) u64 { return seahash(ptr[0..len], a, b, c, d); } test "hash" { const a = 0x16f11fe89b0d677c; const b = 0xb480a793d8e6c86c; const c = 0x6fe2e5aaf078ebc9; const d = 0x14f994a4c5259381; try std.testing.expectEqual(@as(u64, 1988685042348123509), hash("to be or not to be", a, b, c, d)); }
src/seahash/seahash.zig
usingnamespace @import("../Zig-PSP/src/psp/include/pspgu.zig"); const psp = @import("../Zig-PSP/src/psp/utils/psp.zig"); var psp_allocator: ?*std.mem.Allocator = null; const Self = @This(); init: bool = false, maxFilter: i32 = 0, minFilter: i32 = 0, repeat: bool = true, width: usize = 0, height: usize = 0, pWidth: usize = 0, pHeight: usize = 0, swizzled: i32 = 0, data: ?[]u8 align(16) = null, const std = @import("std"); pub fn pow2(int: usize) usize{ var p2 : usize = 1; while(p2 < int){ p2 = p2 << 1; } return p2; } const utils = @import("../utils/utils.zig"); pub fn loadTex(self: *Self, path: []const u8, min: TextureFilter, mag: TextureFilter, repeat: bool) !void { @setRuntimeSafety(false); self.init = true; self.minFilter = @enumToInt(min); self.maxFilter = @enumToInt(mag); self.repeat = repeat; var fs = try std.fs.cwd().openFile(path, .{.read = true}); var size = try fs.getEndPos(); if(psp_allocator == null){ psp_allocator = &psp.PSPAllocator.init().allocator; } //Set data from file //self.pWidth = pow2(self.width); //self.pHeight = pow2(self.height); } pub fn deleteTex(self: *Self) void { self.init = false; } pub fn bind(self: *Self) void { @setRuntimeSafety(false); if(self.init){ sceGuEnable(GuState.Texture2D); sceGuTexMode(GuPixelMode.Psm8888, 0, 0, self.swizzled); sceGuTexFunc(TextureEffect.Modulate, TextureColorComponent.Rgba); sceGuTexFilter(@intToEnum(TextureFilter, self.minFilter), @intToEnum(TextureFilter, self.maxFilter)); sceGuTexOffset(0.0, 0.0); if(self.repeat){ sceGuTexWrap(GuTexWrapMode.Repeat, GuTexWrapMode.Repeat); }else{ sceGuTexWrap(GuTexWrapMode.Clamp, GuTexWrapMode.Clamp); } if(self.data != null){ sceGuTexImage(0, @intCast(c_int, self.pWidth), @intCast(c_int, self.pHeight), @intCast(c_int, self.pWidth), @ptrCast(*c_void, &self.data.?)); } } }
src/gfx/texture.zig
//! A software version formatted according to the Semantic Version 2 specification. //! //! See: https://semver.org const std = @import("std"); const Version = @This(); major: usize, minor: usize, patch: usize, pre: ?[]const u8 = null, build: ?[]const u8 = null, pub const Range = struct { min: Version, max: Version, pub fn includesVersion(self: Range, ver: Version) bool { if (self.min.order(ver) == .gt) return false; if (self.max.order(ver) == .lt) return false; return true; } /// Checks if system is guaranteed to be at least `version` or older than `version`. /// Returns `null` if a runtime check is required. pub fn isAtLeast(self: Range, ver: Version) ?bool { if (self.min.order(ver) != .lt) return true; if (self.max.order(ver) == .lt) return false; return null; } }; pub fn order(lhs: Version, rhs: Version) std.math.Order { if (lhs.major < rhs.major) return .lt; if (lhs.major > rhs.major) return .gt; if (lhs.minor < rhs.minor) return .lt; if (lhs.minor > rhs.minor) return .gt; if (lhs.patch < rhs.patch) return .lt; if (lhs.patch > rhs.patch) return .gt; if (lhs.pre != null and rhs.pre == null) return .lt; if (lhs.pre == null and rhs.pre == null) return .eq; if (lhs.pre == null and rhs.pre != null) return .gt; // Iterate over pre-release identifiers until a difference is found. var lhs_pre_it = std.mem.split(lhs.pre.?, "."); var rhs_pre_it = std.mem.split(rhs.pre.?, "."); while (true) { const next_lid = lhs_pre_it.next(); const next_rid = rhs_pre_it.next(); // A larger set of pre-release fields has a higher precedence than a smaller set. if (next_lid == null and next_rid != null) return .lt; if (next_lid == null and next_rid == null) return .eq; if (next_lid != null and next_rid == null) return .gt; const lid = next_lid.?; // Left identifier const rid = next_rid.?; // Right identifier // Attempt to parse identifiers as numbers. Overflows are checked by parse. const lnum: ?usize = std.fmt.parseUnsigned(usize, lid, 10) catch |err| switch (err) { error.InvalidCharacter => null, error.Overflow => unreachable, }; const rnum: ?usize = std.fmt.parseUnsigned(usize, rid, 10) catch |err| switch (err) { error.InvalidCharacter => null, error.Overflow => unreachable, }; // Numeric identifiers always have lower precedence than non-numeric identifiers. if (lnum != null and rnum == null) return .lt; if (lnum == null and rnum != null) return .gt; // Identifiers consisting of only digits are compared numerically. // Identifiers with letters or hyphens are compared lexically in ASCII sort order. if (lnum != null and rnum != null) { if (lnum.? < rnum.?) return .lt; if (lnum.? > rnum.?) return .gt; } else { const ord = std.mem.order(u8, lid, rid); if (ord != .eq) return ord; } } } pub fn parse(text: []const u8) !Version { // Parse the required major, minor, and patch numbers. const extra_index = std.mem.indexOfAny(u8, text, "-+"); const required = text[0..(extra_index orelse text.len)]; var it = std.mem.split(required, "."); var ver = Version{ .major = try parseNum(it.next() orelse return error.InvalidVersion), .minor = try parseNum(it.next() orelse return error.InvalidVersion), .patch = try parseNum(it.next() orelse return error.InvalidVersion), }; if (it.next() != null) return error.InvalidVersion; if (extra_index == null) return ver; // Slice optional pre-release or build metadata components. const extra: []const u8 = text[extra_index.?..text.len]; if (extra[0] == '-') { const build_index = std.mem.indexOfScalar(u8, extra, '+'); ver.pre = extra[1..(build_index orelse extra.len)]; if (build_index) |idx| ver.build = extra[(idx + 1)..]; } else { ver.build = extra[1..]; } // Check validity of optional pre-release identifiers. // See: https://semver.org/#spec-item-9 if (ver.pre) |pre| { it = std.mem.split(pre, "."); while (it.next()) |id| { // Identifiers MUST NOT be empty. if (id.len == 0) return error.InvalidVersion; // Identifiers MUST comprise only ASCII alphanumerics and hyphens [0-9A-Za-z-]. for (id) |c| if (!std.ascii.isAlNum(c) and c != '-') return error.InvalidVersion; // Numeric identifiers MUST NOT include leading zeroes. const is_num = for (id) |c| { if (!std.ascii.isDigit(c)) break false; } else true; if (is_num) _ = try parseNum(id); } } // Check validity of optional build metadata identifiers. // See: https://semver.org/#spec-item-10 if (ver.build) |build| { it = std.mem.split(build, "."); while (it.next()) |id| { // Identifiers MUST NOT be empty. if (id.len == 0) return error.InvalidVersion; // Identifiers MUST comprise only ASCII alphanumerics and hyphens [0-9A-Za-z-]. for (id) |c| if (!std.ascii.isAlNum(c) and c != '-') return error.InvalidVersion; } } return ver; } fn parseNum(text: []const u8) !usize { // Leading zeroes are not allowed. if (text.len > 1 and text[0] == '0') return error.InvalidVersion; return std.fmt.parseUnsigned(usize, text, 10) catch |err| switch (err) { error.InvalidCharacter => return error.InvalidVersion, else => |e| return e, }; } pub fn format( self: Version, comptime fmt: []const u8, options: std.fmt.FormatOptions, out_stream: anytype, ) !void { if (fmt.len != 0) @compileError("Unknown format string: '" ++ fmt ++ "'"); try std.fmt.format(out_stream, "{d}.{d}.{d}", .{ self.major, self.minor, self.patch }); if (self.pre) |pre| try std.fmt.format(out_stream, "-{s}", .{pre}); if (self.build) |build| try std.fmt.format(out_stream, "+{s}", .{build}); } const expect = std.testing.expect; const expectError = std.testing.expectError; test "SemanticVersion format" { // Test vectors are from https://github.com/semver/semver.org/issues/59#issuecomment-390854010. // Valid version strings should be accepted. for ([_][]const u8{ "0.0.4", "1.2.3", "10.20.30", "1.1.2-prerelease+meta", "1.1.2+meta", "1.1.2+meta-valid", "1.0.0-alpha", "1.0.0-beta", "1.0.0-alpha.beta", "1.0.0-alpha.beta.1", "1.0.0-alpha.1", "1.0.0-alpha0.valid", "1.0.0-alpha.0valid", "1.0.0-alpha-a.b-c-somethinglong+build.1-aef.1-its-okay", "1.0.0-rc.1+build.1", "2.0.0-rc.1+build.123", "1.2.3-beta", "10.2.3-DEV-SNAPSHOT", "1.2.3-SNAPSHOT-123", "1.0.0", "2.0.0", "1.1.7", "2.0.0+build.1848", "2.0.1-alpha.1227", "1.0.0-alpha+beta", "1.2.3----RC-SNAPSHOT.12.9.1--.12+788", "1.2.3----R-S.12.9.1--.12+meta", "1.2.3----RC-SNAPSHOT.12.9.1--.12", "1.0.0+0.build.1-rc.10000aaa-kk-0.1", }) |valid| try std.testing.expectFmt(valid, "{}", .{try parse(valid)}); // Invalid version strings should be rejected. for ([_][]const u8{ "", "1", "1.2", "1.2.3-0123", "1.2.3-0123.0123", "1.1.2+.123", "+invalid", "-invalid", "-invalid+invalid", "-invalid.01", "alpha", "alpha.beta", "alpha.beta.1", "alpha.1", "alpha+beta", "alpha_beta", "alpha.", "alpha..", "beta\\", "1.0.0-alpha_beta", "-alpha.", "1.0.0-alpha..", "1.0.0-alpha..1", "1.0.0-alpha...1", "1.0.0-alpha....1", "1.0.0-alpha.....1", "1.0.0-alpha......1", "1.0.0-alpha.......1", "01.1.1", "1.01.1", "1.1.01", "1.2", "1.2.3.DEV", "1.2-SNAPSHOT", "1.2.31.2.3----RC-SNAPSHOT.12.09.1--..12+788", "1.2-RC-SNAPSHOT", "-1.0.3-gamma+b7718", "+justmeta", "9.8.7+meta+meta", "9.8.7-whatever+meta+meta", }) |invalid| expectError(error.InvalidVersion, parse(invalid)); // Valid version string that may overflow. const big_valid = "99999999999999999999999.999999999999999999.99999999999999999"; if (parse(big_valid)) |ver| { try std.testing.expectFmt(big_valid, "{}", .{ver}); } else |err| expect(err == error.Overflow); // Invalid version string that may overflow. const big_invalid = "99999999999999999999999.999999999999999999.99999999999999999----RC-SNAPSHOT.12.09.1--------------------------------..12"; if (parse(big_invalid)) |ver| std.debug.panic("expected error, found {}", .{ver}) else |err| {} } test "SemanticVersion precedence" { // SemVer 2 spec 11.2 example: 1.0.0 < 2.0.0 < 2.1.0 < 2.1.1. expect(order(try parse("1.0.0"), try parse("2.0.0")) == .lt); expect(order(try parse("2.0.0"), try parse("2.1.0")) == .lt); expect(order(try parse("2.1.0"), try parse("2.1.1")) == .lt); // SemVer 2 spec 11.3 example: 1.0.0-alpha < 1.0.0. expect(order(try parse("1.0.0-alpha"), try parse("1.0.0")) == .lt); // SemVer 2 spec 11.4 example: 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < // 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0. expect(order(try parse("1.0.0-alpha"), try parse("1.0.0-alpha.1")) == .lt); expect(order(try parse("1.0.0-alpha.1"), try parse("1.0.0-alpha.beta")) == .lt); expect(order(try parse("1.0.0-alpha.beta"), try parse("1.0.0-beta")) == .lt); expect(order(try parse("1.0.0-beta"), try parse("1.0.0-beta.2")) == .lt); expect(order(try parse("1.0.0-beta.2"), try parse("1.0.0-beta.11")) == .lt); expect(order(try parse("1.0.0-beta.11"), try parse("1.0.0-rc.1")) == .lt); expect(order(try parse("1.0.0-rc.1"), try parse("1.0.0")) == .lt); } test "zig_version" { // An approximate Zig build that predates this test. const older_version = .{ .major = 0, .minor = 8, .patch = 0, .pre = "dev.874" }; // Simulated compatibility check using Zig version. const compatible = comptime @import("builtin").zig_version.order(older_version) == .gt; if (!compatible) @compileError("zig_version test failed"); }
lib/std/SemanticVersion.zig
const std = @import("std"); const daemon = @import("daemon.zig"); const util = @import("util.zig"); const read = util.read; /// Op code table for incoming messages to a service logger thread pub const LoggerOpCode = enum(u8) { Stop = 1, }; const FdList = std.ArrayList(std.os.fd_t); // When a client adds its file descriptor to the service logger via the // AddClient command, the ServiceLogger will reply with op codes and some basic // framing for log lines. // op codes: // 1 - an error happened // 2 - message from stdout // 3 - message from stderr // on op codes 1, 2, 3, the next u16 represents the length of the message, // followed by that many u8's, representing the message itself. pub const ServiceLogger = struct { pub const Context = struct { state: *daemon.DaemonState, service: *daemon.Service, /// Standard file descriptors of the child process. stdout: std.os.fd_t, stderr: std.os.fd_t, /// File descriptor used to read the sent commands /// to the service logger. message_fd: std.os.fd_t, }; /// Politely request for the service logger thread to stop. /// This function should be called before stopping the service itself. pub fn stopLogger(logger_fd: std.os.fd_t) !void { var file = std.fs.File{ .handle = logger_fd }; var serializer = daemon.MsgSerializer.init(file.writer()); try serializer.serialize(@as(u8, 1)); } /// Add a given file descriptor as an output fd to write stderr/stdout /// of the child process to. pub fn addOutputFd(logger_fd: std.os.fd_t, output_fd: std.os.fd_t) !void { var file = std.fs.File{ .handle = logger_fd }; var serializer = daemon.MsgSerializer.init(file.writer()); try serializer.serialize(@as(u8, 2)); try serializer.serialize(output_fd); } /// Remove the file descriptor from the output fd list. /// MUST be called as deinitialization. pub fn removeOutputFd(logger_fd: std.os.fd_t, output_fd: std.os.fd_t) !void { var file = std.fs.File{ .handle = logger_fd }; var serializer = daemon.MsgSerializer.init(file.writer()); try serializer.serialize(@as(u8, 3)); try serializer.serialize(output_fd); } pub const Std = enum { Out, Err }; pub fn handleProcessStream(ctx: Context, typ: Std, fd: std.os.fd_t, file: std.fs.File) !void { // poll() is level-triggered, that means we can just read 512 bytes // then hand off to the next poll() call, which will still signal // the socket as available. var buf: [512]u8 = undefined; const bytes = try read(fd, &buf); const msg = buf[0..bytes]; // formatting of the logfile is done by the app, and not us // also always write to the logfile first, THEN check // the client fds to write to _ = try file.write(msg); for (ctx.service.logger_client_fds.items) |client_fd, idx| { var client_file = std.fs.File{ .handle = client_fd }; var serializer = daemon.MsgSerializer.init(client_file.writer()); // TODO: remove client from client_fds array on error serializer.serialize(@as(u8, if (typ == .Out) 2 else 3)) catch |err| { std.debug.warn("got error on writing to client fd {}: {}", .{ client_fd, err }); continue; }; serializer.serialize(@intCast(u16, msg.len)) catch |err| { std.debug.warn("got error on writing to client fd {}: {}", .{ client_fd, err }); continue; }; for (msg) |byte| { serializer.serialize(byte) catch |err| { std.debug.warn("got error on writing to client fd {}: {}", .{ client_fd, err }); continue; }; } } } fn sendError(ctx: Context, serializer: anytype, error_message: []const u8) void { serializer.serialize(@as(u8, 1)) catch return; serializer.serialize(@intCast(u16, error_message.len)) catch return; for (error_message) |byte| { serializer.serialize(byte) catch return; } } pub fn handleSignalMessage(ctx: Context) !void { var file = std.fs.File{ .handle = ctx.message_fd }; var stream = file.inStream(); var deserializer = daemon.MsgDeserializer.init(stream); const opcode = try deserializer.deserialize(u8); switch (@intToEnum(LoggerOpCode, opcode)) { .Stop => { ctx.state.logger.info("service logger for {} got stop signal", .{ctx.service.name}); return error.ShouldStop; }, } } fn openLogFile(logfile_path: []const u8) !std.fs.File { var logfile = try std.fs.cwd().createFile( logfile_path, .{ .read = false, .truncate = false, }, ); try logfile.seekFromEnd(0); return logfile; } pub fn handler(ctx: Context) !void { var sockets = [_]std.os.pollfd{ .{ .fd = ctx.stdout, .events = std.os.POLLIN, .revents = 0 }, .{ .fd = ctx.stderr, .events = std.os.POLLIN, .revents = 0 }, .{ .fd = ctx.message_fd, .events = std.os.POLLIN, .revents = 0 }, }; var buf: [1024]u8 = undefined; var fba = std.heap.FixedBufferAllocator.init(&buf); var allocator = &fba.allocator; // TODO: better folder..? maybe we cant use getAppDataDir const data_dir = try std.fs.getAppDataDir(allocator, "tsusu"); std.fs.cwd().makeDir(data_dir) catch |err| { if (err != std.os.MakeDirError.PathAlreadyExists) return err; }; const log_folder = try std.fmt.allocPrint(allocator, "{}/logs", .{data_dir}); std.fs.cwd().makeDir(log_folder) catch |err| { if (err != std.os.MakeDirError.PathAlreadyExists) return err; }; const stdout_logfile_path = try std.fmt.allocPrint( allocator, "{}/{}-out.log", .{ log_folder, ctx.service.name }, ); const stderr_logfile_path = try std.fmt.allocPrint( allocator, "{}/{}-err.log", .{ log_folder, ctx.service.name }, ); // open logfiles for stdout and stder var stdout_logfile = try @This().openLogFile(stdout_logfile_path); defer stdout_logfile.close(); var stderr_logfile = try @This().openLogFile(stderr_logfile_path); defer stderr_logfile.close(); ctx.state.logger.info( "Opened stdout/stderr log files for {}, {}, {}", .{ ctx.service.name, stdout_logfile_path, stderr_logfile_path }, ); while (true) { const available = try std.os.poll(&sockets, -1); if (available == 0) { ctx.state.logger.info("timed out, retrying", .{}); continue; } for (sockets) |pollfd, idx| { if (pollfd.revents == 0) continue; if (pollfd.fd == ctx.stdout) { @This().handleProcessStream(ctx, .Out, pollfd.fd, stdout_logfile) catch |err| switch (err) { // The OS gives EBADF when the process got killed and we're // trying to read from its stdout/stderr fds. catch it and // also stop oureslves. supervisor's job is to restart this type of thread // later on. error.NotOpenForReading => { ctx.state.logger.info("service {} is likely dead", .{ctx.service.name}); return; }, else => return err, }; } else if (pollfd.fd == ctx.stderr) { try @This().handleProcessStream(ctx, .Err, pollfd.fd, stderr_logfile); } else if (pollfd.fd == ctx.message_fd) { @This().handleSignalMessage(ctx) catch |err| { if (err == error.ShouldStop) return else return err; }; } } } } };
src/service_logger.zig
const std = @import("std"); pub const json = @import("serializer_json.zig"); pub const Configuration = struct { const HashSet = std.StringHashMap(void); allocator: *std.mem.Allocator, ignoredFields: std.StringHashMap(HashSet), pub fn init(allocator: *std.mem.Allocator) Configuration { return .{ .allocator = allocator, .ignoredFields = std.StringHashMap(HashSet).init(allocator), }; } pub fn ignore(self: *Configuration, comptime T: type, field: []const u8) void { var entry = self.ignoredFields.getOrPut(@typeName(T)) catch |err| { std.debug.panic("Failed to ignore field '{s}' from type '{s}' due to:\n{s}", .{ field, @typeName(T), @errorName(err) }); }; if (!entry.found_existing) { entry.key_ptr.* = @typeName(T); entry.value_ptr.* = HashSet.init(self.allocator); } entry.value_ptr.put(field, {}) catch |err| { std.debug.panic("Failed to ignore field '{s}' from type '{s}' due to:\n{s}", .{ field, @typeName(T), @errorName(err) }); }; } pub fn ignores(self: *Configuration, comptime T: type, field: []const u8) bool { if (self.ignoredFields.contains(@typeName(T))) { return self.ignoredFields.get(@typeName(T)).?.contains(field); } return false; } }; pub const Lexicon = struct { convert: fn (*std.mem.Allocator, *Tree) []const u8, parse: fn (*std.mem.Allocator, []const u8) *Tree, }; pub const TreeAllocator = union(enum) { raw: *std.mem.Allocator, arena: std.heap.ArenaAllocator, pub fn internal(self: *TreeAllocator) *std.mem.Allocator { switch (self.*) { .raw => { return self.raw; }, .arena => { return &self.arena.allocator; }, } } pub fn create(self: *TreeAllocator, comptime T: type) *T { switch (self.*) { .raw => { return self.raw.create(T) catch unreachable; }, .arena => { return self.arena.allocator.create(T) catch unreachable; }, } } pub fn alloc(self: *TreeAllocator, comptime T: type, N: usize) *T { switch (self.*) { .raw => { return self.raw.alloc(T, N) catch unreachable; }, .arena => { return self.arena.allocator.alloc(T, N) catch unreachable; }, } } pub fn free(self: *TreeAllocator, value: anytype) void { switch (self.*) { .raw => { self.raw.free(value); }, .arena => { self.arena.allocator.free(value); }, } } pub fn destroy(self: *TreeAllocator, value: anytype) void { switch (self.*) { .raw => { self.raw.destroy(value); }, .arena => { self.arena.allocator.destroy(value); }, } } }; pub const Tree = struct { config: ?*Configuration = null, alloc: TreeAllocator = undefined, root: *Node = undefined, pub fn initRaw(allocator: *std.mem.Allocator) *Tree { var self: *Tree = allocator.create(Tree) catch unreachable; self.config = null; self.alloc = .{ .raw = allocator }; self.root = undefined; return self; } pub fn initArena(allocator: *std.mem.Allocator) *Tree { var arena = std.heap.ArenaAllocator.init(allocator); var self: *Tree = arena.allocator.create(Tree) catch unreachable; self.config = null; self.alloc = .{ .arena = arena }; self.root = undefined; return self; } pub fn deinit(self: *Tree) void { switch (self.alloc) { .raw => { self.root.deinit(); self.alloc.destroy(self); }, .arena => { self.alloc.arena.deinit(); }, } } pub fn newObject(tree: *Tree) *Node { var alloc = tree.alloc.internal(); var self = alloc.create(Node) catch unreachable; self.tree = tree; self.data = .{ .Map = std.StringHashMap(*Node).init(tree.alloc.internal()) }; return self; } pub fn newArray(tree: *Tree) *Node { var alloc = tree.alloc.internal(); var self = alloc.create(Node) catch unreachable; self.tree = tree; self.data = .{ .Array = std.ArrayList(*Node).init(tree.alloc.internal()) }; return self; } /// It is assumed that tree.alloc owns the provided string. If not, dupeZ it with /// `tree.alloc.internal().dupeZ(yourstring)` pub fn newString(tree: *Tree, string: []const u8) *Node { var alloc = tree.alloc.internal(); var self = alloc.create(Node) catch unreachable; self.tree = tree; self.data = .{ .Literal = .{ .String = string } }; return self; } pub fn newInt(tree: *Tree, int: i32) *Node { var alloc = tree.alloc.internal(); var self = alloc.create(Node) catch unreachable; self.tree = tree; self.data = .{ .Literal = .{ .Integer = int } }; return self; } pub fn newNull(tree: *Tree) *Node { var alloc = tree.alloc.internal(); var self = alloc.create(Node) catch unreachable; self.tree = tree; self.data = .{ .Literal = .Null }; return self; } pub fn newFloat(tree: *Tree, float: f32) *Node { var alloc = tree.alloc.internal(); var self = alloc.create(Node) catch unreachable; self.tree = tree; self.data = .{ .Literal = .{ .Float = float } }; return self; } pub fn newBool(tree: *Tree, Boolean: bool) *Node { var alloc = tree.alloc.internal(); var self = alloc.create(Node) catch unreachable; self.tree = tree; self.data = .{ .Literal = .{ .Bool = Boolean } }; return self; } pub fn print(self: *Tree, lexicon: Lexicon) void { var bytes = lexicon.convert(std.heap.page_allocator, self); defer std.heap.page_allocator.free(bytes); std.debug.print("{s}\n", .{bytes}); } pub fn toNode(tree: *Tree, value: anytype) *Node { const typeInfo = @typeInfo(@TypeOf(value)); var allocator = tree.alloc.internal(); // few early outs if (@TypeOf(value) == *Node) { return value; } if (isArrayList(@TypeOf(value))) |_| { return tree.toNode(value.items); } if (isStringHashmap(@TypeOf(value))) |hashVal| { var mapObj = tree.newObject(); var cast: std.StringHashMap(hashVal) = value; var iter = cast.iterator(); while (iter.next()) |pair| { mapObj.push(pair.key_ptr.*, pair.value_ptr.*); } return mapObj; } switch (typeInfo) { .Opaque => { return tree.newNull(); }, .Null => { return tree.newNull(); }, .Int => { return tree.newInt(@intCast(i32, value)); }, .Float => { return tree.newFloat(@floatCast(f32, value)); }, .Bool => { return tree.newBool(value); }, .ComptimeInt => { return tree.newInt(@intCast(i32, value)); }, .ComptimeFloat => { return tree.newFloat(@floatCast(f32, value)); }, .Enum => { return tree.newInt(@intCast(i32, @enumToInt(value))); }, .Array => { if (typeInfo.Array.child == u8) { return tree.toNode(std.mem.spanZ(&value)); } else { const Slice = []const typeInfo.Array.child; return tree.toNode(@as(Slice, &value)); } }, .Optional => { if (value == null) { var nullValue = tree.newNull(); return nullValue; } else { return tree.toNode(value.?); } }, .Struct => { var obj = tree.newObject(); inline for (typeInfo.Struct.fields) |field| { if (tree.config) |cfg| { if (!cfg.ignores(@TypeOf(value), field.name)) { obj.data.Map.put(field.name, tree.toNode(@field(value, field.name))) catch unreachable; } } else { obj.data.Map.put(field.name, tree.toNode(@field(value, field.name))) catch unreachable; } } return obj; }, .Pointer => { switch (typeInfo.Pointer.size) { .One => { return toNode(tree, value.*); }, .Slice => { if (typeInfo.Pointer.child == u8) { var ownedString = std.mem.dupeZ(allocator, u8, value) catch unreachable; var stringNode = tree.newString(ownedString); return stringNode; } else { var arr = tree.newArray(); for (value) |item| { arr.push(null, item); } return arr; } }, else => { return tree.newNull(); }, } }, .Union => { var obj = tree.newObject(); obj.push("tag", tree.newString(@tagName(value))); const tagType = typeInfo.Union.tag_type.?; inline for (typeInfo.Union.fields) |unionField| { if (value == @field(tagType, unionField.name)) { obj.push("value", tree.toNode(@field(value, unionField.name))); } } return obj; }, else => { std.debug.panic("Failed to serialize {s}", .{@typeName(@TypeOf(value))}); }, } } }; pub const NodeLiteral = union(enum) { String: []const u8, Bool: bool, Integer: i32, Float: f32, Null }; pub const NodeValue = union(enum) { Literal: NodeLiteral, Map: std.StringHashMap(*Node), Array: std.ArrayList(*Node), }; pub const Node = struct { tree: *Tree, data: NodeValue = undefined, /// Also deinits child nodes. pub fn deinit(self: *Node) void { switch (self.data) { .Map => { var iter = self.data.Map.valueIterator(); while (iter.next()) |innerNode| { innerNode.*.deinit(); } self.data.Map.deinit(); }, .Array => { for (self.data.Array.items) |innerNode| { innerNode.deinit(); } self.data.Array.deinit(); }, else => { if (self.data == .Literal and self.data.Literal == .String) { self.tree.alloc.internal().free(self.data.Literal.String); } }, } if (self.tree.alloc == .raw) { var alloc = self.tree.alloc.internal(); alloc.destroy(self); } } /// You should know what the node is before using this convenience method. /// Passing in a category means you know it is a map. Pass in null to push as /// if this was an array. pub fn push(self: *Node, category: ?[]const u8, value: anytype) void { var result: *Node = self.tree.toNode(value); if (category) |categoryName| { std.debug.assert(self.data == .Map); self.data.Map.put(categoryName, result) catch { std.debug.panic("Failed to push into map", .{}); }; return; } else { std.debug.assert(self.data == .Array); self.data.Array.append(result) catch { std.debug.panic("Failed to push into array", .{}); }; return; } unreachable; } /// Pushes a node into a type, if possible. If owner is not null, initialized arraylists /// and hashmaps will belong to the owner instead of the internal tree allocator. pub fn into(self: *Node, ptr: anytype, owner: ?*std.mem.Allocator) void { var alloc: *std.mem.Allocator = if (owner != null) owner.? else self.tree.alloc.internal(); const T = @TypeOf(ptr.*); const typeInfo = @typeInfo(T); // Early string out if (T == []const u8) { std.debug.assert(self.data == .Literal and self.data.Literal == .String); if (owner) |ownedAllocator| { ptr.* = ownedAllocator.dupeZ(u8, self.data.Literal.String) catch unreachable; } else { ptr.* = self.data.Literal.String; } return; } if (isArrayList(T)) |listType| { ptr.* = std.ArrayList(listType).init(alloc); for (self.data.Array.items) |item| { var castItem: listType = .{}; item.into(&castItem, owner); ptr.append(castItem) catch unreachable; } return; } if (isStringHashmap(T)) |hashVal| { ptr.* = std.StringHashMap(hashVal).init(alloc); var iterator = self.data.Map.iterator(); while (iterator.next()) |entry| { var castItem: hashVal = .{}; entry.value_ptr.*.into(&castItem, owner); ptr.put(entry.key_ptr.*, castItem) catch unreachable; } return; } switch (typeInfo) { .Opaque => { // Dont error, just ignore it I guess. Makes for nicer code. }, .Bool => { std.debug.assert(self.data == .Literal and self.data.Literal == .Bool); ptr.* = self.data.Literal.Bool; }, .Int => { std.debug.assert(self.data == .Literal and self.data.Literal == .Integer); ptr.* = @intCast(std.meta.Int(typeInfo.Int.signedness, @intCast(u16, typeInfo.Int.bits)), self.data.Literal.Integer); }, .Float => { std.debug.assert(self.data == .Literal and self.data.Literal == .Float); ptr.* = self.data.Literal.Float; }, .Optional => { if (@typeInfo(typeInfo.Optional.child) == .Opaque) { ptr.* = null; return; } if (self.data == .Literal and self.data.Literal == .Null) { ptr.* = null; } else { var real: typeInfo.Optional.child = undefined; self.into(&real, owner); ptr.* = real; } }, .Enum => { std.debug.assert(self.data == .Literal and self.data.Literal == .Integer); ptr.* = @intToEnum(T, self.data.Literal.Integer); }, .Struct => { std.debug.assert(self.data == .Map); inline for (typeInfo.Struct.fields) |field| { var fieldNode = self.data.Map.get(field.name); if (fieldNode) |node| { node.into(&@field(ptr.*, field.name), owner); } } }, .Array => { if (typeInfo.Array.child == u8) { ptr.* = std.mem.zeroes(@TypeOf(ptr.*)); for (self.data.Literal.String) |char, i| { ptr.*[i] = char; } } else { std.debug.assert(self.data == .Array); for (self.data.Array.items) |item, i| { ptr.*[i] = .{}; item.into(&ptr.*[i], owner); } } }, .Pointer => { switch (typeInfo.Pointer.size) { .Slice => { var slice = alloc.alloc(typeInfo.Pointer.child, self.data.Array.items.len) catch unreachable; for (slice) |*item, i| { item.* = .{}; self.data.Array.items[i].into(item, owner); } ptr.* = slice; }, else => { std.debug.panic("Failed to deserialize\n", .{}); }, } }, .Union => { std.debug.assert(self.data == .Map); var tagName = self.data.Map.get("tag").?.data.Literal.String; inline for (typeInfo.Union.fields) |field| { if (std.mem.eql(u8, field.name, tagName)) { var nodeData = self.data.Map.get("value").?; var temporary: field.field_type = undefined; nodeData.into(&temporary, owner); ptr.* = @unionInit(T, field.name, temporary); return; } } }, else => { std.debug.panic("Failed to deserialize type {s}\n", .{@typeName(T)}); }, } } }; fn isArrayList(comptime T: type) ?type { const ti = @typeInfo(T); if (ti != .Struct) { return null; } if (comptime @hasDecl(T, "Slice") and std.meta.trait.isSlice(T.Slice) and T == std.ArrayList(std.meta.Elem(T.Slice))) { return std.meta.Elem(T.Slice); } else { return null; } } fn isStringHashmap(comptime T: type) ?type { const ti = @typeInfo(T); if (ti != .Struct) { return null; } if (comptime @hasDecl(T, "Unmanaged") and @hasDecl(T.Unmanaged, "KV")) { if (std.meta.fieldInfo(T.Unmanaged.KV, .key).field_type == []const u8) { const valueType = std.meta.fieldInfo(T.Unmanaged.KV, .value).field_type; if (T == std.StringHashMap(valueType)) { return valueType; } } } return null; } // Basically this is the expected way to manually create objects. It can export // to several formats soon! But for now just json test "Basic Raw Serialization" { var tree = Tree.initRaw(std.testing.allocator); defer tree.deinit(); tree.root = tree.newObject(); var player = tree.newObject(); player.push("health", 10); player.push("mana", 20); var abilityTree = tree.newArray(); { // Melee var ability = tree.newObject(); ability.push("name", "Melee Attack"); ability.push("calculation", "1d4+3"); ability.push("cost", "2mana"); abilityTree.push(null, ability); } { // Charge var ability = tree.newObject(); ability.push("name", "Charge Attack"); ability.push("calculation", "1d2+1"); ability.push("cost", "2health"); ability.push("targets", "enemies"); abilityTree.push(null, ability); } player.push("abilities", abilityTree); tree.root.push("player", player); } test "Basic Arena Serialization" { var tree = Tree.initArena(std.testing.allocator); defer tree.deinit(); tree.root = tree.newObject(); var player = tree.newObject(); player.push("health", 10); player.push("mana", 20); var abilityTree = tree.newArray(); { // Melee var ability = tree.newObject(); ability.push("name", "Melee Attack"); ability.push("calculation", "1d4+3"); ability.push("cost", "2mana"); abilityTree.push(null, ability); } { // Charge var ability = tree.newObject(); ability.push("name", "Charge Attack"); ability.push("calculation", "1d2+1"); ability.push("cost", "2health"); ability.push("targets", "enemies"); abilityTree.push(null, ability); } player.push("abilities", abilityTree); tree.root.push("player", player); } test "Basic Struct Serialization" { // const bad = opaque{}; const Dummy = struct { health: i32 = 30, mana: i32 = 50, ignored: ?bool = null, // never:*bad = undefined, }; var tree = Tree.initArena(std.testing.allocator); defer tree.deinit(); tree.root = tree.toNode(Dummy{}); try std.testing.expect(tree.root.data == .Map); try std.testing.expect(tree.root.data.Map.contains("health")); try std.testing.expect(tree.root.data.Map.contains("mana")); try std.testing.expect(tree.root.data.Map.contains("ignored")); } test "Basic Raw Deserialization" { var tree = Tree.initRaw(std.testing.allocator); defer tree.deinit(); tree.root = tree.newObject(); var player = tree.newObject(); player.push("health", 10); player.push("mana", 20); tree.root.push("player", player); const into = struct { health: i32, mana: i32, }; // Struct: var playerDeserialized = into{ .health = undefined, .mana = undefined }; player.into(&playerDeserialized, null); try std.testing.expectEqual(into{ .health = 10, .mana = 20 }, playerDeserialized); // Basic types: var health: i32 = 0; player.data.Map.get("health").?.into(&health, null); try std.testing.expectEqual(@intCast(i32, 10), health); } test "Standard library structs to basic structs" { var tree = Tree.initRaw(std.testing.allocator); defer tree.deinit(); tree.root = tree.newObject(); var healthMeters = std.ArrayList(i32).init(std.testing.allocator); defer healthMeters.deinit(); var associations = std.StringHashMap(i32).init(std.testing.allocator); defer associations.deinit(); try associations.put("enemy", 10); try associations.put("friendly", 20); try healthMeters.append(30); try healthMeters.append(60); try healthMeters.append(90); var player = tree.newObject(); player.push("health", 10); player.push("mana", 20); player.push("targets", healthMeters); player.push("associations", associations); tree.root.push("player", player); }
src/serializer.zig
const std = @import("std"); const math = std.math; const Allocator = std.mem.Allocator; const mem = std.mem; const print = std.debug.print; const FLIR = @import("./FLIR.zig"); const ArrayList = std.ArrayList; const uv = FLIR.uv; const DomState = @This(); sdom: u16 = undefined, ancestor: ?u16 = null, parent: u16 = undefined, bucket: u16 = 0, bucklink: u16 = 0, label: u16 = undefined, pub fn dominators(self: *FLIR) !void { const n = self.n.items; const s = try self.a.alloc(DomState, n.len); defer self.a.free(s); mem.set(DomState, s, .{}); for (self.dfs.items) |v| { s[v].sdom = v; s[v].label = v; } var i = self.dfs.items.len - 1; while (i >= 1) : (i -= 1) { var w = self.dfs.items[i]; for (self.preds(w)) |v| { var u = eval(self, s, v); if (n[s[u].sdom].dfnum < n[s[w].sdom].dfnum) { s[w].sdom = s[u].sdom; } } var wp = s[w].parent; if (s[w].sdom != s[w].parent) { if (s[w].bucklink != 0) return error.AAAAAA; s[w].bucklink = s[s[w].sdom].bucket; s[s[w].sdom].bucket = w; } else { n[w].idom = wp; } s[w].ancestor = s[w].parent; while (s[wp].bucket != 0) { var v = s[wp].bucket; s[wp].bucket = s[v].bucklink; s[v].bucklink = 0; var u = eval(self, s, v); if (n[s[u].sdom].dfnum < n[s[v].sdom].dfnum) { n[v].idom = u; } else { n[v].idom = wp; } } } i = 1; while (i < self.dfs.items.len) : (i += 1) { var w = self.dfs.items[i]; if (n[w].idom != s[w].sdom) { n[w].idom = n[n[w].idom].idom; } } } fn eval_slow(self: *FLIR, s: []DomState, v0: u16) u16 { const n = self.n.items; var v = v0; var u = v; while (s[v].ancestor) |a| { if (n[s[v].sdom].dfnum < n[s[u].sdom].dfnum) { u = v; } v = a; } return u; } fn eval(self: *FLIR, s: []DomState, v: u16) u16 { const n = self.n.items; if (s[v].ancestor) |a| { _ = eval(self, s, a); if (s[a].ancestor) |aa| { if (n[s[s[a].label].sdom].dfnum < n[s[s[v].label].sdom].dfnum) { s[v].label = s[a].label; s[v].ancestor = aa; } } } return s[v].label; } const test_allocator = std.testing.allocator; const expectEqual = std.testing.expectEqual; test "aa" { // TODO if (true) return; var self = try FLIR.init(8, test_allocator); defer self.deinit(); self.p(1, 0); self.p(2, 3); self.p(3, 6); self.p(4, 0); self.p(5, 0); self.p(0, 0); self.p(7, 0); self.p(5, 0); try self.calc_preds(); if (false) { print("preds:\n", .{}); for (self.n.items) |_, i| { print("{} :", .{i}); for (self.preds(uv(i))) |pred| { print(" {}", .{pred}); } print("\n", .{}); } } try dominators(&self); var idoms: [8]u16 = .{ 0, 0, 1, 1, 3, 1, 2, 6, }; print("doms:\n", .{}); for (self.n.items) |v, i| { expectEqual(idoms[i], v.idom) catch { print("index {}\n", .{i}); return error.IDomFail; }; } }
src/MiniDOM.zig
// Besides, it is not difficult to see that ours is a birth-time // and a period of transition to a new era. Spirit has broken with // the world it has hitherto inhabited and imagined, and is of a // mind to submerge it in the past, and in the labour of its own // transformation. const std = @import("std"); const ArrayList = @import("std").ArrayList; const I_Instruction = @import("instruction.zig").I_Instruction; const C_Instruction = @import("instruction.zig").C_Instruction; const R_Instruction = @import("instruction.zig").R_Instruction; const build_I_Instruction = @import("util.zig").build_I_Instruction; const build_C_Instruction = @import("util.zig").build_C_Instruction; const build_R_Instruction = @import("util.zig").build_R_Instruction; const Register = @import("register.zig").Register; const PageManager = @import("page_manager.zig"); pub const VMEvent = enum { Start, Halt, OpExec, Error, }; pub const VMError = error{ Illegal, OutOfMemory, Todo, }; pub const VM = struct { registers: [32]u64 = [_]u64{0} ** 32, //float_registers: [32]f64 = [_]f64{0} ** 32, program: []const u32, exit_code: u64 = 0, advance: bool = true, pc: u64 = 0, events: std.ArrayList(VMEvent) = undefined, event_allocator: std.mem.Allocator = undefined, page_manager: PageManager = undefined, pub fn init(self: *VM, event_allocator: std.mem.Allocator, page_allocator: std.mem.Allocator) void { self.event_allocator = event_allocator; self.events = std.ArrayList(VMEvent).init(event_allocator); self.page_manager = PageManager.init(page_allocator); } pub fn deinit(self: *VM) void { self.events.deinit(); self.page_manager.deinit(); } /// Send events to the virtual machine pub fn push_event(self: *VM, event: VMEvent) void { self.events.append(event) catch |err| { std.log.err("Virtual machine encountered an event array error {x}", .{err}); }; } /// Run the virtual machine and stop only with IGL,HLT or running out of the program /// WARNING: VM must be deinitialized aftewards pub fn run(self: *VM, event_allocator: std.mem.Allocator, stack_inner_allocator: std.mem.Allocator) !u64 { self.init(event_allocator, stack_inner_allocator); while (self.advance and try self.exec_instruction() and self.pc < self.program.len) {} return self.exit_code; } /// Load the next instruction and increment the program counter fn next_instruction(self: *VM) u32 { const next = self.program[self.pc]; self.pc += 1; return std.mem.nativeToLittle(u32, next); } // Setup some constants for easier masking const FIRST_BIT = 0x1; const SECOND_BIT = 0x2; const R_INS = 0x1FFFC; const R_RD = 0x3E0000; const R_RS1 = 0x7C00000; const R_RS2 = 0xF8000000; const C_INS = 0x7C; const C_RD = 0xF80; const C_i20 = 0xFFFFF000; const I_INS = 0x3FE; const I_RD = 0x7C00; const I_RS1 = 0xF8000; const I_i12 = 0xFFF00000; /// Execute one instruction pub fn exec_instruction(self: *VM) !bool { const instruction = self.next_instruction(); // Switch the instruction type based on the first two bits (as per documentation) if (instruction & FIRST_BIT != 0) { //I-Ins // Mask of the useful bits, shift them to the right and then truncate bits outside the range const opcode = @truncate(u9, (instruction & I_INS) >> 1); const rd = @truncate(u5, (instruction & I_RD) >> 10); const rs1 = @truncate(u5, (instruction & I_RS1) >> 15); // Mask and truncate the bits and then bitcast it to a twos complement signed integer const imm12: i12 = @bitCast(i12, @truncate(u12, (instruction & I_i12) >> 20)); switch (@intToEnum(I_Instruction, opcode)) { // Load a memory chunk into rd from page with id rs1 and offset imm12 I_Instruction.PLB => { self.registers[rd] = self.page_manager.pages.items[self.registers[rs1]][@bitCast(u12, imm12)]; }, I_Instruction.PLH => { // Read int in littleEndian, the architecture is strictly little endian self.registers[rd] = std.mem.readIntLittle(u16, self.page_manager.pages.items[self.registers[rs1]][@bitCast(u12, imm12)..][0..2]); }, I_Instruction.PLW => { self.registers[rd] = std.mem.readIntLittle(u32, self.page_manager.pages.items[self.registers[rs1]][@bitCast(u12, imm12)..][0..4]); }, I_Instruction.PLD => { self.registers[rd] = std.mem.readIntLittle(u64, self.page_manager.pages.items[self.registers[rs1]][@bitCast(u12, imm12)..][0..8]); }, I_Instruction.PSB => { self.page_manager.pages.items[self.registers[rs1]][@bitCast(u12, imm12)] = @truncate(u8, self.registers[rd]); }, I_Instruction.PSH => { std.mem.writeIntLittle(u16, self.page_manager.pages.items[self.registers[rs1]][@bitCast(u12, imm12)..][0..2], @truncate(u16, self.registers[rd])); }, I_Instruction.PSW => { std.mem.writeIntLittle(u32, self.page_manager.pages.items[self.registers[rs1]][@bitCast(u12, imm12)..][0..4], @truncate(u32, self.registers[rd])); }, I_Instruction.PSD => { std.mem.writeIntLittle(u64, self.page_manager.pages.items[self.registers[rs1]][@bitCast(u12, imm12)..][0..8], self.registers[rd]); }, I_Instruction.BEQ => { if (@bitCast(i64, self.registers[rd]) == @bitCast(i64, self.registers[rs1])) { const dest: i64 = imm12 + @intCast(i64, self.pc); self.pc = if (dest > 0) @intCast(u64, dest) else 0; } }, I_Instruction.BNE => { if (@bitCast(i64, self.registers[rd]) != @bitCast(i64, self.registers[rs1])) { const dest: i64 = imm12 + @intCast(i64, self.pc); self.pc = if (dest > 0) @intCast(u64, dest) else 0; } }, I_Instruction.BLT => { if (@bitCast(i64, self.registers[rd]) < @bitCast(i64, self.registers[rs1])) { const dest: i64 = imm12 + @intCast(i64, self.pc); self.pc = if (dest > 0) @intCast(u64, dest) else 0; } }, I_Instruction.BGE => { if (@bitCast(i64, self.registers[rd]) >= @bitCast(i64, self.registers[rs1])) { const dest: i64 = imm12 + @intCast(i64, self.pc); self.pc = if (dest > 0) @intCast(u64, dest) else 0; } }, I_Instruction.BGEU => { if (self.registers[rd] >= self.registers[rs1]) { const dest: i64 = imm12 + @intCast(i64, self.pc); self.pc = if (dest > 0) @intCast(u64, dest) else 0; } }, I_Instruction.BLTU => { if (self.registers[rd] <= self.registers[rs1]) { const dest: i64 = imm12 + @intCast(i64, self.pc); self.pc = if (dest > 0) @intCast(u64, dest) else 0; } }, I_Instruction.JALR => { const dest: i64 = imm12 + @bitCast(i64, self.registers[rs1]); self.registers[rd] = self.pc + 1; self.pc = if (dest > 0) @intCast(u64, dest) else 0; }, I_Instruction.ADDI => { self.registers[rd] = @bitCast(u64, @bitCast(i64, self.registers[rs1]) + @intCast(i64, imm12)); }, I_Instruction.SUBI => { self.registers[rd] = @bitCast(u64, @bitCast(i64, self.registers[rs1]) - @intCast(i64, imm12)); }, I_Instruction.MULI => { self.registers[rd] = @bitCast(u64, @bitCast(i64, self.registers[rs1]) * @intCast(i64, imm12)); }, I_Instruction.DIVI => { self.registers[rd] = @bitCast(u64, @divTrunc(@bitCast(i64, self.registers[rs1]), @intCast(i64, imm12))); }, I_Instruction.REMI => { self.registers[rd] = @bitCast(u64, @rem(@bitCast(i64, self.registers[rs1]), @intCast(i64, imm12))); }, I_Instruction.ANDI => { self.registers[rd] = self.registers[rs1] & @bitCast(u12, imm12); }, I_Instruction.ORI => { self.registers[rd] = self.registers[rs1] | @bitCast(u12, imm12); }, I_Instruction.XORI => { self.registers[rd] = self.registers[rs1] ^ @bitCast(u12, imm12); }, I_Instruction.SHLI => { self.registers[rd] = self.registers[rs1] <<| @intCast(u64, @bitCast(u12, imm12)); }, I_Instruction.SHRI => { self.registers[rd] = self.registers[rs1] >> @truncate(u6, @bitCast(u12, imm12)); }, I_Instruction.EQI => { self.registers[rd] = @boolToInt(self.registers[rs1] == imm12); }, I_Instruction.NEQI => { self.registers[rd] = @boolToInt(self.registers[rs1] != imm12); }, else => { std.log.err("Unrecognized opcode: {any} 0b{b:x>}", .{ @intToEnum(I_Instruction, opcode), opcode }); return VMError.Todo; }, } return true; } else if (instruction & SECOND_BIT != 0) { //C-Ins const opcode = @truncate(u5, (instruction & C_INS) >> 2); const rd = @truncate(u5, (instruction & C_RD) >> 7); const imm20 = @bitCast(i20, @truncate(u20, (instruction & C_i20) >> 12)); switch (@intToEnum(C_Instruction, opcode)) { C_Instruction.JR => { //TODO: check this! const dest: i64 = imm20 + @bitCast(i64, self.registers[rd]); self.pc = if (dest > 0) @intCast(u64, dest) else 0; }, C_Instruction.LUI => { self.registers[rd] = @as(u64, (@bitCast(u20, imm20) << 12)); }, C_Instruction.AUIPC => { self.registers[rd] = @bitCast(u64, @bitCast(i64, @as(u64, (@bitCast(u20, imm20) << 12))) + @intCast(i64, self.pc)); }, C_Instruction.GP => { self.registers[rd] = self.page_manager.new_page(); }, C_Instruction.FP => { self.page_manager.release_page(self.registers[rd]); }, } return true; } else { //R-Ins const opcode = @truncate(u15, (instruction & R_INS) >> 2); const rd = @truncate(u5, (instruction & R_RD) >> 17); const rs1 = @truncate(u5, (instruction & R_RS1) >> 22); const rs2 = @truncate(u5, (instruction & R_RS2) >> 27); switch (@intToEnum(R_Instruction, opcode)) { R_Instruction.IGL => { std.log.err("\nVirtual machine encountered illegal instruction {} at: {x}\n", .{ @intToEnum(R_Instruction, opcode), self.pc }); // self.push_event(VMEvent.Error); return VMError.Illegal; }, R_Instruction.HLT => { self.exit_code = self.registers[rs2]; self.push_event(VMEvent.Halt); return false; }, R_Instruction.ADD => { self.registers[rd] = @bitCast(u64, @bitCast(i64, self.registers[rs1]) + @bitCast(i64, self.registers[rs2])); }, R_Instruction.SUB => { self.registers[rd] = @bitCast(u64, @bitCast(i64, self.registers[rs1]) - @bitCast(i64, self.registers[rs2])); }, R_Instruction.MUL => { self.registers[rd] = @bitCast(u64, @bitCast(i64, self.registers[rs1]) * @bitCast(i64, self.registers[rs2])); }, R_Instruction.DIV => { self.registers[rd] = @bitCast(u64, @divTrunc(@bitCast(i64, self.registers[rs1]), @bitCast(i64, self.registers[rs2]))); }, R_Instruction.REM => { self.registers[rd] = @bitCast(u64, @rem(@bitCast(i64, self.registers[rs1]), @bitCast(i64, self.registers[rs2]))); }, R_Instruction.AND => { self.registers[rd] = self.registers[rs1] & self.registers[rs2]; }, R_Instruction.OR => { self.registers[rd] = self.registers[rs1] | self.registers[rs2]; }, R_Instruction.XOR => { self.registers[rd] = self.registers[rs1] ^ self.registers[rs2]; }, R_Instruction.SHL => { self.registers[rd] = self.registers[rs1] >> @truncate(u6, self.registers[rs2]); }, R_Instruction.SHR => { self.registers[rd] = self.registers[rs1] << @truncate(u6, self.registers[rs2]); }, R_Instruction.EQ => { self.registers[rd] = @boolToInt(self.registers[rs1] == self.registers[rs2]); }, R_Instruction.NEQ => { self.registers[rd] = @boolToInt(self.registers[rs1] != self.registers[rs2]); }, R_Instruction.GE => { self.registers[rd] = @boolToInt(self.registers[rs1] >= self.registers[rs2]); }, R_Instruction.LT => { self.registers[rd] = @boolToInt(self.registers[rs1] < self.registers[rs2]); }, else => { std.log.err("Unrecognized opcode: {any} 0b{b:x>}", .{ @intToEnum(R_Instruction, opcode), opcode }); return VMError.Todo; }, } return true; } } }; test "VM: HLT with code 0xAF" { const program = [_]u32{build_R_Instruction(R_Instruction.HLT, 0, 0, 0)}; var vm = VM{ .program = program[0..], .registers = ([_]u64{0xAF} ++ ([_]u64{0} ** 31)), }; vm.init(std.testing.allocator, std.testing.allocator); defer vm.deinit(); try std.testing.expect(!try vm.exec_instruction()); try std.testing.expectEqual(VMEvent.Halt, vm.events.pop()); try std.testing.expectEqual(@as(u64, 0xAF), vm.exit_code); } test "VM: ADD 0x01 0x02" { const program = [_]u32{build_R_Instruction(R_Instruction.ADD, 0, 1, 2)}; const registers = [_]u64{ 0x0, 0x4, 0x8 } ++ ([_]u64{0} ** 29); var vm = VM{ .program = program[0..] }; vm.registers = registers; try std.testing.expect(try vm.exec_instruction()); try std.testing.expectEqual(@as(u64, 0x0C), vm.registers[0]); } test "VM: program counter moving with ADD" { const program = [_]u32{build_R_Instruction(R_Instruction.ADD, 0, 1, 2)}; const registers = [_]u64{ 0x0, 0xFF, 0xFF } ++ ([_]u64{0} ** 29); var vm = VM{ .program = program[0..] }; vm.init(std.testing.allocator, std.testing.allocator); vm.registers = registers; try std.testing.expectEqual(@as(u64, 0), vm.pc); try std.testing.expect(try vm.exec_instruction()); try std.testing.expectEqual(@as(u64, 0x1FE), vm.registers[0]); try std.testing.expectEqual(@as(u64, 1), vm.pc); } test "VM: execute a short program" { const program = [_]u32{ build_I_Instruction(I_Instruction.ADDI, 0, 1, 0x11), build_R_Instruction(R_Instruction.MUL, 2, 0, 1), build_R_Instruction(R_Instruction.REM, 1, 0, 2), build_R_Instruction(R_Instruction.HLT, 0, 0, 0), }; const registers = [_]u64{ 0x00, 0xFF } ++ ([_]u64{0} ** 30); var vm = VM{ .program = program[0..], .registers = registers, }; try std.testing.expectEqual(@as(u64, 0x110), try vm.run(std.testing.allocator, std.testing.allocator)); defer vm.deinit(); try std.testing.expectEqual(@as(u64, 0x110), vm.registers[0]); try std.testing.expectEqual(@as(u64, 0x110), vm.registers[1]); try std.testing.expectEqual(@as(u64, 0x10EF0), vm.registers[2]); } test "VM: equality" { const program = [_]u32{ build_R_Instruction(R_Instruction.EQ, 2, 0, 1), build_R_Instruction(R_Instruction.NEQ, 3, 0, 1), build_R_Instruction(R_Instruction.GE, 5, 0, 1), build_R_Instruction(R_Instruction.LT, 6, 0, 1), }; const registers = [_]u64{ 0xF1, 0xF1 } ++ ([_]u64{0} ** 30); var vm = VM{ .program = program[0..], .registers = registers, }; _ = try vm.run(std.testing.allocator, std.testing.allocator); defer vm.deinit(); try std.testing.expect(@boolToInt(true) == vm.registers[2]); try std.testing.expect(@boolToInt(false) == vm.registers[3]); try std.testing.expect(@boolToInt(true) == vm.registers[5]); try std.testing.expect(@boolToInt(false) == vm.registers[6]); } test "VM: test jumping" { const program = [_]u32{ build_C_Instruction(C_Instruction.JR, 0, 0x02), build_R_Instruction(R_Instruction.IGL, 0, 0, 0), build_R_Instruction(R_Instruction.HLT, 0, 0, 0x02), }; var vm = VM{ .program = program[0..], }; try std.testing.expectEqual(@as(u64, 0x00), try vm.run(std.testing.allocator, std.testing.allocator)); defer vm.deinit(); } test "VM: test conditional jumping" { // TODO: //std.log.alert("Unimplemented", .{}); // const program = [_]u8{ // @enumToInt(Instruction.EQ), intReg(0), intReg(1), // @enumToInt(Instruction.JMPRE), intReg(2), @enumToInt(Instruction.IGL), // @enumToInt(Instruction.NEQ), intReg(0), intReg(1), // @enumToInt(Instruction.JMPRE), intReg(3), @enumToInt(Instruction.HLT), // intReg(4), @enumToInt(Instruction.IGL), // }; // const registers = [_]u64{ 0x5F, 0x5F, 0x06, 0x0C } ++ ([_]u64{0} ** 28); // var vm = VM{ // .program = program[0..], // .registers = registers, // }; // try std.testing.expectEqual(@as(u64, 0x00), try vm.run(std.testing.allocator, std.testing.allocator)); // defer vm.deinit(); }
src/vm.zig
pub const ALL_SERVICE_TYPES = @as(u32, 0); pub const HIGHLEVEL_SERVICE_TYPES = @as(u32, 1); pub const LOWLEVEL_SERVICE_TYPES = @as(u32, 2); pub const ALL_SERVICES = @as(u32, 0); pub const ONLINE_SERVICES = @as(u32, 1); pub const OFFLINE_SERVICES = @as(u32, 2); pub const MAX_LEADBYTES = @as(u32, 12); pub const MAX_DEFAULTCHAR = @as(u32, 2); pub const HIGH_SURROGATE_START = @as(u32, 55296); pub const HIGH_SURROGATE_END = @as(u32, 56319); pub const LOW_SURROGATE_START = @as(u32, 56320); pub const LOW_SURROGATE_END = @as(u32, 57343); pub const WC_COMPOSITECHECK = @as(u32, 512); pub const WC_DISCARDNS = @as(u32, 16); pub const WC_SEPCHARS = @as(u32, 32); pub const WC_DEFAULTCHAR = @as(u32, 64); pub const WC_ERR_INVALID_CHARS = @as(u32, 128); pub const WC_NO_BEST_FIT_CHARS = @as(u32, 1024); pub const CT_CTYPE1 = @as(u32, 1); pub const CT_CTYPE2 = @as(u32, 2); pub const CT_CTYPE3 = @as(u32, 4); pub const C1_UPPER = @as(u32, 1); pub const C1_LOWER = @as(u32, 2); pub const C1_DIGIT = @as(u32, 4); pub const C1_SPACE = @as(u32, 8); pub const C1_PUNCT = @as(u32, 16); pub const C1_CNTRL = @as(u32, 32); pub const C1_BLANK = @as(u32, 64); pub const C1_XDIGIT = @as(u32, 128); pub const C1_ALPHA = @as(u32, 256); pub const C1_DEFINED = @as(u32, 512); pub const C2_LEFTTORIGHT = @as(u32, 1); pub const C2_RIGHTTOLEFT = @as(u32, 2); pub const C2_EUROPENUMBER = @as(u32, 3); pub const C2_EUROPESEPARATOR = @as(u32, 4); pub const C2_EUROPETERMINATOR = @as(u32, 5); pub const C2_ARABICNUMBER = @as(u32, 6); pub const C2_COMMONSEPARATOR = @as(u32, 7); pub const C2_BLOCKSEPARATOR = @as(u32, 8); pub const C2_SEGMENTSEPARATOR = @as(u32, 9); pub const C2_WHITESPACE = @as(u32, 10); pub const C2_OTHERNEUTRAL = @as(u32, 11); pub const C2_NOTAPPLICABLE = @as(u32, 0); pub const C3_NONSPACING = @as(u32, 1); pub const C3_DIACRITIC = @as(u32, 2); pub const C3_VOWELMARK = @as(u32, 4); pub const C3_SYMBOL = @as(u32, 8); pub const C3_KATAKANA = @as(u32, 16); pub const C3_HIRAGANA = @as(u32, 32); pub const C3_HALFWIDTH = @as(u32, 64); pub const C3_FULLWIDTH = @as(u32, 128); pub const C3_IDEOGRAPH = @as(u32, 256); pub const C3_KASHIDA = @as(u32, 512); pub const C3_LEXICAL = @as(u32, 1024); pub const C3_HIGHSURROGATE = @as(u32, 2048); pub const C3_LOWSURROGATE = @as(u32, 4096); pub const C3_ALPHA = @as(u32, 32768); pub const C3_NOTAPPLICABLE = @as(u32, 0); pub const LCMAP_LOWERCASE = @as(u32, 256); pub const LCMAP_UPPERCASE = @as(u32, 512); pub const LCMAP_TITLECASE = @as(u32, 768); pub const LCMAP_SORTKEY = @as(u32, 1024); pub const LCMAP_BYTEREV = @as(u32, 2048); pub const LCMAP_HIRAGANA = @as(u32, 1048576); pub const LCMAP_KATAKANA = @as(u32, 2097152); pub const LCMAP_HALFWIDTH = @as(u32, 4194304); pub const LCMAP_FULLWIDTH = @as(u32, 8388608); pub const LCMAP_LINGUISTIC_CASING = @as(u32, 16777216); pub const LCMAP_SIMPLIFIED_CHINESE = @as(u32, 33554432); pub const LCMAP_TRADITIONAL_CHINESE = @as(u32, 67108864); pub const LCMAP_SORTHANDLE = @as(u32, 536870912); pub const LCMAP_HASH = @as(u32, 262144); pub const FIND_STARTSWITH = @as(u32, 1048576); pub const FIND_ENDSWITH = @as(u32, 2097152); pub const FIND_FROMSTART = @as(u32, 4194304); pub const FIND_FROMEND = @as(u32, 8388608); pub const LCID_ALTERNATE_SORTS = @as(u32, 4); pub const LOCALE_ALL = @as(u32, 0); pub const LOCALE_WINDOWS = @as(u32, 1); pub const LOCALE_SUPPLEMENTAL = @as(u32, 2); pub const LOCALE_ALTERNATE_SORTS = @as(u32, 4); pub const LOCALE_REPLACEMENT = @as(u32, 8); pub const LOCALE_NEUTRALDATA = @as(u32, 16); pub const LOCALE_SPECIFICDATA = @as(u32, 32); pub const CSTR_LESS_THAN = @as(u32, 1); pub const CSTR_EQUAL = @as(u32, 2); pub const CSTR_GREATER_THAN = @as(u32, 3); pub const CP_ACP = @as(u32, 0); pub const CP_OEMCP = @as(u32, 1); pub const CP_MACCP = @as(u32, 2); pub const CP_THREAD_ACP = @as(u32, 3); pub const CP_SYMBOL = @as(u32, 42); pub const CP_UTF7 = @as(u32, 65000); pub const CP_UTF8 = @as(u32, 65001); pub const CTRY_DEFAULT = @as(u32, 0); pub const CTRY_ALBANIA = @as(u32, 355); pub const CTRY_ALGERIA = @as(u32, 213); pub const CTRY_ARGENTINA = @as(u32, 54); pub const CTRY_ARMENIA = @as(u32, 374); pub const CTRY_AUSTRALIA = @as(u32, 61); pub const CTRY_AUSTRIA = @as(u32, 43); pub const CTRY_AZERBAIJAN = @as(u32, 994); pub const CTRY_BAHRAIN = @as(u32, 973); pub const CTRY_BELARUS = @as(u32, 375); pub const CTRY_BELGIUM = @as(u32, 32); pub const CTRY_BELIZE = @as(u32, 501); pub const CTRY_BOLIVIA = @as(u32, 591); pub const CTRY_BRAZIL = @as(u32, 55); pub const CTRY_BRUNEI_DARUSSALAM = @as(u32, 673); pub const CTRY_BULGARIA = @as(u32, 359); pub const CTRY_CANADA = @as(u32, 2); pub const CTRY_CARIBBEAN = @as(u32, 1); pub const CTRY_CHILE = @as(u32, 56); pub const CTRY_COLOMBIA = @as(u32, 57); pub const CTRY_COSTA_RICA = @as(u32, 506); pub const CTRY_CROATIA = @as(u32, 385); pub const CTRY_CZECH = @as(u32, 420); pub const CTRY_DENMARK = @as(u32, 45); pub const CTRY_DOMINICAN_REPUBLIC = @as(u32, 1); pub const CTRY_ECUADOR = @as(u32, 593); pub const CTRY_EGYPT = @as(u32, 20); pub const CTRY_EL_SALVADOR = @as(u32, 503); pub const CTRY_ESTONIA = @as(u32, 372); pub const CTRY_FAEROE_ISLANDS = @as(u32, 298); pub const CTRY_FINLAND = @as(u32, 358); pub const CTRY_FRANCE = @as(u32, 33); pub const CTRY_GEORGIA = @as(u32, 995); pub const CTRY_GERMANY = @as(u32, 49); pub const CTRY_GREECE = @as(u32, 30); pub const CTRY_GUATEMALA = @as(u32, 502); pub const CTRY_HONDURAS = @as(u32, 504); pub const CTRY_HONG_KONG = @as(u32, 852); pub const CTRY_HUNGARY = @as(u32, 36); pub const CTRY_ICELAND = @as(u32, 354); pub const CTRY_INDIA = @as(u32, 91); pub const CTRY_INDONESIA = @as(u32, 62); pub const CTRY_IRAN = @as(u32, 981); pub const CTRY_IRAQ = @as(u32, 964); pub const CTRY_IRELAND = @as(u32, 353); pub const CTRY_ISRAEL = @as(u32, 972); pub const CTRY_ITALY = @as(u32, 39); pub const CTRY_JAMAICA = @as(u32, 1); pub const CTRY_JAPAN = @as(u32, 81); pub const CTRY_JORDAN = @as(u32, 962); pub const CTRY_KAZAKSTAN = @as(u32, 7); pub const CTRY_KENYA = @as(u32, 254); pub const CTRY_KUWAIT = @as(u32, 965); pub const CTRY_KYRGYZSTAN = @as(u32, 996); pub const CTRY_LATVIA = @as(u32, 371); pub const CTRY_LEBANON = @as(u32, 961); pub const CTRY_LIBYA = @as(u32, 218); pub const CTRY_LIECHTENSTEIN = @as(u32, 41); pub const CTRY_LITHUANIA = @as(u32, 370); pub const CTRY_LUXEMBOURG = @as(u32, 352); pub const CTRY_MACAU = @as(u32, 853); pub const CTRY_MACEDONIA = @as(u32, 389); pub const CTRY_MALAYSIA = @as(u32, 60); pub const CTRY_MALDIVES = @as(u32, 960); pub const CTRY_MEXICO = @as(u32, 52); pub const CTRY_MONACO = @as(u32, 33); pub const CTRY_MONGOLIA = @as(u32, 976); pub const CTRY_MOROCCO = @as(u32, 212); pub const CTRY_NETHERLANDS = @as(u32, 31); pub const CTRY_NEW_ZEALAND = @as(u32, 64); pub const CTRY_NICARAGUA = @as(u32, 505); pub const CTRY_NORWAY = @as(u32, 47); pub const CTRY_OMAN = @as(u32, 968); pub const CTRY_PAKISTAN = @as(u32, 92); pub const CTRY_PANAMA = @as(u32, 507); pub const CTRY_PARAGUAY = @as(u32, 595); pub const CTRY_PERU = @as(u32, 51); pub const CTRY_PHILIPPINES = @as(u32, 63); pub const CTRY_POLAND = @as(u32, 48); pub const CTRY_PORTUGAL = @as(u32, 351); pub const CTRY_PRCHINA = @as(u32, 86); pub const CTRY_PUERTO_RICO = @as(u32, 1); pub const CTRY_QATAR = @as(u32, 974); pub const CTRY_ROMANIA = @as(u32, 40); pub const CTRY_RUSSIA = @as(u32, 7); pub const CTRY_SAUDI_ARABIA = @as(u32, 966); pub const CTRY_SERBIA = @as(u32, 381); pub const CTRY_SINGAPORE = @as(u32, 65); pub const CTRY_SLOVAK = @as(u32, 421); pub const CTRY_SLOVENIA = @as(u32, 386); pub const CTRY_SOUTH_AFRICA = @as(u32, 27); pub const CTRY_SOUTH_KOREA = @as(u32, 82); pub const CTRY_SPAIN = @as(u32, 34); pub const CTRY_SWEDEN = @as(u32, 46); pub const CTRY_SWITZERLAND = @as(u32, 41); pub const CTRY_SYRIA = @as(u32, 963); pub const CTRY_TAIWAN = @as(u32, 886); pub const CTRY_TATARSTAN = @as(u32, 7); pub const CTRY_THAILAND = @as(u32, 66); pub const CTRY_TRINIDAD_Y_TOBAGO = @as(u32, 1); pub const CTRY_TUNISIA = @as(u32, 216); pub const CTRY_TURKEY = @as(u32, 90); pub const CTRY_UAE = @as(u32, 971); pub const CTRY_UKRAINE = @as(u32, 380); pub const CTRY_UNITED_KINGDOM = @as(u32, 44); pub const CTRY_UNITED_STATES = @as(u32, 1); pub const CTRY_URUGUAY = @as(u32, 598); pub const CTRY_UZBEKISTAN = @as(u32, 7); pub const CTRY_VENEZUELA = @as(u32, 58); pub const CTRY_VIET_NAM = @as(u32, 84); pub const CTRY_YEMEN = @as(u32, 967); pub const CTRY_ZIMBABWE = @as(u32, 263); pub const LOCALE_NOUSEROVERRIDE = @as(u32, 2147483648); pub const LOCALE_USE_CP_ACP = @as(u32, 1073741824); pub const LOCALE_RETURN_NUMBER = @as(u32, 536870912); pub const LOCALE_RETURN_GENITIVE_NAMES = @as(u32, 268435456); pub const LOCALE_ALLOW_NEUTRAL_NAMES = @as(u32, 134217728); pub const LOCALE_SLOCALIZEDDISPLAYNAME = @as(u32, 2); pub const LOCALE_SENGLISHDISPLAYNAME = @as(u32, 114); pub const LOCALE_SNATIVEDISPLAYNAME = @as(u32, 115); pub const LOCALE_SLOCALIZEDLANGUAGENAME = @as(u32, 111); pub const LOCALE_SENGLISHLANGUAGENAME = @as(u32, 4097); pub const LOCALE_SNATIVELANGUAGENAME = @as(u32, 4); pub const LOCALE_SLOCALIZEDCOUNTRYNAME = @as(u32, 6); pub const LOCALE_SENGLISHCOUNTRYNAME = @as(u32, 4098); pub const LOCALE_SNATIVECOUNTRYNAME = @as(u32, 8); pub const LOCALE_IDIALINGCODE = @as(u32, 5); pub const LOCALE_SLIST = @as(u32, 12); pub const LOCALE_IMEASURE = @as(u32, 13); pub const LOCALE_SDECIMAL = @as(u32, 14); pub const LOCALE_STHOUSAND = @as(u32, 15); pub const LOCALE_SGROUPING = @as(u32, 16); pub const LOCALE_IDIGITS = @as(u32, 17); pub const LOCALE_ILZERO = @as(u32, 18); pub const LOCALE_INEGNUMBER = @as(u32, 4112); pub const LOCALE_SNATIVEDIGITS = @as(u32, 19); pub const LOCALE_SCURRENCY = @as(u32, 20); pub const LOCALE_SINTLSYMBOL = @as(u32, 21); pub const LOCALE_SMONDECIMALSEP = @as(u32, 22); pub const LOCALE_SMONTHOUSANDSEP = @as(u32, 23); pub const LOCALE_SMONGROUPING = @as(u32, 24); pub const LOCALE_ICURRDIGITS = @as(u32, 25); pub const LOCALE_ICURRENCY = @as(u32, 27); pub const LOCALE_INEGCURR = @as(u32, 28); pub const LOCALE_SSHORTDATE = @as(u32, 31); pub const LOCALE_SLONGDATE = @as(u32, 32); pub const LOCALE_STIMEFORMAT = @as(u32, 4099); pub const LOCALE_SAM = @as(u32, 40); pub const LOCALE_SPM = @as(u32, 41); pub const LOCALE_ICALENDARTYPE = @as(u32, 4105); pub const LOCALE_IOPTIONALCALENDAR = @as(u32, 4107); pub const LOCALE_IFIRSTDAYOFWEEK = @as(u32, 4108); pub const LOCALE_IFIRSTWEEKOFYEAR = @as(u32, 4109); pub const LOCALE_SDAYNAME1 = @as(u32, 42); pub const LOCALE_SDAYNAME2 = @as(u32, 43); pub const LOCALE_SDAYNAME3 = @as(u32, 44); pub const LOCALE_SDAYNAME4 = @as(u32, 45); pub const LOCALE_SDAYNAME5 = @as(u32, 46); pub const LOCALE_SDAYNAME6 = @as(u32, 47); pub const LOCALE_SDAYNAME7 = @as(u32, 48); pub const LOCALE_SABBREVDAYNAME1 = @as(u32, 49); pub const LOCALE_SABBREVDAYNAME2 = @as(u32, 50); pub const LOCALE_SABBREVDAYNAME3 = @as(u32, 51); pub const LOCALE_SABBREVDAYNAME4 = @as(u32, 52); pub const LOCALE_SABBREVDAYNAME5 = @as(u32, 53); pub const LOCALE_SABBREVDAYNAME6 = @as(u32, 54); pub const LOCALE_SABBREVDAYNAME7 = @as(u32, 55); pub const LOCALE_SMONTHNAME1 = @as(u32, 56); pub const LOCALE_SMONTHNAME2 = @as(u32, 57); pub const LOCALE_SMONTHNAME3 = @as(u32, 58); pub const LOCALE_SMONTHNAME4 = @as(u32, 59); pub const LOCALE_SMONTHNAME5 = @as(u32, 60); pub const LOCALE_SMONTHNAME6 = @as(u32, 61); pub const LOCALE_SMONTHNAME7 = @as(u32, 62); pub const LOCALE_SMONTHNAME8 = @as(u32, 63); pub const LOCALE_SMONTHNAME9 = @as(u32, 64); pub const LOCALE_SMONTHNAME10 = @as(u32, 65); pub const LOCALE_SMONTHNAME11 = @as(u32, 66); pub const LOCALE_SMONTHNAME12 = @as(u32, 67); pub const LOCALE_SMONTHNAME13 = @as(u32, 4110); pub const LOCALE_SABBREVMONTHNAME1 = @as(u32, 68); pub const LOCALE_SABBREVMONTHNAME2 = @as(u32, 69); pub const LOCALE_SABBREVMONTHNAME3 = @as(u32, 70); pub const LOCALE_SABBREVMONTHNAME4 = @as(u32, 71); pub const LOCALE_SABBREVMONTHNAME5 = @as(u32, 72); pub const LOCALE_SABBREVMONTHNAME6 = @as(u32, 73); pub const LOCALE_SABBREVMONTHNAME7 = @as(u32, 74); pub const LOCALE_SABBREVMONTHNAME8 = @as(u32, 75); pub const LOCALE_SABBREVMONTHNAME9 = @as(u32, 76); pub const LOCALE_SABBREVMONTHNAME10 = @as(u32, 77); pub const LOCALE_SABBREVMONTHNAME11 = @as(u32, 78); pub const LOCALE_SABBREVMONTHNAME12 = @as(u32, 79); pub const LOCALE_SABBREVMONTHNAME13 = @as(u32, 4111); pub const LOCALE_SPOSITIVESIGN = @as(u32, 80); pub const LOCALE_SNEGATIVESIGN = @as(u32, 81); pub const LOCALE_IPOSSIGNPOSN = @as(u32, 82); pub const LOCALE_INEGSIGNPOSN = @as(u32, 83); pub const LOCALE_IPOSSYMPRECEDES = @as(u32, 84); pub const LOCALE_IPOSSEPBYSPACE = @as(u32, 85); pub const LOCALE_INEGSYMPRECEDES = @as(u32, 86); pub const LOCALE_INEGSEPBYSPACE = @as(u32, 87); pub const LOCALE_FONTSIGNATURE = @as(u32, 88); pub const LOCALE_SISO639LANGNAME = @as(u32, 89); pub const LOCALE_SISO3166CTRYNAME = @as(u32, 90); pub const LOCALE_IPAPERSIZE = @as(u32, 4106); pub const LOCALE_SENGCURRNAME = @as(u32, 4103); pub const LOCALE_SNATIVECURRNAME = @as(u32, 4104); pub const LOCALE_SYEARMONTH = @as(u32, 4102); pub const LOCALE_SSORTNAME = @as(u32, 4115); pub const LOCALE_IDIGITSUBSTITUTION = @as(u32, 4116); pub const LOCALE_SNAME = @as(u32, 92); pub const LOCALE_SDURATION = @as(u32, 93); pub const LOCALE_SSHORTESTDAYNAME1 = @as(u32, 96); pub const LOCALE_SSHORTESTDAYNAME2 = @as(u32, 97); pub const LOCALE_SSHORTESTDAYNAME3 = @as(u32, 98); pub const LOCALE_SSHORTESTDAYNAME4 = @as(u32, 99); pub const LOCALE_SSHORTESTDAYNAME5 = @as(u32, 100); pub const LOCALE_SSHORTESTDAYNAME6 = @as(u32, 101); pub const LOCALE_SSHORTESTDAYNAME7 = @as(u32, 102); pub const LOCALE_SISO639LANGNAME2 = @as(u32, 103); pub const LOCALE_SISO3166CTRYNAME2 = @as(u32, 104); pub const LOCALE_SNAN = @as(u32, 105); pub const LOCALE_SPOSINFINITY = @as(u32, 106); pub const LOCALE_SNEGINFINITY = @as(u32, 107); pub const LOCALE_SSCRIPTS = @as(u32, 108); pub const LOCALE_SPARENT = @as(u32, 109); pub const LOCALE_SCONSOLEFALLBACKNAME = @as(u32, 110); pub const LOCALE_IREADINGLAYOUT = @as(u32, 112); pub const LOCALE_INEUTRAL = @as(u32, 113); pub const LOCALE_INEGATIVEPERCENT = @as(u32, 116); pub const LOCALE_IPOSITIVEPERCENT = @as(u32, 117); pub const LOCALE_SPERCENT = @as(u32, 118); pub const LOCALE_SPERMILLE = @as(u32, 119); pub const LOCALE_SMONTHDAY = @as(u32, 120); pub const LOCALE_SSHORTTIME = @as(u32, 121); pub const LOCALE_SOPENTYPELANGUAGETAG = @as(u32, 122); pub const LOCALE_SSORTLOCALE = @as(u32, 123); pub const LOCALE_SRELATIVELONGDATE = @as(u32, 124); pub const LOCALE_SSHORTESTAM = @as(u32, 126); pub const LOCALE_SSHORTESTPM = @as(u32, 127); pub const LOCALE_IDEFAULTCODEPAGE = @as(u32, 11); pub const LOCALE_IDEFAULTANSICODEPAGE = @as(u32, 4100); pub const LOCALE_IDEFAULTMACCODEPAGE = @as(u32, 4113); pub const LOCALE_IDEFAULTEBCDICCODEPAGE = @as(u32, 4114); pub const LOCALE_ILANGUAGE = @as(u32, 1); pub const LOCALE_SABBREVLANGNAME = @as(u32, 3); pub const LOCALE_SABBREVCTRYNAME = @as(u32, 7); pub const LOCALE_IGEOID = @as(u32, 91); pub const LOCALE_IDEFAULTLANGUAGE = @as(u32, 9); pub const LOCALE_IDEFAULTCOUNTRY = @as(u32, 10); pub const LOCALE_IINTLCURRDIGITS = @as(u32, 26); pub const LOCALE_SDATE = @as(u32, 29); pub const LOCALE_STIME = @as(u32, 30); pub const LOCALE_IDATE = @as(u32, 33); pub const LOCALE_ILDATE = @as(u32, 34); pub const LOCALE_ITIME = @as(u32, 35); pub const LOCALE_ITIMEMARKPOSN = @as(u32, 4101); pub const LOCALE_ICENTURY = @as(u32, 36); pub const LOCALE_ITLZERO = @as(u32, 37); pub const LOCALE_IDAYLZERO = @as(u32, 38); pub const LOCALE_IMONLZERO = @as(u32, 39); pub const LOCALE_SKEYBOARDSTOINSTALL = @as(u32, 94); pub const CAL_ICALINTVALUE = @as(u32, 1); pub const CAL_SCALNAME = @as(u32, 2); pub const CAL_IYEAROFFSETRANGE = @as(u32, 3); pub const CAL_SERASTRING = @as(u32, 4); pub const CAL_SSHORTDATE = @as(u32, 5); pub const CAL_SLONGDATE = @as(u32, 6); pub const CAL_SDAYNAME1 = @as(u32, 7); pub const CAL_SDAYNAME2 = @as(u32, 8); pub const CAL_SDAYNAME3 = @as(u32, 9); pub const CAL_SDAYNAME4 = @as(u32, 10); pub const CAL_SDAYNAME5 = @as(u32, 11); pub const CAL_SDAYNAME6 = @as(u32, 12); pub const CAL_SDAYNAME7 = @as(u32, 13); pub const CAL_SABBREVDAYNAME1 = @as(u32, 14); pub const CAL_SABBREVDAYNAME2 = @as(u32, 15); pub const CAL_SABBREVDAYNAME3 = @as(u32, 16); pub const CAL_SABBREVDAYNAME4 = @as(u32, 17); pub const CAL_SABBREVDAYNAME5 = @as(u32, 18); pub const CAL_SABBREVDAYNAME6 = @as(u32, 19); pub const CAL_SABBREVDAYNAME7 = @as(u32, 20); pub const CAL_SMONTHNAME1 = @as(u32, 21); pub const CAL_SMONTHNAME2 = @as(u32, 22); pub const CAL_SMONTHNAME3 = @as(u32, 23); pub const CAL_SMONTHNAME4 = @as(u32, 24); pub const CAL_SMONTHNAME5 = @as(u32, 25); pub const CAL_SMONTHNAME6 = @as(u32, 26); pub const CAL_SMONTHNAME7 = @as(u32, 27); pub const CAL_SMONTHNAME8 = @as(u32, 28); pub const CAL_SMONTHNAME9 = @as(u32, 29); pub const CAL_SMONTHNAME10 = @as(u32, 30); pub const CAL_SMONTHNAME11 = @as(u32, 31); pub const CAL_SMONTHNAME12 = @as(u32, 32); pub const CAL_SMONTHNAME13 = @as(u32, 33); pub const CAL_SABBREVMONTHNAME1 = @as(u32, 34); pub const CAL_SABBREVMONTHNAME2 = @as(u32, 35); pub const CAL_SABBREVMONTHNAME3 = @as(u32, 36); pub const CAL_SABBREVMONTHNAME4 = @as(u32, 37); pub const CAL_SABBREVMONTHNAME5 = @as(u32, 38); pub const CAL_SABBREVMONTHNAME6 = @as(u32, 39); pub const CAL_SABBREVMONTHNAME7 = @as(u32, 40); pub const CAL_SABBREVMONTHNAME8 = @as(u32, 41); pub const CAL_SABBREVMONTHNAME9 = @as(u32, 42); pub const CAL_SABBREVMONTHNAME10 = @as(u32, 43); pub const CAL_SABBREVMONTHNAME11 = @as(u32, 44); pub const CAL_SABBREVMONTHNAME12 = @as(u32, 45); pub const CAL_SABBREVMONTHNAME13 = @as(u32, 46); pub const CAL_SYEARMONTH = @as(u32, 47); pub const CAL_ITWODIGITYEARMAX = @as(u32, 48); pub const CAL_SSHORTESTDAYNAME1 = @as(u32, 49); pub const CAL_SSHORTESTDAYNAME2 = @as(u32, 50); pub const CAL_SSHORTESTDAYNAME3 = @as(u32, 51); pub const CAL_SSHORTESTDAYNAME4 = @as(u32, 52); pub const CAL_SSHORTESTDAYNAME5 = @as(u32, 53); pub const CAL_SSHORTESTDAYNAME6 = @as(u32, 54); pub const CAL_SSHORTESTDAYNAME7 = @as(u32, 55); pub const CAL_SMONTHDAY = @as(u32, 56); pub const CAL_SABBREVERASTRING = @as(u32, 57); pub const CAL_SRELATIVELONGDATE = @as(u32, 58); pub const CAL_SENGLISHERANAME = @as(u32, 59); pub const CAL_SENGLISHABBREVERANAME = @as(u32, 60); pub const CAL_SJAPANESEERAFIRSTYEAR = @as(u32, 61); pub const ENUM_ALL_CALENDARS = @as(u32, 4294967295); pub const CAL_GREGORIAN = @as(u32, 1); pub const CAL_GREGORIAN_US = @as(u32, 2); pub const CAL_JAPAN = @as(u32, 3); pub const CAL_TAIWAN = @as(u32, 4); pub const CAL_KOREA = @as(u32, 5); pub const CAL_HIJRI = @as(u32, 6); pub const CAL_THAI = @as(u32, 7); pub const CAL_HEBREW = @as(u32, 8); pub const CAL_GREGORIAN_ME_FRENCH = @as(u32, 9); pub const CAL_GREGORIAN_ARABIC = @as(u32, 10); pub const CAL_GREGORIAN_XLIT_ENGLISH = @as(u32, 11); pub const CAL_GREGORIAN_XLIT_FRENCH = @as(u32, 12); pub const CAL_PERSIAN = @as(u32, 22); pub const CAL_UMALQURA = @as(u32, 23); pub const LGRPID_WESTERN_EUROPE = @as(u32, 1); pub const LGRPID_CENTRAL_EUROPE = @as(u32, 2); pub const LGRPID_BALTIC = @as(u32, 3); pub const LGRPID_GREEK = @as(u32, 4); pub const LGRPID_CYRILLIC = @as(u32, 5); pub const LGRPID_TURKIC = @as(u32, 6); pub const LGRPID_TURKISH = @as(u32, 6); pub const LGRPID_JAPANESE = @as(u32, 7); pub const LGRPID_KOREAN = @as(u32, 8); pub const LGRPID_TRADITIONAL_CHINESE = @as(u32, 9); pub const LGRPID_SIMPLIFIED_CHINESE = @as(u32, 10); pub const LGRPID_THAI = @as(u32, 11); pub const LGRPID_HEBREW = @as(u32, 12); pub const LGRPID_ARABIC = @as(u32, 13); pub const LGRPID_VIETNAMESE = @as(u32, 14); pub const LGRPID_INDIC = @as(u32, 15); pub const LGRPID_GEORGIAN = @as(u32, 16); pub const LGRPID_ARMENIAN = @as(u32, 17); pub const MUI_LANGUAGE_ID = @as(u32, 4); pub const MUI_LANGUAGE_NAME = @as(u32, 8); pub const MUI_MERGE_SYSTEM_FALLBACK = @as(u32, 16); pub const MUI_MERGE_USER_FALLBACK = @as(u32, 32); pub const MUI_THREAD_LANGUAGES = @as(u32, 64); pub const MUI_CONSOLE_FILTER = @as(u32, 256); pub const MUI_COMPLEX_SCRIPT_FILTER = @as(u32, 512); pub const MUI_RESET_FILTERS = @as(u32, 1); pub const MUI_USER_PREFERRED_UI_LANGUAGES = @as(u32, 16); pub const MUI_USE_INSTALLED_LANGUAGES = @as(u32, 32); pub const MUI_USE_SEARCH_ALL_LANGUAGES = @as(u32, 64); pub const MUI_LANG_NEUTRAL_PE_FILE = @as(u32, 256); pub const MUI_NON_LANG_NEUTRAL_FILE = @as(u32, 512); pub const MUI_MACHINE_LANGUAGE_SETTINGS = @as(u32, 1024); pub const MUI_FILETYPE_NOT_LANGUAGE_NEUTRAL = @as(u32, 1); pub const MUI_FILETYPE_LANGUAGE_NEUTRAL_MAIN = @as(u32, 2); pub const MUI_FILETYPE_LANGUAGE_NEUTRAL_MUI = @as(u32, 4); pub const MUI_QUERY_TYPE = @as(u32, 1); pub const MUI_QUERY_CHECKSUM = @as(u32, 2); pub const MUI_QUERY_LANGUAGE_NAME = @as(u32, 4); pub const MUI_QUERY_RESOURCE_TYPES = @as(u32, 8); pub const MUI_FILEINFO_VERSION = @as(u32, 1); pub const MUI_FULL_LANGUAGE = @as(u32, 1); pub const MUI_PARTIAL_LANGUAGE = @as(u32, 2); pub const MUI_LIP_LANGUAGE = @as(u32, 4); pub const MUI_LANGUAGE_INSTALLED = @as(u32, 32); pub const MUI_LANGUAGE_LICENSED = @as(u32, 64); pub const GEOID_NOT_AVAILABLE = @as(i32, -1); pub const IDN_ALLOW_UNASSIGNED = @as(u32, 1); pub const IDN_USE_STD3_ASCII_RULES = @as(u32, 2); pub const IDN_EMAIL_ADDRESS = @as(u32, 4); pub const IDN_RAW_PUNYCODE = @as(u32, 8); pub const VS_ALLOW_LATIN = @as(u32, 1); pub const GSS_ALLOW_INHERITED_COMMON = @as(u32, 1); pub const MUI_FORMAT_REG_COMPAT = @as(u32, 1); pub const MUI_FORMAT_INF_COMPAT = @as(u32, 2); pub const MUI_VERIFY_FILE_EXISTS = @as(u32, 4); pub const MUI_SKIP_STRING_CACHE = @as(u32, 8); pub const MUI_IMMUTABLE_LOOKUP = @as(u32, 16); pub const CLSID_VERSION_DEPENDENT_MSIME_JAPANESE = Guid.initString("6a91029e-aa49-471b-aee7-7d332785660d"); pub const IFEC_S_ALREADY_DEFAULT = @import("zig.zig").typedConst(HRESULT, @as(i32, 291840)); pub const FELANG_REQ_CONV = @as(u32, 65536); pub const FELANG_REQ_RECONV = @as(u32, 131072); pub const FELANG_REQ_REV = @as(u32, 196608); pub const FELANG_CMODE_MONORUBY = @as(u32, 2); pub const FELANG_CMODE_NOPRUNING = @as(u32, 4); pub const FELANG_CMODE_KATAKANAOUT = @as(u32, 8); pub const FELANG_CMODE_HIRAGANAOUT = @as(u32, 0); pub const FELANG_CMODE_HALFWIDTHOUT = @as(u32, 16); pub const FELANG_CMODE_FULLWIDTHOUT = @as(u32, 32); pub const FELANG_CMODE_BOPOMOFO = @as(u32, 64); pub const FELANG_CMODE_HANGUL = @as(u32, 128); pub const FELANG_CMODE_PINYIN = @as(u32, 256); pub const FELANG_CMODE_PRECONV = @as(u32, 512); pub const FELANG_CMODE_RADICAL = @as(u32, 1024); pub const FELANG_CMODE_UNKNOWNREADING = @as(u32, 2048); pub const FELANG_CMODE_MERGECAND = @as(u32, 4096); pub const FELANG_CMODE_ROMAN = @as(u32, 8192); pub const FELANG_CMODE_BESTFIRST = @as(u32, 16384); pub const FELANG_CMODE_USENOREVWORDS = @as(u32, 32768); pub const FELANG_CMODE_NONE = @as(u32, 16777216); pub const FELANG_CMODE_PLAURALCLAUSE = @as(u32, 33554432); pub const FELANG_CMODE_SINGLECONVERT = @as(u32, 67108864); pub const FELANG_CMODE_AUTOMATIC = @as(u32, 134217728); pub const FELANG_CMODE_PHRASEPREDICT = @as(u32, 268435456); pub const FELANG_CMODE_CONVERSATION = @as(u32, 536870912); pub const FELANG_CMODE_NOINVISIBLECHAR = @as(u32, 1073741824); pub const E_NOCAND = @as(u32, 48); pub const E_NOTENOUGH_BUFFER = @as(u32, 49); pub const E_NOTENOUGH_WDD = @as(u32, 50); pub const E_LARGEINPUT = @as(u32, 51); pub const FELANG_CLMN_WBREAK = @as(u32, 1); pub const FELANG_CLMN_NOWBREAK = @as(u32, 2); pub const FELANG_CLMN_PBREAK = @as(u32, 4); pub const FELANG_CLMN_NOPBREAK = @as(u32, 8); pub const FELANG_CLMN_FIXR = @as(u32, 16); pub const FELANG_CLMN_FIXD = @as(u32, 32); pub const FELANG_INVALD_PO = @as(u32, 65535); pub const IFED_POS_NONE = @as(u32, 0); pub const IFED_POS_NOUN = @as(u32, 1); pub const IFED_POS_VERB = @as(u32, 2); pub const IFED_POS_ADJECTIVE = @as(u32, 4); pub const IFED_POS_ADJECTIVE_VERB = @as(u32, 8); pub const IFED_POS_ADVERB = @as(u32, 16); pub const IFED_POS_ADNOUN = @as(u32, 32); pub const IFED_POS_CONJUNCTION = @as(u32, 64); pub const IFED_POS_INTERJECTION = @as(u32, 128); pub const IFED_POS_INDEPENDENT = @as(u32, 255); pub const IFED_POS_INFLECTIONALSUFFIX = @as(u32, 256); pub const IFED_POS_PREFIX = @as(u32, 512); pub const IFED_POS_SUFFIX = @as(u32, 1024); pub const IFED_POS_AFFIX = @as(u32, 1536); pub const IFED_POS_TANKANJI = @as(u32, 2048); pub const IFED_POS_IDIOMS = @as(u32, 4096); pub const IFED_POS_SYMBOLS = @as(u32, 8192); pub const IFED_POS_PARTICLE = @as(u32, 16384); pub const IFED_POS_AUXILIARY_VERB = @as(u32, 32768); pub const IFED_POS_SUB_VERB = @as(u32, 65536); pub const IFED_POS_DEPENDENT = @as(u32, 114688); pub const IFED_POS_ALL = @as(u32, 131071); pub const IFED_SELECT_NONE = @as(u32, 0); pub const IFED_SELECT_READING = @as(u32, 1); pub const IFED_SELECT_DISPLAY = @as(u32, 2); pub const IFED_SELECT_POS = @as(u32, 4); pub const IFED_SELECT_COMMENT = @as(u32, 8); pub const IFED_SELECT_ALL = @as(u32, 15); pub const IFED_REG_NONE = @as(u32, 0); pub const IFED_REG_USER = @as(u32, 1); pub const IFED_REG_AUTO = @as(u32, 2); pub const IFED_REG_GRAMMAR = @as(u32, 4); pub const IFED_REG_ALL = @as(u32, 7); pub const IFED_TYPE_NONE = @as(u32, 0); pub const IFED_TYPE_GENERAL = @as(u32, 1); pub const IFED_TYPE_NAMEPLACE = @as(u32, 2); pub const IFED_TYPE_SPEECH = @as(u32, 4); pub const IFED_TYPE_REVERSE = @as(u32, 8); pub const IFED_TYPE_ENGLISH = @as(u32, 16); pub const IFED_TYPE_ALL = @as(u32, 31); pub const IFED_S_MORE_ENTRIES = @import("zig.zig").typedConst(HRESULT, @as(i32, 291328)); pub const IFED_S_EMPTY_DICTIONARY = @import("zig.zig").typedConst(HRESULT, @as(i32, 291329)); pub const IFED_S_WORD_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, 291330)); pub const IFED_S_COMMENT_CHANGED = @import("zig.zig").typedConst(HRESULT, @as(i32, 291331)); pub const IFED_E_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147192064)); pub const IFED_E_INVALID_FORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147192063)); pub const IFED_E_OPEN_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147192062)); pub const IFED_E_WRITE_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147192061)); pub const IFED_E_NO_ENTRY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147192060)); pub const IFED_E_REGISTER_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147192059)); pub const IFED_E_NOT_USER_DIC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147192058)); pub const IFED_E_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147192057)); pub const IFED_E_USER_COMMENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147192056)); pub const IFED_E_REGISTER_ILLEGAL_POS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147192055)); pub const IFED_E_REGISTER_IMPROPER_WORD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147192054)); pub const IFED_E_REGISTER_DISCONNECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147192053)); pub const POS_UNDEFINED = @as(u32, 0); pub const JPOS_MEISHI_FUTSU = @as(u32, 100); pub const JPOS_MEISHI_SAHEN = @as(u32, 101); pub const JPOS_MEISHI_ZAHEN = @as(u32, 102); pub const JPOS_MEISHI_KEIYOUDOUSHI = @as(u32, 103); pub const JPOS_HUKUSIMEISHI = @as(u32, 104); pub const JPOS_MEISA_KEIDOU = @as(u32, 105); pub const JPOS_JINMEI = @as(u32, 106); pub const JPOS_JINMEI_SEI = @as(u32, 107); pub const JPOS_JINMEI_MEI = @as(u32, 108); pub const JPOS_CHIMEI = @as(u32, 109); pub const JPOS_CHIMEI_KUNI = @as(u32, 110); pub const JPOS_CHIMEI_KEN = @as(u32, 111); pub const JPOS_CHIMEI_GUN = @as(u32, 112); pub const JPOS_CHIMEI_KU = @as(u32, 113); pub const JPOS_CHIMEI_SHI = @as(u32, 114); pub const JPOS_CHIMEI_MACHI = @as(u32, 115); pub const JPOS_CHIMEI_MURA = @as(u32, 116); pub const JPOS_CHIMEI_EKI = @as(u32, 117); pub const JPOS_SONOTA = @as(u32, 118); pub const JPOS_SHAMEI = @as(u32, 119); pub const JPOS_SOSHIKI = @as(u32, 120); pub const JPOS_KENCHIKU = @as(u32, 121); pub const JPOS_BUPPIN = @as(u32, 122); pub const JPOS_DAIMEISHI = @as(u32, 123); pub const JPOS_DAIMEISHI_NINSHOU = @as(u32, 124); pub const JPOS_DAIMEISHI_SHIJI = @as(u32, 125); pub const JPOS_KAZU = @as(u32, 126); pub const JPOS_KAZU_SURYOU = @as(u32, 127); pub const JPOS_KAZU_SUSHI = @as(u32, 128); pub const JPOS_5DAN_AWA = @as(u32, 200); pub const JPOS_5DAN_KA = @as(u32, 201); pub const JPOS_5DAN_GA = @as(u32, 202); pub const JPOS_5DAN_SA = @as(u32, 203); pub const JPOS_5DAN_TA = @as(u32, 204); pub const JPOS_5DAN_NA = @as(u32, 205); pub const JPOS_5DAN_BA = @as(u32, 206); pub const JPOS_5DAN_MA = @as(u32, 207); pub const JPOS_5DAN_RA = @as(u32, 208); pub const JPOS_5DAN_AWAUON = @as(u32, 209); pub const JPOS_5DAN_KASOKUON = @as(u32, 210); pub const JPOS_5DAN_RAHEN = @as(u32, 211); pub const JPOS_4DAN_HA = @as(u32, 212); pub const JPOS_1DAN = @as(u32, 213); pub const JPOS_TOKUSHU_KAHEN = @as(u32, 214); pub const JPOS_TOKUSHU_SAHENSURU = @as(u32, 215); pub const JPOS_TOKUSHU_SAHEN = @as(u32, 216); pub const JPOS_TOKUSHU_ZAHEN = @as(u32, 217); pub const JPOS_TOKUSHU_NAHEN = @as(u32, 218); pub const JPOS_KURU_KI = @as(u32, 219); pub const JPOS_KURU_KITA = @as(u32, 220); pub const JPOS_KURU_KITARA = @as(u32, 221); pub const JPOS_KURU_KITARI = @as(u32, 222); pub const JPOS_KURU_KITAROU = @as(u32, 223); pub const JPOS_KURU_KITE = @as(u32, 224); pub const JPOS_KURU_KUREBA = @as(u32, 225); pub const JPOS_KURU_KO = @as(u32, 226); pub const JPOS_KURU_KOI = @as(u32, 227); pub const JPOS_KURU_KOYOU = @as(u32, 228); pub const JPOS_SURU_SA = @as(u32, 229); pub const JPOS_SURU_SI = @as(u32, 230); pub const JPOS_SURU_SITA = @as(u32, 231); pub const JPOS_SURU_SITARA = @as(u32, 232); pub const JPOS_SURU_SIATRI = @as(u32, 233); pub const JPOS_SURU_SITAROU = @as(u32, 234); pub const JPOS_SURU_SITE = @as(u32, 235); pub const JPOS_SURU_SIYOU = @as(u32, 236); pub const JPOS_SURU_SUREBA = @as(u32, 237); pub const JPOS_SURU_SE = @as(u32, 238); pub const JPOS_SURU_SEYO = @as(u32, 239); pub const JPOS_KEIYOU = @as(u32, 300); pub const JPOS_KEIYOU_GARU = @as(u32, 301); pub const JPOS_KEIYOU_GE = @as(u32, 302); pub const JPOS_KEIYOU_ME = @as(u32, 303); pub const JPOS_KEIYOU_YUU = @as(u32, 304); pub const JPOS_KEIYOU_U = @as(u32, 305); pub const JPOS_KEIDOU = @as(u32, 400); pub const JPOS_KEIDOU_NO = @as(u32, 401); pub const JPOS_KEIDOU_TARU = @as(u32, 402); pub const JPOS_KEIDOU_GARU = @as(u32, 403); pub const JPOS_FUKUSHI = @as(u32, 500); pub const JPOS_FUKUSHI_SAHEN = @as(u32, 501); pub const JPOS_FUKUSHI_NI = @as(u32, 502); pub const JPOS_FUKUSHI_NANO = @as(u32, 503); pub const JPOS_FUKUSHI_DA = @as(u32, 504); pub const JPOS_FUKUSHI_TO = @as(u32, 505); pub const JPOS_FUKUSHI_TOSURU = @as(u32, 506); pub const JPOS_RENTAISHI = @as(u32, 600); pub const JPOS_RENTAISHI_SHIJI = @as(u32, 601); pub const JPOS_SETSUZOKUSHI = @as(u32, 650); pub const JPOS_KANDOUSHI = @as(u32, 670); pub const JPOS_SETTOU = @as(u32, 700); pub const JPOS_SETTOU_KAKU = @as(u32, 701); pub const JPOS_SETTOU_SAI = @as(u32, 702); pub const JPOS_SETTOU_FUKU = @as(u32, 703); pub const JPOS_SETTOU_MI = @as(u32, 704); pub const JPOS_SETTOU_DAISHOU = @as(u32, 705); pub const JPOS_SETTOU_KOUTEI = @as(u32, 706); pub const JPOS_SETTOU_CHOUTAN = @as(u32, 707); pub const JPOS_SETTOU_SHINKYU = @as(u32, 708); pub const JPOS_SETTOU_JINMEI = @as(u32, 709); pub const JPOS_SETTOU_CHIMEI = @as(u32, 710); pub const JPOS_SETTOU_SONOTA = @as(u32, 711); pub const JPOS_SETTOU_JOSUSHI = @as(u32, 712); pub const JPOS_SETTOU_TEINEI_O = @as(u32, 713); pub const JPOS_SETTOU_TEINEI_GO = @as(u32, 714); pub const JPOS_SETTOU_TEINEI_ON = @as(u32, 715); pub const JPOS_SETSUBI = @as(u32, 800); pub const JPOS_SETSUBI_TEKI = @as(u32, 801); pub const JPOS_SETSUBI_SEI = @as(u32, 802); pub const JPOS_SETSUBI_KA = @as(u32, 803); pub const JPOS_SETSUBI_CHU = @as(u32, 804); pub const JPOS_SETSUBI_FU = @as(u32, 805); pub const JPOS_SETSUBI_RYU = @as(u32, 806); pub const JPOS_SETSUBI_YOU = @as(u32, 807); pub const JPOS_SETSUBI_KATA = @as(u32, 808); pub const JPOS_SETSUBI_MEISHIRENDAKU = @as(u32, 809); pub const JPOS_SETSUBI_JINMEI = @as(u32, 810); pub const JPOS_SETSUBI_CHIMEI = @as(u32, 811); pub const JPOS_SETSUBI_KUNI = @as(u32, 812); pub const JPOS_SETSUBI_KEN = @as(u32, 813); pub const JPOS_SETSUBI_GUN = @as(u32, 814); pub const JPOS_SETSUBI_KU = @as(u32, 815); pub const JPOS_SETSUBI_SHI = @as(u32, 816); pub const JPOS_SETSUBI_MACHI = @as(u32, 817); pub const JPOS_SETSUBI_CHOU = @as(u32, 818); pub const JPOS_SETSUBI_MURA = @as(u32, 819); pub const JPOS_SETSUBI_SON = @as(u32, 820); pub const JPOS_SETSUBI_EKI = @as(u32, 821); pub const JPOS_SETSUBI_SONOTA = @as(u32, 822); pub const JPOS_SETSUBI_SHAMEI = @as(u32, 823); pub const JPOS_SETSUBI_SOSHIKI = @as(u32, 824); pub const JPOS_SETSUBI_KENCHIKU = @as(u32, 825); pub const JPOS_RENYOU_SETSUBI = @as(u32, 826); pub const JPOS_SETSUBI_JOSUSHI = @as(u32, 827); pub const JPOS_SETSUBI_JOSUSHIPLUS = @as(u32, 828); pub const JPOS_SETSUBI_JIKAN = @as(u32, 829); pub const JPOS_SETSUBI_JIKANPLUS = @as(u32, 830); pub const JPOS_SETSUBI_TEINEI = @as(u32, 831); pub const JPOS_SETSUBI_SAN = @as(u32, 832); pub const JPOS_SETSUBI_KUN = @as(u32, 833); pub const JPOS_SETSUBI_SAMA = @as(u32, 834); pub const JPOS_SETSUBI_DONO = @as(u32, 835); pub const JPOS_SETSUBI_FUKUSU = @as(u32, 836); pub const JPOS_SETSUBI_TACHI = @as(u32, 837); pub const JPOS_SETSUBI_RA = @as(u32, 838); pub const JPOS_TANKANJI = @as(u32, 900); pub const JPOS_TANKANJI_KAO = @as(u32, 901); pub const JPOS_KANYOUKU = @as(u32, 902); pub const JPOS_DOKURITSUGO = @as(u32, 903); pub const JPOS_FUTEIGO = @as(u32, 904); pub const JPOS_KIGOU = @as(u32, 905); pub const JPOS_EIJI = @as(u32, 906); pub const JPOS_KUTEN = @as(u32, 907); pub const JPOS_TOUTEN = @as(u32, 908); pub const JPOS_KANJI = @as(u32, 909); pub const JPOS_OPENBRACE = @as(u32, 910); pub const JPOS_CLOSEBRACE = @as(u32, 911); pub const JPOS_YOKUSEI = @as(u32, 912); pub const JPOS_TANSHUKU = @as(u32, 913); pub const VERSION_ID_JAPANESE = @as(u32, 16777216); pub const VERSION_ID_KOREAN = @as(u32, 33554432); pub const VERSION_ID_CHINESE_TRADITIONAL = @as(u32, 67108864); pub const VERSION_ID_CHINESE_SIMPLIFIED = @as(u32, 134217728); pub const FID_MSIME_VERSION = @as(u32, 0); pub const VERSION_MOUSE_OPERATION = @as(u32, 1); pub const IMEMOUSERET_NOTHANDLED = @as(i32, -1); pub const IMEMOUSE_VERSION = @as(u32, 255); pub const IMEMOUSE_NONE = @as(u32, 0); pub const IMEMOUSE_LDOWN = @as(u32, 1); pub const IMEMOUSE_RDOWN = @as(u32, 2); pub const IMEMOUSE_MDOWN = @as(u32, 4); pub const IMEMOUSE_WUP = @as(u32, 16); pub const IMEMOUSE_WDOWN = @as(u32, 32); pub const FID_RECONVERT_VERSION = @as(u32, 268435456); pub const VERSION_RECONVERSION = @as(u32, 1); pub const VERSION_DOCUMENTFEED = @as(u32, 1); pub const VERSION_QUERYPOSITION = @as(u32, 1); pub const VERSION_MODEBIAS = @as(u32, 1); pub const MODEBIAS_GETVERSION = @as(u32, 0); pub const MODEBIAS_SETVALUE = @as(u32, 1); pub const MODEBIAS_GETVALUE = @as(u32, 2); pub const MODEBIASMODE_DEFAULT = @as(u32, 0); pub const MODEBIASMODE_FILENAME = @as(u32, 1); pub const MODEBIASMODE_READING = @as(u32, 2); pub const MODEBIASMODE_DIGIT = @as(u32, 4); pub const SHOWIMEPAD_DEFAULT = @as(u32, 0); pub const SHOWIMEPAD_CATEGORY = @as(u32, 1); pub const SHOWIMEPAD_GUID = @as(u32, 2); pub const FID_MSIME_KMS_VERSION = @as(u32, 1); pub const FID_MSIME_KMS_INIT = @as(u32, 2); pub const FID_MSIME_KMS_TERM = @as(u32, 3); pub const FID_MSIME_KMS_DEL_KEYLIST = @as(u32, 4); pub const FID_MSIME_KMS_NOTIFY = @as(u32, 5); pub const FID_MSIME_KMS_GETMAP = @as(u32, 6); pub const FID_MSIME_KMS_INVOKE = @as(u32, 7); pub const FID_MSIME_KMS_SETMAP = @as(u32, 8); pub const FID_MSIME_KMS_FUNCDESC = @as(u32, 9); pub const FID_MSIME_KMS_GETMAPSEAMLESS = @as(u32, 10); pub const FID_MSIME_KMS_GETMAPFAST = @as(u32, 11); pub const IMEKMS_NOCOMPOSITION = @as(u32, 0); pub const IMEKMS_COMPOSITION = @as(u32, 1); pub const IMEKMS_SELECTION = @as(u32, 2); pub const IMEKMS_IMEOFF = @as(u32, 3); pub const IMEKMS_2NDLEVEL = @as(u32, 4); pub const IMEKMS_INPTGL = @as(u32, 5); pub const IMEKMS_CANDIDATE = @as(u32, 6); pub const IMEKMS_TYPECAND = @as(u32, 7); pub const RECONVOPT_NONE = @as(u32, 0); pub const RECONVOPT_USECANCELNOTIFY = @as(u32, 1); pub const GCSEX_CANCELRECONVERT = @as(u32, 268435456); pub const STYLE_DESCRIPTION_SIZE = @as(u32, 32); pub const IMEMENUITEM_STRING_SIZE = @as(u32, 80); pub const IMC_GETCANDIDATEPOS = @as(u32, 7); pub const IMC_SETCANDIDATEPOS = @as(u32, 8); pub const IMC_GETCOMPOSITIONFONT = @as(u32, 9); pub const IMC_SETCOMPOSITIONFONT = @as(u32, 10); pub const IMC_GETCOMPOSITIONWINDOW = @as(u32, 11); pub const IMC_SETCOMPOSITIONWINDOW = @as(u32, 12); pub const IMC_GETSTATUSWINDOWPOS = @as(u32, 15); pub const IMC_SETSTATUSWINDOWPOS = @as(u32, 16); pub const IMC_CLOSESTATUSWINDOW = @as(u32, 33); pub const IMC_OPENSTATUSWINDOW = @as(u32, 34); pub const NI_FINALIZECONVERSIONRESULT = @as(u32, 20); pub const ISC_SHOWUICANDIDATEWINDOW = @as(u32, 1); pub const ISC_SHOWUICOMPOSITIONWINDOW = @as(u32, 2147483648); pub const ISC_SHOWUIGUIDELINE = @as(u32, 1073741824); pub const ISC_SHOWUIALLCANDIDATEWINDOW = @as(u32, 15); pub const ISC_SHOWUIALL = @as(u32, 3221225487); pub const MOD_LEFT = @as(u32, 32768); pub const MOD_RIGHT = @as(u32, 16384); pub const MOD_ON_KEYUP = @as(u32, 2048); pub const MOD_IGNORE_ALL_MODIFIER = @as(u32, 1024); pub const IME_CHOTKEY_IME_NONIME_TOGGLE = @as(u32, 16); pub const IME_CHOTKEY_SHAPE_TOGGLE = @as(u32, 17); pub const IME_CHOTKEY_SYMBOL_TOGGLE = @as(u32, 18); pub const IME_JHOTKEY_CLOSE_OPEN = @as(u32, 48); pub const IME_KHOTKEY_SHAPE_TOGGLE = @as(u32, 80); pub const IME_KHOTKEY_HANJACONVERT = @as(u32, 81); pub const IME_KHOTKEY_ENGLISH = @as(u32, 82); pub const IME_THOTKEY_IME_NONIME_TOGGLE = @as(u32, 112); pub const IME_THOTKEY_SHAPE_TOGGLE = @as(u32, 113); pub const IME_THOTKEY_SYMBOL_TOGGLE = @as(u32, 114); pub const IME_HOTKEY_DSWITCH_FIRST = @as(u32, 256); pub const IME_HOTKEY_DSWITCH_LAST = @as(u32, 287); pub const IME_HOTKEY_PRIVATE_FIRST = @as(u32, 512); pub const IME_ITHOTKEY_RESEND_RESULTSTR = @as(u32, 512); pub const IME_ITHOTKEY_PREVIOUS_COMPOSITION = @as(u32, 513); pub const IME_ITHOTKEY_UISTYLE_TOGGLE = @as(u32, 514); pub const IME_ITHOTKEY_RECONVERTSTRING = @as(u32, 515); pub const IME_HOTKEY_PRIVATE_LAST = @as(u32, 543); pub const GCS_COMPREADSTR = @as(u32, 1); pub const GCS_COMPREADATTR = @as(u32, 2); pub const GCS_COMPREADCLAUSE = @as(u32, 4); pub const GCS_COMPSTR = @as(u32, 8); pub const GCS_COMPATTR = @as(u32, 16); pub const GCS_COMPCLAUSE = @as(u32, 32); pub const GCS_CURSORPOS = @as(u32, 128); pub const GCS_DELTASTART = @as(u32, 256); pub const GCS_RESULTREADSTR = @as(u32, 512); pub const GCS_RESULTREADCLAUSE = @as(u32, 1024); pub const GCS_RESULTSTR = @as(u32, 2048); pub const GCS_RESULTCLAUSE = @as(u32, 4096); pub const CS_INSERTCHAR = @as(u32, 8192); pub const CS_NOMOVECARET = @as(u32, 16384); pub const IMEVER_0310 = @as(u32, 196618); pub const IMEVER_0400 = @as(u32, 262144); pub const IME_PROP_AT_CARET = @as(u32, 65536); pub const IME_PROP_SPECIAL_UI = @as(u32, 131072); pub const IME_PROP_CANDLIST_START_FROM_1 = @as(u32, 262144); pub const IME_PROP_UNICODE = @as(u32, 524288); pub const IME_PROP_COMPLETE_ON_UNSELECT = @as(u32, 1048576); pub const UI_CAP_2700 = @as(u32, 1); pub const UI_CAP_ROT90 = @as(u32, 2); pub const UI_CAP_ROTANY = @as(u32, 4); pub const SCS_CAP_COMPSTR = @as(u32, 1); pub const SCS_CAP_MAKEREAD = @as(u32, 2); pub const SCS_CAP_SETRECONVERTSTRING = @as(u32, 4); pub const SELECT_CAP_CONVERSION = @as(u32, 1); pub const SELECT_CAP_SENTENCE = @as(u32, 2); pub const GL_LEVEL_NOGUIDELINE = @as(u32, 0); pub const GL_LEVEL_FATAL = @as(u32, 1); pub const GL_LEVEL_ERROR = @as(u32, 2); pub const GL_LEVEL_WARNING = @as(u32, 3); pub const GL_LEVEL_INFORMATION = @as(u32, 4); pub const GL_ID_UNKNOWN = @as(u32, 0); pub const GL_ID_NOMODULE = @as(u32, 1); pub const GL_ID_NODICTIONARY = @as(u32, 16); pub const GL_ID_CANNOTSAVE = @as(u32, 17); pub const GL_ID_NOCONVERT = @as(u32, 32); pub const GL_ID_TYPINGERROR = @as(u32, 33); pub const GL_ID_TOOMANYSTROKE = @as(u32, 34); pub const GL_ID_READINGCONFLICT = @as(u32, 35); pub const GL_ID_INPUTREADING = @as(u32, 36); pub const GL_ID_INPUTRADICAL = @as(u32, 37); pub const GL_ID_INPUTCODE = @as(u32, 38); pub const GL_ID_INPUTSYMBOL = @as(u32, 39); pub const GL_ID_CHOOSECANDIDATE = @as(u32, 40); pub const GL_ID_REVERSECONVERSION = @as(u32, 41); pub const GL_ID_PRIVATE_FIRST = @as(u32, 32768); pub const GL_ID_PRIVATE_LAST = @as(u32, 65535); pub const ATTR_INPUT = @as(u32, 0); pub const ATTR_TARGET_CONVERTED = @as(u32, 1); pub const ATTR_CONVERTED = @as(u32, 2); pub const ATTR_TARGET_NOTCONVERTED = @as(u32, 3); pub const ATTR_INPUT_ERROR = @as(u32, 4); pub const ATTR_FIXEDCONVERTED = @as(u32, 5); pub const CFS_DEFAULT = @as(u32, 0); pub const CFS_RECT = @as(u32, 1); pub const CFS_POINT = @as(u32, 2); pub const CFS_FORCE_POSITION = @as(u32, 32); pub const CFS_CANDIDATEPOS = @as(u32, 64); pub const CFS_EXCLUDE = @as(u32, 128); pub const IME_CMODE_SOFTKBD = @as(u32, 128); pub const IME_CMODE_NOCONVERSION = @as(u32, 256); pub const IME_CMODE_EUDC = @as(u32, 512); pub const IME_CMODE_SYMBOL = @as(u32, 1024); pub const IME_CMODE_FIXED = @as(u32, 2048); pub const IME_CMODE_RESERVED = @as(u32, 4026531840); pub const IME_SMODE_NONE = @as(u32, 0); pub const IME_SMODE_PLAURALCLAUSE = @as(u32, 1); pub const IME_SMODE_SINGLECONVERT = @as(u32, 2); pub const IME_SMODE_AUTOMATIC = @as(u32, 4); pub const IME_SMODE_PHRASEPREDICT = @as(u32, 8); pub const IME_SMODE_CONVERSATION = @as(u32, 16); pub const IME_SMODE_RESERVED = @as(u32, 61440); pub const IME_CAND_UNKNOWN = @as(u32, 0); pub const IME_CAND_READ = @as(u32, 1); pub const IME_CAND_CODE = @as(u32, 2); pub const IME_CAND_MEANING = @as(u32, 3); pub const IME_CAND_RADICAL = @as(u32, 4); pub const IME_CAND_STROKE = @as(u32, 5); pub const IMN_CLOSESTATUSWINDOW = @as(u32, 1); pub const IMN_OPENSTATUSWINDOW = @as(u32, 2); pub const IMN_CHANGECANDIDATE = @as(u32, 3); pub const IMN_CLOSECANDIDATE = @as(u32, 4); pub const IMN_OPENCANDIDATE = @as(u32, 5); pub const IMN_SETCONVERSIONMODE = @as(u32, 6); pub const IMN_SETSENTENCEMODE = @as(u32, 7); pub const IMN_SETOPENSTATUS = @as(u32, 8); pub const IMN_SETCANDIDATEPOS = @as(u32, 9); pub const IMN_SETCOMPOSITIONFONT = @as(u32, 10); pub const IMN_SETCOMPOSITIONWINDOW = @as(u32, 11); pub const IMN_SETSTATUSWINDOWPOS = @as(u32, 12); pub const IMN_GUIDELINE = @as(u32, 13); pub const IMN_PRIVATE = @as(u32, 14); pub const IMR_COMPOSITIONWINDOW = @as(u32, 1); pub const IMR_CANDIDATEWINDOW = @as(u32, 2); pub const IMR_COMPOSITIONFONT = @as(u32, 3); pub const IMR_RECONVERTSTRING = @as(u32, 4); pub const IMR_CONFIRMRECONVERTSTRING = @as(u32, 5); pub const IMR_QUERYCHARPOSITION = @as(u32, 6); pub const IMR_DOCUMENTFEED = @as(u32, 7); pub const IMM_ERROR_NODATA = @as(i32, -1); pub const IMM_ERROR_GENERAL = @as(i32, -2); pub const IME_CONFIG_GENERAL = @as(u32, 1); pub const IME_CONFIG_REGISTERWORD = @as(u32, 2); pub const IME_CONFIG_SELECTDICTIONARY = @as(u32, 3); pub const IME_ESC_QUERY_SUPPORT = @as(u32, 3); pub const IME_ESC_RESERVED_FIRST = @as(u32, 4); pub const IME_ESC_RESERVED_LAST = @as(u32, 2047); pub const IME_ESC_PRIVATE_FIRST = @as(u32, 2048); pub const IME_ESC_PRIVATE_LAST = @as(u32, 4095); pub const IME_ESC_SEQUENCE_TO_INTERNAL = @as(u32, 4097); pub const IME_ESC_GET_EUDC_DICTIONARY = @as(u32, 4099); pub const IME_ESC_SET_EUDC_DICTIONARY = @as(u32, 4100); pub const IME_ESC_MAX_KEY = @as(u32, 4101); pub const IME_ESC_IME_NAME = @as(u32, 4102); pub const IME_ESC_SYNC_HOTKEY = @as(u32, 4103); pub const IME_ESC_HANJA_MODE = @as(u32, 4104); pub const IME_ESC_AUTOMATA = @as(u32, 4105); pub const IME_ESC_PRIVATE_HOTKEY = @as(u32, 4106); pub const IME_ESC_GETHELPFILENAME = @as(u32, 4107); pub const IME_REGWORD_STYLE_EUDC = @as(u32, 1); pub const IME_REGWORD_STYLE_USER_FIRST = @as(u32, 2147483648); pub const IME_REGWORD_STYLE_USER_LAST = @as(u32, 4294967295); pub const IACE_CHILDREN = @as(u32, 1); pub const IACE_DEFAULT = @as(u32, 16); pub const IACE_IGNORENOCONTEXT = @as(u32, 32); pub const IGIMIF_RIGHTMENU = @as(u32, 1); pub const IGIMII_CMODE = @as(u32, 1); pub const IGIMII_SMODE = @as(u32, 2); pub const IGIMII_CONFIGURE = @as(u32, 4); pub const IGIMII_TOOLS = @as(u32, 8); pub const IGIMII_HELP = @as(u32, 16); pub const IGIMII_OTHER = @as(u32, 32); pub const IGIMII_INPUTTOOLS = @as(u32, 64); pub const IMFT_RADIOCHECK = @as(u32, 1); pub const IMFT_SEPARATOR = @as(u32, 2); pub const IMFT_SUBMENU = @as(u32, 4); pub const SOFTKEYBOARD_TYPE_T1 = @as(u32, 1); pub const SOFTKEYBOARD_TYPE_C1 = @as(u32, 2); pub const IMMGWL_IMC = @as(u32, 0); pub const IMMGWLP_IMC = @as(u32, 0); pub const IMC_SETCONVERSIONMODE = @as(u32, 2); pub const IMC_SETSENTENCEMODE = @as(u32, 4); pub const IMC_SETOPENSTATUS = @as(u32, 6); pub const IMC_GETSOFTKBDFONT = @as(u32, 17); pub const IMC_SETSOFTKBDFONT = @as(u32, 18); pub const IMC_GETSOFTKBDPOS = @as(u32, 19); pub const IMC_SETSOFTKBDPOS = @as(u32, 20); pub const IMC_GETSOFTKBDSUBTYPE = @as(u32, 21); pub const IMC_SETSOFTKBDSUBTYPE = @as(u32, 22); pub const IMC_SETSOFTKBDDATA = @as(u32, 24); pub const NI_CONTEXTUPDATED = @as(u32, 3); pub const IME_SYSINFO_WINLOGON = @as(u32, 1); pub const IME_SYSINFO_WOW16 = @as(u32, 2); pub const INIT_STATUSWNDPOS = @as(u32, 1); pub const INIT_CONVERSION = @as(u32, 2); pub const INIT_SENTENCE = @as(u32, 4); pub const INIT_LOGFONT = @as(u32, 8); pub const INIT_COMPFORM = @as(u32, 16); pub const INIT_SOFTKBDPOS = @as(u32, 32); pub const IME_PROP_END_UNLOAD = @as(u32, 1); pub const IME_PROP_KBD_CHAR_FIRST = @as(u32, 2); pub const IME_PROP_IGNORE_UPKEYS = @as(u32, 4); pub const IME_PROP_NEED_ALTKEY = @as(u32, 8); pub const IME_PROP_NO_KEYS_ON_CLOSE = @as(u32, 16); pub const IME_PROP_ACCEPT_WIDE_VKEY = @as(u32, 32); pub const UI_CAP_SOFTKBD = @as(u32, 65536); pub const IMN_SOFTKBDDESTROYED = @as(u32, 17); pub const IME_UI_CLASS_NAME_SIZE = @as(u32, 16); pub const IME_ESC_STRING_BUFFER_SIZE = @as(u32, 80); pub const CATID_MSIME_IImePadApplet_VER7 = Guid.initString("4a0f8e31-c3ee-11d1-afef-00805f0c8b6d"); pub const CATID_MSIME_IImePadApplet_VER80 = Guid.initString("56f7a792-fef1-11d3-8463-00c04f7a06e5"); pub const CATID_MSIME_IImePadApplet_VER81 = Guid.initString("656520b0-bb88-11d4-84c0-00c04f7a06e5"); pub const CATID_MSIME_IImePadApplet900 = Guid.initString("faae51bf-5e5b-4a1d-8de1-17c1d9e1728d"); pub const CATID_MSIME_IImePadApplet1000 = Guid.initString("e081e1d6-2389-43cb-b66f-609f823d9f9c"); pub const CATID_MSIME_IImePadApplet1200 = Guid.initString("a47fb5fc-7d15-4223-a789-b781bf9ae667"); pub const CATID_MSIME_IImePadApplet = Guid.initString("7566cad1-4ec9-4478-9fe9-8ed766619edf"); pub const FEID_NONE = @as(u32, 0); pub const FEID_CHINESE_TRADITIONAL = @as(u32, 1); pub const FEID_CHINESE_SIMPLIFIED = @as(u32, 2); pub const FEID_CHINESE_HONGKONG = @as(u32, 3); pub const FEID_CHINESE_SINGAPORE = @as(u32, 4); pub const FEID_JAPANESE = @as(u32, 5); pub const FEID_KOREAN = @as(u32, 6); pub const FEID_KOREAN_JOHAB = @as(u32, 7); pub const INFOMASK_NONE = @as(u32, 0); pub const INFOMASK_QUERY_CAND = @as(u32, 1); pub const INFOMASK_APPLY_CAND = @as(u32, 2); pub const INFOMASK_APPLY_CAND_EX = @as(u32, 4); pub const INFOMASK_STRING_FIX = @as(u32, 65536); pub const INFOMASK_HIDE_CAND = @as(u32, 131072); pub const INFOMASK_BLOCK_CAND = @as(u32, 262144); pub const IMEFAREASTINFO_TYPE_DEFAULT = @as(u32, 0); pub const IMEFAREASTINFO_TYPE_READING = @as(u32, 1); pub const IMEFAREASTINFO_TYPE_COMMENT = @as(u32, 2); pub const IMEFAREASTINFO_TYPE_COSTTIME = @as(u32, 3); pub const CHARINFO_APPLETID_MASK = @as(u32, 4278190080); pub const CHARINFO_FEID_MASK = @as(u32, 15728640); pub const CHARINFO_CHARID_MASK = @as(u32, 65535); pub const MAX_APPLETTITLE = @as(u32, 64); pub const MAX_FONTFACE = @as(u32, 32); pub const IPACFG_NONE = @as(i32, 0); pub const IPACFG_PROPERTY = @as(i32, 1); pub const IPACFG_HELP = @as(i32, 2); pub const IPACFG_TITLE = @as(i32, 65536); pub const IPACFG_TITLEFONTFACE = @as(i32, 131072); pub const IPACFG_CATEGORY = @as(i32, 262144); pub const IPACFG_LANG = @as(i32, 16); pub const IPACID_NONE = @as(u32, 0); pub const IPACID_SOFTKEY = @as(u32, 1); pub const IPACID_HANDWRITING = @as(u32, 2); pub const IPACID_STROKESEARCH = @as(u32, 3); pub const IPACID_RADICALSEARCH = @as(u32, 4); pub const IPACID_SYMBOLSEARCH = @as(u32, 5); pub const IPACID_VOICE = @as(u32, 6); pub const IPACID_EPWING = @as(u32, 7); pub const IPACID_OCR = @as(u32, 8); pub const IPACID_CHARLIST = @as(u32, 9); pub const IPACID_USER = @as(u32, 256); pub const IMEPADREQ_FIRST = @as(u32, 4096); pub const IMEPADREQ_INSERTSTRINGCANDIDATE = @as(u32, 4098); pub const IMEPADREQ_INSERTITEMCANDIDATE = @as(u32, 4099); pub const IMEPADREQ_SENDKEYCONTROL = @as(u32, 4101); pub const IMEPADREQ_GETSELECTEDSTRING = @as(u32, 4103); pub const IMEPADREQ_SETAPPLETDATA = @as(u32, 4105); pub const IMEPADREQ_GETAPPLETDATA = @as(u32, 4106); pub const IMEPADREQ_SETTITLEFONT = @as(u32, 4107); pub const IMEPADREQ_GETCOMPOSITIONSTRINGID = @as(u32, 4109); pub const IMEPADREQ_INSERTSTRINGCANDIDATEINFO = @as(u32, 4110); pub const IMEPADREQ_CHANGESTRINGCANDIDATEINFO = @as(u32, 4111); pub const IMEPADREQ_INSERTSTRINGINFO = @as(u32, 4114); pub const IMEPADREQ_CHANGESTRINGINFO = @as(u32, 4115); pub const IMEPADREQ_GETCURRENTUILANGID = @as(u32, 4120); pub const IMEPADCTRL_CONVERTALL = @as(u32, 1); pub const IMEPADCTRL_DETERMINALL = @as(u32, 2); pub const IMEPADCTRL_DETERMINCHAR = @as(u32, 3); pub const IMEPADCTRL_CLEARALL = @as(u32, 4); pub const IMEPADCTRL_CARETSET = @as(u32, 5); pub const IMEPADCTRL_CARETLEFT = @as(u32, 6); pub const IMEPADCTRL_CARETRIGHT = @as(u32, 7); pub const IMEPADCTRL_CARETTOP = @as(u32, 8); pub const IMEPADCTRL_CARETBOTTOM = @as(u32, 9); pub const IMEPADCTRL_CARETBACKSPACE = @as(u32, 10); pub const IMEPADCTRL_CARETDELETE = @as(u32, 11); pub const IMEPADCTRL_PHRASEDELETE = @as(u32, 12); pub const IMEPADCTRL_INSERTSPACE = @as(u32, 13); pub const IMEPADCTRL_INSERTFULLSPACE = @as(u32, 14); pub const IMEPADCTRL_INSERTHALFSPACE = @as(u32, 15); pub const IMEPADCTRL_ONIME = @as(u32, 16); pub const IMEPADCTRL_OFFIME = @as(u32, 17); pub const IMEPADCTRL_ONPRECONVERSION = @as(u32, 18); pub const IMEPADCTRL_OFFPRECONVERSION = @as(u32, 19); pub const IMEPADCTRL_PHONETICCANDIDATE = @as(u32, 20); pub const IMEKEYCTRLMASK_ALT = @as(u32, 1); pub const IMEKEYCTRLMASK_CTRL = @as(u32, 2); pub const IMEKEYCTRLMASK_SHIFT = @as(u32, 4); pub const IMEKEYCTRL_UP = @as(u32, 1); pub const IMEKEYCTRL_DOWN = @as(u32, 0); pub const IMEPN_FIRST = @as(u32, 256); pub const IMEPN_ACTIVATE = @as(u32, 257); pub const IMEPN_INACTIVATE = @as(u32, 258); pub const IMEPN_SHOW = @as(u32, 260); pub const IMEPN_HIDE = @as(u32, 261); pub const IMEPN_SIZECHANGING = @as(u32, 262); pub const IMEPN_SIZECHANGED = @as(u32, 263); pub const IMEPN_CONFIG = @as(u32, 264); pub const IMEPN_HELP = @as(u32, 265); pub const IMEPN_QUERYCAND = @as(u32, 266); pub const IMEPN_APPLYCAND = @as(u32, 267); pub const IMEPN_APPLYCANDEX = @as(u32, 268); pub const IMEPN_SETTINGCHANGED = @as(u32, 269); pub const IMEPN_USER = @as(u32, 356); pub const IPAWS_ENABLED = @as(i32, 1); pub const IPAWS_SIZINGNOTIFY = @as(i32, 4); pub const IPAWS_VERTICALFIXED = @as(i32, 256); pub const IPAWS_HORIZONTALFIXED = @as(i32, 512); pub const IPAWS_SIZEFIXED = @as(i32, 768); pub const IPAWS_MAXWIDTHFIXED = @as(i32, 4096); pub const IPAWS_MAXHEIGHTFIXED = @as(i32, 8192); pub const IPAWS_MAXSIZEFIXED = @as(i32, 12288); pub const IPAWS_MINWIDTHFIXED = @as(i32, 65536); pub const IPAWS_MINHEIGHTFIXED = @as(i32, 131072); pub const IPAWS_MINSIZEFIXED = @as(i32, 196608); pub const CLSID_ImePlugInDictDictionaryList_CHS = Guid.initString("7bf0129b-5bef-4de4-9b0b-5edb6<PASSWORD>"); pub const CLSID_ImePlugInDictDictionaryList_JPN = Guid.initString("4fe2776b-b0f9-4396-b5fc-e9d4cf1ec195"); pub const SCRIPT_UNDEFINED = @as(u32, 0); pub const USP_E_SCRIPT_NOT_IN_FONT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220992)); pub const SGCM_RTL = @as(u32, 1); pub const SSA_PASSWORD = @as(u32, 1); pub const SSA_TAB = @as(u32, 2); pub const SSA_CLIP = @as(u32, 4); pub const SSA_FIT = @as(u32, 8); pub const SSA_DZWG = @as(u32, 16); pub const SSA_FALLBACK = @as(u32, 32); pub const SSA_BREAK = @as(u32, 64); pub const SSA_GLYPHS = @as(u32, 128); pub const SSA_RTL = @as(u32, 256); pub const SSA_GCP = @as(u32, 512); pub const SSA_HOTKEY = @as(u32, 1024); pub const SSA_METAFILE = @as(u32, 2048); pub const SSA_LINK = @as(u32, 4096); pub const SSA_HIDEHOTKEY = @as(u32, 8192); pub const SSA_HOTKEYONLY = @as(u32, 9216); pub const SSA_FULLMEASURE = @as(u32, 67108864); pub const SSA_LPKANSIFALLBACK = @as(u32, 134217728); pub const SSA_PIDX = @as(u32, 268435456); pub const SSA_LAYOUTRTL = @as(u32, 536870912); pub const SSA_DONTGLYPH = @as(u32, 1073741824); pub const SSA_NOKASHIDA = @as(u32, 2147483648); pub const SCRIPT_DIGITSUBSTITUTE_CONTEXT = @as(u32, 0); pub const SCRIPT_DIGITSUBSTITUTE_NONE = @as(u32, 1); pub const SCRIPT_DIGITSUBSTITUTE_NATIONAL = @as(u32, 2); pub const SCRIPT_DIGITSUBSTITUTE_TRADITIONAL = @as(u32, 3); pub const UNISCRIBE_OPENTYPE = @as(u32, 256); pub const SCRIPT_TAG_UNKNOWN = @as(u32, 0); pub const MUI_LANGUAGE_EXACT = @as(u32, 16); pub const NLS_CP_CPINFO = @as(u32, 268435456); pub const NLS_CP_MBTOWC = @as(u32, 1073741824); pub const NLS_CP_WCTOMB = @as(u32, 2147483648); pub const U_DISABLE_RENAMING = @as(u32, 1); pub const U_SHOW_CPLUSPLUS_API = @as(u32, 0); pub const U_DEFAULT_SHOW_DRAFT = @as(u32, 0); pub const U_HIDE_DRAFT_API = @as(u32, 1); pub const U_HIDE_DEPRECATED_API = @as(u32, 1); pub const U_HIDE_OBSOLETE_API = @as(u32, 1); pub const U_HIDE_INTERNAL_API = @as(u32, 1); pub const U_NO_DEFAULT_INCLUDE_UTF_HEADERS = @as(u32, 1); pub const UCLN_NO_AUTO_CLEANUP = @as(u32, 1); pub const U_OVERRIDE_CXX_ALLOCATION = @as(u32, 1); pub const U_ENABLE_TRACING = @as(u32, 0); pub const UCONFIG_ENABLE_PLUGINS = @as(u32, 0); pub const U_ENABLE_DYLOAD = @as(u32, 1); pub const U_CHECK_DYLOAD = @as(u32, 1); pub const U_PF_UNKNOWN = @as(u32, 0); pub const U_PF_WINDOWS = @as(u32, 1000); pub const U_PF_MINGW = @as(u32, 1800); pub const U_PF_CYGWIN = @as(u32, 1900); pub const U_PF_HPUX = @as(u32, 2100); pub const U_PF_SOLARIS = @as(u32, 2600); pub const U_PF_BSD = @as(u32, 3000); pub const U_PF_AIX = @as(u32, 3100); pub const U_PF_IRIX = @as(u32, 3200); pub const U_PF_DARWIN = @as(u32, 3500); pub const U_PF_IPHONE = @as(u32, 3550); pub const U_PF_QNX = @as(u32, 3700); pub const U_PF_LINUX = @as(u32, 4000); pub const U_PF_BROWSER_NATIVE_CLIENT = @as(u32, 4020); pub const U_PF_ANDROID = @as(u32, 4050); pub const U_PF_FUCHSIA = @as(u32, 4100); pub const U_PF_OS390 = @as(u32, 9000); pub const U_PF_OS400 = @as(u32, 9400); pub const U_ASCII_FAMILY = @as(u32, 0); pub const U_EBCDIC_FAMILY = @as(u32, 1); pub const U_SIZEOF_UCHAR = @as(u32, 2); pub const U_SENTINEL = @as(i32, -1); pub const U8_MAX_LENGTH = @as(u32, 4); pub const U16_MAX_LENGTH = @as(u32, 2); pub const UTF_SIZE = @as(u32, 16); pub const UTF8_ERROR_VALUE_1 = @as(u32, 21); pub const UTF8_ERROR_VALUE_2 = @as(u32, 159); pub const UTF_ERROR_VALUE = @as(u32, 65535); pub const UTF8_MAX_CHAR_LENGTH = @as(u32, 4); pub const UTF16_MAX_CHAR_LENGTH = @as(u32, 2); pub const UTF32_MAX_CHAR_LENGTH = @as(u32, 1); pub const U_COPYRIGHT_STRING_LENGTH = @as(u32, 128); pub const U_MAX_VERSION_LENGTH = @as(u32, 4); pub const U_MAX_VERSION_STRING_LENGTH = @as(u32, 20); pub const U_MILLIS_PER_SECOND = @as(u32, 1000); pub const U_MILLIS_PER_MINUTE = @as(u32, 60000); pub const U_MILLIS_PER_HOUR = @as(u32, 3600000); pub const U_MILLIS_PER_DAY = @as(u32, 86400000); pub const U_COMBINED_IMPLEMENTATION = @as(u32, 1); pub const U_SHAPE_LENGTH_GROW_SHRINK = @as(u32, 0); pub const U_SHAPE_LAMALEF_RESIZE = @as(u32, 0); pub const U_SHAPE_LENGTH_FIXED_SPACES_NEAR = @as(u32, 1); pub const U_SHAPE_LAMALEF_NEAR = @as(u32, 1); pub const U_SHAPE_LENGTH_FIXED_SPACES_AT_END = @as(u32, 2); pub const U_SHAPE_LAMALEF_END = @as(u32, 2); pub const U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING = @as(u32, 3); pub const U_SHAPE_LAMALEF_BEGIN = @as(u32, 3); pub const U_SHAPE_LAMALEF_AUTO = @as(u32, 65536); pub const U_SHAPE_LENGTH_MASK = @as(u32, 65539); pub const U_SHAPE_LAMALEF_MASK = @as(u32, 65539); pub const U_SHAPE_TEXT_DIRECTION_LOGICAL = @as(u32, 0); pub const U_SHAPE_TEXT_DIRECTION_VISUAL_RTL = @as(u32, 0); pub const U_SHAPE_TEXT_DIRECTION_VISUAL_LTR = @as(u32, 4); pub const U_SHAPE_TEXT_DIRECTION_MASK = @as(u32, 4); pub const U_SHAPE_LETTERS_NOOP = @as(u32, 0); pub const U_SHAPE_LETTERS_SHAPE = @as(u32, 8); pub const U_SHAPE_LETTERS_UNSHAPE = @as(u32, 16); pub const U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED = @as(u32, 24); pub const U_SHAPE_LETTERS_MASK = @as(u32, 24); pub const U_SHAPE_DIGITS_NOOP = @as(u32, 0); pub const U_SHAPE_DIGITS_EN2AN = @as(u32, 32); pub const U_SHAPE_DIGITS_AN2EN = @as(u32, 64); pub const U_SHAPE_DIGITS_ALEN2AN_INIT_LR = @as(u32, 96); pub const U_SHAPE_DIGITS_ALEN2AN_INIT_AL = @as(u32, 128); pub const U_SHAPE_DIGITS_RESERVED = @as(u32, 160); pub const U_SHAPE_DIGITS_MASK = @as(u32, 224); pub const U_SHAPE_DIGIT_TYPE_AN = @as(u32, 0); pub const U_SHAPE_DIGIT_TYPE_AN_EXTENDED = @as(u32, 256); pub const U_SHAPE_DIGIT_TYPE_RESERVED = @as(u32, 512); pub const U_SHAPE_DIGIT_TYPE_MASK = @as(u32, 768); pub const U_SHAPE_AGGREGATE_TASHKEEL = @as(u32, 16384); pub const U_SHAPE_AGGREGATE_TASHKEEL_NOOP = @as(u32, 0); pub const U_SHAPE_AGGREGATE_TASHKEEL_MASK = @as(u32, 16384); pub const U_SHAPE_PRESERVE_PRESENTATION = @as(u32, 32768); pub const U_SHAPE_PRESERVE_PRESENTATION_NOOP = @as(u32, 0); pub const U_SHAPE_PRESERVE_PRESENTATION_MASK = @as(u32, 32768); pub const U_SHAPE_SEEN_TWOCELL_NEAR = @as(u32, 2097152); pub const U_SHAPE_SEEN_MASK = @as(u32, 7340032); pub const U_SHAPE_YEHHAMZA_TWOCELL_NEAR = @as(u32, 16777216); pub const U_SHAPE_YEHHAMZA_MASK = @as(u32, 58720256); pub const U_SHAPE_TASHKEEL_BEGIN = @as(u32, 262144); pub const U_SHAPE_TASHKEEL_END = @as(u32, 393216); pub const U_SHAPE_TASHKEEL_RESIZE = @as(u32, 524288); pub const U_SHAPE_TASHKEEL_REPLACE_BY_TATWEEL = @as(u32, 786432); pub const U_SHAPE_TASHKEEL_MASK = @as(u32, 917504); pub const U_SHAPE_SPACES_RELATIVE_TO_TEXT_BEGIN_END = @as(u32, 67108864); pub const U_SHAPE_SPACES_RELATIVE_TO_TEXT_MASK = @as(u32, 67108864); pub const U_SHAPE_TAIL_NEW_UNICODE = @as(u32, 134217728); pub const U_SHAPE_TAIL_TYPE_MASK = @as(u32, 134217728); pub const ULOC_LANG_CAPACITY = @as(u32, 12); pub const ULOC_COUNTRY_CAPACITY = @as(u32, 4); pub const ULOC_FULLNAME_CAPACITY = @as(u32, 157); pub const ULOC_SCRIPT_CAPACITY = @as(u32, 6); pub const ULOC_KEYWORDS_CAPACITY = @as(u32, 96); pub const ULOC_KEYWORD_AND_VALUES_CAPACITY = @as(u32, 100); pub const ULOC_KEYWORD_SEPARATOR_UNICODE = @as(u32, 64); pub const ULOC_KEYWORD_ASSIGN_UNICODE = @as(u32, 61); pub const ULOC_KEYWORD_ITEM_SEPARATOR_UNICODE = @as(u32, 59); pub const UCNV_MAX_CONVERTER_NAME_LENGTH = @as(u32, 60); pub const UCNV_SI = @as(u32, 15); pub const UCNV_SO = @as(u32, 14); pub const U_FOLD_CASE_DEFAULT = @as(u32, 0); pub const U_FOLD_CASE_EXCLUDE_SPECIAL_I = @as(u32, 1); pub const U_TITLECASE_WHOLE_STRING = @as(u32, 32); pub const U_TITLECASE_SENTENCES = @as(u32, 64); pub const U_TITLECASE_NO_LOWERCASE = @as(u32, 256); pub const U_TITLECASE_NO_BREAK_ADJUSTMENT = @as(u32, 512); pub const U_TITLECASE_ADJUST_TO_CASED = @as(u32, 1024); pub const U_EDITS_NO_RESET = @as(u32, 8192); pub const U_OMIT_UNCHANGED_TEXT = @as(u32, 16384); pub const U_COMPARE_CODE_POINT_ORDER = @as(u32, 32768); pub const U_COMPARE_IGNORE_CASE = @as(u32, 65536); pub const UNORM_INPUT_IS_FCD = @as(u32, 131072); pub const UCHAR_MIN_VALUE = @as(u32, 0); pub const UCHAR_MAX_VALUE = @as(u32, 1114111); pub const UBIDI_DEFAULT_LTR = @as(u32, 254); pub const UBIDI_DEFAULT_RTL = @as(u32, 255); pub const UBIDI_MAX_EXPLICIT_LEVEL = @as(u32, 125); pub const UBIDI_LEVEL_OVERRIDE = @as(u32, 128); pub const UBIDI_MAP_NOWHERE = @as(i32, -1); pub const UBIDI_KEEP_BASE_COMBINING = @as(u32, 1); pub const UBIDI_DO_MIRRORING = @as(u32, 2); pub const UBIDI_INSERT_LRM_FOR_NUMERIC = @as(u32, 4); pub const UBIDI_REMOVE_BIDI_CONTROLS = @as(u32, 8); pub const UBIDI_OUTPUT_REVERSE = @as(u32, 16); pub const USPREP_DEFAULT = @as(u32, 0); pub const USPREP_ALLOW_UNASSIGNED = @as(u32, 1); pub const USEARCH_DONE = @as(i32, -1); pub const UITER_UNKNOWN_INDEX = @as(i32, -2); pub const UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE = @as(i32, 1); pub const UTEXT_PROVIDER_STABLE_CHUNKS = @as(i32, 2); pub const UTEXT_PROVIDER_WRITABLE = @as(i32, 3); pub const UTEXT_PROVIDER_HAS_META_DATA = @as(i32, 4); pub const UTEXT_PROVIDER_OWNS_TEXT = @as(i32, 5); pub const UTEXT_MAGIC = @as(i32, 878368812); pub const USET_IGNORE_SPACE = @as(i32, 1); pub const USET_CASE_INSENSITIVE = @as(i32, 2); pub const USET_ADD_CASE_MAPPINGS = @as(i32, 4); pub const USET_SERIALIZED_STATIC_ARRAY_CAPACITY = @as(i32, 8); pub const U_PARSE_CONTEXT_LEN = @as(i32, 16); pub const UIDNA_DEFAULT = @as(i32, 0); pub const UIDNA_USE_STD3_RULES = @as(i32, 2); pub const UIDNA_CHECK_BIDI = @as(i32, 4); pub const UIDNA_CHECK_CONTEXTJ = @as(i32, 8); pub const UIDNA_NONTRANSITIONAL_TO_ASCII = @as(i32, 16); pub const UIDNA_NONTRANSITIONAL_TO_UNICODE = @as(i32, 32); pub const UIDNA_CHECK_CONTEXTO = @as(i32, 64); pub const UIDNA_ERROR_EMPTY_LABEL = @as(i32, 1); pub const UIDNA_ERROR_LABEL_TOO_LONG = @as(i32, 2); pub const UIDNA_ERROR_DOMAIN_NAME_TOO_LONG = @as(i32, 4); pub const UIDNA_ERROR_LEADING_HYPHEN = @as(i32, 8); pub const UIDNA_ERROR_TRAILING_HYPHEN = @as(i32, 16); pub const UIDNA_ERROR_HYPHEN_3_4 = @as(i32, 32); pub const UIDNA_ERROR_LEADING_COMBINING_MARK = @as(i32, 64); pub const UIDNA_ERROR_DISALLOWED = @as(i32, 128); pub const UIDNA_ERROR_PUNYCODE = @as(i32, 256); pub const UIDNA_ERROR_LABEL_HAS_DOT = @as(i32, 512); pub const UIDNA_ERROR_INVALID_ACE_LABEL = @as(i32, 1024); pub const UIDNA_ERROR_BIDI = @as(i32, 2048); pub const UIDNA_ERROR_CONTEXTJ = @as(i32, 4096); pub const UIDNA_ERROR_CONTEXTO_PUNCTUATION = @as(i32, 8192); pub const UIDNA_ERROR_CONTEXTO_DIGITS = @as(i32, 16384); //-------------------------------------------------------------------------------- // Section: Types (358) //-------------------------------------------------------------------------------- pub const FOLD_STRING_MAP_FLAGS = enum(u32) { COMPOSITE = 64, EXPAND_LIGATURES = 8192, FOLDCZONE = 16, FOLDDIGITS = 128, PRECOMPOSED = 32, _, pub fn initFlags(o: struct { COMPOSITE: u1 = 0, EXPAND_LIGATURES: u1 = 0, FOLDCZONE: u1 = 0, FOLDDIGITS: u1 = 0, PRECOMPOSED: u1 = 0, }) FOLD_STRING_MAP_FLAGS { return @intToEnum(FOLD_STRING_MAP_FLAGS, (if (o.COMPOSITE == 1) @enumToInt(FOLD_STRING_MAP_FLAGS.COMPOSITE) else 0) | (if (o.EXPAND_LIGATURES == 1) @enumToInt(FOLD_STRING_MAP_FLAGS.EXPAND_LIGATURES) else 0) | (if (o.FOLDCZONE == 1) @enumToInt(FOLD_STRING_MAP_FLAGS.FOLDCZONE) else 0) | (if (o.FOLDDIGITS == 1) @enumToInt(FOLD_STRING_MAP_FLAGS.FOLDDIGITS) else 0) | (if (o.PRECOMPOSED == 1) @enumToInt(FOLD_STRING_MAP_FLAGS.PRECOMPOSED) else 0) ); } }; pub const MAP_COMPOSITE = FOLD_STRING_MAP_FLAGS.COMPOSITE; pub const MAP_EXPAND_LIGATURES = FOLD_STRING_MAP_FLAGS.EXPAND_LIGATURES; pub const MAP_FOLDCZONE = FOLD_STRING_MAP_FLAGS.FOLDCZONE; pub const MAP_FOLDDIGITS = FOLD_STRING_MAP_FLAGS.FOLDDIGITS; pub const MAP_PRECOMPOSED = FOLD_STRING_MAP_FLAGS.PRECOMPOSED; pub const SET_COMPOSITION_STRING_TYPE = enum(u32) { SETSTR = 9, CHANGEATTR = 18, CHANGECLAUSE = 36, SETRECONVERTSTRING = 65536, QUERYRECONVERTSTRING = 131072, }; pub const SCS_SETSTR = SET_COMPOSITION_STRING_TYPE.SETSTR; pub const SCS_CHANGEATTR = SET_COMPOSITION_STRING_TYPE.CHANGEATTR; pub const SCS_CHANGECLAUSE = SET_COMPOSITION_STRING_TYPE.CHANGECLAUSE; pub const SCS_SETRECONVERTSTRING = SET_COMPOSITION_STRING_TYPE.SETRECONVERTSTRING; pub const SCS_QUERYRECONVERTSTRING = SET_COMPOSITION_STRING_TYPE.QUERYRECONVERTSTRING; pub const GET_GUIDE_LINE_TYPE = enum(u32) { LEVEL = 1, INDEX = 2, STRING = 3, PRIVATE = 4, }; pub const GGL_LEVEL = GET_GUIDE_LINE_TYPE.LEVEL; pub const GGL_INDEX = GET_GUIDE_LINE_TYPE.INDEX; pub const GGL_STRING = GET_GUIDE_LINE_TYPE.STRING; pub const GGL_PRIVATE = GET_GUIDE_LINE_TYPE.PRIVATE; pub const ENUM_DATE_FORMATS_FLAGS = enum(u32) { SHORTDATE = 1, LONGDATE = 2, YEARMONTH = 8, MONTHDAY = 128, AUTOLAYOUT = 64, LTRREADING = 16, RTLREADING = 32, USE_ALT_CALENDAR = 4, }; pub const DATE_SHORTDATE = ENUM_DATE_FORMATS_FLAGS.SHORTDATE; pub const DATE_LONGDATE = ENUM_DATE_FORMATS_FLAGS.LONGDATE; pub const DATE_YEARMONTH = ENUM_DATE_FORMATS_FLAGS.YEARMONTH; pub const DATE_MONTHDAY = ENUM_DATE_FORMATS_FLAGS.MONTHDAY; pub const DATE_AUTOLAYOUT = ENUM_DATE_FORMATS_FLAGS.AUTOLAYOUT; pub const DATE_LTRREADING = ENUM_DATE_FORMATS_FLAGS.LTRREADING; pub const DATE_RTLREADING = ENUM_DATE_FORMATS_FLAGS.RTLREADING; pub const DATE_USE_ALT_CALENDAR = ENUM_DATE_FORMATS_FLAGS.USE_ALT_CALENDAR; pub const NOTIFY_IME_INDEX = enum(u32) { CANCEL = 4, COMPLETE = 1, CONVERT = 2, REVERT = 3, }; pub const CPS_CANCEL = NOTIFY_IME_INDEX.CANCEL; pub const CPS_COMPLETE = NOTIFY_IME_INDEX.COMPLETE; pub const CPS_CONVERT = NOTIFY_IME_INDEX.CONVERT; pub const CPS_REVERT = NOTIFY_IME_INDEX.REVERT; pub const TRANSLATE_CHARSET_INFO_FLAGS = enum(u32) { CHARSET = 1, CODEPAGE = 2, FONTSIG = 3, LOCALE = 4096, }; pub const TCI_SRCCHARSET = TRANSLATE_CHARSET_INFO_FLAGS.CHARSET; pub const TCI_SRCCODEPAGE = TRANSLATE_CHARSET_INFO_FLAGS.CODEPAGE; pub const TCI_SRCFONTSIG = TRANSLATE_CHARSET_INFO_FLAGS.FONTSIG; pub const TCI_SRCLOCALE = TRANSLATE_CHARSET_INFO_FLAGS.LOCALE; pub const TIME_FORMAT_FLAGS = enum(u32) { NOMINUTESORSECONDS = 1, NOSECONDS = 2, NOTIMEMARKER = 4, FORCE24HOURFORMAT = 8, _, pub fn initFlags(o: struct { NOMINUTESORSECONDS: u1 = 0, NOSECONDS: u1 = 0, NOTIMEMARKER: u1 = 0, FORCE24HOURFORMAT: u1 = 0, }) TIME_FORMAT_FLAGS { return @intToEnum(TIME_FORMAT_FLAGS, (if (o.NOMINUTESORSECONDS == 1) @enumToInt(TIME_FORMAT_FLAGS.NOMINUTESORSECONDS) else 0) | (if (o.NOSECONDS == 1) @enumToInt(TIME_FORMAT_FLAGS.NOSECONDS) else 0) | (if (o.NOTIMEMARKER == 1) @enumToInt(TIME_FORMAT_FLAGS.NOTIMEMARKER) else 0) | (if (o.FORCE24HOURFORMAT == 1) @enumToInt(TIME_FORMAT_FLAGS.FORCE24HOURFORMAT) else 0) ); } }; pub const TIME_NOMINUTESORSECONDS = TIME_FORMAT_FLAGS.NOMINUTESORSECONDS; pub const TIME_NOSECONDS = TIME_FORMAT_FLAGS.NOSECONDS; pub const TIME_NOTIMEMARKER = TIME_FORMAT_FLAGS.NOTIMEMARKER; pub const TIME_FORCE24HOURFORMAT = TIME_FORMAT_FLAGS.FORCE24HOURFORMAT; pub const NOTIFY_IME_ACTION = enum(u32) { CHANGECANDIDATELIST = 19, CLOSECANDIDATE = 17, COMPOSITIONSTR = 21, IMEMENUSELECTED = 24, OPENCANDIDATE = 16, SELECTCANDIDATESTR = 18, SETCANDIDATE_PAGESIZE = 23, SETCANDIDATE_PAGESTART = 22, }; pub const NI_CHANGECANDIDATELIST = NOTIFY_IME_ACTION.CHANGECANDIDATELIST; pub const NI_CLOSECANDIDATE = NOTIFY_IME_ACTION.CLOSECANDIDATE; pub const NI_COMPOSITIONSTR = NOTIFY_IME_ACTION.COMPOSITIONSTR; pub const NI_IMEMENUSELECTED = NOTIFY_IME_ACTION.IMEMENUSELECTED; pub const NI_OPENCANDIDATE = NOTIFY_IME_ACTION.OPENCANDIDATE; pub const NI_SELECTCANDIDATESTR = NOTIFY_IME_ACTION.SELECTCANDIDATESTR; pub const NI_SETCANDIDATE_PAGESIZE = NOTIFY_IME_ACTION.SETCANDIDATE_PAGESIZE; pub const NI_SETCANDIDATE_PAGESTART = NOTIFY_IME_ACTION.SETCANDIDATE_PAGESTART; pub const GET_CONVERSION_LIST_FLAG = enum(u32) { CONVERSION = 1, REVERSECONVERSION = 2, REVERSE_LENGTH = 3, }; pub const GCL_CONVERSION = GET_CONVERSION_LIST_FLAG.CONVERSION; pub const GCL_REVERSECONVERSION = GET_CONVERSION_LIST_FLAG.REVERSECONVERSION; pub const GCL_REVERSE_LENGTH = GET_CONVERSION_LIST_FLAG.REVERSE_LENGTH; pub const ENUM_SYSTEM_LANGUAGE_GROUPS_FLAGS = enum(u32) { INSTALLED = 1, SUPPORTED = 2, }; pub const LGRPID_INSTALLED = ENUM_SYSTEM_LANGUAGE_GROUPS_FLAGS.INSTALLED; pub const LGRPID_SUPPORTED = ENUM_SYSTEM_LANGUAGE_GROUPS_FLAGS.SUPPORTED; pub const MULTI_BYTE_TO_WIDE_CHAR_FLAGS = enum(u32) { COMPOSITE = 2, ERR_INVALID_CHARS = 8, PRECOMPOSED = 1, USEGLYPHCHARS = 4, _, pub fn initFlags(o: struct { COMPOSITE: u1 = 0, ERR_INVALID_CHARS: u1 = 0, PRECOMPOSED: u1 = 0, USEGLYPHCHARS: u1 = 0, }) MULTI_BYTE_TO_WIDE_CHAR_FLAGS { return @intToEnum(MULTI_BYTE_TO_WIDE_CHAR_FLAGS, (if (o.COMPOSITE == 1) @enumToInt(MULTI_BYTE_TO_WIDE_CHAR_FLAGS.COMPOSITE) else 0) | (if (o.ERR_INVALID_CHARS == 1) @enumToInt(MULTI_BYTE_TO_WIDE_CHAR_FLAGS.ERR_INVALID_CHARS) else 0) | (if (o.PRECOMPOSED == 1) @enumToInt(MULTI_BYTE_TO_WIDE_CHAR_FLAGS.PRECOMPOSED) else 0) | (if (o.USEGLYPHCHARS == 1) @enumToInt(MULTI_BYTE_TO_WIDE_CHAR_FLAGS.USEGLYPHCHARS) else 0) ); } }; pub const MB_COMPOSITE = MULTI_BYTE_TO_WIDE_CHAR_FLAGS.COMPOSITE; pub const MB_ERR_INVALID_CHARS = MULTI_BYTE_TO_WIDE_CHAR_FLAGS.ERR_INVALID_CHARS; pub const MB_PRECOMPOSED = MULTI_BYTE_TO_WIDE_CHAR_FLAGS.PRECOMPOSED; pub const MB_USEGLYPHCHARS = MULTI_BYTE_TO_WIDE_CHAR_FLAGS.USEGLYPHCHARS; pub const COMPARE_STRING_FLAGS = enum(u32) { LINGUISTIC_IGNORECASE = 16, LINGUISTIC_IGNOREDIACRITIC = 32, NORM_IGNORECASE = 1, NORM_IGNOREKANATYPE = 65536, NORM_IGNORENONSPACE = 2, NORM_IGNORESYMBOLS = 4, NORM_IGNOREWIDTH = 131072, NORM_LINGUISTIC_CASING = 134217728, SORT_DIGITSASNUMBERS = 8, SORT_STRINGSORT = 4096, _, pub fn initFlags(o: struct { LINGUISTIC_IGNORECASE: u1 = 0, LINGUISTIC_IGNOREDIACRITIC: u1 = 0, NORM_IGNORECASE: u1 = 0, NORM_IGNOREKANATYPE: u1 = 0, NORM_IGNORENONSPACE: u1 = 0, NORM_IGNORESYMBOLS: u1 = 0, NORM_IGNOREWIDTH: u1 = 0, NORM_LINGUISTIC_CASING: u1 = 0, SORT_DIGITSASNUMBERS: u1 = 0, SORT_STRINGSORT: u1 = 0, }) COMPARE_STRING_FLAGS { return @intToEnum(COMPARE_STRING_FLAGS, (if (o.LINGUISTIC_IGNORECASE == 1) @enumToInt(COMPARE_STRING_FLAGS.LINGUISTIC_IGNORECASE) else 0) | (if (o.LINGUISTIC_IGNOREDIACRITIC == 1) @enumToInt(COMPARE_STRING_FLAGS.LINGUISTIC_IGNOREDIACRITIC) else 0) | (if (o.NORM_IGNORECASE == 1) @enumToInt(COMPARE_STRING_FLAGS.NORM_IGNORECASE) else 0) | (if (o.NORM_IGNOREKANATYPE == 1) @enumToInt(COMPARE_STRING_FLAGS.NORM_IGNOREKANATYPE) else 0) | (if (o.NORM_IGNORENONSPACE == 1) @enumToInt(COMPARE_STRING_FLAGS.NORM_IGNORENONSPACE) else 0) | (if (o.NORM_IGNORESYMBOLS == 1) @enumToInt(COMPARE_STRING_FLAGS.NORM_IGNORESYMBOLS) else 0) | (if (o.NORM_IGNOREWIDTH == 1) @enumToInt(COMPARE_STRING_FLAGS.NORM_IGNOREWIDTH) else 0) | (if (o.NORM_LINGUISTIC_CASING == 1) @enumToInt(COMPARE_STRING_FLAGS.NORM_LINGUISTIC_CASING) else 0) | (if (o.SORT_DIGITSASNUMBERS == 1) @enumToInt(COMPARE_STRING_FLAGS.SORT_DIGITSASNUMBERS) else 0) | (if (o.SORT_STRINGSORT == 1) @enumToInt(COMPARE_STRING_FLAGS.SORT_STRINGSORT) else 0) ); } }; pub const LINGUISTIC_IGNORECASE = COMPARE_STRING_FLAGS.LINGUISTIC_IGNORECASE; pub const LINGUISTIC_IGNOREDIACRITIC = COMPARE_STRING_FLAGS.LINGUISTIC_IGNOREDIACRITIC; pub const NORM_IGNORECASE = COMPARE_STRING_FLAGS.NORM_IGNORECASE; pub const NORM_IGNOREKANATYPE = COMPARE_STRING_FLAGS.NORM_IGNOREKANATYPE; pub const NORM_IGNORENONSPACE = COMPARE_STRING_FLAGS.NORM_IGNORENONSPACE; pub const NORM_IGNORESYMBOLS = COMPARE_STRING_FLAGS.NORM_IGNORESYMBOLS; pub const NORM_IGNOREWIDTH = COMPARE_STRING_FLAGS.NORM_IGNOREWIDTH; pub const NORM_LINGUISTIC_CASING = COMPARE_STRING_FLAGS.NORM_LINGUISTIC_CASING; pub const SORT_DIGITSASNUMBERS = COMPARE_STRING_FLAGS.SORT_DIGITSASNUMBERS; pub const SORT_STRINGSORT = COMPARE_STRING_FLAGS.SORT_STRINGSORT; pub const IS_VALID_LOCALE_FLAGS = enum(u32) { INSTALLED = 1, SUPPORTED = 2, }; pub const LCID_INSTALLED = IS_VALID_LOCALE_FLAGS.INSTALLED; pub const LCID_SUPPORTED = IS_VALID_LOCALE_FLAGS.SUPPORTED; pub const ENUM_SYSTEM_CODE_PAGES_FLAGS = enum(u32) { INSTALLED = 1, SUPPORTED = 2, }; pub const CP_INSTALLED = ENUM_SYSTEM_CODE_PAGES_FLAGS.INSTALLED; pub const CP_SUPPORTED = ENUM_SYSTEM_CODE_PAGES_FLAGS.SUPPORTED; pub const IME_PAD_REQUEST_FLAGS = enum(u32) { INSERTSTRING = 4097, SENDCONTROL = 4100, SETAPPLETSIZE = 4104, GETCOMPOSITIONSTRING = 4102, GETCOMPOSITIONSTRINGINFO = 4108, DELETESTRING = 4112, CHANGESTRING = 4113, GETAPPLHWND = 4116, FORCEIMEPADWINDOWSHOW = 4117, POSTMODALNOTIFY = 4118, GETDEFAULTUILANGID = 4119, GETAPPLETUISTYLE = 4121, SETAPPLETUISTYLE = 4122, ISAPPLETACTIVE = 4123, ISIMEPADWINDOWVISIBLE = 4124, SETAPPLETMINMAXSIZE = 4125, GETCONVERSIONSTATUS = 4126, GETVERSION = 4127, GETCURRENTIMEINFO = 4128, }; pub const IMEPADREQ_INSERTSTRING = IME_PAD_REQUEST_FLAGS.INSERTSTRING; pub const IMEPADREQ_SENDCONTROL = IME_PAD_REQUEST_FLAGS.SENDCONTROL; pub const IMEPADREQ_SETAPPLETSIZE = IME_PAD_REQUEST_FLAGS.SETAPPLETSIZE; pub const IMEPADREQ_GETCOMPOSITIONSTRING = IME_PAD_REQUEST_FLAGS.GETCOMPOSITIONSTRING; pub const IMEPADREQ_GETCOMPOSITIONSTRINGINFO = IME_PAD_REQUEST_FLAGS.GETCOMPOSITIONSTRINGINFO; pub const IMEPADREQ_DELETESTRING = IME_PAD_REQUEST_FLAGS.DELETESTRING; pub const IMEPADREQ_CHANGESTRING = IME_PAD_REQUEST_FLAGS.CHANGESTRING; pub const IMEPADREQ_GETAPPLHWND = IME_PAD_REQUEST_FLAGS.GETAPPLHWND; pub const IMEPADREQ_FORCEIMEPADWINDOWSHOW = IME_PAD_REQUEST_FLAGS.FORCEIMEPADWINDOWSHOW; pub const IMEPADREQ_POSTMODALNOTIFY = IME_PAD_REQUEST_FLAGS.POSTMODALNOTIFY; pub const IMEPADREQ_GETDEFAULTUILANGID = IME_PAD_REQUEST_FLAGS.GETDEFAULTUILANGID; pub const IMEPADREQ_GETAPPLETUISTYLE = IME_PAD_REQUEST_FLAGS.GETAPPLETUISTYLE; pub const IMEPADREQ_SETAPPLETUISTYLE = IME_PAD_REQUEST_FLAGS.SETAPPLETUISTYLE; pub const IMEPADREQ_ISAPPLETACTIVE = IME_PAD_REQUEST_FLAGS.ISAPPLETACTIVE; pub const IMEPADREQ_ISIMEPADWINDOWVISIBLE = IME_PAD_REQUEST_FLAGS.ISIMEPADWINDOWVISIBLE; pub const IMEPADREQ_SETAPPLETMINMAXSIZE = IME_PAD_REQUEST_FLAGS.SETAPPLETMINMAXSIZE; pub const IMEPADREQ_GETCONVERSIONSTATUS = IME_PAD_REQUEST_FLAGS.GETCONVERSIONSTATUS; pub const IMEPADREQ_GETVERSION = IME_PAD_REQUEST_FLAGS.GETVERSION; pub const IMEPADREQ_GETCURRENTIMEINFO = IME_PAD_REQUEST_FLAGS.GETCURRENTIMEINFO; pub const SCRIPT_IS_COMPLEX_FLAGS = enum(u32) { ASCIIDIGIT = 2, COMPLEX = 1, NEUTRAL = 4, }; pub const SIC_ASCIIDIGIT = SCRIPT_IS_COMPLEX_FLAGS.ASCIIDIGIT; pub const SIC_COMPLEX = SCRIPT_IS_COMPLEX_FLAGS.COMPLEX; pub const SIC_NEUTRAL = SCRIPT_IS_COMPLEX_FLAGS.NEUTRAL; pub const IS_TEXT_UNICODE_RESULT = enum(u32) { ASCII16 = 1, REVERSE_ASCII16 = 16, STATISTICS = 2, REVERSE_STATISTICS = 32, CONTROLS = 4, REVERSE_CONTROLS = 64, SIGNATURE = 8, REVERSE_SIGNATURE = 128, ILLEGAL_CHARS = 256, ODD_LENGTH = 512, NULL_BYTES = 4096, UNICODE_MASK = 15, REVERSE_MASK = 240, NOT_UNICODE_MASK = 3840, NOT_ASCII_MASK = 61440, _, pub fn initFlags(o: struct { ASCII16: u1 = 0, REVERSE_ASCII16: u1 = 0, STATISTICS: u1 = 0, REVERSE_STATISTICS: u1 = 0, CONTROLS: u1 = 0, REVERSE_CONTROLS: u1 = 0, SIGNATURE: u1 = 0, REVERSE_SIGNATURE: u1 = 0, ILLEGAL_CHARS: u1 = 0, ODD_LENGTH: u1 = 0, NULL_BYTES: u1 = 0, UNICODE_MASK: u1 = 0, REVERSE_MASK: u1 = 0, NOT_UNICODE_MASK: u1 = 0, NOT_ASCII_MASK: u1 = 0, }) IS_TEXT_UNICODE_RESULT { return @intToEnum(IS_TEXT_UNICODE_RESULT, (if (o.ASCII16 == 1) @enumToInt(IS_TEXT_UNICODE_RESULT.ASCII16) else 0) | (if (o.REVERSE_ASCII16 == 1) @enumToInt(IS_TEXT_UNICODE_RESULT.REVERSE_ASCII16) else 0) | (if (o.STATISTICS == 1) @enumToInt(IS_TEXT_UNICODE_RESULT.STATISTICS) else 0) | (if (o.REVERSE_STATISTICS == 1) @enumToInt(IS_TEXT_UNICODE_RESULT.REVERSE_STATISTICS) else 0) | (if (o.CONTROLS == 1) @enumToInt(IS_TEXT_UNICODE_RESULT.CONTROLS) else 0) | (if (o.REVERSE_CONTROLS == 1) @enumToInt(IS_TEXT_UNICODE_RESULT.REVERSE_CONTROLS) else 0) | (if (o.SIGNATURE == 1) @enumToInt(IS_TEXT_UNICODE_RESULT.SIGNATURE) else 0) | (if (o.REVERSE_SIGNATURE == 1) @enumToInt(IS_TEXT_UNICODE_RESULT.REVERSE_SIGNATURE) else 0) | (if (o.ILLEGAL_CHARS == 1) @enumToInt(IS_TEXT_UNICODE_RESULT.ILLEGAL_CHARS) else 0) | (if (o.ODD_LENGTH == 1) @enumToInt(IS_TEXT_UNICODE_RESULT.ODD_LENGTH) else 0) | (if (o.NULL_BYTES == 1) @enumToInt(IS_TEXT_UNICODE_RESULT.NULL_BYTES) else 0) | (if (o.UNICODE_MASK == 1) @enumToInt(IS_TEXT_UNICODE_RESULT.UNICODE_MASK) else 0) | (if (o.REVERSE_MASK == 1) @enumToInt(IS_TEXT_UNICODE_RESULT.REVERSE_MASK) else 0) | (if (o.NOT_UNICODE_MASK == 1) @enumToInt(IS_TEXT_UNICODE_RESULT.NOT_UNICODE_MASK) else 0) | (if (o.NOT_ASCII_MASK == 1) @enumToInt(IS_TEXT_UNICODE_RESULT.NOT_ASCII_MASK) else 0) ); } }; pub const IS_TEXT_UNICODE_ASCII16 = IS_TEXT_UNICODE_RESULT.ASCII16; pub const IS_TEXT_UNICODE_REVERSE_ASCII16 = IS_TEXT_UNICODE_RESULT.REVERSE_ASCII16; pub const IS_TEXT_UNICODE_STATISTICS = IS_TEXT_UNICODE_RESULT.STATISTICS; pub const IS_TEXT_UNICODE_REVERSE_STATISTICS = IS_TEXT_UNICODE_RESULT.REVERSE_STATISTICS; pub const IS_TEXT_UNICODE_CONTROLS = IS_TEXT_UNICODE_RESULT.CONTROLS; pub const IS_TEXT_UNICODE_REVERSE_CONTROLS = IS_TEXT_UNICODE_RESULT.REVERSE_CONTROLS; pub const IS_TEXT_UNICODE_SIGNATURE = IS_TEXT_UNICODE_RESULT.SIGNATURE; pub const IS_TEXT_UNICODE_REVERSE_SIGNATURE = IS_TEXT_UNICODE_RESULT.REVERSE_SIGNATURE; pub const IS_TEXT_UNICODE_ILLEGAL_CHARS = IS_TEXT_UNICODE_RESULT.ILLEGAL_CHARS; pub const IS_TEXT_UNICODE_ODD_LENGTH = IS_TEXT_UNICODE_RESULT.ODD_LENGTH; pub const IS_TEXT_UNICODE_NULL_BYTES = IS_TEXT_UNICODE_RESULT.NULL_BYTES; pub const IS_TEXT_UNICODE_UNICODE_MASK = IS_TEXT_UNICODE_RESULT.UNICODE_MASK; pub const IS_TEXT_UNICODE_REVERSE_MASK = IS_TEXT_UNICODE_RESULT.REVERSE_MASK; pub const IS_TEXT_UNICODE_NOT_UNICODE_MASK = IS_TEXT_UNICODE_RESULT.NOT_UNICODE_MASK; pub const IS_TEXT_UNICODE_NOT_ASCII_MASK = IS_TEXT_UNICODE_RESULT.NOT_ASCII_MASK; pub const UEnumeration = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UResourceBundle = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const ULocaleDisplayNames = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UConverter = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const USet = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UBiDi = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UBiDiTransform = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UNormalizer2 = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UConverterSelector = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UBreakIterator = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UCaseMap = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UStringPrepProfile = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UIDNA = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UCollator = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UCollationElements = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UCharsetDetector = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UCharsetMatch = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UFieldPositionIterator = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UDateIntervalFormat = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UGenderInfo = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UListFormatter = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const ULocaleData = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UDateFormatSymbols = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UNumberFormatter = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UFormattedNumber = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UNumberingSystem = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UPluralRules = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const URegularExpression = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const URegion = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const URelativeDateTimeFormatter = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const UStringSearch = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const USpoofChecker = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const USpoofCheckResult = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const HIMC = *opaque{}; pub const HIMCC = *opaque{}; pub const HSAVEDUILANGUAGES = *opaque{}; pub const FONTSIGNATURE = extern struct { fsUsb: [4]u32, fsCsb: [2]u32, }; pub const CHARSETINFO = extern struct { ciCharset: u32, ciACP: u32, fs: FONTSIGNATURE, }; pub const LOCALESIGNATURE = extern struct { lsUsb: [4]u32, lsCsbDefault: [2]u32, lsCsbSupported: [2]u32, }; pub const CPINFO = extern struct { MaxCharSize: u32, DefaultChar: [2]u8, LeadByte: [12]u8, }; pub const CPINFOEXA = extern struct { MaxCharSize: u32, DefaultChar: [2]u8, LeadByte: [12]u8, UnicodeDefaultChar: u16, CodePage: u32, CodePageName: [260]CHAR, }; pub const CPINFOEXW = extern struct { MaxCharSize: u32, DefaultChar: [2]u8, LeadByte: [12]u8, UnicodeDefaultChar: u16, CodePage: u32, CodePageName: [260]u16, }; pub const NUMBERFMTA = extern struct { NumDigits: u32, LeadingZero: u32, Grouping: u32, lpDecimalSep: ?PSTR, lpThousandSep: ?PSTR, NegativeOrder: u32, }; pub const NUMBERFMTW = extern struct { NumDigits: u32, LeadingZero: u32, Grouping: u32, lpDecimalSep: ?PWSTR, lpThousandSep: ?PWSTR, NegativeOrder: u32, }; pub const CURRENCYFMTA = extern struct { NumDigits: u32, LeadingZero: u32, Grouping: u32, lpDecimalSep: ?PSTR, lpThousandSep: ?PSTR, NegativeOrder: u32, PositiveOrder: u32, lpCurrencySymbol: ?PSTR, }; pub const CURRENCYFMTW = extern struct { NumDigits: u32, LeadingZero: u32, Grouping: u32, lpDecimalSep: ?PWSTR, lpThousandSep: ?PWSTR, NegativeOrder: u32, PositiveOrder: u32, lpCurrencySymbol: ?PWSTR, }; pub const SYSNLS_FUNCTION = enum(i32) { G = 1, }; pub const COMPARE_STRING = SYSNLS_FUNCTION.G; pub const NLSVERSIONINFO = extern struct { dwNLSVersionInfoSize: u32, dwNLSVersion: u32, dwDefinedVersion: u32, dwEffectiveId: u32, guidCustomVersion: Guid, }; pub const NLSVERSIONINFOEX = extern struct { dwNLSVersionInfoSize: u32, dwNLSVersion: u32, dwDefinedVersion: u32, dwEffectiveId: u32, guidCustomVersion: Guid, }; pub const SYSGEOTYPE = enum(i32) { NATION = 1, LATITUDE = 2, LONGITUDE = 3, ISO2 = 4, ISO3 = 5, RFC1766 = 6, LCID = 7, FRIENDLYNAME = 8, OFFICIALNAME = 9, TIMEZONES = 10, OFFICIALLANGUAGES = 11, ISO_UN_NUMBER = 12, PARENT = 13, DIALINGCODE = 14, CURRENCYCODE = 15, CURRENCYSYMBOL = 16, NAME = 17, ID = 18, }; pub const GEO_NATION = SYSGEOTYPE.NATION; pub const GEO_LATITUDE = SYSGEOTYPE.LATITUDE; pub const GEO_LONGITUDE = SYSGEOTYPE.LONGITUDE; pub const GEO_ISO2 = SYSGEOTYPE.ISO2; pub const GEO_ISO3 = SYSGEOTYPE.ISO3; pub const GEO_RFC1766 = SYSGEOTYPE.RFC1766; pub const GEO_LCID = SYSGEOTYPE.LCID; pub const GEO_FRIENDLYNAME = SYSGEOTYPE.FRIENDLYNAME; pub const GEO_OFFICIALNAME = SYSGEOTYPE.OFFICIALNAME; pub const GEO_TIMEZONES = SYSGEOTYPE.TIMEZONES; pub const GEO_OFFICIALLANGUAGES = SYSGEOTYPE.OFFICIALLANGUAGES; pub const GEO_ISO_UN_NUMBER = SYSGEOTYPE.ISO_UN_NUMBER; pub const GEO_PARENT = SYSGEOTYPE.PARENT; pub const GEO_DIALINGCODE = SYSGEOTYPE.DIALINGCODE; pub const GEO_CURRENCYCODE = SYSGEOTYPE.CURRENCYCODE; pub const GEO_CURRENCYSYMBOL = SYSGEOTYPE.CURRENCYSYMBOL; pub const GEO_NAME = SYSGEOTYPE.NAME; pub const GEO_ID = SYSGEOTYPE.ID; pub const SYSGEOCLASS = enum(i32) { NATION = 16, REGION = 14, ALL = 0, }; pub const GEOCLASS_NATION = SYSGEOCLASS.NATION; pub const GEOCLASS_REGION = SYSGEOCLASS.REGION; pub const GEOCLASS_ALL = SYSGEOCLASS.ALL; pub const LOCALE_ENUMPROCA = fn( param0: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LOCALE_ENUMPROCW = fn( param0: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const NORM_FORM = enum(i32) { Other = 0, C = 1, D = 2, KC = 5, KD = 6, }; pub const NormalizationOther = NORM_FORM.Other; pub const NormalizationC = NORM_FORM.C; pub const NormalizationD = NORM_FORM.D; pub const NormalizationKC = NORM_FORM.KC; pub const NormalizationKD = NORM_FORM.KD; pub const LANGUAGEGROUP_ENUMPROCA = fn( param0: u32, param1: ?PSTR, param2: ?PSTR, param3: u32, param4: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LANGGROUPLOCALE_ENUMPROCA = fn( param0: u32, param1: u32, param2: ?PSTR, param3: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const UILANGUAGE_ENUMPROCA = fn( param0: ?PSTR, param1: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const CODEPAGE_ENUMPROCA = fn( param0: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const DATEFMT_ENUMPROCA = fn( param0: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const DATEFMT_ENUMPROCEXA = fn( param0: ?PSTR, param1: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const TIMEFMT_ENUMPROCA = fn( param0: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const CALINFO_ENUMPROCA = fn( param0: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const CALINFO_ENUMPROCEXA = fn( param0: ?PSTR, param1: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LANGUAGEGROUP_ENUMPROCW = fn( param0: u32, param1: ?PWSTR, param2: ?PWSTR, param3: u32, param4: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LANGGROUPLOCALE_ENUMPROCW = fn( param0: u32, param1: u32, param2: ?PWSTR, param3: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const UILANGUAGE_ENUMPROCW = fn( param0: ?PWSTR, param1: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const CODEPAGE_ENUMPROCW = fn( param0: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const DATEFMT_ENUMPROCW = fn( param0: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const DATEFMT_ENUMPROCEXW = fn( param0: ?PWSTR, param1: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const TIMEFMT_ENUMPROCW = fn( param0: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const CALINFO_ENUMPROCW = fn( param0: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const CALINFO_ENUMPROCEXW = fn( param0: ?PWSTR, param1: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const GEO_ENUMPROC = fn( param0: i32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const GEO_ENUMNAMEPROC = fn( param0: ?PWSTR, param1: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const FILEMUIINFO = extern struct { dwSize: u32, dwVersion: u32, dwFileType: u32, pChecksum: [16]u8, pServiceChecksum: [16]u8, dwLanguageNameOffset: u32, dwTypeIDMainSize: u32, dwTypeIDMainOffset: u32, dwTypeNameMainOffset: u32, dwTypeIDMUISize: u32, dwTypeIDMUIOffset: u32, dwTypeNameMUIOffset: u32, abBuffer: [8]u8, }; pub const CALINFO_ENUMPROCEXEX = fn( param0: ?PWSTR, param1: u32, param2: ?PWSTR, param3: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const DATEFMT_ENUMPROCEXEX = fn( param0: ?PWSTR, param1: u32, param2: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const TIMEFMT_ENUMPROCEX = fn( param0: ?PWSTR, param1: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LOCALE_ENUMPROCEX = fn( param0: ?PWSTR, param1: u32, param2: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const COMPOSITIONFORM = extern struct { dwStyle: u32, ptCurrentPos: POINT, rcArea: RECT, }; pub const CANDIDATEFORM = extern struct { dwIndex: u32, dwStyle: u32, ptCurrentPos: POINT, rcArea: RECT, }; pub const CANDIDATELIST = extern struct { dwSize: u32, dwStyle: u32, dwCount: u32, dwSelection: u32, dwPageStart: u32, dwPageSize: u32, dwOffset: [1]u32, }; pub const REGISTERWORDA = extern struct { lpReading: ?PSTR, lpWord: ?PSTR, }; pub const REGISTERWORDW = extern struct { lpReading: ?PWSTR, lpWord: ?PWSTR, }; pub const RECONVERTSTRING = extern struct { dwSize: u32, dwVersion: u32, dwStrLen: u32, dwStrOffset: u32, dwCompStrLen: u32, dwCompStrOffset: u32, dwTargetStrLen: u32, dwTargetStrOffset: u32, }; pub const STYLEBUFA = extern struct { dwStyle: u32, szDescription: [32]CHAR, }; pub const STYLEBUFW = extern struct { dwStyle: u32, szDescription: [32]u16, }; pub const IMEMENUITEMINFOA = extern struct { cbSize: u32, fType: u32, fState: u32, wID: u32, hbmpChecked: ?HBITMAP, hbmpUnchecked: ?HBITMAP, dwItemData: u32, szString: [80]CHAR, hbmpItem: ?HBITMAP, }; pub const IMEMENUITEMINFOW = extern struct { cbSize: u32, fType: u32, fState: u32, wID: u32, hbmpChecked: ?HBITMAP, hbmpUnchecked: ?HBITMAP, dwItemData: u32, szString: [80]u16, hbmpItem: ?HBITMAP, }; pub const IMECHARPOSITION = extern struct { dwSize: u32, dwCharPos: u32, pt: POINT, cLineHeight: u32, rcDocument: RECT, }; pub const IMCENUMPROC = fn( param0: ?HIMC, param1: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const REGISTERWORDENUMPROCA = fn( lpszReading: ?[*:0]const u8, param1: u32, lpszString: ?[*:0]const u8, param3: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) i32; pub const REGISTERWORDENUMPROCW = fn( lpszReading: ?[*:0]const u16, param1: u32, lpszString: ?[*:0]const u16, param3: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PFN_MAPPINGCALLBACKPROC = fn( pBag: ?*MAPPING_PROPERTY_BAG, data: ?*c_void, dwDataSize: u32, Result: HRESULT, ) callconv(@import("std").os.windows.WINAPI) void; pub const MAPPING_SERVICE_INFO = extern struct { Size: usize, pszCopyright: ?PWSTR, wMajorVersion: u16, wMinorVersion: u16, wBuildVersion: u16, wStepVersion: u16, dwInputContentTypesCount: u32, prgInputContentTypes: ?*?PWSTR, dwOutputContentTypesCount: u32, prgOutputContentTypes: ?*?PWSTR, dwInputLanguagesCount: u32, prgInputLanguages: ?*?PWSTR, dwOutputLanguagesCount: u32, prgOutputLanguages: ?*?PWSTR, dwInputScriptsCount: u32, prgInputScripts: ?*?PWSTR, dwOutputScriptsCount: u32, prgOutputScripts: ?*?PWSTR, guid: Guid, pszCategory: ?PWSTR, pszDescription: ?PWSTR, dwPrivateDataSize: u32, pPrivateData: ?*c_void, pContext: ?*c_void, _bitfield: u32, }; pub const MAPPING_ENUM_OPTIONS = extern struct { Size: usize, pszCategory: ?PWSTR, pszInputLanguage: ?PWSTR, pszOutputLanguage: ?PWSTR, pszInputScript: ?PWSTR, pszOutputScript: ?PWSTR, pszInputContentType: ?PWSTR, pszOutputContentType: ?PWSTR, pGuid: ?*Guid, _bitfield: u32, }; pub const MAPPING_OPTIONS = extern struct { Size: usize, pszInputLanguage: ?PWSTR, pszOutputLanguage: ?PWSTR, pszInputScript: ?PWSTR, pszOutputScript: ?PWSTR, pszInputContentType: ?PWSTR, pszOutputContentType: ?PWSTR, pszUILanguage: ?PWSTR, pfnRecognizeCallback: ?PFN_MAPPINGCALLBACKPROC, pRecognizeCallerData: ?*c_void, dwRecognizeCallerDataSize: u32, pfnActionCallback: ?PFN_MAPPINGCALLBACKPROC, pActionCallerData: ?*c_void, dwActionCallerDataSize: u32, dwServiceFlag: u32, _bitfield: u32, }; pub const MAPPING_DATA_RANGE = extern struct { dwStartIndex: u32, dwEndIndex: u32, pszDescription: ?PWSTR, dwDescriptionLength: u32, pData: ?*c_void, dwDataSize: u32, pszContentType: ?PWSTR, prgActionIds: ?*?PWSTR, dwActionsCount: u32, prgActionDisplayNames: ?*?PWSTR, }; pub const MAPPING_PROPERTY_BAG = extern struct { Size: usize, prgResultRanges: ?*MAPPING_DATA_RANGE, dwRangesCount: u32, pServiceData: ?*c_void, dwServiceDataSize: u32, pCallerData: ?*c_void, dwCallerDataSize: u32, pContext: ?*c_void, }; const CLSID_SpellCheckerFactory_Value = @import("zig.zig").Guid.initString("7ab36653-1796-484b-bdfa-e74f1db7c1dc"); pub const CLSID_SpellCheckerFactory = &CLSID_SpellCheckerFactory_Value; pub const WORDLIST_TYPE = enum(i32) { IGNORE = 0, ADD = 1, EXCLUDE = 2, AUTOCORRECT = 3, }; pub const WORDLIST_TYPE_IGNORE = WORDLIST_TYPE.IGNORE; pub const WORDLIST_TYPE_ADD = WORDLIST_TYPE.ADD; pub const WORDLIST_TYPE_EXCLUDE = WORDLIST_TYPE.EXCLUDE; pub const WORDLIST_TYPE_AUTOCORRECT = WORDLIST_TYPE.AUTOCORRECT; pub const CORRECTIVE_ACTION = enum(i32) { NONE = 0, GET_SUGGESTIONS = 1, REPLACE = 2, DELETE = 3, }; pub const CORRECTIVE_ACTION_NONE = CORRECTIVE_ACTION.NONE; pub const CORRECTIVE_ACTION_GET_SUGGESTIONS = CORRECTIVE_ACTION.GET_SUGGESTIONS; pub const CORRECTIVE_ACTION_REPLACE = CORRECTIVE_ACTION.REPLACE; pub const CORRECTIVE_ACTION_DELETE = CORRECTIVE_ACTION.DELETE; // TODO: this type is limited to platform 'windows8.0' const IID_ISpellingError_Value = @import("zig.zig").Guid.initString("b7c82d61-fbe8-4b47-9b27-6c0d2e0de0a3"); pub const IID_ISpellingError = &IID_ISpellingError_Value; pub const ISpellingError = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_StartIndex: fn( self: *const ISpellingError, value: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Length: fn( self: *const ISpellingError, value: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CorrectiveAction: fn( self: *const ISpellingError, value: ?*CORRECTIVE_ACTION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Replacement: fn( self: *const ISpellingError, value: ?*?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 ISpellingError_get_StartIndex(self: *const T, value: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellingError.VTable, self.vtable).get_StartIndex(@ptrCast(*const ISpellingError, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellingError_get_Length(self: *const T, value: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellingError.VTable, self.vtable).get_Length(@ptrCast(*const ISpellingError, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellingError_get_CorrectiveAction(self: *const T, value: ?*CORRECTIVE_ACTION) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellingError.VTable, self.vtable).get_CorrectiveAction(@ptrCast(*const ISpellingError, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellingError_get_Replacement(self: *const T, value: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellingError.VTable, self.vtable).get_Replacement(@ptrCast(*const ISpellingError, self), value); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IEnumSpellingError_Value = @import("zig.zig").Guid.initString("803e3bd4-2828-4410-8290-418d1d73c762"); pub const IID_IEnumSpellingError = &IID_IEnumSpellingError_Value; pub const IEnumSpellingError = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumSpellingError, value: ?*?*ISpellingError, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumSpellingError_Next(self: *const T, value: ?*?*ISpellingError) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumSpellingError.VTable, self.vtable).Next(@ptrCast(*const IEnumSpellingError, self), value); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IOptionDescription_Value = @import("zig.zig").Guid.initString("432e5f85-35cf-4606-a801-6f70277e1d7a"); pub const IID_IOptionDescription = &IID_IOptionDescription_Value; pub const IOptionDescription = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Id: fn( self: *const IOptionDescription, value: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Heading: fn( self: *const IOptionDescription, value: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Description: fn( self: *const IOptionDescription, value: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Labels: fn( self: *const IOptionDescription, value: ?*?*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 IOptionDescription_get_Id(self: *const T, value: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOptionDescription.VTable, self.vtable).get_Id(@ptrCast(*const IOptionDescription, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOptionDescription_get_Heading(self: *const T, value: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOptionDescription.VTable, self.vtable).get_Heading(@ptrCast(*const IOptionDescription, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOptionDescription_get_Description(self: *const T, value: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOptionDescription.VTable, self.vtable).get_Description(@ptrCast(*const IOptionDescription, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOptionDescription_get_Labels(self: *const T, value: ?*?*IEnumString) callconv(.Inline) HRESULT { return @ptrCast(*const IOptionDescription.VTable, self.vtable).get_Labels(@ptrCast(*const IOptionDescription, self), value); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_ISpellCheckerChangedEventHandler_Value = @import("zig.zig").Guid.initString("0b83a5b0-792f-4eab-9799-acf52c5ed08a"); pub const IID_ISpellCheckerChangedEventHandler = &IID_ISpellCheckerChangedEventHandler_Value; pub const ISpellCheckerChangedEventHandler = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Invoke: fn( self: *const ISpellCheckerChangedEventHandler, sender: ?*ISpellChecker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellCheckerChangedEventHandler_Invoke(self: *const T, sender: ?*ISpellChecker) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellCheckerChangedEventHandler.VTable, self.vtable).Invoke(@ptrCast(*const ISpellCheckerChangedEventHandler, self), sender); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_ISpellChecker_Value = @import("zig.zig").Guid.initString("b6fd0b71-e2bc-4653-8d05-f197e412770b"); pub const IID_ISpellChecker = &IID_ISpellChecker_Value; pub const ISpellChecker = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LanguageTag: fn( self: *const ISpellChecker, value: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Check: fn( self: *const ISpellChecker, text: ?[*:0]const u16, value: ?*?*IEnumSpellingError, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Suggest: fn( self: *const ISpellChecker, word: ?[*:0]const u16, value: ?*?*IEnumString, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Add: fn( self: *const ISpellChecker, word: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Ignore: fn( self: *const ISpellChecker, word: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AutoCorrect: fn( self: *const ISpellChecker, from: ?[*:0]const u16, to: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetOptionValue: fn( self: *const ISpellChecker, optionId: ?[*:0]const u16, value: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_OptionIds: fn( self: *const ISpellChecker, value: ?*?*IEnumString, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Id: fn( self: *const ISpellChecker, value: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LocalizedName: fn( self: *const ISpellChecker, value: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? add_SpellCheckerChanged: fn( self: *const ISpellChecker, handler: ?*ISpellCheckerChangedEventHandler, eventCookie: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? remove_SpellCheckerChanged: fn( self: *const ISpellChecker, eventCookie: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetOptionDescription: fn( self: *const ISpellChecker, optionId: ?[*:0]const u16, value: ?*?*IOptionDescription, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ComprehensiveCheck: fn( self: *const ISpellChecker, text: ?[*:0]const u16, value: ?*?*IEnumSpellingError, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellChecker_get_LanguageTag(self: *const T, value: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellChecker.VTable, self.vtable).get_LanguageTag(@ptrCast(*const ISpellChecker, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellChecker_Check(self: *const T, text: ?[*:0]const u16, value: ?*?*IEnumSpellingError) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellChecker.VTable, self.vtable).Check(@ptrCast(*const ISpellChecker, self), text, value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellChecker_Suggest(self: *const T, word: ?[*:0]const u16, value: ?*?*IEnumString) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellChecker.VTable, self.vtable).Suggest(@ptrCast(*const ISpellChecker, self), word, value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellChecker_Add(self: *const T, word: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellChecker.VTable, self.vtable).Add(@ptrCast(*const ISpellChecker, self), word); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellChecker_Ignore(self: *const T, word: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellChecker.VTable, self.vtable).Ignore(@ptrCast(*const ISpellChecker, self), word); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellChecker_AutoCorrect(self: *const T, from: ?[*:0]const u16, to: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellChecker.VTable, self.vtable).AutoCorrect(@ptrCast(*const ISpellChecker, self), from, to); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellChecker_GetOptionValue(self: *const T, optionId: ?[*:0]const u16, value: ?*u8) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellChecker.VTable, self.vtable).GetOptionValue(@ptrCast(*const ISpellChecker, self), optionId, value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellChecker_get_OptionIds(self: *const T, value: ?*?*IEnumString) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellChecker.VTable, self.vtable).get_OptionIds(@ptrCast(*const ISpellChecker, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellChecker_get_Id(self: *const T, value: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellChecker.VTable, self.vtable).get_Id(@ptrCast(*const ISpellChecker, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellChecker_get_LocalizedName(self: *const T, value: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellChecker.VTable, self.vtable).get_LocalizedName(@ptrCast(*const ISpellChecker, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellChecker_add_SpellCheckerChanged(self: *const T, handler: ?*ISpellCheckerChangedEventHandler, eventCookie: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellChecker.VTable, self.vtable).add_SpellCheckerChanged(@ptrCast(*const ISpellChecker, self), handler, eventCookie); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellChecker_remove_SpellCheckerChanged(self: *const T, eventCookie: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellChecker.VTable, self.vtable).remove_SpellCheckerChanged(@ptrCast(*const ISpellChecker, self), eventCookie); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellChecker_GetOptionDescription(self: *const T, optionId: ?[*:0]const u16, value: ?*?*IOptionDescription) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellChecker.VTable, self.vtable).GetOptionDescription(@ptrCast(*const ISpellChecker, self), optionId, value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellChecker_ComprehensiveCheck(self: *const T, text: ?[*:0]const u16, value: ?*?*IEnumSpellingError) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellChecker.VTable, self.vtable).ComprehensiveCheck(@ptrCast(*const ISpellChecker, self), text, value); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.10240' const IID_ISpellChecker2_Value = @import("zig.zig").Guid.initString("e7ed1c71-87f7-4378-a840-c9200dacee47"); pub const IID_ISpellChecker2 = &IID_ISpellChecker2_Value; pub const ISpellChecker2 = extern struct { pub const VTable = extern struct { base: ISpellChecker.VTable, Remove: fn( self: *const ISpellChecker2, word: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ISpellChecker.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellChecker2_Remove(self: *const T, word: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellChecker2.VTable, self.vtable).Remove(@ptrCast(*const ISpellChecker2, self), word); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_ISpellCheckerFactory_Value = @import("zig.zig").Guid.initString("8e018a9d-2415-4677-bf08-794ea61f94bb"); pub const IID_ISpellCheckerFactory = &IID_ISpellCheckerFactory_Value; pub const ISpellCheckerFactory = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SupportedLanguages: fn( self: *const ISpellCheckerFactory, value: ?*?*IEnumString, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsSupported: fn( self: *const ISpellCheckerFactory, languageTag: ?[*:0]const u16, value: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateSpellChecker: fn( self: *const ISpellCheckerFactory, languageTag: ?[*:0]const u16, value: ?*?*ISpellChecker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellCheckerFactory_get_SupportedLanguages(self: *const T, value: ?*?*IEnumString) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellCheckerFactory.VTable, self.vtable).get_SupportedLanguages(@ptrCast(*const ISpellCheckerFactory, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellCheckerFactory_IsSupported(self: *const T, languageTag: ?[*:0]const u16, value: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellCheckerFactory.VTable, self.vtable).IsSupported(@ptrCast(*const ISpellCheckerFactory, self), languageTag, value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellCheckerFactory_CreateSpellChecker(self: *const T, languageTag: ?[*:0]const u16, value: ?*?*ISpellChecker) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellCheckerFactory.VTable, self.vtable).CreateSpellChecker(@ptrCast(*const ISpellCheckerFactory, self), languageTag, value); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IUserDictionariesRegistrar_Value = @import("zig.zig").Guid.initString("aa176b85-0e12-4844-8e1a-eef1da77f586"); pub const IID_IUserDictionariesRegistrar = &IID_IUserDictionariesRegistrar_Value; pub const IUserDictionariesRegistrar = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, RegisterUserDictionary: fn( self: *const IUserDictionariesRegistrar, dictionaryPath: ?[*:0]const u16, languageTag: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnregisterUserDictionary: fn( self: *const IUserDictionariesRegistrar, dictionaryPath: ?[*:0]const u16, languageTag: ?[*: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 IUserDictionariesRegistrar_RegisterUserDictionary(self: *const T, dictionaryPath: ?[*:0]const u16, languageTag: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IUserDictionariesRegistrar.VTable, self.vtable).RegisterUserDictionary(@ptrCast(*const IUserDictionariesRegistrar, self), dictionaryPath, languageTag); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IUserDictionariesRegistrar_UnregisterUserDictionary(self: *const T, dictionaryPath: ?[*:0]const u16, languageTag: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IUserDictionariesRegistrar.VTable, self.vtable).UnregisterUserDictionary(@ptrCast(*const IUserDictionariesRegistrar, self), dictionaryPath, languageTag); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_ISpellCheckProvider_Value = @import("zig.zig").Guid.initString("73e976e0-8ed4-4eb1-80d7-1be0a16b0c38"); pub const IID_ISpellCheckProvider = &IID_ISpellCheckProvider_Value; pub const ISpellCheckProvider = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LanguageTag: fn( self: *const ISpellCheckProvider, value: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Check: fn( self: *const ISpellCheckProvider, text: ?[*:0]const u16, value: ?*?*IEnumSpellingError, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Suggest: fn( self: *const ISpellCheckProvider, word: ?[*:0]const u16, value: ?*?*IEnumString, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetOptionValue: fn( self: *const ISpellCheckProvider, optionId: ?[*:0]const u16, value: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetOptionValue: fn( self: *const ISpellCheckProvider, optionId: ?[*:0]const u16, value: u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_OptionIds: fn( self: *const ISpellCheckProvider, value: ?*?*IEnumString, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Id: fn( self: *const ISpellCheckProvider, value: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LocalizedName: fn( self: *const ISpellCheckProvider, value: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetOptionDescription: fn( self: *const ISpellCheckProvider, optionId: ?[*:0]const u16, value: ?*?*IOptionDescription, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InitializeWordlist: fn( self: *const ISpellCheckProvider, wordlistType: WORDLIST_TYPE, words: ?*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 ISpellCheckProvider_get_LanguageTag(self: *const T, value: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellCheckProvider.VTable, self.vtable).get_LanguageTag(@ptrCast(*const ISpellCheckProvider, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellCheckProvider_Check(self: *const T, text: ?[*:0]const u16, value: ?*?*IEnumSpellingError) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellCheckProvider.VTable, self.vtable).Check(@ptrCast(*const ISpellCheckProvider, self), text, value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellCheckProvider_Suggest(self: *const T, word: ?[*:0]const u16, value: ?*?*IEnumString) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellCheckProvider.VTable, self.vtable).Suggest(@ptrCast(*const ISpellCheckProvider, self), word, value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellCheckProvider_GetOptionValue(self: *const T, optionId: ?[*:0]const u16, value: ?*u8) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellCheckProvider.VTable, self.vtable).GetOptionValue(@ptrCast(*const ISpellCheckProvider, self), optionId, value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellCheckProvider_SetOptionValue(self: *const T, optionId: ?[*:0]const u16, value: u8) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellCheckProvider.VTable, self.vtable).SetOptionValue(@ptrCast(*const ISpellCheckProvider, self), optionId, value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellCheckProvider_get_OptionIds(self: *const T, value: ?*?*IEnumString) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellCheckProvider.VTable, self.vtable).get_OptionIds(@ptrCast(*const ISpellCheckProvider, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellCheckProvider_get_Id(self: *const T, value: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellCheckProvider.VTable, self.vtable).get_Id(@ptrCast(*const ISpellCheckProvider, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellCheckProvider_get_LocalizedName(self: *const T, value: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellCheckProvider.VTable, self.vtable).get_LocalizedName(@ptrCast(*const ISpellCheckProvider, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellCheckProvider_GetOptionDescription(self: *const T, optionId: ?[*:0]const u16, value: ?*?*IOptionDescription) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellCheckProvider.VTable, self.vtable).GetOptionDescription(@ptrCast(*const ISpellCheckProvider, self), optionId, value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellCheckProvider_InitializeWordlist(self: *const T, wordlistType: WORDLIST_TYPE, words: ?*IEnumString) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellCheckProvider.VTable, self.vtable).InitializeWordlist(@ptrCast(*const ISpellCheckProvider, self), wordlistType, words); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IComprehensiveSpellCheckProvider_Value = @import("zig.zig").Guid.initString("0c58f8de-8e94-479e-9717-70c42c4ad2c3"); pub const IID_IComprehensiveSpellCheckProvider = &IID_IComprehensiveSpellCheckProvider_Value; pub const IComprehensiveSpellCheckProvider = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ComprehensiveCheck: fn( self: *const IComprehensiveSpellCheckProvider, text: ?[*:0]const u16, value: ?*?*IEnumSpellingError, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IComprehensiveSpellCheckProvider_ComprehensiveCheck(self: *const T, text: ?[*:0]const u16, value: ?*?*IEnumSpellingError) callconv(.Inline) HRESULT { return @ptrCast(*const IComprehensiveSpellCheckProvider.VTable, self.vtable).ComprehensiveCheck(@ptrCast(*const IComprehensiveSpellCheckProvider, self), text, value); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_ISpellCheckProviderFactory_Value = @import("zig.zig").Guid.initString("9f671e11-77d6-4c92-aefb-615215e3a4be"); pub const IID_ISpellCheckProviderFactory = &IID_ISpellCheckProviderFactory_Value; pub const ISpellCheckProviderFactory = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SupportedLanguages: fn( self: *const ISpellCheckProviderFactory, value: ?*?*IEnumString, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsSupported: fn( self: *const ISpellCheckProviderFactory, languageTag: ?[*:0]const u16, value: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateSpellCheckProvider: fn( self: *const ISpellCheckProviderFactory, languageTag: ?[*:0]const u16, value: ?*?*ISpellCheckProvider, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellCheckProviderFactory_get_SupportedLanguages(self: *const T, value: ?*?*IEnumString) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellCheckProviderFactory.VTable, self.vtable).get_SupportedLanguages(@ptrCast(*const ISpellCheckProviderFactory, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellCheckProviderFactory_IsSupported(self: *const T, languageTag: ?[*:0]const u16, value: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellCheckProviderFactory.VTable, self.vtable).IsSupported(@ptrCast(*const ISpellCheckProviderFactory, self), languageTag, value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpellCheckProviderFactory_CreateSpellCheckProvider(self: *const T, languageTag: ?[*:0]const u16, value: ?*?*ISpellCheckProvider) callconv(.Inline) HRESULT { return @ptrCast(*const ISpellCheckProviderFactory.VTable, self.vtable).CreateSpellCheckProvider(@ptrCast(*const ISpellCheckProviderFactory, self), languageTag, value); } };} pub usingnamespace MethodMixin(@This()); }; pub const IFEClassFactory = extern struct { pub const VTable = extern struct { base: IClassFactory.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IClassFactory.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; pub const IMEDLG = packed struct { cbIMEDLG: i32, hwnd: ?HWND, lpwstrWord: ?PWSTR, nTabId: i32, }; const IID_IFECommon_Value = @import("zig.zig").Guid.initString("019f7151-e6db-11d0-83c3-00c04fddb82e"); pub const IID_IFECommon = &IID_IFECommon_Value; pub const IFECommon = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, IsDefaultIME: fn( self: *const IFECommon, szName: [*:0]const u8, cszName: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetDefaultIME: fn( self: *const IFECommon, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InvokeWordRegDialog: fn( self: *const IFECommon, pimedlg: ?*IMEDLG, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InvokeDictToolDialog: fn( self: *const IFECommon, pimedlg: ?*IMEDLG, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFECommon_IsDefaultIME(self: *const T, szName: [*:0]const u8, cszName: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IFECommon.VTable, self.vtable).IsDefaultIME(@ptrCast(*const IFECommon, self), szName, cszName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFECommon_SetDefaultIME(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IFECommon.VTable, self.vtable).SetDefaultIME(@ptrCast(*const IFECommon, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFECommon_InvokeWordRegDialog(self: *const T, pimedlg: ?*IMEDLG) callconv(.Inline) HRESULT { return @ptrCast(*const IFECommon.VTable, self.vtable).InvokeWordRegDialog(@ptrCast(*const IFECommon, self), pimedlg); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFECommon_InvokeDictToolDialog(self: *const T, pimedlg: ?*IMEDLG) callconv(.Inline) HRESULT { return @ptrCast(*const IFECommon.VTable, self.vtable).InvokeDictToolDialog(@ptrCast(*const IFECommon, self), pimedlg); } };} pub usingnamespace MethodMixin(@This()); }; pub const WDD = packed struct { wDispPos: u16, Anonymous1: packed union { wReadPos: u16, wCompPos: u16, }, cchDisp: u16, Anonymous2: packed union { cchRead: u16, cchComp: u16, }, WDD_nReserve1: u32, nPos: u16, _bitfield: u16, pReserved: ?*c_void, }; pub const MORRSLT = packed struct { dwSize: u32, pwchOutput: ?PWSTR, cchOutput: u16, Anonymous1: packed union { pwchRead: ?PWSTR, pwchComp: ?PWSTR, }, Anonymous2: packed union { cchRead: u16, cchComp: u16, }, pchInputPos: ?*u16, pchOutputIdxWDD: ?*u16, Anonymous3: packed union { pchReadIdxWDD: ?*u16, pchCompIdxWDD: ?*u16, }, paMonoRubyPos: ?*u16, pWDD: ?*WDD, cWDD: i32, pPrivate: ?*c_void, BLKBuff: [1]u16, }; const IID_IFELanguage_Value = @import("zig.zig").Guid.initString("019f7152-e6db-11d0-83c3-00c04fddb82e"); pub const IID_IFELanguage = &IID_IFELanguage_Value; pub const IFELanguage = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Open: fn( self: *const IFELanguage, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Close: fn( self: *const IFELanguage, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetJMorphResult: fn( self: *const IFELanguage, dwRequest: u32, dwCMode: u32, cwchInput: i32, pwchInput: ?[*:0]const u16, pfCInfo: ?*u32, ppResult: ?*?*MORRSLT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConversionModeCaps: fn( self: *const IFELanguage, pdwCaps: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPhonetic: fn( self: *const IFELanguage, string: ?BSTR, start: i32, length: i32, phonetic: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConversion: fn( self: *const IFELanguage, string: ?BSTR, start: i32, length: i32, result: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFELanguage_Open(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IFELanguage.VTable, self.vtable).Open(@ptrCast(*const IFELanguage, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFELanguage_Close(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IFELanguage.VTable, self.vtable).Close(@ptrCast(*const IFELanguage, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFELanguage_GetJMorphResult(self: *const T, dwRequest: u32, dwCMode: u32, cwchInput: i32, pwchInput: ?[*:0]const u16, pfCInfo: ?*u32, ppResult: ?*?*MORRSLT) callconv(.Inline) HRESULT { return @ptrCast(*const IFELanguage.VTable, self.vtable).GetJMorphResult(@ptrCast(*const IFELanguage, self), dwRequest, dwCMode, cwchInput, pwchInput, pfCInfo, ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFELanguage_GetConversionModeCaps(self: *const T, pdwCaps: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IFELanguage.VTable, self.vtable).GetConversionModeCaps(@ptrCast(*const IFELanguage, self), pdwCaps); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFELanguage_GetPhonetic(self: *const T, string: ?BSTR, start: i32, length: i32, phonetic: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IFELanguage.VTable, self.vtable).GetPhonetic(@ptrCast(*const IFELanguage, self), string, start, length, phonetic); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFELanguage_GetConversion(self: *const T, string: ?BSTR, start: i32, length: i32, result: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IFELanguage.VTable, self.vtable).GetConversion(@ptrCast(*const IFELanguage, self), string, start, length, result); } };} pub usingnamespace MethodMixin(@This()); }; pub const IMEREG = enum(i32) { HEAD = 0, TAIL = 1, DEL = 2, }; pub const IFED_REG_HEAD = IMEREG.HEAD; pub const IFED_REG_TAIL = IMEREG.TAIL; pub const IFED_REG_DEL = IMEREG.DEL; pub const IMEFMT = enum(i32) { UNKNOWN = 0, MSIME2_BIN_SYSTEM = 1, MSIME2_BIN_USER = 2, MSIME2_TEXT_USER = 3, MSIME95_BIN_SYSTEM = 4, MSIME95_BIN_USER = 5, MSIME95_TEXT_USER = 6, MSIME97_BIN_SYSTEM = 7, MSIME97_BIN_USER = 8, MSIME97_TEXT_USER = 9, MSIME98_BIN_SYSTEM = 10, MSIME98_BIN_USER = 11, MSIME98_TEXT_USER = 12, ACTIVE_DICT = 13, ATOK9 = 14, ATOK10 = 15, NEC_AI_ = 16, WX_II = 17, WX_III = 18, VJE_20 = 19, MSIME98_SYSTEM_CE = 20, MSIME_BIN_SYSTEM = 21, MSIME_BIN_USER = 22, MSIME_TEXT_USER = 23, PIME2_BIN_USER = 24, PIME2_BIN_SYSTEM = 25, PIME2_BIN_STANDARD_SYSTEM = 26, }; pub const IFED_UNKNOWN = IMEFMT.UNKNOWN; pub const IFED_MSIME2_BIN_SYSTEM = IMEFMT.MSIME2_BIN_SYSTEM; pub const IFED_MSIME2_BIN_USER = IMEFMT.MSIME2_BIN_USER; pub const IFED_MSIME2_TEXT_USER = IMEFMT.MSIME2_TEXT_USER; pub const IFED_MSIME95_BIN_SYSTEM = IMEFMT.MSIME95_BIN_SYSTEM; pub const IFED_MSIME95_BIN_USER = IMEFMT.MSIME95_BIN_USER; pub const IFED_MSIME95_TEXT_USER = IMEFMT.MSIME95_TEXT_USER; pub const IFED_MSIME97_BIN_SYSTEM = IMEFMT.MSIME97_BIN_SYSTEM; pub const IFED_MSIME97_BIN_USER = IMEFMT.MSIME97_BIN_USER; pub const IFED_MSIME97_TEXT_USER = IMEFMT.MSIME97_TEXT_USER; pub const IFED_MSIME98_BIN_SYSTEM = IMEFMT.MSIME98_BIN_SYSTEM; pub const IFED_MSIME98_BIN_USER = IMEFMT.MSIME98_BIN_USER; pub const IFED_MSIME98_TEXT_USER = IMEFMT.MSIME98_TEXT_USER; pub const IFED_ACTIVE_DICT = IMEFMT.ACTIVE_DICT; pub const IFED_ATOK9 = IMEFMT.ATOK9; pub const IFED_ATOK10 = IMEFMT.ATOK10; pub const IFED_NEC_AI_ = IMEFMT.NEC_AI_; pub const IFED_WX_II = IMEFMT.WX_II; pub const IFED_WX_III = IMEFMT.WX_III; pub const IFED_VJE_20 = IMEFMT.VJE_20; pub const IFED_MSIME98_SYSTEM_CE = IMEFMT.MSIME98_SYSTEM_CE; pub const IFED_MSIME_BIN_SYSTEM = IMEFMT.MSIME_BIN_SYSTEM; pub const IFED_MSIME_BIN_USER = IMEFMT.MSIME_BIN_USER; pub const IFED_MSIME_TEXT_USER = IMEFMT.MSIME_TEXT_USER; pub const IFED_PIME2_BIN_USER = IMEFMT.PIME2_BIN_USER; pub const IFED_PIME2_BIN_SYSTEM = IMEFMT.PIME2_BIN_SYSTEM; pub const IFED_PIME2_BIN_STANDARD_SYSTEM = IMEFMT.PIME2_BIN_STANDARD_SYSTEM; pub const IMEUCT = enum(i32) { NONE = 0, STRING_SJIS = 1, STRING_UNICODE = 2, USER_DEFINED = 3, MAX = 4, }; pub const IFED_UCT_NONE = IMEUCT.NONE; pub const IFED_UCT_STRING_SJIS = IMEUCT.STRING_SJIS; pub const IFED_UCT_STRING_UNICODE = IMEUCT.STRING_UNICODE; pub const IFED_UCT_USER_DEFINED = IMEUCT.USER_DEFINED; pub const IFED_UCT_MAX = IMEUCT.MAX; pub const IMEWRD = packed struct { pwchReading: ?PWSTR, pwchDisplay: ?PWSTR, Anonymous: packed union { ulPos: u32, Anonymous: packed struct { nPos1: u16, nPos2: u16, }, }, rgulAttrs: [2]u32, cbComment: i32, uct: IMEUCT, pvComment: ?*c_void, }; pub const IMESHF = packed struct { cbShf: u16, verDic: u16, szTitle: [48]CHAR, szDescription: [256]CHAR, szCopyright: [128]CHAR, }; pub const POSTBL = packed struct { nPos: u16, szName: ?*u8, }; pub const IMEREL = enum(i32) { NONE = 0, NO = 1, GA = 2, WO = 3, NI = 4, DE = 5, YORI = 6, KARA = 7, MADE = 8, HE = 9, TO = 10, IDEOM = 11, FUKU_YOUGEN = 12, KEIYOU_YOUGEN = 13, KEIDOU1_YOUGEN = 14, KEIDOU2_YOUGEN = 15, TAIGEN = 16, YOUGEN = 17, RENTAI_MEI = 18, RENSOU = 19, KEIYOU_TO_YOUGEN = 20, KEIYOU_TARU_YOUGEN = 21, UNKNOWN1 = 22, UNKNOWN2 = 23, ALL = 24, }; pub const IFED_REL_NONE = IMEREL.NONE; pub const IFED_REL_NO = IMEREL.NO; pub const IFED_REL_GA = IMEREL.GA; pub const IFED_REL_WO = IMEREL.WO; pub const IFED_REL_NI = IMEREL.NI; pub const IFED_REL_DE = IMEREL.DE; pub const IFED_REL_YORI = IMEREL.YORI; pub const IFED_REL_KARA = IMEREL.KARA; pub const IFED_REL_MADE = IMEREL.MADE; pub const IFED_REL_HE = IMEREL.HE; pub const IFED_REL_TO = IMEREL.TO; pub const IFED_REL_IDEOM = IMEREL.IDEOM; pub const IFED_REL_FUKU_YOUGEN = IMEREL.FUKU_YOUGEN; pub const IFED_REL_KEIYOU_YOUGEN = IMEREL.KEIYOU_YOUGEN; pub const IFED_REL_KEIDOU1_YOUGEN = IMEREL.KEIDOU1_YOUGEN; pub const IFED_REL_KEIDOU2_YOUGEN = IMEREL.KEIDOU2_YOUGEN; pub const IFED_REL_TAIGEN = IMEREL.TAIGEN; pub const IFED_REL_YOUGEN = IMEREL.YOUGEN; pub const IFED_REL_RENTAI_MEI = IMEREL.RENTAI_MEI; pub const IFED_REL_RENSOU = IMEREL.RENSOU; pub const IFED_REL_KEIYOU_TO_YOUGEN = IMEREL.KEIYOU_TO_YOUGEN; pub const IFED_REL_KEIYOU_TARU_YOUGEN = IMEREL.KEIYOU_TARU_YOUGEN; pub const IFED_REL_UNKNOWN1 = IMEREL.UNKNOWN1; pub const IFED_REL_UNKNOWN2 = IMEREL.UNKNOWN2; pub const IFED_REL_ALL = IMEREL.ALL; pub const IMEDP = packed struct { wrdModifier: IMEWRD, wrdModifiee: IMEWRD, relID: IMEREL, }; pub const PFNLOG = fn( param0: ?*IMEDP, param1: HRESULT, ) callconv(@import("std").os.windows.WINAPI) BOOL; const IID_IFEDictionary_Value = @import("zig.zig").Guid.initString("019f7153-e6db-11d0-83c3-00c04fddb82e"); pub const IID_IFEDictionary = &IID_IFEDictionary_Value; pub const IFEDictionary = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Open: fn( self: *const IFEDictionary, pchDictPath: ?*[260]u8, pshf: ?*IMESHF, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Close: fn( self: *const IFEDictionary, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetHeader: fn( self: *const IFEDictionary, pchDictPath: ?*[260]u8, pshf: ?*IMESHF, pjfmt: ?*IMEFMT, pulType: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DisplayProperty: fn( self: *const IFEDictionary, hwnd: ?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPosTable: fn( self: *const IFEDictionary, prgPosTbl: ?*?*POSTBL, pcPosTbl: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetWords: fn( self: *const IFEDictionary, pwchFirst: ?[*:0]const u16, pwchLast: ?[*:0]const u16, pwchDisplay: ?[*:0]const u16, ulPos: u32, ulSelect: u32, ulWordSrc: u32, pchBuffer: ?*u8, cbBuffer: u32, pcWrd: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, NextWords: fn( self: *const IFEDictionary, pchBuffer: ?*u8, cbBuffer: u32, pcWrd: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Create: fn( self: *const IFEDictionary, pchDictPath: ?[*:0]const u8, pshf: ?*IMESHF, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetHeader: fn( self: *const IFEDictionary, pshf: ?*IMESHF, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ExistWord: fn( self: *const IFEDictionary, pwrd: ?*IMEWRD, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ExistDependency: fn( self: *const IFEDictionary, pdp: ?*IMEDP, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterWord: fn( self: *const IFEDictionary, reg: IMEREG, pwrd: ?*IMEWRD, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterDependency: fn( self: *const IFEDictionary, reg: IMEREG, pdp: ?*IMEDP, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDependencies: fn( self: *const IFEDictionary, pwchKakariReading: ?[*:0]const u16, pwchKakariDisplay: ?[*:0]const u16, ulKakariPos: u32, pwchUkeReading: ?[*:0]const u16, pwchUkeDisplay: ?[*:0]const u16, ulUkePos: u32, jrel: IMEREL, ulWordSrc: u32, pchBuffer: ?*u8, cbBuffer: u32, pcdp: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, NextDependencies: fn( self: *const IFEDictionary, pchBuffer: ?*u8, cbBuffer: u32, pcDp: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ConvertFromOldMSIME: fn( self: *const IFEDictionary, pchDic: ?[*:0]const u8, pfnLog: ?PFNLOG, reg: IMEREG, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ConvertFromUserToSys: fn( self: *const IFEDictionary, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFEDictionary_Open(self: *const T, pchDictPath: ?*[260]u8, pshf: ?*IMESHF) callconv(.Inline) HRESULT { return @ptrCast(*const IFEDictionary.VTable, self.vtable).Open(@ptrCast(*const IFEDictionary, self), pchDictPath, pshf); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFEDictionary_Close(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IFEDictionary.VTable, self.vtable).Close(@ptrCast(*const IFEDictionary, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFEDictionary_GetHeader(self: *const T, pchDictPath: ?*[260]u8, pshf: ?*IMESHF, pjfmt: ?*IMEFMT, pulType: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IFEDictionary.VTable, self.vtable).GetHeader(@ptrCast(*const IFEDictionary, self), pchDictPath, pshf, pjfmt, pulType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFEDictionary_DisplayProperty(self: *const T, hwnd: ?HWND) callconv(.Inline) HRESULT { return @ptrCast(*const IFEDictionary.VTable, self.vtable).DisplayProperty(@ptrCast(*const IFEDictionary, self), hwnd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFEDictionary_GetPosTable(self: *const T, prgPosTbl: ?*?*POSTBL, pcPosTbl: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IFEDictionary.VTable, self.vtable).GetPosTable(@ptrCast(*const IFEDictionary, self), prgPosTbl, pcPosTbl); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFEDictionary_GetWords(self: *const T, pwchFirst: ?[*:0]const u16, pwchLast: ?[*:0]const u16, pwchDisplay: ?[*:0]const u16, ulPos: u32, ulSelect: u32, ulWordSrc: u32, pchBuffer: ?*u8, cbBuffer: u32, pcWrd: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IFEDictionary.VTable, self.vtable).GetWords(@ptrCast(*const IFEDictionary, self), pwchFirst, pwchLast, pwchDisplay, ulPos, ulSelect, ulWordSrc, pchBuffer, cbBuffer, pcWrd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFEDictionary_NextWords(self: *const T, pchBuffer: ?*u8, cbBuffer: u32, pcWrd: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IFEDictionary.VTable, self.vtable).NextWords(@ptrCast(*const IFEDictionary, self), pchBuffer, cbBuffer, pcWrd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFEDictionary_Create(self: *const T, pchDictPath: ?[*:0]const u8, pshf: ?*IMESHF) callconv(.Inline) HRESULT { return @ptrCast(*const IFEDictionary.VTable, self.vtable).Create(@ptrCast(*const IFEDictionary, self), pchDictPath, pshf); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFEDictionary_SetHeader(self: *const T, pshf: ?*IMESHF) callconv(.Inline) HRESULT { return @ptrCast(*const IFEDictionary.VTable, self.vtable).SetHeader(@ptrCast(*const IFEDictionary, self), pshf); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFEDictionary_ExistWord(self: *const T, pwrd: ?*IMEWRD) callconv(.Inline) HRESULT { return @ptrCast(*const IFEDictionary.VTable, self.vtable).ExistWord(@ptrCast(*const IFEDictionary, self), pwrd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFEDictionary_ExistDependency(self: *const T, pdp: ?*IMEDP) callconv(.Inline) HRESULT { return @ptrCast(*const IFEDictionary.VTable, self.vtable).ExistDependency(@ptrCast(*const IFEDictionary, self), pdp); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFEDictionary_RegisterWord(self: *const T, reg: IMEREG, pwrd: ?*IMEWRD) callconv(.Inline) HRESULT { return @ptrCast(*const IFEDictionary.VTable, self.vtable).RegisterWord(@ptrCast(*const IFEDictionary, self), reg, pwrd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFEDictionary_RegisterDependency(self: *const T, reg: IMEREG, pdp: ?*IMEDP) callconv(.Inline) HRESULT { return @ptrCast(*const IFEDictionary.VTable, self.vtable).RegisterDependency(@ptrCast(*const IFEDictionary, self), reg, pdp); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFEDictionary_GetDependencies(self: *const T, pwchKakariReading: ?[*:0]const u16, pwchKakariDisplay: ?[*:0]const u16, ulKakariPos: u32, pwchUkeReading: ?[*:0]const u16, pwchUkeDisplay: ?[*:0]const u16, ulUkePos: u32, jrel: IMEREL, ulWordSrc: u32, pchBuffer: ?*u8, cbBuffer: u32, pcdp: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IFEDictionary.VTable, self.vtable).GetDependencies(@ptrCast(*const IFEDictionary, self), pwchKakariReading, pwchKakariDisplay, ulKakariPos, pwchUkeReading, pwchUkeDisplay, ulUkePos, jrel, ulWordSrc, pchBuffer, cbBuffer, pcdp); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFEDictionary_NextDependencies(self: *const T, pchBuffer: ?*u8, cbBuffer: u32, pcDp: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IFEDictionary.VTable, self.vtable).NextDependencies(@ptrCast(*const IFEDictionary, self), pchBuffer, cbBuffer, pcDp); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFEDictionary_ConvertFromOldMSIME(self: *const T, pchDic: ?[*:0]const u8, pfnLog: ?PFNLOG, reg: IMEREG) callconv(.Inline) HRESULT { return @ptrCast(*const IFEDictionary.VTable, self.vtable).ConvertFromOldMSIME(@ptrCast(*const IFEDictionary, self), pchDic, pfnLog, reg); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFEDictionary_ConvertFromUserToSys(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IFEDictionary.VTable, self.vtable).ConvertFromUserToSys(@ptrCast(*const IFEDictionary, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const IMEKMSINIT = packed struct { cbSize: i32, hWnd: ?HWND, }; pub const IMEKMSKEY = packed struct { dwStatus: u32, dwCompStatus: u32, dwVKEY: u32, Anonymous1: packed union { dwControl: u32, dwNotUsed: u32, }, Anonymous2: packed union { pwszDscr: [31]u16, pwszNoUse: [31]u16, }, }; pub const IMEKMS = packed struct { cbSize: i32, hIMC: ?HIMC, cKeyList: u32, pKeyList: ?*IMEKMSKEY, }; pub const IMEKMSNTFY = packed struct { cbSize: i32, hIMC: ?HIMC, fSelect: BOOL, }; pub const IMEKMSKMP = packed struct { cbSize: i32, hIMC: ?HIMC, idLang: u16, wVKStart: u16, wVKEnd: u16, cKeyList: i32, pKeyList: ?*IMEKMSKEY, }; pub const IMEKMSINVK = packed struct { cbSize: i32, hIMC: ?HIMC, dwControl: u32, }; pub const IMEKMSFUNCDESC = packed struct { cbSize: i32, idLang: u16, dwControl: u32, pwszDescription: [128]u16, }; pub const fpCreateIFECommonInstanceType = fn( ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const fpCreateIFELanguageInstanceType = fn( clsid: ?*const Guid, ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const fpCreateIFEDictionaryInstanceType = fn( ppvObj: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const COMPOSITIONSTRING = extern struct { dwSize: u32, dwCompReadAttrLen: u32, dwCompReadAttrOffset: u32, dwCompReadClauseLen: u32, dwCompReadClauseOffset: u32, dwCompReadStrLen: u32, dwCompReadStrOffset: u32, dwCompAttrLen: u32, dwCompAttrOffset: u32, dwCompClauseLen: u32, dwCompClauseOffset: u32, dwCompStrLen: u32, dwCompStrOffset: u32, dwCursorPos: u32, dwDeltaStart: u32, dwResultReadClauseLen: u32, dwResultReadClauseOffset: u32, dwResultReadStrLen: u32, dwResultReadStrOffset: u32, dwResultClauseLen: u32, dwResultClauseOffset: u32, dwResultStrLen: u32, dwResultStrOffset: u32, dwPrivateSize: u32, dwPrivateOffset: u32, }; pub const GUIDELINE = extern struct { dwSize: u32, dwLevel: u32, dwIndex: u32, dwStrLen: u32, dwStrOffset: u32, dwPrivateSize: u32, dwPrivateOffset: u32, }; pub const TRANSMSG = extern struct { message: u32, wParam: WPARAM, lParam: LPARAM, }; pub const TRANSMSGLIST = extern struct { uMsgCount: u32, TransMsg: [1]TRANSMSG, }; pub const CANDIDATEINFO = extern struct { dwSize: u32, dwCount: u32, dwOffset: [32]u32, dwPrivateSize: u32, dwPrivateOffset: u32, }; pub const INPUTCONTEXT = extern struct { hWnd: ?HWND, fOpen: BOOL, ptStatusWndPos: POINT, ptSoftKbdPos: POINT, fdwConversion: u32, fdwSentence: u32, lfFont: extern union { A: LOGFONTA, W: LOGFONTW, }, cfCompForm: COMPOSITIONFORM, cfCandForm: [4]CANDIDATEFORM, hCompStr: ?HIMCC, hCandInfo: ?HIMCC, hGuideLine: ?HIMCC, hPrivate: ?HIMCC, dwNumMsgBuf: u32, hMsgBuf: ?HIMCC, fdwInit: u32, dwReserve: [3]u32, }; pub const IMEINFO = extern struct { dwPrivateDataSize: u32, fdwProperty: u32, fdwConversionCaps: u32, fdwSentenceCaps: u32, fdwUICaps: u32, fdwSCSCaps: u32, fdwSelectCaps: u32, }; pub const SOFTKBDDATA = extern struct { uCount: u32, wCode: [256]u16, }; pub const APPLETIDLIST = extern struct { count: i32, pIIDList: ?*Guid, }; pub const IMESTRINGCANDIDATE = extern struct { uCount: u32, lpwstr: [1]?PWSTR, }; pub const IMEITEM = extern struct { cbSize: i32, iType: i32, lpItemData: ?*c_void, }; pub const IMEITEMCANDIDATE = extern struct { uCount: u32, imeItem: [1]IMEITEM, }; pub const tabIMESTRINGINFO = extern struct { dwFarEastId: u32, lpwstr: ?PWSTR, }; pub const tabIMEFAREASTINFO = extern struct { dwSize: u32, dwType: u32, dwData: [1]u32, }; pub const IMESTRINGCANDIDATEINFO = extern struct { dwFarEastId: u32, lpFarEastInfo: ?*tabIMEFAREASTINFO, fInfoMask: u32, iSelIndex: i32, uCount: u32, lpwstr: [1]?PWSTR, }; pub const IMECOMPOSITIONSTRINGINFO = extern struct { iCompStrLen: i32, iCaretPos: i32, iEditStart: i32, iEditLen: i32, iTargetStart: i32, iTargetLen: i32, }; pub const IMECHARINFO = extern struct { wch: u16, dwCharInfo: u32, }; pub const IMEAPPLETCFG = extern struct { dwConfig: u32, wchTitle: [64]u16, wchTitleFontFace: [32]u16, dwCharSet: u32, iCategory: i32, hIcon: ?HICON, langID: u16, dummy: u16, lReserved1: LPARAM, }; pub const IMEAPPLETUI = extern struct { hwnd: ?HWND, dwStyle: u32, width: i32, height: i32, minWidth: i32, minHeight: i32, maxWidth: i32, maxHeight: i32, lReserved1: LPARAM, lReserved2: LPARAM, }; pub const APPLYCANDEXPARAM = extern struct { dwSize: u32, lpwstrDisplay: ?PWSTR, lpwstrReading: ?PWSTR, dwReserved: u32, }; const IID_IImeSpecifyApplets_Value = @import("zig.zig").Guid.initString("5d8e643c-c3a9-11d1-afef-00805f0c8b6d"); pub const IID_IImeSpecifyApplets = &IID_IImeSpecifyApplets_Value; pub const IImeSpecifyApplets = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetAppletIIDList: fn( self: *const IImeSpecifyApplets, refiid: ?*const Guid, lpIIDList: ?*APPLETIDLIST, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IImeSpecifyApplets_GetAppletIIDList(self: *const T, refiid: ?*const Guid, lpIIDList: ?*APPLETIDLIST) callconv(.Inline) HRESULT { return @ptrCast(*const IImeSpecifyApplets.VTable, self.vtable).GetAppletIIDList(@ptrCast(*const IImeSpecifyApplets, self), refiid, lpIIDList); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IImePadApplet_Value = @import("zig.zig").Guid.initString("5d8e643b-c3a9-11d1-afef-00805f0c8b6d"); pub const IID_IImePadApplet = &IID_IImePadApplet_Value; pub const IImePadApplet = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Initialize: fn( self: *const IImePadApplet, lpIImePad: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Terminate: fn( self: *const IImePadApplet, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAppletConfig: fn( self: *const IImePadApplet, lpAppletCfg: ?*IMEAPPLETCFG, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateUI: fn( self: *const IImePadApplet, hwndParent: ?HWND, lpImeAppletUI: ?*IMEAPPLETUI, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Notify: fn( self: *const IImePadApplet, lpImePad: ?*IUnknown, notify: i32, wParam: WPARAM, lParam: LPARAM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IImePadApplet_Initialize(self: *const T, lpIImePad: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IImePadApplet.VTable, self.vtable).Initialize(@ptrCast(*const IImePadApplet, self), lpIImePad); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IImePadApplet_Terminate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IImePadApplet.VTable, self.vtable).Terminate(@ptrCast(*const IImePadApplet, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IImePadApplet_GetAppletConfig(self: *const T, lpAppletCfg: ?*IMEAPPLETCFG) callconv(.Inline) HRESULT { return @ptrCast(*const IImePadApplet.VTable, self.vtable).GetAppletConfig(@ptrCast(*const IImePadApplet, self), lpAppletCfg); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IImePadApplet_CreateUI(self: *const T, hwndParent: ?HWND, lpImeAppletUI: ?*IMEAPPLETUI) callconv(.Inline) HRESULT { return @ptrCast(*const IImePadApplet.VTable, self.vtable).CreateUI(@ptrCast(*const IImePadApplet, self), hwndParent, lpImeAppletUI); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IImePadApplet_Notify(self: *const T, lpImePad: ?*IUnknown, notify: i32, wParam: WPARAM, lParam: LPARAM) callconv(.Inline) HRESULT { return @ptrCast(*const IImePadApplet.VTable, self.vtable).Notify(@ptrCast(*const IImePadApplet, self), lpImePad, notify, wParam, lParam); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IImePad_Value = @import("zig.zig").Guid.initString("5d8e643a-c3a9-11d1-afef-00805f0c8b6d"); pub const IID_IImePad = &IID_IImePad_Value; pub const IImePad = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Request: fn( self: *const IImePad, pIImePadApplet: ?*IImePadApplet, reqId: IME_PAD_REQUEST_FLAGS, wParam: WPARAM, lParam: LPARAM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IImePad_Request(self: *const T, pIImePadApplet: ?*IImePadApplet, reqId: IME_PAD_REQUEST_FLAGS, wParam: WPARAM, lParam: LPARAM) callconv(.Inline) HRESULT { return @ptrCast(*const IImePad.VTable, self.vtable).Request(@ptrCast(*const IImePad, self), pIImePadApplet, reqId, wParam, lParam); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IImePlugInDictDictionaryList_Value = @import("zig.zig").Guid.initString("98752974-b0a6-489b-8f6f-bff3769c8eeb"); pub const IID_IImePlugInDictDictionaryList = &IID_IImePlugInDictDictionaryList_Value; pub const IImePlugInDictDictionaryList = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetDictionariesInUse: fn( self: *const IImePlugInDictDictionaryList, prgDictionaryGUID: ?*?*SAFEARRAY, prgDateCreated: ?*?*SAFEARRAY, prgfEncrypted: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteDictionary: fn( self: *const IImePlugInDictDictionaryList, bstrDictionaryGUID: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IImePlugInDictDictionaryList_GetDictionariesInUse(self: *const T, prgDictionaryGUID: ?*?*SAFEARRAY, prgDateCreated: ?*?*SAFEARRAY, prgfEncrypted: ?*?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IImePlugInDictDictionaryList.VTable, self.vtable).GetDictionariesInUse(@ptrCast(*const IImePlugInDictDictionaryList, self), prgDictionaryGUID, prgDateCreated, prgfEncrypted); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IImePlugInDictDictionaryList_DeleteDictionary(self: *const T, bstrDictionaryGUID: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IImePlugInDictDictionaryList.VTable, self.vtable).DeleteDictionary(@ptrCast(*const IImePlugInDictDictionaryList, self), bstrDictionaryGUID); } };} pub usingnamespace MethodMixin(@This()); }; pub const SCRIPT_CONTROL = extern struct { _bitfield: u32, }; pub const SCRIPT_STATE = extern struct { _bitfield: u16, }; pub const SCRIPT_ANALYSIS = extern struct { _bitfield: u16, s: SCRIPT_STATE, }; pub const SCRIPT_ITEM = extern struct { iCharPos: i32, a: SCRIPT_ANALYSIS, }; pub const SCRIPT_JUSTIFY = enum(i32) { NONE = 0, ARABIC_BLANK = 1, CHARACTER = 2, RESERVED1 = 3, BLANK = 4, RESERVED2 = 5, RESERVED3 = 6, ARABIC_NORMAL = 7, ARABIC_KASHIDA = 8, ARABIC_ALEF = 9, ARABIC_HA = 10, ARABIC_RA = 11, ARABIC_BA = 12, ARABIC_BARA = 13, ARABIC_SEEN = 14, ARABIC_SEEN_M = 15, }; pub const SCRIPT_JUSTIFY_NONE = SCRIPT_JUSTIFY.NONE; pub const SCRIPT_JUSTIFY_ARABIC_BLANK = SCRIPT_JUSTIFY.ARABIC_BLANK; pub const SCRIPT_JUSTIFY_CHARACTER = SCRIPT_JUSTIFY.CHARACTER; pub const SCRIPT_JUSTIFY_RESERVED1 = SCRIPT_JUSTIFY.RESERVED1; pub const SCRIPT_JUSTIFY_BLANK = SCRIPT_JUSTIFY.BLANK; pub const SCRIPT_JUSTIFY_RESERVED2 = SCRIPT_JUSTIFY.RESERVED2; pub const SCRIPT_JUSTIFY_RESERVED3 = SCRIPT_JUSTIFY.RESERVED3; pub const SCRIPT_JUSTIFY_ARABIC_NORMAL = SCRIPT_JUSTIFY.ARABIC_NORMAL; pub const SCRIPT_JUSTIFY_ARABIC_KASHIDA = SCRIPT_JUSTIFY.ARABIC_KASHIDA; pub const SCRIPT_JUSTIFY_ARABIC_ALEF = SCRIPT_JUSTIFY.ARABIC_ALEF; pub const SCRIPT_JUSTIFY_ARABIC_HA = SCRIPT_JUSTIFY.ARABIC_HA; pub const SCRIPT_JUSTIFY_ARABIC_RA = SCRIPT_JUSTIFY.ARABIC_RA; pub const SCRIPT_JUSTIFY_ARABIC_BA = SCRIPT_JUSTIFY.ARABIC_BA; pub const SCRIPT_JUSTIFY_ARABIC_BARA = SCRIPT_JUSTIFY.ARABIC_BARA; pub const SCRIPT_JUSTIFY_ARABIC_SEEN = SCRIPT_JUSTIFY.ARABIC_SEEN; pub const SCRIPT_JUSTIFY_ARABIC_SEEN_M = SCRIPT_JUSTIFY.ARABIC_SEEN_M; pub const SCRIPT_VISATTR = extern struct { _bitfield: u16, }; pub const GOFFSET = extern struct { du: i32, dv: i32, }; pub const SCRIPT_LOGATTR = extern struct { _bitfield: u8, }; pub const SCRIPT_PROPERTIES = extern struct { _bitfield1: u32, _bitfield2: u32, }; pub const SCRIPT_FONTPROPERTIES = extern struct { cBytes: i32, wgBlank: u16, wgDefault: u16, wgInvalid: u16, wgKashida: u16, iKashidaWidth: i32, }; pub const SCRIPT_TABDEF = extern struct { cTabStops: i32, iScale: i32, pTabStops: ?*i32, iTabOrigin: i32, }; pub const SCRIPT_DIGITSUBSTITUTE = extern struct { _bitfield1: u32, _bitfield2: u32, dwReserved: u32, }; pub const opentype_feature_record = extern struct { tagFeature: u32, lParameter: i32, }; pub const textrange_properties = extern struct { potfRecords: ?*opentype_feature_record, cotfRecords: i32, }; pub const script_charprop = extern struct { _bitfield: u16, }; pub const script_glyphprop = extern struct { sva: SCRIPT_VISATTR, reserved: u16, }; pub const UErrorCode = enum(i32) { USING_FALLBACK_WARNING = -128, // ERROR_WARNING_START = -128, this enum value conflicts with USING_FALLBACK_WARNING USING_DEFAULT_WARNING = -127, SAFECLONE_ALLOCATED_WARNING = -126, STATE_OLD_WARNING = -125, STRING_NOT_TERMINATED_WARNING = -124, SORT_KEY_TOO_SHORT_WARNING = -123, AMBIGUOUS_ALIAS_WARNING = -122, DIFFERENT_UCA_VERSION = -121, PLUGIN_CHANGED_LEVEL_WARNING = -120, ZERO_ERROR = 0, ILLEGAL_ARGUMENT_ERROR = 1, MISSING_RESOURCE_ERROR = 2, INVALID_FORMAT_ERROR = 3, FILE_ACCESS_ERROR = 4, INTERNAL_PROGRAM_ERROR = 5, MESSAGE_PARSE_ERROR = 6, MEMORY_ALLOCATION_ERROR = 7, INDEX_OUTOFBOUNDS_ERROR = 8, PARSE_ERROR = 9, INVALID_CHAR_FOUND = 10, TRUNCATED_CHAR_FOUND = 11, ILLEGAL_CHAR_FOUND = 12, INVALID_TABLE_FORMAT = 13, INVALID_TABLE_FILE = 14, BUFFER_OVERFLOW_ERROR = 15, UNSUPPORTED_ERROR = 16, RESOURCE_TYPE_MISMATCH = 17, ILLEGAL_ESCAPE_SEQUENCE = 18, UNSUPPORTED_ESCAPE_SEQUENCE = 19, NO_SPACE_AVAILABLE = 20, CE_NOT_FOUND_ERROR = 21, PRIMARY_TOO_LONG_ERROR = 22, STATE_TOO_OLD_ERROR = 23, TOO_MANY_ALIASES_ERROR = 24, ENUM_OUT_OF_SYNC_ERROR = 25, INVARIANT_CONVERSION_ERROR = 26, INVALID_STATE_ERROR = 27, COLLATOR_VERSION_MISMATCH = 28, USELESS_COLLATOR_ERROR = 29, NO_WRITE_PERMISSION = 30, BAD_VARIABLE_DEFINITION = 65536, // PARSE_ERROR_START = 65536, this enum value conflicts with BAD_VARIABLE_DEFINITION MALFORMED_RULE = 65537, MALFORMED_SET = 65538, MALFORMED_SYMBOL_REFERENCE = 65539, MALFORMED_UNICODE_ESCAPE = 65540, MALFORMED_VARIABLE_DEFINITION = 65541, MALFORMED_VARIABLE_REFERENCE = 65542, MISMATCHED_SEGMENT_DELIMITERS = 65543, MISPLACED_ANCHOR_START = 65544, MISPLACED_CURSOR_OFFSET = 65545, MISPLACED_QUANTIFIER = 65546, MISSING_OPERATOR = 65547, MISSING_SEGMENT_CLOSE = 65548, MULTIPLE_ANTE_CONTEXTS = 65549, MULTIPLE_CURSORS = 65550, MULTIPLE_POST_CONTEXTS = 65551, TRAILING_BACKSLASH = 65552, UNDEFINED_SEGMENT_REFERENCE = 65553, UNDEFINED_VARIABLE = 65554, UNQUOTED_SPECIAL = 65555, UNTERMINATED_QUOTE = 65556, RULE_MASK_ERROR = 65557, MISPLACED_COMPOUND_FILTER = 65558, MULTIPLE_COMPOUND_FILTERS = 65559, INVALID_RBT_SYNTAX = 65560, INVALID_PROPERTY_PATTERN = 65561, MALFORMED_PRAGMA = 65562, UNCLOSED_SEGMENT = 65563, ILLEGAL_CHAR_IN_SEGMENT = 65564, VARIABLE_RANGE_EXHAUSTED = 65565, VARIABLE_RANGE_OVERLAP = 65566, ILLEGAL_CHARACTER = 65567, INTERNAL_TRANSLITERATOR_ERROR = 65568, INVALID_ID = 65569, INVALID_FUNCTION = 65570, UNEXPECTED_TOKEN = 65792, // FMT_PARSE_ERROR_START = 65792, this enum value conflicts with UNEXPECTED_TOKEN MULTIPLE_DECIMAL_SEPARATORS = 65793, // MULTIPLE_DECIMAL_SEPERATORS = 65793, this enum value conflicts with MULTIPLE_DECIMAL_SEPARATORS MULTIPLE_EXPONENTIAL_SYMBOLS = 65794, MALFORMED_EXPONENTIAL_PATTERN = 65795, MULTIPLE_PERCENT_SYMBOLS = 65796, MULTIPLE_PERMILL_SYMBOLS = 65797, MULTIPLE_PAD_SPECIFIERS = 65798, PATTERN_SYNTAX_ERROR = 65799, ILLEGAL_PAD_POSITION = 65800, UNMATCHED_BRACES = 65801, UNSUPPORTED_PROPERTY = 65802, UNSUPPORTED_ATTRIBUTE = 65803, ARGUMENT_TYPE_MISMATCH = 65804, DUPLICATE_KEYWORD = 65805, UNDEFINED_KEYWORD = 65806, DEFAULT_KEYWORD_MISSING = 65807, DECIMAL_NUMBER_SYNTAX_ERROR = 65808, FORMAT_INEXACT_ERROR = 65809, NUMBER_ARG_OUTOFBOUNDS_ERROR = 65810, NUMBER_SKELETON_SYNTAX_ERROR = 65811, BRK_INTERNAL_ERROR = 66048, // BRK_ERROR_START = 66048, this enum value conflicts with BRK_INTERNAL_ERROR BRK_HEX_DIGITS_EXPECTED = 66049, BRK_SEMICOLON_EXPECTED = 66050, BRK_RULE_SYNTAX = 66051, BRK_UNCLOSED_SET = 66052, BRK_ASSIGN_ERROR = 66053, BRK_VARIABLE_REDFINITION = 66054, BRK_MISMATCHED_PAREN = 66055, BRK_NEW_LINE_IN_QUOTED_STRING = 66056, BRK_UNDEFINED_VARIABLE = 66057, BRK_INIT_ERROR = 66058, BRK_RULE_EMPTY_SET = 66059, BRK_UNRECOGNIZED_OPTION = 66060, BRK_MALFORMED_RULE_TAG = 66061, REGEX_INTERNAL_ERROR = 66304, // REGEX_ERROR_START = 66304, this enum value conflicts with REGEX_INTERNAL_ERROR REGEX_RULE_SYNTAX = 66305, REGEX_INVALID_STATE = 66306, REGEX_BAD_ESCAPE_SEQUENCE = 66307, REGEX_PROPERTY_SYNTAX = 66308, REGEX_UNIMPLEMENTED = 66309, REGEX_MISMATCHED_PAREN = 66310, REGEX_NUMBER_TOO_BIG = 66311, REGEX_BAD_INTERVAL = 66312, REGEX_MAX_LT_MIN = 66313, REGEX_INVALID_BACK_REF = 66314, REGEX_INVALID_FLAG = 66315, REGEX_LOOK_BEHIND_LIMIT = 66316, REGEX_SET_CONTAINS_STRING = 66317, REGEX_MISSING_CLOSE_BRACKET = 66319, REGEX_INVALID_RANGE = 66320, REGEX_STACK_OVERFLOW = 66321, REGEX_TIME_OUT = 66322, REGEX_STOPPED_BY_CALLER = 66323, REGEX_PATTERN_TOO_BIG = 66324, REGEX_INVALID_CAPTURE_GROUP_NAME = 66325, IDNA_PROHIBITED_ERROR = 66560, // IDNA_ERROR_START = 66560, this enum value conflicts with IDNA_PROHIBITED_ERROR IDNA_UNASSIGNED_ERROR = 66561, IDNA_CHECK_BIDI_ERROR = 66562, IDNA_STD3_ASCII_RULES_ERROR = 66563, IDNA_ACE_PREFIX_ERROR = 66564, IDNA_VERIFICATION_ERROR = 66565, IDNA_LABEL_TOO_LONG_ERROR = 66566, IDNA_ZERO_LENGTH_LABEL_ERROR = 66567, IDNA_DOMAIN_NAME_TOO_LONG_ERROR = 66568, // STRINGPREP_PROHIBITED_ERROR = 66560, this enum value conflicts with IDNA_PROHIBITED_ERROR // STRINGPREP_UNASSIGNED_ERROR = 66561, this enum value conflicts with IDNA_UNASSIGNED_ERROR // STRINGPREP_CHECK_BIDI_ERROR = 66562, this enum value conflicts with IDNA_CHECK_BIDI_ERROR PLUGIN_ERROR_START = 66816, // PLUGIN_TOO_HIGH = 66816, this enum value conflicts with PLUGIN_ERROR_START PLUGIN_DIDNT_SET_LEVEL = 66817, }; pub const U_USING_FALLBACK_WARNING = UErrorCode.USING_FALLBACK_WARNING; pub const U_ERROR_WARNING_START = UErrorCode.USING_FALLBACK_WARNING; pub const U_USING_DEFAULT_WARNING = UErrorCode.USING_DEFAULT_WARNING; pub const U_SAFECLONE_ALLOCATED_WARNING = UErrorCode.SAFECLONE_ALLOCATED_WARNING; pub const U_STATE_OLD_WARNING = UErrorCode.STATE_OLD_WARNING; pub const U_STRING_NOT_TERMINATED_WARNING = UErrorCode.STRING_NOT_TERMINATED_WARNING; pub const U_SORT_KEY_TOO_SHORT_WARNING = UErrorCode.SORT_KEY_TOO_SHORT_WARNING; pub const U_AMBIGUOUS_ALIAS_WARNING = UErrorCode.AMBIGUOUS_ALIAS_WARNING; pub const U_DIFFERENT_UCA_VERSION = UErrorCode.DIFFERENT_UCA_VERSION; pub const U_PLUGIN_CHANGED_LEVEL_WARNING = UErrorCode.PLUGIN_CHANGED_LEVEL_WARNING; pub const U_ZERO_ERROR = UErrorCode.ZERO_ERROR; pub const U_ILLEGAL_ARGUMENT_ERROR = UErrorCode.ILLEGAL_ARGUMENT_ERROR; pub const U_MISSING_RESOURCE_ERROR = UErrorCode.MISSING_RESOURCE_ERROR; pub const U_INVALID_FORMAT_ERROR = UErrorCode.INVALID_FORMAT_ERROR; pub const U_FILE_ACCESS_ERROR = UErrorCode.FILE_ACCESS_ERROR; pub const U_INTERNAL_PROGRAM_ERROR = UErrorCode.INTERNAL_PROGRAM_ERROR; pub const U_MESSAGE_PARSE_ERROR = UErrorCode.MESSAGE_PARSE_ERROR; pub const U_MEMORY_ALLOCATION_ERROR = UErrorCode.MEMORY_ALLOCATION_ERROR; pub const U_INDEX_OUTOFBOUNDS_ERROR = UErrorCode.INDEX_OUTOFBOUNDS_ERROR; pub const U_PARSE_ERROR = UErrorCode.PARSE_ERROR; pub const U_INVALID_CHAR_FOUND = UErrorCode.INVALID_CHAR_FOUND; pub const U_TRUNCATED_CHAR_FOUND = UErrorCode.TRUNCATED_CHAR_FOUND; pub const U_ILLEGAL_CHAR_FOUND = UErrorCode.ILLEGAL_CHAR_FOUND; pub const U_INVALID_TABLE_FORMAT = UErrorCode.INVALID_TABLE_FORMAT; pub const U_INVALID_TABLE_FILE = UErrorCode.INVALID_TABLE_FILE; pub const U_BUFFER_OVERFLOW_ERROR = UErrorCode.BUFFER_OVERFLOW_ERROR; pub const U_UNSUPPORTED_ERROR = UErrorCode.UNSUPPORTED_ERROR; pub const U_RESOURCE_TYPE_MISMATCH = UErrorCode.RESOURCE_TYPE_MISMATCH; pub const U_ILLEGAL_ESCAPE_SEQUENCE = UErrorCode.ILLEGAL_ESCAPE_SEQUENCE; pub const U_UNSUPPORTED_ESCAPE_SEQUENCE = UErrorCode.UNSUPPORTED_ESCAPE_SEQUENCE; pub const U_NO_SPACE_AVAILABLE = UErrorCode.NO_SPACE_AVAILABLE; pub const U_CE_NOT_FOUND_ERROR = UErrorCode.CE_NOT_FOUND_ERROR; pub const U_PRIMARY_TOO_LONG_ERROR = UErrorCode.PRIMARY_TOO_LONG_ERROR; pub const U_STATE_TOO_OLD_ERROR = UErrorCode.STATE_TOO_OLD_ERROR; pub const U_TOO_MANY_ALIASES_ERROR = UErrorCode.TOO_MANY_ALIASES_ERROR; pub const U_ENUM_OUT_OF_SYNC_ERROR = UErrorCode.ENUM_OUT_OF_SYNC_ERROR; pub const U_INVARIANT_CONVERSION_ERROR = UErrorCode.INVARIANT_CONVERSION_ERROR; pub const U_INVALID_STATE_ERROR = UErrorCode.INVALID_STATE_ERROR; pub const U_COLLATOR_VERSION_MISMATCH = UErrorCode.COLLATOR_VERSION_MISMATCH; pub const U_USELESS_COLLATOR_ERROR = UErrorCode.USELESS_COLLATOR_ERROR; pub const U_NO_WRITE_PERMISSION = UErrorCode.NO_WRITE_PERMISSION; pub const U_BAD_VARIABLE_DEFINITION = UErrorCode.BAD_VARIABLE_DEFINITION; pub const U_PARSE_ERROR_START = UErrorCode.BAD_VARIABLE_DEFINITION; pub const U_MALFORMED_RULE = UErrorCode.MALFORMED_RULE; pub const U_MALFORMED_SET = UErrorCode.MALFORMED_SET; pub const U_MALFORMED_SYMBOL_REFERENCE = UErrorCode.MALFORMED_SYMBOL_REFERENCE; pub const U_MALFORMED_UNICODE_ESCAPE = UErrorCode.MALFORMED_UNICODE_ESCAPE; pub const U_MALFORMED_VARIABLE_DEFINITION = UErrorCode.MALFORMED_VARIABLE_DEFINITION; pub const U_MALFORMED_VARIABLE_REFERENCE = UErrorCode.MALFORMED_VARIABLE_REFERENCE; pub const U_MISMATCHED_SEGMENT_DELIMITERS = UErrorCode.MISMATCHED_SEGMENT_DELIMITERS; pub const U_MISPLACED_ANCHOR_START = UErrorCode.MISPLACED_ANCHOR_START; pub const U_MISPLACED_CURSOR_OFFSET = UErrorCode.MISPLACED_CURSOR_OFFSET; pub const U_MISPLACED_QUANTIFIER = UErrorCode.MISPLACED_QUANTIFIER; pub const U_MISSING_OPERATOR = UErrorCode.MISSING_OPERATOR; pub const U_MISSING_SEGMENT_CLOSE = UErrorCode.MISSING_SEGMENT_CLOSE; pub const U_MULTIPLE_ANTE_CONTEXTS = UErrorCode.MULTIPLE_ANTE_CONTEXTS; pub const U_MULTIPLE_CURSORS = UErrorCode.MULTIPLE_CURSORS; pub const U_MULTIPLE_POST_CONTEXTS = UErrorCode.MULTIPLE_POST_CONTEXTS; pub const U_TRAILING_BACKSLASH = UErrorCode.TRAILING_BACKSLASH; pub const U_UNDEFINED_SEGMENT_REFERENCE = UErrorCode.UNDEFINED_SEGMENT_REFERENCE; pub const U_UNDEFINED_VARIABLE = UErrorCode.UNDEFINED_VARIABLE; pub const U_UNQUOTED_SPECIAL = UErrorCode.UNQUOTED_SPECIAL; pub const U_UNTERMINATED_QUOTE = UErrorCode.UNTERMINATED_QUOTE; pub const U_RULE_MASK_ERROR = UErrorCode.RULE_MASK_ERROR; pub const U_MISPLACED_COMPOUND_FILTER = UErrorCode.MISPLACED_COMPOUND_FILTER; pub const U_MULTIPLE_COMPOUND_FILTERS = UErrorCode.MULTIPLE_COMPOUND_FILTERS; pub const U_INVALID_RBT_SYNTAX = UErrorCode.INVALID_RBT_SYNTAX; pub const U_INVALID_PROPERTY_PATTERN = UErrorCode.INVALID_PROPERTY_PATTERN; pub const U_MALFORMED_PRAGMA = UErrorCode.MALFORMED_PRAGMA; pub const U_UNCLOSED_SEGMENT = UErrorCode.UNCLOSED_SEGMENT; pub const U_ILLEGAL_CHAR_IN_SEGMENT = UErrorCode.ILLEGAL_CHAR_IN_SEGMENT; pub const U_VARIABLE_RANGE_EXHAUSTED = UErrorCode.VARIABLE_RANGE_EXHAUSTED; pub const U_VARIABLE_RANGE_OVERLAP = UErrorCode.VARIABLE_RANGE_OVERLAP; pub const U_ILLEGAL_CHARACTER = UErrorCode.ILLEGAL_CHARACTER; pub const U_INTERNAL_TRANSLITERATOR_ERROR = UErrorCode.INTERNAL_TRANSLITERATOR_ERROR; pub const U_INVALID_ID = UErrorCode.INVALID_ID; pub const U_INVALID_FUNCTION = UErrorCode.INVALID_FUNCTION; pub const U_UNEXPECTED_TOKEN = UErrorCode.UNEXPECTED_TOKEN; pub const U_FMT_PARSE_ERROR_START = UErrorCode.UNEXPECTED_TOKEN; pub const U_MULTIPLE_DECIMAL_SEPARATORS = UErrorCode.MULTIPLE_DECIMAL_SEPARATORS; pub const U_MULTIPLE_DECIMAL_SEPERATORS = UErrorCode.MULTIPLE_DECIMAL_SEPARATORS; pub const U_MULTIPLE_EXPONENTIAL_SYMBOLS = UErrorCode.MULTIPLE_EXPONENTIAL_SYMBOLS; pub const U_MALFORMED_EXPONENTIAL_PATTERN = UErrorCode.MALFORMED_EXPONENTIAL_PATTERN; pub const U_MULTIPLE_PERCENT_SYMBOLS = UErrorCode.MULTIPLE_PERCENT_SYMBOLS; pub const U_MULTIPLE_PERMILL_SYMBOLS = UErrorCode.MULTIPLE_PERMILL_SYMBOLS; pub const U_MULTIPLE_PAD_SPECIFIERS = UErrorCode.MULTIPLE_PAD_SPECIFIERS; pub const U_PATTERN_SYNTAX_ERROR = UErrorCode.PATTERN_SYNTAX_ERROR; pub const U_ILLEGAL_PAD_POSITION = UErrorCode.ILLEGAL_PAD_POSITION; pub const U_UNMATCHED_BRACES = UErrorCode.UNMATCHED_BRACES; pub const U_UNSUPPORTED_PROPERTY = UErrorCode.UNSUPPORTED_PROPERTY; pub const U_UNSUPPORTED_ATTRIBUTE = UErrorCode.UNSUPPORTED_ATTRIBUTE; pub const U_ARGUMENT_TYPE_MISMATCH = UErrorCode.ARGUMENT_TYPE_MISMATCH; pub const U_DUPLICATE_KEYWORD = UErrorCode.DUPLICATE_KEYWORD; pub const U_UNDEFINED_KEYWORD = UErrorCode.UNDEFINED_KEYWORD; pub const U_DEFAULT_KEYWORD_MISSING = UErrorCode.DEFAULT_KEYWORD_MISSING; pub const U_DECIMAL_NUMBER_SYNTAX_ERROR = UErrorCode.DECIMAL_NUMBER_SYNTAX_ERROR; pub const U_FORMAT_INEXACT_ERROR = UErrorCode.FORMAT_INEXACT_ERROR; pub const U_NUMBER_ARG_OUTOFBOUNDS_ERROR = UErrorCode.NUMBER_ARG_OUTOFBOUNDS_ERROR; pub const U_NUMBER_SKELETON_SYNTAX_ERROR = UErrorCode.NUMBER_SKELETON_SYNTAX_ERROR; pub const U_BRK_INTERNAL_ERROR = UErrorCode.BRK_INTERNAL_ERROR; pub const U_BRK_ERROR_START = UErrorCode.BRK_INTERNAL_ERROR; pub const U_BRK_HEX_DIGITS_EXPECTED = UErrorCode.BRK_HEX_DIGITS_EXPECTED; pub const U_BRK_SEMICOLON_EXPECTED = UErrorCode.BRK_SEMICOLON_EXPECTED; pub const U_BRK_RULE_SYNTAX = UErrorCode.BRK_RULE_SYNTAX; pub const U_BRK_UNCLOSED_SET = UErrorCode.BRK_UNCLOSED_SET; pub const U_BRK_ASSIGN_ERROR = UErrorCode.BRK_ASSIGN_ERROR; pub const U_BRK_VARIABLE_REDFINITION = UErrorCode.BRK_VARIABLE_REDFINITION; pub const U_BRK_MISMATCHED_PAREN = UErrorCode.BRK_MISMATCHED_PAREN; pub const U_BRK_NEW_LINE_IN_QUOTED_STRING = UErrorCode.BRK_NEW_LINE_IN_QUOTED_STRING; pub const U_BRK_UNDEFINED_VARIABLE = UErrorCode.BRK_UNDEFINED_VARIABLE; pub const U_BRK_INIT_ERROR = UErrorCode.BRK_INIT_ERROR; pub const U_BRK_RULE_EMPTY_SET = UErrorCode.BRK_RULE_EMPTY_SET; pub const U_BRK_UNRECOGNIZED_OPTION = UErrorCode.BRK_UNRECOGNIZED_OPTION; pub const U_BRK_MALFORMED_RULE_TAG = UErrorCode.BRK_MALFORMED_RULE_TAG; pub const U_REGEX_INTERNAL_ERROR = UErrorCode.REGEX_INTERNAL_ERROR; pub const U_REGEX_ERROR_START = UErrorCode.REGEX_INTERNAL_ERROR; pub const U_REGEX_RULE_SYNTAX = UErrorCode.REGEX_RULE_SYNTAX; pub const U_REGEX_INVALID_STATE = UErrorCode.REGEX_INVALID_STATE; pub const U_REGEX_BAD_ESCAPE_SEQUENCE = UErrorCode.REGEX_BAD_ESCAPE_SEQUENCE; pub const U_REGEX_PROPERTY_SYNTAX = UErrorCode.REGEX_PROPERTY_SYNTAX; pub const U_REGEX_UNIMPLEMENTED = UErrorCode.REGEX_UNIMPLEMENTED; pub const U_REGEX_MISMATCHED_PAREN = UErrorCode.REGEX_MISMATCHED_PAREN; pub const U_REGEX_NUMBER_TOO_BIG = UErrorCode.REGEX_NUMBER_TOO_BIG; pub const U_REGEX_BAD_INTERVAL = UErrorCode.REGEX_BAD_INTERVAL; pub const U_REGEX_MAX_LT_MIN = UErrorCode.REGEX_MAX_LT_MIN; pub const U_REGEX_INVALID_BACK_REF = UErrorCode.REGEX_INVALID_BACK_REF; pub const U_REGEX_INVALID_FLAG = UErrorCode.REGEX_INVALID_FLAG; pub const U_REGEX_LOOK_BEHIND_LIMIT = UErrorCode.REGEX_LOOK_BEHIND_LIMIT; pub const U_REGEX_SET_CONTAINS_STRING = UErrorCode.REGEX_SET_CONTAINS_STRING; pub const U_REGEX_MISSING_CLOSE_BRACKET = UErrorCode.REGEX_MISSING_CLOSE_BRACKET; pub const U_REGEX_INVALID_RANGE = UErrorCode.REGEX_INVALID_RANGE; pub const U_REGEX_STACK_OVERFLOW = UErrorCode.REGEX_STACK_OVERFLOW; pub const U_REGEX_TIME_OUT = UErrorCode.REGEX_TIME_OUT; pub const U_REGEX_STOPPED_BY_CALLER = UErrorCode.REGEX_STOPPED_BY_CALLER; pub const U_REGEX_PATTERN_TOO_BIG = UErrorCode.REGEX_PATTERN_TOO_BIG; pub const U_REGEX_INVALID_CAPTURE_GROUP_NAME = UErrorCode.REGEX_INVALID_CAPTURE_GROUP_NAME; pub const U_IDNA_PROHIBITED_ERROR = UErrorCode.IDNA_PROHIBITED_ERROR; pub const U_IDNA_ERROR_START = UErrorCode.IDNA_PROHIBITED_ERROR; pub const U_IDNA_UNASSIGNED_ERROR = UErrorCode.IDNA_UNASSIGNED_ERROR; pub const U_IDNA_CHECK_BIDI_ERROR = UErrorCode.IDNA_CHECK_BIDI_ERROR; pub const U_IDNA_STD3_ASCII_RULES_ERROR = UErrorCode.IDNA_STD3_ASCII_RULES_ERROR; pub const U_IDNA_ACE_PREFIX_ERROR = UErrorCode.IDNA_ACE_PREFIX_ERROR; pub const U_IDNA_VERIFICATION_ERROR = UErrorCode.IDNA_VERIFICATION_ERROR; pub const U_IDNA_LABEL_TOO_LONG_ERROR = UErrorCode.IDNA_LABEL_TOO_LONG_ERROR; pub const U_IDNA_ZERO_LENGTH_LABEL_ERROR = UErrorCode.IDNA_ZERO_LENGTH_LABEL_ERROR; pub const U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR = UErrorCode.IDNA_DOMAIN_NAME_TOO_LONG_ERROR; pub const U_STRINGPREP_PROHIBITED_ERROR = UErrorCode.IDNA_PROHIBITED_ERROR; pub const U_STRINGPREP_UNASSIGNED_ERROR = UErrorCode.IDNA_UNASSIGNED_ERROR; pub const U_STRINGPREP_CHECK_BIDI_ERROR = UErrorCode.IDNA_CHECK_BIDI_ERROR; pub const U_PLUGIN_ERROR_START = UErrorCode.PLUGIN_ERROR_START; pub const U_PLUGIN_TOO_HIGH = UErrorCode.PLUGIN_ERROR_START; pub const U_PLUGIN_DIDNT_SET_LEVEL = UErrorCode.PLUGIN_DIDNT_SET_LEVEL; pub const UTraceLevel = enum(i32) { OFF = -1, ERROR = 0, WARNING = 3, OPEN_CLOSE = 5, INFO = 7, VERBOSE = 9, }; pub const UTRACE_OFF = UTraceLevel.OFF; pub const UTRACE_ERROR = UTraceLevel.ERROR; pub const UTRACE_WARNING = UTraceLevel.WARNING; pub const UTRACE_OPEN_CLOSE = UTraceLevel.OPEN_CLOSE; pub const UTRACE_INFO = UTraceLevel.INFO; pub const UTRACE_VERBOSE = UTraceLevel.VERBOSE; pub const UTraceFunctionNumber = enum(i32) { FUNCTION_START = 0, // U_INIT = 0, this enum value conflicts with FUNCTION_START U_CLEANUP = 1, CONVERSION_START = 4096, // UCNV_OPEN = 4096, this enum value conflicts with CONVERSION_START UCNV_OPEN_PACKAGE = 4097, UCNV_OPEN_ALGORITHMIC = 4098, UCNV_CLONE = 4099, UCNV_CLOSE = 4100, UCNV_FLUSH_CACHE = 4101, UCNV_LOAD = 4102, UCNV_UNLOAD = 4103, COLLATION_START = 8192, // UCOL_OPEN = 8192, this enum value conflicts with COLLATION_START UCOL_CLOSE = 8193, UCOL_STRCOLL = 8194, UCOL_GET_SORTKEY = 8195, UCOL_GETLOCALE = 8196, UCOL_NEXTSORTKEYPART = 8197, UCOL_STRCOLLITER = 8198, UCOL_OPEN_FROM_SHORT_STRING = 8199, UCOL_STRCOLLUTF8 = 8200, }; pub const UTRACE_FUNCTION_START = UTraceFunctionNumber.FUNCTION_START; pub const UTRACE_U_INIT = UTraceFunctionNumber.FUNCTION_START; pub const UTRACE_U_CLEANUP = UTraceFunctionNumber.U_CLEANUP; pub const UTRACE_CONVERSION_START = UTraceFunctionNumber.CONVERSION_START; pub const UTRACE_UCNV_OPEN = UTraceFunctionNumber.CONVERSION_START; pub const UTRACE_UCNV_OPEN_PACKAGE = UTraceFunctionNumber.UCNV_OPEN_PACKAGE; pub const UTRACE_UCNV_OPEN_ALGORITHMIC = UTraceFunctionNumber.UCNV_OPEN_ALGORITHMIC; pub const UTRACE_UCNV_CLONE = UTraceFunctionNumber.UCNV_CLONE; pub const UTRACE_UCNV_CLOSE = UTraceFunctionNumber.UCNV_CLOSE; pub const UTRACE_UCNV_FLUSH_CACHE = UTraceFunctionNumber.UCNV_FLUSH_CACHE; pub const UTRACE_UCNV_LOAD = UTraceFunctionNumber.UCNV_LOAD; pub const UTRACE_UCNV_UNLOAD = UTraceFunctionNumber.UCNV_UNLOAD; pub const UTRACE_COLLATION_START = UTraceFunctionNumber.COLLATION_START; pub const UTRACE_UCOL_OPEN = UTraceFunctionNumber.COLLATION_START; pub const UTRACE_UCOL_CLOSE = UTraceFunctionNumber.UCOL_CLOSE; pub const UTRACE_UCOL_STRCOLL = UTraceFunctionNumber.UCOL_STRCOLL; pub const UTRACE_UCOL_GET_SORTKEY = UTraceFunctionNumber.UCOL_GET_SORTKEY; pub const UTRACE_UCOL_GETLOCALE = UTraceFunctionNumber.UCOL_GETLOCALE; pub const UTRACE_UCOL_NEXTSORTKEYPART = UTraceFunctionNumber.UCOL_NEXTSORTKEYPART; pub const UTRACE_UCOL_STRCOLLITER = UTraceFunctionNumber.UCOL_STRCOLLITER; pub const UTRACE_UCOL_OPEN_FROM_SHORT_STRING = UTraceFunctionNumber.UCOL_OPEN_FROM_SHORT_STRING; pub const UTRACE_UCOL_STRCOLLUTF8 = UTraceFunctionNumber.UCOL_STRCOLLUTF8; pub const UTraceEntry = fn( context: ?*const c_void, fnNumber: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub const UTraceExit = fn( context: ?*const c_void, fnNumber: i32, fmt: ?[*:0]const u8, args: ?*i8, ) callconv(@import("std").os.windows.WINAPI) void; pub const UTraceData = fn( context: ?*const c_void, fnNumber: i32, level: i32, fmt: ?[*:0]const u8, args: ?*i8, ) callconv(@import("std").os.windows.WINAPI) void; pub const UStringTrieResult = enum(i32) { NO_MATCH = 0, NO_VALUE = 1, FINAL_VALUE = 2, INTERMEDIATE_VALUE = 3, }; pub const USTRINGTRIE_NO_MATCH = UStringTrieResult.NO_MATCH; pub const USTRINGTRIE_NO_VALUE = UStringTrieResult.NO_VALUE; pub const USTRINGTRIE_FINAL_VALUE = UStringTrieResult.FINAL_VALUE; pub const USTRINGTRIE_INTERMEDIATE_VALUE = UStringTrieResult.INTERMEDIATE_VALUE; pub const UScriptCode = enum(i32) { INVALID_CODE = -1, COMMON = 0, INHERITED = 1, ARABIC = 2, ARMENIAN = 3, BENGALI = 4, BOPOMOFO = 5, CHEROKEE = 6, COPTIC = 7, CYRILLIC = 8, DESERET = 9, DEVANAGARI = 10, ETHIOPIC = 11, GEORGIAN = 12, GOTHIC = 13, GREEK = 14, GUJARATI = 15, GURMUKHI = 16, HAN = 17, HANGUL = 18, HEBREW = 19, HIRAGANA = 20, KANNADA = 21, KATAKANA = 22, KHMER = 23, LAO = 24, LATIN = 25, MALAYALAM = 26, MONGOLIAN = 27, MYANMAR = 28, OGHAM = 29, OLD_ITALIC = 30, ORIYA = 31, RUNIC = 32, SINHALA = 33, SYRIAC = 34, TAMIL = 35, TELUGU = 36, THAANA = 37, THAI = 38, TIBETAN = 39, CANADIAN_ABORIGINAL = 40, // UCAS = 40, this enum value conflicts with CANADIAN_ABORIGINAL YI = 41, TAGALOG = 42, HANUNOO = 43, BUHID = 44, TAGBANWA = 45, BRAILLE = 46, CYPRIOT = 47, LIMBU = 48, LINEAR_B = 49, OSMANYA = 50, SHAVIAN = 51, TAI_LE = 52, UGARITIC = 53, KATAKANA_OR_HIRAGANA = 54, BUGINESE = 55, GLAGOLITIC = 56, KHAROSHTHI = 57, SYLOTI_NAGRI = 58, NEW_TAI_LUE = 59, TIFINAGH = 60, OLD_PERSIAN = 61, BALINESE = 62, BATAK = 63, BLISSYMBOLS = 64, BRAHMI = 65, CHAM = 66, CIRTH = 67, OLD_CHURCH_SLAVONIC_CYRILLIC = 68, DEMOTIC_EGYPTIAN = 69, HIERATIC_EGYPTIAN = 70, EGYPTIAN_HIEROGLYPHS = 71, KHUTSURI = 72, SIMPLIFIED_HAN = 73, TRADITIONAL_HAN = 74, PAHAWH_HMONG = 75, OLD_HUNGARIAN = 76, HARAPPAN_INDUS = 77, JAVANESE = 78, KAYAH_LI = 79, LATIN_FRAKTUR = 80, LATIN_GAELIC = 81, LEPCHA = 82, LINEAR_A = 83, MANDAIC = 84, // MANDAEAN = 84, this enum value conflicts with MANDAIC MAYAN_HIEROGLYPHS = 85, MEROITIC_HIEROGLYPHS = 86, // MEROITIC = 86, this enum value conflicts with MEROITIC_HIEROGLYPHS NKO = 87, ORKHON = 88, OLD_PERMIC = 89, PHAGS_PA = 90, PHOENICIAN = 91, MIAO = 92, // PHONETIC_POLLARD = 92, this enum value conflicts with MIAO RONGORONGO = 93, SARATI = 94, ESTRANGELO_SYRIAC = 95, WESTERN_SYRIAC = 96, EASTERN_SYRIAC = 97, TENGWAR = 98, VAI = 99, VISIBLE_SPEECH = 100, CUNEIFORM = 101, UNWRITTEN_LANGUAGES = 102, UNKNOWN = 103, CARIAN = 104, JAPANESE = 105, LANNA = 106, LYCIAN = 107, LYDIAN = 108, OL_CHIKI = 109, REJANG = 110, SAURASHTRA = 111, SIGN_WRITING = 112, SUNDANESE = 113, MOON = 114, MEITEI_MAYEK = 115, IMPERIAL_ARAMAIC = 116, AVESTAN = 117, CHAKMA = 118, KOREAN = 119, KAITHI = 120, MANICHAEAN = 121, INSCRIPTIONAL_PAHLAVI = 122, PSALTER_PAHLAVI = 123, BOOK_PAHLAVI = 124, INSCRIPTIONAL_PARTHIAN = 125, SAMARITAN = 126, TAI_VIET = 127, MATHEMATICAL_NOTATION = 128, SYMBOLS = 129, BAMUM = 130, LISU = 131, NAKHI_GEBA = 132, OLD_SOUTH_ARABIAN = 133, BASSA_VAH = 134, DUPLOYAN = 135, ELBASAN = 136, GRANTHA = 137, KPELLE = 138, LOMA = 139, MENDE = 140, MEROITIC_CURSIVE = 141, OLD_NORTH_ARABIAN = 142, NABATAEAN = 143, PALMYRENE = 144, KHUDAWADI = 145, // SINDHI = 145, this enum value conflicts with KHUDAWADI WARANG_CITI = 146, AFAKA = 147, JURCHEN = 148, MRO = 149, NUSHU = 150, SHARADA = 151, SORA_SOMPENG = 152, TAKRI = 153, TANGUT = 154, WOLEAI = 155, ANATOLIAN_HIEROGLYPHS = 156, KHOJKI = 157, TIRHUTA = 158, CAUCASIAN_ALBANIAN = 159, MAHAJANI = 160, AHOM = 161, HATRAN = 162, MODI = 163, MULTANI = 164, PAU_CIN_HAU = 165, SIDDHAM = 166, ADLAM = 167, BHAIKSUKI = 168, MARCHEN = 169, NEWA = 170, OSAGE = 171, HAN_WITH_BOPOMOFO = 172, JAMO = 173, SYMBOLS_EMOJI = 174, MASARAM_GONDI = 175, SOYOMBO = 176, ZANABAZAR_SQUARE = 177, DOGRA = 178, GUNJALA_GONDI = 179, MAKASAR = 180, MEDEFAIDRIN = 181, HANIFI_ROHINGYA = 182, SOGDIAN = 183, OLD_SOGDIAN = 184, ELYMAIC = 185, NYIAKENG_PUACHUE_HMONG = 186, NANDINAGARI = 187, WANCHO = 188, }; pub const USCRIPT_INVALID_CODE = UScriptCode.INVALID_CODE; pub const USCRIPT_COMMON = UScriptCode.COMMON; pub const USCRIPT_INHERITED = UScriptCode.INHERITED; pub const USCRIPT_ARABIC = UScriptCode.ARABIC; pub const USCRIPT_ARMENIAN = UScriptCode.ARMENIAN; pub const USCRIPT_BENGALI = UScriptCode.BENGALI; pub const USCRIPT_BOPOMOFO = UScriptCode.BOPOMOFO; pub const USCRIPT_CHEROKEE = UScriptCode.CHEROKEE; pub const USCRIPT_COPTIC = UScriptCode.COPTIC; pub const USCRIPT_CYRILLIC = UScriptCode.CYRILLIC; pub const USCRIPT_DESERET = UScriptCode.DESERET; pub const USCRIPT_DEVANAGARI = UScriptCode.DEVANAGARI; pub const USCRIPT_ETHIOPIC = UScriptCode.ETHIOPIC; pub const USCRIPT_GEORGIAN = UScriptCode.GEORGIAN; pub const USCRIPT_GOTHIC = UScriptCode.GOTHIC; pub const USCRIPT_GREEK = UScriptCode.GREEK; pub const USCRIPT_GUJARATI = UScriptCode.GUJARATI; pub const USCRIPT_GURMUKHI = UScriptCode.GURMUKHI; pub const USCRIPT_HAN = UScriptCode.HAN; pub const USCRIPT_HANGUL = UScriptCode.HANGUL; pub const USCRIPT_HEBREW = UScriptCode.HEBREW; pub const USCRIPT_HIRAGANA = UScriptCode.HIRAGANA; pub const USCRIPT_KANNADA = UScriptCode.KANNADA; pub const USCRIPT_KATAKANA = UScriptCode.KATAKANA; pub const USCRIPT_KHMER = UScriptCode.KHMER; pub const USCRIPT_LAO = UScriptCode.LAO; pub const USCRIPT_LATIN = UScriptCode.LATIN; pub const USCRIPT_MALAYALAM = UScriptCode.MALAYALAM; pub const USCRIPT_MONGOLIAN = UScriptCode.MONGOLIAN; pub const USCRIPT_MYANMAR = UScriptCode.MYANMAR; pub const USCRIPT_OGHAM = UScriptCode.OGHAM; pub const USCRIPT_OLD_ITALIC = UScriptCode.OLD_ITALIC; pub const USCRIPT_ORIYA = UScriptCode.ORIYA; pub const USCRIPT_RUNIC = UScriptCode.RUNIC; pub const USCRIPT_SINHALA = UScriptCode.SINHALA; pub const USCRIPT_SYRIAC = UScriptCode.SYRIAC; pub const USCRIPT_TAMIL = UScriptCode.TAMIL; pub const USCRIPT_TELUGU = UScriptCode.TELUGU; pub const USCRIPT_THAANA = UScriptCode.THAANA; pub const USCRIPT_THAI = UScriptCode.THAI; pub const USCRIPT_TIBETAN = UScriptCode.TIBETAN; pub const USCRIPT_CANADIAN_ABORIGINAL = UScriptCode.CANADIAN_ABORIGINAL; pub const USCRIPT_UCAS = UScriptCode.CANADIAN_ABORIGINAL; pub const USCRIPT_YI = UScriptCode.YI; pub const USCRIPT_TAGALOG = UScriptCode.TAGALOG; pub const USCRIPT_HANUNOO = UScriptCode.HANUNOO; pub const USCRIPT_BUHID = UScriptCode.BUHID; pub const USCRIPT_TAGBANWA = UScriptCode.TAGBANWA; pub const USCRIPT_BRAILLE = UScriptCode.BRAILLE; pub const USCRIPT_CYPRIOT = UScriptCode.CYPRIOT; pub const USCRIPT_LIMBU = UScriptCode.LIMBU; pub const USCRIPT_LINEAR_B = UScriptCode.LINEAR_B; pub const USCRIPT_OSMANYA = UScriptCode.OSMANYA; pub const USCRIPT_SHAVIAN = UScriptCode.SHAVIAN; pub const USCRIPT_TAI_LE = UScriptCode.TAI_LE; pub const USCRIPT_UGARITIC = UScriptCode.UGARITIC; pub const USCRIPT_KATAKANA_OR_HIRAGANA = UScriptCode.KATAKANA_OR_HIRAGANA; pub const USCRIPT_BUGINESE = UScriptCode.BUGINESE; pub const USCRIPT_GLAGOLITIC = UScriptCode.GLAGOLITIC; pub const USCRIPT_KHAROSHTHI = UScriptCode.KHAROSHTHI; pub const USCRIPT_SYLOTI_NAGRI = UScriptCode.SYLOTI_NAGRI; pub const USCRIPT_NEW_TAI_LUE = UScriptCode.NEW_TAI_LUE; pub const USCRIPT_TIFINAGH = UScriptCode.TIFINAGH; pub const USCRIPT_OLD_PERSIAN = UScriptCode.OLD_PERSIAN; pub const USCRIPT_BALINESE = UScriptCode.BALINESE; pub const USCRIPT_BATAK = UScriptCode.BATAK; pub const USCRIPT_BLISSYMBOLS = UScriptCode.BLISSYMBOLS; pub const USCRIPT_BRAHMI = UScriptCode.BRAHMI; pub const USCRIPT_CHAM = UScriptCode.CHAM; pub const USCRIPT_CIRTH = UScriptCode.CIRTH; pub const USCRIPT_OLD_CHURCH_SLAVONIC_CYRILLIC = UScriptCode.OLD_CHURCH_SLAVONIC_CYRILLIC; pub const USCRIPT_DEMOTIC_EGYPTIAN = UScriptCode.DEMOTIC_EGYPTIAN; pub const USCRIPT_HIERATIC_EGYPTIAN = UScriptCode.HIERATIC_EGYPTIAN; pub const USCRIPT_EGYPTIAN_HIEROGLYPHS = UScriptCode.EGYPTIAN_HIEROGLYPHS; pub const USCRIPT_KHUTSURI = UScriptCode.KHUTSURI; pub const USCRIPT_SIMPLIFIED_HAN = UScriptCode.SIMPLIFIED_HAN; pub const USCRIPT_TRADITIONAL_HAN = UScriptCode.TRADITIONAL_HAN; pub const USCRIPT_PAHAWH_HMONG = UScriptCode.PAHAWH_HMONG; pub const USCRIPT_OLD_HUNGARIAN = UScriptCode.OLD_HUNGARIAN; pub const USCRIPT_HARAPPAN_INDUS = UScriptCode.HARAPPAN_INDUS; pub const USCRIPT_JAVANESE = UScriptCode.JAVANESE; pub const USCRIPT_KAYAH_LI = UScriptCode.KAYAH_LI; pub const USCRIPT_LATIN_FRAKTUR = UScriptCode.LATIN_FRAKTUR; pub const USCRIPT_LATIN_GAELIC = UScriptCode.LATIN_GAELIC; pub const USCRIPT_LEPCHA = UScriptCode.LEPCHA; pub const USCRIPT_LINEAR_A = UScriptCode.LINEAR_A; pub const USCRIPT_MANDAIC = UScriptCode.MANDAIC; pub const USCRIPT_MANDAEAN = UScriptCode.MANDAIC; pub const USCRIPT_MAYAN_HIEROGLYPHS = UScriptCode.MAYAN_HIEROGLYPHS; pub const USCRIPT_MEROITIC_HIEROGLYPHS = UScriptCode.MEROITIC_HIEROGLYPHS; pub const USCRIPT_MEROITIC = UScriptCode.MEROITIC_HIEROGLYPHS; pub const USCRIPT_NKO = UScriptCode.NKO; pub const USCRIPT_ORKHON = UScriptCode.ORKHON; pub const USCRIPT_OLD_PERMIC = UScriptCode.OLD_PERMIC; pub const USCRIPT_PHAGS_PA = UScriptCode.PHAGS_PA; pub const USCRIPT_PHOENICIAN = UScriptCode.PHOENICIAN; pub const USCRIPT_MIAO = UScriptCode.MIAO; pub const USCRIPT_PHONETIC_POLLARD = UScriptCode.MIAO; pub const USCRIPT_RONGORONGO = UScriptCode.RONGORONGO; pub const USCRIPT_SARATI = UScriptCode.SARATI; pub const USCRIPT_ESTRANGELO_SYRIAC = UScriptCode.ESTRANGELO_SYRIAC; pub const USCRIPT_WESTERN_SYRIAC = UScriptCode.WESTERN_SYRIAC; pub const USCRIPT_EASTERN_SYRIAC = UScriptCode.EASTERN_SYRIAC; pub const USCRIPT_TENGWAR = UScriptCode.TENGWAR; pub const USCRIPT_VAI = UScriptCode.VAI; pub const USCRIPT_VISIBLE_SPEECH = UScriptCode.VISIBLE_SPEECH; pub const USCRIPT_CUNEIFORM = UScriptCode.CUNEIFORM; pub const USCRIPT_UNWRITTEN_LANGUAGES = UScriptCode.UNWRITTEN_LANGUAGES; pub const USCRIPT_UNKNOWN = UScriptCode.UNKNOWN; pub const USCRIPT_CARIAN = UScriptCode.CARIAN; pub const USCRIPT_JAPANESE = UScriptCode.JAPANESE; pub const USCRIPT_LANNA = UScriptCode.LANNA; pub const USCRIPT_LYCIAN = UScriptCode.LYCIAN; pub const USCRIPT_LYDIAN = UScriptCode.LYDIAN; pub const USCRIPT_OL_CHIKI = UScriptCode.OL_CHIKI; pub const USCRIPT_REJANG = UScriptCode.REJANG; pub const USCRIPT_SAURASHTRA = UScriptCode.SAURASHTRA; pub const USCRIPT_SIGN_WRITING = UScriptCode.SIGN_WRITING; pub const USCRIPT_SUNDANESE = UScriptCode.SUNDANESE; pub const USCRIPT_MOON = UScriptCode.MOON; pub const USCRIPT_MEITEI_MAYEK = UScriptCode.MEITEI_MAYEK; pub const USCRIPT_IMPERIAL_ARAMAIC = UScriptCode.IMPERIAL_ARAMAIC; pub const USCRIPT_AVESTAN = UScriptCode.AVESTAN; pub const USCRIPT_CHAKMA = UScriptCode.CHAKMA; pub const USCRIPT_KOREAN = UScriptCode.KOREAN; pub const USCRIPT_KAITHI = UScriptCode.KAITHI; pub const USCRIPT_MANICHAEAN = UScriptCode.MANICHAEAN; pub const USCRIPT_INSCRIPTIONAL_PAHLAVI = UScriptCode.INSCRIPTIONAL_PAHLAVI; pub const USCRIPT_PSALTER_PAHLAVI = UScriptCode.PSALTER_PAHLAVI; pub const USCRIPT_BOOK_PAHLAVI = UScriptCode.BOOK_PAHLAVI; pub const USCRIPT_INSCRIPTIONAL_PARTHIAN = UScriptCode.INSCRIPTIONAL_PARTHIAN; pub const USCRIPT_SAMARITAN = UScriptCode.SAMARITAN; pub const USCRIPT_TAI_VIET = UScriptCode.TAI_VIET; pub const USCRIPT_MATHEMATICAL_NOTATION = UScriptCode.MATHEMATICAL_NOTATION; pub const USCRIPT_SYMBOLS = UScriptCode.SYMBOLS; pub const USCRIPT_BAMUM = UScriptCode.BAMUM; pub const USCRIPT_LISU = UScriptCode.LISU; pub const USCRIPT_NAKHI_GEBA = UScriptCode.NAKHI_GEBA; pub const USCRIPT_OLD_SOUTH_ARABIAN = UScriptCode.OLD_SOUTH_ARABIAN; pub const USCRIPT_BASSA_VAH = UScriptCode.BASSA_VAH; pub const USCRIPT_DUPLOYAN = UScriptCode.DUPLOYAN; pub const USCRIPT_ELBASAN = UScriptCode.ELBASAN; pub const USCRIPT_GRANTHA = UScriptCode.GRANTHA; pub const USCRIPT_KPELLE = UScriptCode.KPELLE; pub const USCRIPT_LOMA = UScriptCode.LOMA; pub const USCRIPT_MENDE = UScriptCode.MENDE; pub const USCRIPT_MEROITIC_CURSIVE = UScriptCode.MEROITIC_CURSIVE; pub const USCRIPT_OLD_NORTH_ARABIAN = UScriptCode.OLD_NORTH_ARABIAN; pub const USCRIPT_NABATAEAN = UScriptCode.NABATAEAN; pub const USCRIPT_PALMYRENE = UScriptCode.PALMYRENE; pub const USCRIPT_KHUDAWADI = UScriptCode.KHUDAWADI; pub const USCRIPT_SINDHI = UScriptCode.KHUDAWADI; pub const USCRIPT_WARANG_CITI = UScriptCode.WARANG_CITI; pub const USCRIPT_AFAKA = UScriptCode.AFAKA; pub const USCRIPT_JURCHEN = UScriptCode.JURCHEN; pub const USCRIPT_MRO = UScriptCode.MRO; pub const USCRIPT_NUSHU = UScriptCode.NUSHU; pub const USCRIPT_SHARADA = UScriptCode.SHARADA; pub const USCRIPT_SORA_SOMPENG = UScriptCode.SORA_SOMPENG; pub const USCRIPT_TAKRI = UScriptCode.TAKRI; pub const USCRIPT_TANGUT = UScriptCode.TANGUT; pub const USCRIPT_WOLEAI = UScriptCode.WOLEAI; pub const USCRIPT_ANATOLIAN_HIEROGLYPHS = UScriptCode.ANATOLIAN_HIEROGLYPHS; pub const USCRIPT_KHOJKI = UScriptCode.KHOJKI; pub const USCRIPT_TIRHUTA = UScriptCode.TIRHUTA; pub const USCRIPT_CAUCASIAN_ALBANIAN = UScriptCode.CAUCASIAN_ALBANIAN; pub const USCRIPT_MAHAJANI = UScriptCode.MAHAJANI; pub const USCRIPT_AHOM = UScriptCode.AHOM; pub const USCRIPT_HATRAN = UScriptCode.HATRAN; pub const USCRIPT_MODI = UScriptCode.MODI; pub const USCRIPT_MULTANI = UScriptCode.MULTANI; pub const USCRIPT_PAU_CIN_HAU = UScriptCode.PAU_CIN_HAU; pub const USCRIPT_SIDDHAM = UScriptCode.SIDDHAM; pub const USCRIPT_ADLAM = UScriptCode.ADLAM; pub const USCRIPT_BHAIKSUKI = UScriptCode.BHAIKSUKI; pub const USCRIPT_MARCHEN = UScriptCode.MARCHEN; pub const USCRIPT_NEWA = UScriptCode.NEWA; pub const USCRIPT_OSAGE = UScriptCode.OSAGE; pub const USCRIPT_HAN_WITH_BOPOMOFO = UScriptCode.HAN_WITH_BOPOMOFO; pub const USCRIPT_JAMO = UScriptCode.JAMO; pub const USCRIPT_SYMBOLS_EMOJI = UScriptCode.SYMBOLS_EMOJI; pub const USCRIPT_MASARAM_GONDI = UScriptCode.MASARAM_GONDI; pub const USCRIPT_SOYOMBO = UScriptCode.SOYOMBO; pub const USCRIPT_ZANABAZAR_SQUARE = UScriptCode.ZANABAZAR_SQUARE; pub const USCRIPT_DOGRA = UScriptCode.DOGRA; pub const USCRIPT_GUNJALA_GONDI = UScriptCode.GUNJALA_GONDI; pub const USCRIPT_MAKASAR = UScriptCode.MAKASAR; pub const USCRIPT_MEDEFAIDRIN = UScriptCode.MEDEFAIDRIN; pub const USCRIPT_HANIFI_ROHINGYA = UScriptCode.HANIFI_ROHINGYA; pub const USCRIPT_SOGDIAN = UScriptCode.SOGDIAN; pub const USCRIPT_OLD_SOGDIAN = UScriptCode.OLD_SOGDIAN; pub const USCRIPT_ELYMAIC = UScriptCode.ELYMAIC; pub const USCRIPT_NYIAKENG_PUACHUE_HMONG = UScriptCode.NYIAKENG_PUACHUE_HMONG; pub const USCRIPT_NANDINAGARI = UScriptCode.NANDINAGARI; pub const USCRIPT_WANCHO = UScriptCode.WANCHO; pub const UScriptUsage = enum(i32) { NOT_ENCODED = 0, UNKNOWN = 1, EXCLUDED = 2, LIMITED_USE = 3, ASPIRATIONAL = 4, RECOMMENDED = 5, }; pub const USCRIPT_USAGE_NOT_ENCODED = UScriptUsage.NOT_ENCODED; pub const USCRIPT_USAGE_UNKNOWN = UScriptUsage.UNKNOWN; pub const USCRIPT_USAGE_EXCLUDED = UScriptUsage.EXCLUDED; pub const USCRIPT_USAGE_LIMITED_USE = UScriptUsage.LIMITED_USE; pub const USCRIPT_USAGE_ASPIRATIONAL = UScriptUsage.ASPIRATIONAL; pub const USCRIPT_USAGE_RECOMMENDED = UScriptUsage.RECOMMENDED; pub const UReplaceableCallbacks = extern struct { length: isize, charAt: isize, char32At: isize, replace: isize, extract: isize, copy: isize, }; pub const UFieldPosition = extern struct { field: i32, beginIndex: i32, endIndex: i32, }; pub const UCharIteratorOrigin = enum(i32) { START = 0, CURRENT = 1, LIMIT = 2, ZERO = 3, LENGTH = 4, }; pub const UITER_START = UCharIteratorOrigin.START; pub const UITER_CURRENT = UCharIteratorOrigin.CURRENT; pub const UITER_LIMIT = UCharIteratorOrigin.LIMIT; pub const UITER_ZERO = UCharIteratorOrigin.ZERO; pub const UITER_LENGTH = UCharIteratorOrigin.LENGTH; pub const UCharIteratorGetIndex = fn( iter: ?*UCharIterator, origin: UCharIteratorOrigin, ) callconv(@import("std").os.windows.WINAPI) i32; pub const UCharIteratorMove = fn( iter: ?*UCharIterator, delta: i32, origin: UCharIteratorOrigin, ) callconv(@import("std").os.windows.WINAPI) i32; pub const UCharIteratorHasNext = fn( iter: ?*UCharIterator, ) callconv(@import("std").os.windows.WINAPI) i8; pub const UCharIteratorHasPrevious = fn( iter: ?*UCharIterator, ) callconv(@import("std").os.windows.WINAPI) i8; pub const UCharIteratorCurrent = fn( iter: ?*UCharIterator, ) callconv(@import("std").os.windows.WINAPI) i32; pub const UCharIteratorNext = fn( iter: ?*UCharIterator, ) callconv(@import("std").os.windows.WINAPI) i32; pub const UCharIteratorPrevious = fn( iter: ?*UCharIterator, ) callconv(@import("std").os.windows.WINAPI) i32; pub const UCharIteratorReserved = fn( iter: ?*UCharIterator, something: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const UCharIteratorGetState = fn( iter: ?*const UCharIterator, ) callconv(@import("std").os.windows.WINAPI) u32; pub const UCharIteratorSetState = fn( iter: ?*UCharIterator, state: u32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub const UCharIterator = extern struct { context: ?*const c_void, length: i32, start: i32, index: i32, limit: i32, reservedField: i32, getIndex: ?UCharIteratorGetIndex, move: ?UCharIteratorMove, hasNext: ?UCharIteratorHasNext, hasPrevious: ?UCharIteratorHasPrevious, current: ?UCharIteratorCurrent, next: ?UCharIteratorNext, previous: ?UCharIteratorPrevious, reservedFn: ?UCharIteratorReserved, getState: ?UCharIteratorGetState, setState: ?UCharIteratorSetState, }; pub const ULocDataLocaleType = enum(i32) { ACTUAL_LOCALE = 0, VALID_LOCALE = 1, }; pub const ULOC_ACTUAL_LOCALE = ULocDataLocaleType.ACTUAL_LOCALE; pub const ULOC_VALID_LOCALE = ULocDataLocaleType.VALID_LOCALE; pub const ULayoutType = enum(i32) { LTR = 0, RTL = 1, TTB = 2, BTT = 3, UNKNOWN = 4, }; pub const ULOC_LAYOUT_LTR = ULayoutType.LTR; pub const ULOC_LAYOUT_RTL = ULayoutType.RTL; pub const ULOC_LAYOUT_TTB = ULayoutType.TTB; pub const ULOC_LAYOUT_BTT = ULayoutType.BTT; pub const ULOC_LAYOUT_UNKNOWN = ULayoutType.UNKNOWN; pub const UAcceptResult = enum(i32) { FAILED = 0, VALID = 1, FALLBACK = 2, }; pub const ULOC_ACCEPT_FAILED = UAcceptResult.FAILED; pub const ULOC_ACCEPT_VALID = UAcceptResult.VALID; pub const ULOC_ACCEPT_FALLBACK = UAcceptResult.FALLBACK; pub const UResType = enum(i32) { NONE = -1, STRING = 0, BINARY = 1, TABLE = 2, ALIAS = 3, INT = 7, ARRAY = 8, INT_VECTOR = 14, }; pub const URES_NONE = UResType.NONE; pub const URES_STRING = UResType.STRING; pub const URES_BINARY = UResType.BINARY; pub const URES_TABLE = UResType.TABLE; pub const URES_ALIAS = UResType.ALIAS; pub const URES_INT = UResType.INT; pub const URES_ARRAY = UResType.ARRAY; pub const URES_INT_VECTOR = UResType.INT_VECTOR; pub const UDisplayContextType = enum(i32) { DIALECT_HANDLING = 0, CAPITALIZATION = 1, DISPLAY_LENGTH = 2, SUBSTITUTE_HANDLING = 3, }; pub const UDISPCTX_TYPE_DIALECT_HANDLING = UDisplayContextType.DIALECT_HANDLING; pub const UDISPCTX_TYPE_CAPITALIZATION = UDisplayContextType.CAPITALIZATION; pub const UDISPCTX_TYPE_DISPLAY_LENGTH = UDisplayContextType.DISPLAY_LENGTH; pub const UDISPCTX_TYPE_SUBSTITUTE_HANDLING = UDisplayContextType.SUBSTITUTE_HANDLING; pub const UDisplayContext = enum(i32) { STANDARD_NAMES = 0, DIALECT_NAMES = 1, CAPITALIZATION_NONE = 256, CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE = 257, CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE = 258, CAPITALIZATION_FOR_UI_LIST_OR_MENU = 259, CAPITALIZATION_FOR_STANDALONE = 260, LENGTH_FULL = 512, LENGTH_SHORT = 513, SUBSTITUTE = 768, NO_SUBSTITUTE = 769, }; pub const UDISPCTX_STANDARD_NAMES = UDisplayContext.STANDARD_NAMES; pub const UDISPCTX_DIALECT_NAMES = UDisplayContext.DIALECT_NAMES; pub const UDISPCTX_CAPITALIZATION_NONE = UDisplayContext.CAPITALIZATION_NONE; pub const UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE = UDisplayContext.CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE; pub const UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE = UDisplayContext.CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE; pub const UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU = UDisplayContext.CAPITALIZATION_FOR_UI_LIST_OR_MENU; pub const UDISPCTX_CAPITALIZATION_FOR_STANDALONE = UDisplayContext.CAPITALIZATION_FOR_STANDALONE; pub const UDISPCTX_LENGTH_FULL = UDisplayContext.LENGTH_FULL; pub const UDISPCTX_LENGTH_SHORT = UDisplayContext.LENGTH_SHORT; pub const UDISPCTX_SUBSTITUTE = UDisplayContext.SUBSTITUTE; pub const UDISPCTX_NO_SUBSTITUTE = UDisplayContext.NO_SUBSTITUTE; pub const UDialectHandling = enum(i32) { STANDARD_NAMES = 0, DIALECT_NAMES = 1, }; pub const ULDN_STANDARD_NAMES = UDialectHandling.STANDARD_NAMES; pub const ULDN_DIALECT_NAMES = UDialectHandling.DIALECT_NAMES; pub const UCurrencyUsage = enum(i32) { STANDARD = 0, CASH = 1, }; pub const UCURR_USAGE_STANDARD = UCurrencyUsage.STANDARD; pub const UCURR_USAGE_CASH = UCurrencyUsage.CASH; pub const UCurrNameStyle = enum(i32) { SYMBOL_NAME = 0, LONG_NAME = 1, NARROW_SYMBOL_NAME = 2, }; pub const UCURR_SYMBOL_NAME = UCurrNameStyle.SYMBOL_NAME; pub const UCURR_LONG_NAME = UCurrNameStyle.LONG_NAME; pub const UCURR_NARROW_SYMBOL_NAME = UCurrNameStyle.NARROW_SYMBOL_NAME; pub const UCurrCurrencyType = enum(i32) { ALL = 2147483647, COMMON = 1, UNCOMMON = 2, DEPRECATED = 4, NON_DEPRECATED = 8, }; pub const UCURR_ALL = UCurrCurrencyType.ALL; pub const UCURR_COMMON = UCurrCurrencyType.COMMON; pub const UCURR_UNCOMMON = UCurrCurrencyType.UNCOMMON; pub const UCURR_DEPRECATED = UCurrCurrencyType.DEPRECATED; pub const UCURR_NON_DEPRECATED = UCurrCurrencyType.NON_DEPRECATED; pub const UConverterCallbackReason = enum(i32) { UNASSIGNED = 0, ILLEGAL = 1, IRREGULAR = 2, RESET = 3, CLOSE = 4, CLONE = 5, }; pub const UCNV_UNASSIGNED = UConverterCallbackReason.UNASSIGNED; pub const UCNV_ILLEGAL = UConverterCallbackReason.ILLEGAL; pub const UCNV_IRREGULAR = UConverterCallbackReason.IRREGULAR; pub const UCNV_RESET = UConverterCallbackReason.RESET; pub const UCNV_CLOSE = UConverterCallbackReason.CLOSE; pub const UCNV_CLONE = UConverterCallbackReason.CLONE; pub const UConverterFromUnicodeArgs = extern struct { size: u16, flush: i8, converter: ?*UConverter, source: ?*const u16, sourceLimit: ?*const u16, target: ?PSTR, targetLimit: ?[*:0]const u8, offsets: ?*i32, }; pub const UConverterToUnicodeArgs = extern struct { size: u16, flush: i8, converter: ?*UConverter, source: ?[*:0]const u8, sourceLimit: ?[*:0]const u8, target: ?*u16, targetLimit: ?*const u16, offsets: ?*i32, }; pub const UConverterType = enum(i32) { UNSUPPORTED_CONVERTER = -1, SBCS = 0, DBCS = 1, MBCS = 2, LATIN_1 = 3, UTF8 = 4, UTF16_BigEndian = 5, UTF16_LittleEndian = 6, UTF32_BigEndian = 7, UTF32_LittleEndian = 8, EBCDIC_STATEFUL = 9, ISO_2022 = 10, LMBCS_1 = 11, LMBCS_2 = 12, LMBCS_3 = 13, LMBCS_4 = 14, LMBCS_5 = 15, LMBCS_6 = 16, LMBCS_8 = 17, LMBCS_11 = 18, LMBCS_16 = 19, LMBCS_17 = 20, LMBCS_18 = 21, LMBCS_19 = 22, // LMBCS_LAST = 22, this enum value conflicts with LMBCS_19 HZ = 23, SCSU = 24, ISCII = 25, US_ASCII = 26, UTF7 = 27, BOCU1 = 28, UTF16 = 29, UTF32 = 30, CESU8 = 31, IMAP_MAILBOX = 32, COMPOUND_TEXT = 33, NUMBER_OF_SUPPORTED_CONVERTER_TYPES = 34, }; pub const UCNV_UNSUPPORTED_CONVERTER = UConverterType.UNSUPPORTED_CONVERTER; pub const UCNV_SBCS = UConverterType.SBCS; pub const UCNV_DBCS = UConverterType.DBCS; pub const UCNV_MBCS = UConverterType.MBCS; pub const UCNV_LATIN_1 = UConverterType.LATIN_1; pub const UCNV_UTF8 = UConverterType.UTF8; pub const UCNV_UTF16_BigEndian = UConverterType.UTF16_BigEndian; pub const UCNV_UTF16_LittleEndian = UConverterType.UTF16_LittleEndian; pub const UCNV_UTF32_BigEndian = UConverterType.UTF32_BigEndian; pub const UCNV_UTF32_LittleEndian = UConverterType.UTF32_LittleEndian; pub const UCNV_EBCDIC_STATEFUL = UConverterType.EBCDIC_STATEFUL; pub const UCNV_ISO_2022 = UConverterType.ISO_2022; pub const UCNV_LMBCS_1 = UConverterType.LMBCS_1; pub const UCNV_LMBCS_2 = UConverterType.LMBCS_2; pub const UCNV_LMBCS_3 = UConverterType.LMBCS_3; pub const UCNV_LMBCS_4 = UConverterType.LMBCS_4; pub const UCNV_LMBCS_5 = UConverterType.LMBCS_5; pub const UCNV_LMBCS_6 = UConverterType.LMBCS_6; pub const UCNV_LMBCS_8 = UConverterType.LMBCS_8; pub const UCNV_LMBCS_11 = UConverterType.LMBCS_11; pub const UCNV_LMBCS_16 = UConverterType.LMBCS_16; pub const UCNV_LMBCS_17 = UConverterType.LMBCS_17; pub const UCNV_LMBCS_18 = UConverterType.LMBCS_18; pub const UCNV_LMBCS_19 = UConverterType.LMBCS_19; pub const UCNV_LMBCS_LAST = UConverterType.LMBCS_19; pub const UCNV_HZ = UConverterType.HZ; pub const UCNV_SCSU = UConverterType.SCSU; pub const UCNV_ISCII = UConverterType.ISCII; pub const UCNV_US_ASCII = UConverterType.US_ASCII; pub const UCNV_UTF7 = UConverterType.UTF7; pub const UCNV_BOCU1 = UConverterType.BOCU1; pub const UCNV_UTF16 = UConverterType.UTF16; pub const UCNV_UTF32 = UConverterType.UTF32; pub const UCNV_CESU8 = UConverterType.CESU8; pub const UCNV_IMAP_MAILBOX = UConverterType.IMAP_MAILBOX; pub const UCNV_COMPOUND_TEXT = UConverterType.COMPOUND_TEXT; pub const UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES = UConverterType.NUMBER_OF_SUPPORTED_CONVERTER_TYPES; pub const UConverterPlatform = enum(i32) { UNKNOWN = -1, IBM = 0, }; pub const UCNV_UNKNOWN = UConverterPlatform.UNKNOWN; pub const UCNV_IBM = UConverterPlatform.IBM; pub const UConverterToUCallback = fn( context: ?*const c_void, args: ?*UConverterToUnicodeArgs, codeUnits: ?[*:0]const u8, length: i32, reason: UConverterCallbackReason, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub const UConverterFromUCallback = fn( context: ?*const c_void, args: ?*UConverterFromUnicodeArgs, codeUnits: ?*const u16, length: i32, codePoint: i32, reason: UConverterCallbackReason, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub const UConverterUnicodeSet = enum(i32) { SET = 0, AND_FALLBACK_SET = 1, }; pub const UCNV_ROUNDTRIP_SET = UConverterUnicodeSet.SET; pub const UCNV_ROUNDTRIP_AND_FALLBACK_SET = UConverterUnicodeSet.AND_FALLBACK_SET; pub const UMemAllocFn = fn( context: ?*const c_void, size: usize, ) callconv(@import("std").os.windows.WINAPI) ?*c_void; pub const UMemReallocFn = fn( context: ?*const c_void, mem: ?*c_void, size: usize, ) callconv(@import("std").os.windows.WINAPI) ?*c_void; pub const UMemFreeFn = fn( context: ?*const c_void, mem: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) void; pub const UProperty = enum(i32) { ALPHABETIC = 0, // BINARY_START = 0, this enum value conflicts with ALPHABETIC ASCII_HEX_DIGIT = 1, BIDI_CONTROL = 2, BIDI_MIRRORED = 3, DASH = 4, DEFAULT_IGNORABLE_CODE_POINT = 5, DEPRECATED = 6, DIACRITIC = 7, EXTENDER = 8, FULL_COMPOSITION_EXCLUSION = 9, GRAPHEME_BASE = 10, GRAPHEME_EXTEND = 11, GRAPHEME_LINK = 12, HEX_DIGIT = 13, HYPHEN = 14, ID_CONTINUE = 15, ID_START = 16, IDEOGRAPHIC = 17, IDS_BINARY_OPERATOR = 18, IDS_TRINARY_OPERATOR = 19, JOIN_CONTROL = 20, LOGICAL_ORDER_EXCEPTION = 21, LOWERCASE = 22, MATH = 23, NONCHARACTER_CODE_POINT = 24, QUOTATION_MARK = 25, RADICAL = 26, SOFT_DOTTED = 27, TERMINAL_PUNCTUATION = 28, UNIFIED_IDEOGRAPH = 29, UPPERCASE = 30, WHITE_SPACE = 31, XID_CONTINUE = 32, XID_START = 33, CASE_SENSITIVE = 34, S_TERM = 35, VARIATION_SELECTOR = 36, NFD_INERT = 37, NFKD_INERT = 38, NFC_INERT = 39, NFKC_INERT = 40, SEGMENT_STARTER = 41, PATTERN_SYNTAX = 42, PATTERN_WHITE_SPACE = 43, POSIX_ALNUM = 44, POSIX_BLANK = 45, POSIX_GRAPH = 46, POSIX_PRINT = 47, POSIX_XDIGIT = 48, CASED = 49, CASE_IGNORABLE = 50, CHANGES_WHEN_LOWERCASED = 51, CHANGES_WHEN_UPPERCASED = 52, CHANGES_WHEN_TITLECASED = 53, CHANGES_WHEN_CASEFOLDED = 54, CHANGES_WHEN_CASEMAPPED = 55, CHANGES_WHEN_NFKC_CASEFOLDED = 56, EMOJI = 57, EMOJI_PRESENTATION = 58, EMOJI_MODIFIER = 59, EMOJI_MODIFIER_BASE = 60, EMOJI_COMPONENT = 61, REGIONAL_INDICATOR = 62, PREPENDED_CONCATENATION_MARK = 63, EXTENDED_PICTOGRAPHIC = 64, BIDI_CLASS = 4096, // INT_START = 4096, this enum value conflicts with BIDI_CLASS BLOCK = 4097, CANONICAL_COMBINING_CLASS = 4098, DECOMPOSITION_TYPE = 4099, EAST_ASIAN_WIDTH = 4100, GENERAL_CATEGORY = 4101, JOINING_GROUP = 4102, JOINING_TYPE = 4103, LINE_BREAK = 4104, NUMERIC_TYPE = 4105, SCRIPT = 4106, HANGUL_SYLLABLE_TYPE = 4107, NFD_QUICK_CHECK = 4108, NFKD_QUICK_CHECK = 4109, NFC_QUICK_CHECK = 4110, NFKC_QUICK_CHECK = 4111, LEAD_CANONICAL_COMBINING_CLASS = 4112, TRAIL_CANONICAL_COMBINING_CLASS = 4113, GRAPHEME_CLUSTER_BREAK = 4114, SENTENCE_BREAK = 4115, WORD_BREAK = 4116, BIDI_PAIRED_BRACKET_TYPE = 4117, INDIC_POSITIONAL_CATEGORY = 4118, INDIC_SYLLABIC_CATEGORY = 4119, VERTICAL_ORIENTATION = 4120, GENERAL_CATEGORY_MASK = 8192, // MASK_START = 8192, this enum value conflicts with GENERAL_CATEGORY_MASK NUMERIC_VALUE = 12288, // DOUBLE_START = 12288, this enum value conflicts with NUMERIC_VALUE AGE = 16384, // STRING_START = 16384, this enum value conflicts with AGE BIDI_MIRRORING_GLYPH = 16385, CASE_FOLDING = 16386, LOWERCASE_MAPPING = 16388, NAME = 16389, SIMPLE_CASE_FOLDING = 16390, SIMPLE_LOWERCASE_MAPPING = 16391, SIMPLE_TITLECASE_MAPPING = 16392, SIMPLE_UPPERCASE_MAPPING = 16393, TITLECASE_MAPPING = 16394, UPPERCASE_MAPPING = 16396, BIDI_PAIRED_BRACKET = 16397, SCRIPT_EXTENSIONS = 28672, // OTHER_PROPERTY_START = 28672, this enum value conflicts with SCRIPT_EXTENSIONS INVALID_CODE = -1, }; pub const UCHAR_ALPHABETIC = UProperty.ALPHABETIC; pub const UCHAR_BINARY_START = UProperty.ALPHABETIC; pub const UCHAR_ASCII_HEX_DIGIT = UProperty.ASCII_HEX_DIGIT; pub const UCHAR_BIDI_CONTROL = UProperty.BIDI_CONTROL; pub const UCHAR_BIDI_MIRRORED = UProperty.BIDI_MIRRORED; pub const UCHAR_DASH = UProperty.DASH; pub const UCHAR_DEFAULT_IGNORABLE_CODE_POINT = UProperty.DEFAULT_IGNORABLE_CODE_POINT; pub const UCHAR_DEPRECATED = UProperty.DEPRECATED; pub const UCHAR_DIACRITIC = UProperty.DIACRITIC; pub const UCHAR_EXTENDER = UProperty.EXTENDER; pub const UCHAR_FULL_COMPOSITION_EXCLUSION = UProperty.FULL_COMPOSITION_EXCLUSION; pub const UCHAR_GRAPHEME_BASE = UProperty.GRAPHEME_BASE; pub const UCHAR_GRAPHEME_EXTEND = UProperty.GRAPHEME_EXTEND; pub const UCHAR_GRAPHEME_LINK = UProperty.GRAPHEME_LINK; pub const UCHAR_HEX_DIGIT = UProperty.HEX_DIGIT; pub const UCHAR_HYPHEN = UProperty.HYPHEN; pub const UCHAR_ID_CONTINUE = UProperty.ID_CONTINUE; pub const UCHAR_ID_START = UProperty.ID_START; pub const UCHAR_IDEOGRAPHIC = UProperty.IDEOGRAPHIC; pub const UCHAR_IDS_BINARY_OPERATOR = UProperty.IDS_BINARY_OPERATOR; pub const UCHAR_IDS_TRINARY_OPERATOR = UProperty.IDS_TRINARY_OPERATOR; pub const UCHAR_JOIN_CONTROL = UProperty.JOIN_CONTROL; pub const UCHAR_LOGICAL_ORDER_EXCEPTION = UProperty.LOGICAL_ORDER_EXCEPTION; pub const UCHAR_LOWERCASE = UProperty.LOWERCASE; pub const UCHAR_MATH = UProperty.MATH; pub const UCHAR_NONCHARACTER_CODE_POINT = UProperty.NONCHARACTER_CODE_POINT; pub const UCHAR_QUOTATION_MARK = UProperty.QUOTATION_MARK; pub const UCHAR_RADICAL = UProperty.RADICAL; pub const UCHAR_SOFT_DOTTED = UProperty.SOFT_DOTTED; pub const UCHAR_TERMINAL_PUNCTUATION = UProperty.TERMINAL_PUNCTUATION; pub const UCHAR_UNIFIED_IDEOGRAPH = UProperty.UNIFIED_IDEOGRAPH; pub const UCHAR_UPPERCASE = UProperty.UPPERCASE; pub const UCHAR_WHITE_SPACE = UProperty.WHITE_SPACE; pub const UCHAR_XID_CONTINUE = UProperty.XID_CONTINUE; pub const UCHAR_XID_START = UProperty.XID_START; pub const UCHAR_CASE_SENSITIVE = UProperty.CASE_SENSITIVE; pub const UCHAR_S_TERM = UProperty.S_TERM; pub const UCHAR_VARIATION_SELECTOR = UProperty.VARIATION_SELECTOR; pub const UCHAR_NFD_INERT = UProperty.NFD_INERT; pub const UCHAR_NFKD_INERT = UProperty.NFKD_INERT; pub const UCHAR_NFC_INERT = UProperty.NFC_INERT; pub const UCHAR_NFKC_INERT = UProperty.NFKC_INERT; pub const UCHAR_SEGMENT_STARTER = UProperty.SEGMENT_STARTER; pub const UCHAR_PATTERN_SYNTAX = UProperty.PATTERN_SYNTAX; pub const UCHAR_PATTERN_WHITE_SPACE = UProperty.PATTERN_WHITE_SPACE; pub const UCHAR_POSIX_ALNUM = UProperty.POSIX_ALNUM; pub const UCHAR_POSIX_BLANK = UProperty.POSIX_BLANK; pub const UCHAR_POSIX_GRAPH = UProperty.POSIX_GRAPH; pub const UCHAR_POSIX_PRINT = UProperty.POSIX_PRINT; pub const UCHAR_POSIX_XDIGIT = UProperty.POSIX_XDIGIT; pub const UCHAR_CASED = UProperty.CASED; pub const UCHAR_CASE_IGNORABLE = UProperty.CASE_IGNORABLE; pub const UCHAR_CHANGES_WHEN_LOWERCASED = UProperty.CHANGES_WHEN_LOWERCASED; pub const UCHAR_CHANGES_WHEN_UPPERCASED = UProperty.CHANGES_WHEN_UPPERCASED; pub const UCHAR_CHANGES_WHEN_TITLECASED = UProperty.CHANGES_WHEN_TITLECASED; pub const UCHAR_CHANGES_WHEN_CASEFOLDED = UProperty.CHANGES_WHEN_CASEFOLDED; pub const UCHAR_CHANGES_WHEN_CASEMAPPED = UProperty.CHANGES_WHEN_CASEMAPPED; pub const UCHAR_CHANGES_WHEN_NFKC_CASEFOLDED = UProperty.CHANGES_WHEN_NFKC_CASEFOLDED; pub const UCHAR_EMOJI = UProperty.EMOJI; pub const UCHAR_EMOJI_PRESENTATION = UProperty.EMOJI_PRESENTATION; pub const UCHAR_EMOJI_MODIFIER = UProperty.EMOJI_MODIFIER; pub const UCHAR_EMOJI_MODIFIER_BASE = UProperty.EMOJI_MODIFIER_BASE; pub const UCHAR_EMOJI_COMPONENT = UProperty.EMOJI_COMPONENT; pub const UCHAR_REGIONAL_INDICATOR = UProperty.REGIONAL_INDICATOR; pub const UCHAR_PREPENDED_CONCATENATION_MARK = UProperty.PREPENDED_CONCATENATION_MARK; pub const UCHAR_EXTENDED_PICTOGRAPHIC = UProperty.EXTENDED_PICTOGRAPHIC; pub const UCHAR_BIDI_CLASS = UProperty.BIDI_CLASS; pub const UCHAR_INT_START = UProperty.BIDI_CLASS; pub const UCHAR_BLOCK = UProperty.BLOCK; pub const UCHAR_CANONICAL_COMBINING_CLASS = UProperty.CANONICAL_COMBINING_CLASS; pub const UCHAR_DECOMPOSITION_TYPE = UProperty.DECOMPOSITION_TYPE; pub const UCHAR_EAST_ASIAN_WIDTH = UProperty.EAST_ASIAN_WIDTH; pub const UCHAR_GENERAL_CATEGORY = UProperty.GENERAL_CATEGORY; pub const UCHAR_JOINING_GROUP = UProperty.JOINING_GROUP; pub const UCHAR_JOINING_TYPE = UProperty.JOINING_TYPE; pub const UCHAR_LINE_BREAK = UProperty.LINE_BREAK; pub const UCHAR_NUMERIC_TYPE = UProperty.NUMERIC_TYPE; pub const UCHAR_SCRIPT = UProperty.SCRIPT; pub const UCHAR_HANGUL_SYLLABLE_TYPE = UProperty.HANGUL_SYLLABLE_TYPE; pub const UCHAR_NFD_QUICK_CHECK = UProperty.NFD_QUICK_CHECK; pub const UCHAR_NFKD_QUICK_CHECK = UProperty.NFKD_QUICK_CHECK; pub const UCHAR_NFC_QUICK_CHECK = UProperty.NFC_QUICK_CHECK; pub const UCHAR_NFKC_QUICK_CHECK = UProperty.NFKC_QUICK_CHECK; pub const UCHAR_LEAD_CANONICAL_COMBINING_CLASS = UProperty.LEAD_CANONICAL_COMBINING_CLASS; pub const UCHAR_TRAIL_CANONICAL_COMBINING_CLASS = UProperty.TRAIL_CANONICAL_COMBINING_CLASS; pub const UCHAR_GRAPHEME_CLUSTER_BREAK = UProperty.GRAPHEME_CLUSTER_BREAK; pub const UCHAR_SENTENCE_BREAK = UProperty.SENTENCE_BREAK; pub const UCHAR_WORD_BREAK = UProperty.WORD_BREAK; pub const UCHAR_BIDI_PAIRED_BRACKET_TYPE = UProperty.BIDI_PAIRED_BRACKET_TYPE; pub const UCHAR_INDIC_POSITIONAL_CATEGORY = UProperty.INDIC_POSITIONAL_CATEGORY; pub const UCHAR_INDIC_SYLLABIC_CATEGORY = UProperty.INDIC_SYLLABIC_CATEGORY; pub const UCHAR_VERTICAL_ORIENTATION = UProperty.VERTICAL_ORIENTATION; pub const UCHAR_GENERAL_CATEGORY_MASK = UProperty.GENERAL_CATEGORY_MASK; pub const UCHAR_MASK_START = UProperty.GENERAL_CATEGORY_MASK; pub const UCHAR_NUMERIC_VALUE = UProperty.NUMERIC_VALUE; pub const UCHAR_DOUBLE_START = UProperty.NUMERIC_VALUE; pub const UCHAR_AGE = UProperty.AGE; pub const UCHAR_STRING_START = UProperty.AGE; pub const UCHAR_BIDI_MIRRORING_GLYPH = UProperty.BIDI_MIRRORING_GLYPH; pub const UCHAR_CASE_FOLDING = UProperty.CASE_FOLDING; pub const UCHAR_LOWERCASE_MAPPING = UProperty.LOWERCASE_MAPPING; pub const UCHAR_NAME = UProperty.NAME; pub const UCHAR_SIMPLE_CASE_FOLDING = UProperty.SIMPLE_CASE_FOLDING; pub const UCHAR_SIMPLE_LOWERCASE_MAPPING = UProperty.SIMPLE_LOWERCASE_MAPPING; pub const UCHAR_SIMPLE_TITLECASE_MAPPING = UProperty.SIMPLE_TITLECASE_MAPPING; pub const UCHAR_SIMPLE_UPPERCASE_MAPPING = UProperty.SIMPLE_UPPERCASE_MAPPING; pub const UCHAR_TITLECASE_MAPPING = UProperty.TITLECASE_MAPPING; pub const UCHAR_UPPERCASE_MAPPING = UProperty.UPPERCASE_MAPPING; pub const UCHAR_BIDI_PAIRED_BRACKET = UProperty.BIDI_PAIRED_BRACKET; pub const UCHAR_SCRIPT_EXTENSIONS = UProperty.SCRIPT_EXTENSIONS; pub const UCHAR_OTHER_PROPERTY_START = UProperty.SCRIPT_EXTENSIONS; pub const UCHAR_INVALID_CODE = UProperty.INVALID_CODE; pub const UCharCategory = enum(i32) { UNASSIGNED = 0, // GENERAL_OTHER_TYPES = 0, this enum value conflicts with UNASSIGNED UPPERCASE_LETTER = 1, LOWERCASE_LETTER = 2, TITLECASE_LETTER = 3, MODIFIER_LETTER = 4, OTHER_LETTER = 5, NON_SPACING_MARK = 6, ENCLOSING_MARK = 7, COMBINING_SPACING_MARK = 8, DECIMAL_DIGIT_NUMBER = 9, LETTER_NUMBER = 10, OTHER_NUMBER = 11, SPACE_SEPARATOR = 12, LINE_SEPARATOR = 13, PARAGRAPH_SEPARATOR = 14, CONTROL_CHAR = 15, FORMAT_CHAR = 16, PRIVATE_USE_CHAR = 17, SURROGATE = 18, DASH_PUNCTUATION = 19, START_PUNCTUATION = 20, END_PUNCTUATION = 21, CONNECTOR_PUNCTUATION = 22, OTHER_PUNCTUATION = 23, MATH_SYMBOL = 24, CURRENCY_SYMBOL = 25, MODIFIER_SYMBOL = 26, OTHER_SYMBOL = 27, INITIAL_PUNCTUATION = 28, FINAL_PUNCTUATION = 29, CHAR_CATEGORY_COUNT = 30, }; pub const U_UNASSIGNED = UCharCategory.UNASSIGNED; pub const U_GENERAL_OTHER_TYPES = UCharCategory.UNASSIGNED; pub const U_UPPERCASE_LETTER = UCharCategory.UPPERCASE_LETTER; pub const U_LOWERCASE_LETTER = UCharCategory.LOWERCASE_LETTER; pub const U_TITLECASE_LETTER = UCharCategory.TITLECASE_LETTER; pub const U_MODIFIER_LETTER = UCharCategory.MODIFIER_LETTER; pub const U_OTHER_LETTER = UCharCategory.OTHER_LETTER; pub const U_NON_SPACING_MARK = UCharCategory.NON_SPACING_MARK; pub const U_ENCLOSING_MARK = UCharCategory.ENCLOSING_MARK; pub const U_COMBINING_SPACING_MARK = UCharCategory.COMBINING_SPACING_MARK; pub const U_DECIMAL_DIGIT_NUMBER = UCharCategory.DECIMAL_DIGIT_NUMBER; pub const U_LETTER_NUMBER = UCharCategory.LETTER_NUMBER; pub const U_OTHER_NUMBER = UCharCategory.OTHER_NUMBER; pub const U_SPACE_SEPARATOR = UCharCategory.SPACE_SEPARATOR; pub const U_LINE_SEPARATOR = UCharCategory.LINE_SEPARATOR; pub const U_PARAGRAPH_SEPARATOR = UCharCategory.PARAGRAPH_SEPARATOR; pub const U_CONTROL_CHAR = UCharCategory.CONTROL_CHAR; pub const U_FORMAT_CHAR = UCharCategory.FORMAT_CHAR; pub const U_PRIVATE_USE_CHAR = UCharCategory.PRIVATE_USE_CHAR; pub const U_SURROGATE = UCharCategory.SURROGATE; pub const U_DASH_PUNCTUATION = UCharCategory.DASH_PUNCTUATION; pub const U_START_PUNCTUATION = UCharCategory.START_PUNCTUATION; pub const U_END_PUNCTUATION = UCharCategory.END_PUNCTUATION; pub const U_CONNECTOR_PUNCTUATION = UCharCategory.CONNECTOR_PUNCTUATION; pub const U_OTHER_PUNCTUATION = UCharCategory.OTHER_PUNCTUATION; pub const U_MATH_SYMBOL = UCharCategory.MATH_SYMBOL; pub const U_CURRENCY_SYMBOL = UCharCategory.CURRENCY_SYMBOL; pub const U_MODIFIER_SYMBOL = UCharCategory.MODIFIER_SYMBOL; pub const U_OTHER_SYMBOL = UCharCategory.OTHER_SYMBOL; pub const U_INITIAL_PUNCTUATION = UCharCategory.INITIAL_PUNCTUATION; pub const U_FINAL_PUNCTUATION = UCharCategory.FINAL_PUNCTUATION; pub const U_CHAR_CATEGORY_COUNT = UCharCategory.CHAR_CATEGORY_COUNT; pub const UCharDirection = enum(i32) { LEFT_TO_RIGHT = 0, RIGHT_TO_LEFT = 1, EUROPEAN_NUMBER = 2, EUROPEAN_NUMBER_SEPARATOR = 3, EUROPEAN_NUMBER_TERMINATOR = 4, ARABIC_NUMBER = 5, COMMON_NUMBER_SEPARATOR = 6, BLOCK_SEPARATOR = 7, SEGMENT_SEPARATOR = 8, WHITE_SPACE_NEUTRAL = 9, OTHER_NEUTRAL = 10, LEFT_TO_RIGHT_EMBEDDING = 11, LEFT_TO_RIGHT_OVERRIDE = 12, RIGHT_TO_LEFT_ARABIC = 13, RIGHT_TO_LEFT_EMBEDDING = 14, RIGHT_TO_LEFT_OVERRIDE = 15, POP_DIRECTIONAL_FORMAT = 16, DIR_NON_SPACING_MARK = 17, BOUNDARY_NEUTRAL = 18, FIRST_STRONG_ISOLATE = 19, LEFT_TO_RIGHT_ISOLATE = 20, RIGHT_TO_LEFT_ISOLATE = 21, POP_DIRECTIONAL_ISOLATE = 22, }; pub const U_LEFT_TO_RIGHT = UCharDirection.LEFT_TO_RIGHT; pub const U_RIGHT_TO_LEFT = UCharDirection.RIGHT_TO_LEFT; pub const U_EUROPEAN_NUMBER = UCharDirection.EUROPEAN_NUMBER; pub const U_EUROPEAN_NUMBER_SEPARATOR = UCharDirection.EUROPEAN_NUMBER_SEPARATOR; pub const U_EUROPEAN_NUMBER_TERMINATOR = UCharDirection.EUROPEAN_NUMBER_TERMINATOR; pub const U_ARABIC_NUMBER = UCharDirection.ARABIC_NUMBER; pub const U_COMMON_NUMBER_SEPARATOR = UCharDirection.COMMON_NUMBER_SEPARATOR; pub const U_BLOCK_SEPARATOR = UCharDirection.BLOCK_SEPARATOR; pub const U_SEGMENT_SEPARATOR = UCharDirection.SEGMENT_SEPARATOR; pub const U_WHITE_SPACE_NEUTRAL = UCharDirection.WHITE_SPACE_NEUTRAL; pub const U_OTHER_NEUTRAL = UCharDirection.OTHER_NEUTRAL; pub const U_LEFT_TO_RIGHT_EMBEDDING = UCharDirection.LEFT_TO_RIGHT_EMBEDDING; pub const U_LEFT_TO_RIGHT_OVERRIDE = UCharDirection.LEFT_TO_RIGHT_OVERRIDE; pub const U_RIGHT_TO_LEFT_ARABIC = UCharDirection.RIGHT_TO_LEFT_ARABIC; pub const U_RIGHT_TO_LEFT_EMBEDDING = UCharDirection.RIGHT_TO_LEFT_EMBEDDING; pub const U_RIGHT_TO_LEFT_OVERRIDE = UCharDirection.RIGHT_TO_LEFT_OVERRIDE; pub const U_POP_DIRECTIONAL_FORMAT = UCharDirection.POP_DIRECTIONAL_FORMAT; pub const U_DIR_NON_SPACING_MARK = UCharDirection.DIR_NON_SPACING_MARK; pub const U_BOUNDARY_NEUTRAL = UCharDirection.BOUNDARY_NEUTRAL; pub const U_FIRST_STRONG_ISOLATE = UCharDirection.FIRST_STRONG_ISOLATE; pub const U_LEFT_TO_RIGHT_ISOLATE = UCharDirection.LEFT_TO_RIGHT_ISOLATE; pub const U_RIGHT_TO_LEFT_ISOLATE = UCharDirection.RIGHT_TO_LEFT_ISOLATE; pub const U_POP_DIRECTIONAL_ISOLATE = UCharDirection.POP_DIRECTIONAL_ISOLATE; pub const UBidiPairedBracketType = enum(i32) { NONE = 0, OPEN = 1, CLOSE = 2, }; pub const U_BPT_NONE = UBidiPairedBracketType.NONE; pub const U_BPT_OPEN = UBidiPairedBracketType.OPEN; pub const U_BPT_CLOSE = UBidiPairedBracketType.CLOSE; pub const UBlockCode = enum(i32) { NO_BLOCK = 0, BASIC_LATIN = 1, LATIN_1_SUPPLEMENT = 2, LATIN_EXTENDED_A = 3, LATIN_EXTENDED_B = 4, IPA_EXTENSIONS = 5, SPACING_MODIFIER_LETTERS = 6, COMBINING_DIACRITICAL_MARKS = 7, GREEK = 8, CYRILLIC = 9, ARMENIAN = 10, HEBREW = 11, ARABIC = 12, SYRIAC = 13, THAANA = 14, DEVANAGARI = 15, BENGALI = 16, GURMUKHI = 17, GUJARATI = 18, ORIYA = 19, TAMIL = 20, TELUGU = 21, KANNADA = 22, MALAYALAM = 23, SINHALA = 24, THAI = 25, LAO = 26, TIBETAN = 27, MYANMAR = 28, GEORGIAN = 29, HANGUL_JAMO = 30, ETHIOPIC = 31, CHEROKEE = 32, UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS = 33, OGHAM = 34, RUNIC = 35, KHMER = 36, MONGOLIAN = 37, LATIN_EXTENDED_ADDITIONAL = 38, GREEK_EXTENDED = 39, GENERAL_PUNCTUATION = 40, SUPERSCRIPTS_AND_SUBSCRIPTS = 41, CURRENCY_SYMBOLS = 42, COMBINING_MARKS_FOR_SYMBOLS = 43, LETTERLIKE_SYMBOLS = 44, NUMBER_FORMS = 45, ARROWS = 46, MATHEMATICAL_OPERATORS = 47, MISCELLANEOUS_TECHNICAL = 48, CONTROL_PICTURES = 49, OPTICAL_CHARACTER_RECOGNITION = 50, ENCLOSED_ALPHANUMERICS = 51, BOX_DRAWING = 52, BLOCK_ELEMENTS = 53, GEOMETRIC_SHAPES = 54, MISCELLANEOUS_SYMBOLS = 55, DINGBATS = 56, BRAILLE_PATTERNS = 57, CJK_RADICALS_SUPPLEMENT = 58, KANGXI_RADICALS = 59, IDEOGRAPHIC_DESCRIPTION_CHARACTERS = 60, CJK_SYMBOLS_AND_PUNCTUATION = 61, HIRAGANA = 62, KATAKANA = 63, BOPOMOFO = 64, HANGUL_COMPATIBILITY_JAMO = 65, KANBUN = 66, BOPOMOFO_EXTENDED = 67, ENCLOSED_CJK_LETTERS_AND_MONTHS = 68, CJK_COMPATIBILITY = 69, CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A = 70, CJK_UNIFIED_IDEOGRAPHS = 71, YI_SYLLABLES = 72, YI_RADICALS = 73, HANGUL_SYLLABLES = 74, HIGH_SURROGATES = 75, HIGH_PRIVATE_USE_SURROGATES = 76, LOW_SURROGATES = 77, PRIVATE_USE_AREA = 78, // PRIVATE_USE = 78, this enum value conflicts with PRIVATE_USE_AREA CJK_COMPATIBILITY_IDEOGRAPHS = 79, ALPHABETIC_PRESENTATION_FORMS = 80, ARABIC_PRESENTATION_FORMS_A = 81, COMBINING_HALF_MARKS = 82, CJK_COMPATIBILITY_FORMS = 83, SMALL_FORM_VARIANTS = 84, ARABIC_PRESENTATION_FORMS_B = 85, SPECIALS = 86, HALFWIDTH_AND_FULLWIDTH_FORMS = 87, OLD_ITALIC = 88, GOTHIC = 89, DESERET = 90, BYZANTINE_MUSICAL_SYMBOLS = 91, MUSICAL_SYMBOLS = 92, MATHEMATICAL_ALPHANUMERIC_SYMBOLS = 93, CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B = 94, CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT = 95, TAGS = 96, CYRILLIC_SUPPLEMENT = 97, // CYRILLIC_SUPPLEMENTARY = 97, this enum value conflicts with CYRILLIC_SUPPLEMENT TAGALOG = 98, HANUNOO = 99, BUHID = 100, TAGBANWA = 101, MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A = 102, SUPPLEMENTAL_ARROWS_A = 103, SUPPLEMENTAL_ARROWS_B = 104, MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B = 105, SUPPLEMENTAL_MATHEMATICAL_OPERATORS = 106, KATAKANA_PHONETIC_EXTENSIONS = 107, VARIATION_SELECTORS = 108, SUPPLEMENTARY_PRIVATE_USE_AREA_A = 109, SUPPLEMENTARY_PRIVATE_USE_AREA_B = 110, LIMBU = 111, TAI_LE = 112, KHMER_SYMBOLS = 113, PHONETIC_EXTENSIONS = 114, MISCELLANEOUS_SYMBOLS_AND_ARROWS = 115, YIJING_HEXAGRAM_SYMBOLS = 116, LINEAR_B_SYLLABARY = 117, LINEAR_B_IDEOGRAMS = 118, AEGEAN_NUMBERS = 119, UGARITIC = 120, SHAVIAN = 121, OSMANYA = 122, CYPRIOT_SYLLABARY = 123, TAI_XUAN_JING_SYMBOLS = 124, VARIATION_SELECTORS_SUPPLEMENT = 125, ANCIENT_GREEK_MUSICAL_NOTATION = 126, ANCIENT_GREEK_NUMBERS = 127, ARABIC_SUPPLEMENT = 128, BUGINESE = 129, CJK_STROKES = 130, COMBINING_DIACRITICAL_MARKS_SUPPLEMENT = 131, COPTIC = 132, ETHIOPIC_EXTENDED = 133, ETHIOPIC_SUPPLEMENT = 134, GEORGIAN_SUPPLEMENT = 135, GLAGOLITIC = 136, KHAROSHTHI = 137, MODIFIER_TONE_LETTERS = 138, NEW_TAI_LUE = 139, OLD_PERSIAN = 140, PHONETIC_EXTENSIONS_SUPPLEMENT = 141, SUPPLEMENTAL_PUNCTUATION = 142, SYLOTI_NAGRI = 143, TIFINAGH = 144, VERTICAL_FORMS = 145, NKO = 146, BALINESE = 147, LATIN_EXTENDED_C = 148, LATIN_EXTENDED_D = 149, PHAGS_PA = 150, PHOENICIAN = 151, CUNEIFORM = 152, CUNEIFORM_NUMBERS_AND_PUNCTUATION = 153, COUNTING_ROD_NUMERALS = 154, SUNDANESE = 155, LEPCHA = 156, OL_CHIKI = 157, CYRILLIC_EXTENDED_A = 158, VAI = 159, CYRILLIC_EXTENDED_B = 160, SAURASHTRA = 161, KAYAH_LI = 162, REJANG = 163, CHAM = 164, ANCIENT_SYMBOLS = 165, PHAISTOS_DISC = 166, LYCIAN = 167, CARIAN = 168, LYDIAN = 169, MAHJONG_TILES = 170, DOMINO_TILES = 171, SAMARITAN = 172, UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED = 173, TAI_THAM = 174, VEDIC_EXTENSIONS = 175, LISU = 176, BAMUM = 177, COMMON_INDIC_NUMBER_FORMS = 178, DEVANAGARI_EXTENDED = 179, HANGUL_JAMO_EXTENDED_A = 180, JAVANESE = 181, MYANMAR_EXTENDED_A = 182, TAI_VIET = 183, MEETEI_MAYEK = 184, HANGUL_JAMO_EXTENDED_B = 185, IMPERIAL_ARAMAIC = 186, OLD_SOUTH_ARABIAN = 187, AVESTAN = 188, INSCRIPTIONAL_PARTHIAN = 189, INSCRIPTIONAL_PAHLAVI = 190, OLD_TURKIC = 191, RUMI_NUMERAL_SYMBOLS = 192, KAITHI = 193, EGYPTIAN_HIEROGLYPHS = 194, ENCLOSED_ALPHANUMERIC_SUPPLEMENT = 195, ENCLOSED_IDEOGRAPHIC_SUPPLEMENT = 196, CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C = 197, MANDAIC = 198, BATAK = 199, ETHIOPIC_EXTENDED_A = 200, BRAHMI = 201, BAMUM_SUPPLEMENT = 202, KANA_SUPPLEMENT = 203, PLAYING_CARDS = 204, MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS = 205, EMOTICONS = 206, TRANSPORT_AND_MAP_SYMBOLS = 207, ALCHEMICAL_SYMBOLS = 208, CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D = 209, ARABIC_EXTENDED_A = 210, ARABIC_MATHEMATICAL_ALPHABETIC_SYMBOLS = 211, CHAKMA = 212, MEETEI_MAYEK_EXTENSIONS = 213, MEROITIC_CURSIVE = 214, MEROITIC_HIEROGLYPHS = 215, MIAO = 216, SHARADA = 217, SORA_SOMPENG = 218, SUNDANESE_SUPPLEMENT = 219, TAKRI = 220, BASSA_VAH = 221, CAUCASIAN_ALBANIAN = 222, COPTIC_EPACT_NUMBERS = 223, COMBINING_DIACRITICAL_MARKS_EXTENDED = 224, DUPLOYAN = 225, ELBASAN = 226, GEOMETRIC_SHAPES_EXTENDED = 227, GRANTHA = 228, KHOJKI = 229, KHUDAWADI = 230, LATIN_EXTENDED_E = 231, LINEAR_A = 232, MAHAJANI = 233, MANICHAEAN = 234, MENDE_KIKAKUI = 235, MODI = 236, MRO = 237, MYANMAR_EXTENDED_B = 238, NABATAEAN = 239, OLD_NORTH_ARABIAN = 240, OLD_PERMIC = 241, ORNAMENTAL_DINGBATS = 242, PAHAWH_HMONG = 243, PALMYRENE = 244, PAU_CIN_HAU = 245, PSALTER_PAHLAVI = 246, SHORTHAND_FORMAT_CONTROLS = 247, SIDDHAM = 248, SINHALA_ARCHAIC_NUMBERS = 249, SUPPLEMENTAL_ARROWS_C = 250, TIRHUTA = 251, WARANG_CITI = 252, AHOM = 253, ANATOLIAN_HIEROGLYPHS = 254, CHEROKEE_SUPPLEMENT = 255, CJK_UNIFIED_IDEOGRAPHS_EXTENSION_E = 256, EARLY_DYNASTIC_CUNEIFORM = 257, HATRAN = 258, MULTANI = 259, OLD_HUNGARIAN = 260, SUPPLEMENTAL_SYMBOLS_AND_PICTOGRAPHS = 261, SUTTON_SIGNWRITING = 262, ADLAM = 263, BHAIKSUKI = 264, CYRILLIC_EXTENDED_C = 265, GLAGOLITIC_SUPPLEMENT = 266, IDEOGRAPHIC_SYMBOLS_AND_PUNCTUATION = 267, MARCHEN = 268, MONGOLIAN_SUPPLEMENT = 269, NEWA = 270, OSAGE = 271, TANGUT = 272, TANGUT_COMPONENTS = 273, CJK_UNIFIED_IDEOGRAPHS_EXTENSION_F = 274, KANA_EXTENDED_A = 275, MASARAM_GONDI = 276, NUSHU = 277, SOYOMBO = 278, SYRIAC_SUPPLEMENT = 279, ZANABAZAR_SQUARE = 280, CHESS_SYMBOLS = 281, DOGRA = 282, GEORGIAN_EXTENDED = 283, GUNJALA_GONDI = 284, HANIFI_ROHINGYA = 285, INDIC_SIYAQ_NUMBERS = 286, MAKASAR = 287, MAYAN_NUMERALS = 288, MEDEFAIDRIN = 289, OLD_SOGDIAN = 290, SOGDIAN = 291, EGYPTIAN_HIEROGLYPH_FORMAT_CONTROLS = 292, ELYMAIC = 293, NANDINAGARI = 294, NYIAKENG_PUACHUE_HMONG = 295, OTTOMAN_SIYAQ_NUMBERS = 296, SMALL_KANA_EXTENSION = 297, SYMBOLS_AND_PICTOGRAPHS_EXTENDED_A = 298, TAMIL_SUPPLEMENT = 299, WANCHO = 300, INVALID_CODE = -1, }; pub const UBLOCK_NO_BLOCK = UBlockCode.NO_BLOCK; pub const UBLOCK_BASIC_LATIN = UBlockCode.BASIC_LATIN; pub const UBLOCK_LATIN_1_SUPPLEMENT = UBlockCode.LATIN_1_SUPPLEMENT; pub const UBLOCK_LATIN_EXTENDED_A = UBlockCode.LATIN_EXTENDED_A; pub const UBLOCK_LATIN_EXTENDED_B = UBlockCode.LATIN_EXTENDED_B; pub const UBLOCK_IPA_EXTENSIONS = UBlockCode.IPA_EXTENSIONS; pub const UBLOCK_SPACING_MODIFIER_LETTERS = UBlockCode.SPACING_MODIFIER_LETTERS; pub const UBLOCK_COMBINING_DIACRITICAL_MARKS = UBlockCode.COMBINING_DIACRITICAL_MARKS; pub const UBLOCK_GREEK = UBlockCode.GREEK; pub const UBLOCK_CYRILLIC = UBlockCode.CYRILLIC; pub const UBLOCK_ARMENIAN = UBlockCode.ARMENIAN; pub const UBLOCK_HEBREW = UBlockCode.HEBREW; pub const UBLOCK_ARABIC = UBlockCode.ARABIC; pub const UBLOCK_SYRIAC = UBlockCode.SYRIAC; pub const UBLOCK_THAANA = UBlockCode.THAANA; pub const UBLOCK_DEVANAGARI = UBlockCode.DEVANAGARI; pub const UBLOCK_BENGALI = UBlockCode.BENGALI; pub const UBLOCK_GURMUKHI = UBlockCode.GURMUKHI; pub const UBLOCK_GUJARATI = UBlockCode.GUJARATI; pub const UBLOCK_ORIYA = UBlockCode.ORIYA; pub const UBLOCK_TAMIL = UBlockCode.TAMIL; pub const UBLOCK_TELUGU = UBlockCode.TELUGU; pub const UBLOCK_KANNADA = UBlockCode.KANNADA; pub const UBLOCK_MALAYALAM = UBlockCode.MALAYALAM; pub const UBLOCK_SINHALA = UBlockCode.SINHALA; pub const UBLOCK_THAI = UBlockCode.THAI; pub const UBLOCK_LAO = UBlockCode.LAO; pub const UBLOCK_TIBETAN = UBlockCode.TIBETAN; pub const UBLOCK_MYANMAR = UBlockCode.MYANMAR; pub const UBLOCK_GEORGIAN = UBlockCode.GEORGIAN; pub const UBLOCK_HANGUL_JAMO = UBlockCode.HANGUL_JAMO; pub const UBLOCK_ETHIOPIC = UBlockCode.ETHIOPIC; pub const UBLOCK_CHEROKEE = UBlockCode.CHEROKEE; pub const UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS = UBlockCode.UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS; pub const UBLOCK_OGHAM = UBlockCode.OGHAM; pub const UBLOCK_RUNIC = UBlockCode.RUNIC; pub const UBLOCK_KHMER = UBlockCode.KHMER; pub const UBLOCK_MONGOLIAN = UBlockCode.MONGOLIAN; pub const UBLOCK_LATIN_EXTENDED_ADDITIONAL = UBlockCode.LATIN_EXTENDED_ADDITIONAL; pub const UBLOCK_GREEK_EXTENDED = UBlockCode.GREEK_EXTENDED; pub const UBLOCK_GENERAL_PUNCTUATION = UBlockCode.GENERAL_PUNCTUATION; pub const UBLOCK_SUPERSCRIPTS_AND_SUBSCRIPTS = UBlockCode.SUPERSCRIPTS_AND_SUBSCRIPTS; pub const UBLOCK_CURRENCY_SYMBOLS = UBlockCode.CURRENCY_SYMBOLS; pub const UBLOCK_COMBINING_MARKS_FOR_SYMBOLS = UBlockCode.COMBINING_MARKS_FOR_SYMBOLS; pub const UBLOCK_LETTERLIKE_SYMBOLS = UBlockCode.LETTERLIKE_SYMBOLS; pub const UBLOCK_NUMBER_FORMS = UBlockCode.NUMBER_FORMS; pub const UBLOCK_ARROWS = UBlockCode.ARROWS; pub const UBLOCK_MATHEMATICAL_OPERATORS = UBlockCode.MATHEMATICAL_OPERATORS; pub const UBLOCK_MISCELLANEOUS_TECHNICAL = UBlockCode.MISCELLANEOUS_TECHNICAL; pub const UBLOCK_CONTROL_PICTURES = UBlockCode.CONTROL_PICTURES; pub const UBLOCK_OPTICAL_CHARACTER_RECOGNITION = UBlockCode.OPTICAL_CHARACTER_RECOGNITION; pub const UBLOCK_ENCLOSED_ALPHANUMERICS = UBlockCode.ENCLOSED_ALPHANUMERICS; pub const UBLOCK_BOX_DRAWING = UBlockCode.BOX_DRAWING; pub const UBLOCK_BLOCK_ELEMENTS = UBlockCode.BLOCK_ELEMENTS; pub const UBLOCK_GEOMETRIC_SHAPES = UBlockCode.GEOMETRIC_SHAPES; pub const UBLOCK_MISCELLANEOUS_SYMBOLS = UBlockCode.MISCELLANEOUS_SYMBOLS; pub const UBLOCK_DINGBATS = UBlockCode.DINGBATS; pub const UBLOCK_BRAILLE_PATTERNS = UBlockCode.BRAILLE_PATTERNS; pub const UBLOCK_CJK_RADICALS_SUPPLEMENT = UBlockCode.CJK_RADICALS_SUPPLEMENT; pub const UBLOCK_KANGXI_RADICALS = UBlockCode.KANGXI_RADICALS; pub const UBLOCK_IDEOGRAPHIC_DESCRIPTION_CHARACTERS = UBlockCode.IDEOGRAPHIC_DESCRIPTION_CHARACTERS; pub const UBLOCK_CJK_SYMBOLS_AND_PUNCTUATION = UBlockCode.CJK_SYMBOLS_AND_PUNCTUATION; pub const UBLOCK_HIRAGANA = UBlockCode.HIRAGANA; pub const UBLOCK_KATAKANA = UBlockCode.KATAKANA; pub const UBLOCK_BOPOMOFO = UBlockCode.BOPOMOFO; pub const UBLOCK_HANGUL_COMPATIBILITY_JAMO = UBlockCode.HANGUL_COMPATIBILITY_JAMO; pub const UBLOCK_KANBUN = UBlockCode.KANBUN; pub const UBLOCK_BOPOMOFO_EXTENDED = UBlockCode.BOPOMOFO_EXTENDED; pub const UBLOCK_ENCLOSED_CJK_LETTERS_AND_MONTHS = UBlockCode.ENCLOSED_CJK_LETTERS_AND_MONTHS; pub const UBLOCK_CJK_COMPATIBILITY = UBlockCode.CJK_COMPATIBILITY; pub const UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A = UBlockCode.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A; pub const UBLOCK_CJK_UNIFIED_IDEOGRAPHS = UBlockCode.CJK_UNIFIED_IDEOGRAPHS; pub const UBLOCK_YI_SYLLABLES = UBlockCode.YI_SYLLABLES; pub const UBLOCK_YI_RADICALS = UBlockCode.YI_RADICALS; pub const UBLOCK_HANGUL_SYLLABLES = UBlockCode.HANGUL_SYLLABLES; pub const UBLOCK_HIGH_SURROGATES = UBlockCode.HIGH_SURROGATES; pub const UBLOCK_HIGH_PRIVATE_USE_SURROGATES = UBlockCode.HIGH_PRIVATE_USE_SURROGATES; pub const UBLOCK_LOW_SURROGATES = UBlockCode.LOW_SURROGATES; pub const UBLOCK_PRIVATE_USE_AREA = UBlockCode.PRIVATE_USE_AREA; pub const UBLOCK_PRIVATE_USE = UBlockCode.PRIVATE_USE_AREA; pub const UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS = UBlockCode.CJK_COMPATIBILITY_IDEOGRAPHS; pub const UBLOCK_ALPHABETIC_PRESENTATION_FORMS = UBlockCode.ALPHABETIC_PRESENTATION_FORMS; pub const UBLOCK_ARABIC_PRESENTATION_FORMS_A = UBlockCode.ARABIC_PRESENTATION_FORMS_A; pub const UBLOCK_COMBINING_HALF_MARKS = UBlockCode.COMBINING_HALF_MARKS; pub const UBLOCK_CJK_COMPATIBILITY_FORMS = UBlockCode.CJK_COMPATIBILITY_FORMS; pub const UBLOCK_SMALL_FORM_VARIANTS = UBlockCode.SMALL_FORM_VARIANTS; pub const UBLOCK_ARABIC_PRESENTATION_FORMS_B = UBlockCode.ARABIC_PRESENTATION_FORMS_B; pub const UBLOCK_SPECIALS = UBlockCode.SPECIALS; pub const UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS = UBlockCode.HALFWIDTH_AND_FULLWIDTH_FORMS; pub const UBLOCK_OLD_ITALIC = UBlockCode.OLD_ITALIC; pub const UBLOCK_GOTHIC = UBlockCode.GOTHIC; pub const UBLOCK_DESERET = UBlockCode.DESERET; pub const UBLOCK_BYZANTINE_MUSICAL_SYMBOLS = UBlockCode.BYZANTINE_MUSICAL_SYMBOLS; pub const UBLOCK_MUSICAL_SYMBOLS = UBlockCode.MUSICAL_SYMBOLS; pub const UBLOCK_MATHEMATICAL_ALPHANUMERIC_SYMBOLS = UBlockCode.MATHEMATICAL_ALPHANUMERIC_SYMBOLS; pub const UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B = UBlockCode.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B; pub const UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT = UBlockCode.CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT; pub const UBLOCK_TAGS = UBlockCode.TAGS; pub const UBLOCK_CYRILLIC_SUPPLEMENT = UBlockCode.CYRILLIC_SUPPLEMENT; pub const UBLOCK_CYRILLIC_SUPPLEMENTARY = UBlockCode.CYRILLIC_SUPPLEMENT; pub const UBLOCK_TAGALOG = UBlockCode.TAGALOG; pub const UBLOCK_HANUNOO = UBlockCode.HANUNOO; pub const UBLOCK_BUHID = UBlockCode.BUHID; pub const UBLOCK_TAGBANWA = UBlockCode.TAGBANWA; pub const UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A = UBlockCode.MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A; pub const UBLOCK_SUPPLEMENTAL_ARROWS_A = UBlockCode.SUPPLEMENTAL_ARROWS_A; pub const UBLOCK_SUPPLEMENTAL_ARROWS_B = UBlockCode.SUPPLEMENTAL_ARROWS_B; pub const UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B = UBlockCode.MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B; pub const UBLOCK_SUPPLEMENTAL_MATHEMATICAL_OPERATORS = UBlockCode.SUPPLEMENTAL_MATHEMATICAL_OPERATORS; pub const UBLOCK_KATAKANA_PHONETIC_EXTENSIONS = UBlockCode.KATAKANA_PHONETIC_EXTENSIONS; pub const UBLOCK_VARIATION_SELECTORS = UBlockCode.VARIATION_SELECTORS; pub const UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_A = UBlockCode.SUPPLEMENTARY_PRIVATE_USE_AREA_A; pub const UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_B = UBlockCode.SUPPLEMENTARY_PRIVATE_USE_AREA_B; pub const UBLOCK_LIMBU = UBlockCode.LIMBU; pub const UBLOCK_TAI_LE = UBlockCode.TAI_LE; pub const UBLOCK_KHMER_SYMBOLS = UBlockCode.KHMER_SYMBOLS; pub const UBLOCK_PHONETIC_EXTENSIONS = UBlockCode.PHONETIC_EXTENSIONS; pub const UBLOCK_MISCELLANEOUS_SYMBOLS_AND_ARROWS = UBlockCode.MISCELLANEOUS_SYMBOLS_AND_ARROWS; pub const UBLOCK_YIJING_HEXAGRAM_SYMBOLS = UBlockCode.YIJING_HEXAGRAM_SYMBOLS; pub const UBLOCK_LINEAR_B_SYLLABARY = UBlockCode.LINEAR_B_SYLLABARY; pub const UBLOCK_LINEAR_B_IDEOGRAMS = UBlockCode.LINEAR_B_IDEOGRAMS; pub const UBLOCK_AEGEAN_NUMBERS = UBlockCode.AEGEAN_NUMBERS; pub const UBLOCK_UGARITIC = UBlockCode.UGARITIC; pub const UBLOCK_SHAVIAN = UBlockCode.SHAVIAN; pub const UBLOCK_OSMANYA = UBlockCode.OSMANYA; pub const UBLOCK_CYPRIOT_SYLLABARY = UBlockCode.CYPRIOT_SYLLABARY; pub const UBLOCK_TAI_XUAN_JING_SYMBOLS = UBlockCode.TAI_XUAN_JING_SYMBOLS; pub const UBLOCK_VARIATION_SELECTORS_SUPPLEMENT = UBlockCode.VARIATION_SELECTORS_SUPPLEMENT; pub const UBLOCK_ANCIENT_GREEK_MUSICAL_NOTATION = UBlockCode.ANCIENT_GREEK_MUSICAL_NOTATION; pub const UBLOCK_ANCIENT_GREEK_NUMBERS = UBlockCode.ANCIENT_GREEK_NUMBERS; pub const UBLOCK_ARABIC_SUPPLEMENT = UBlockCode.ARABIC_SUPPLEMENT; pub const UBLOCK_BUGINESE = UBlockCode.BUGINESE; pub const UBLOCK_CJK_STROKES = UBlockCode.CJK_STROKES; pub const UBLOCK_COMBINING_DIACRITICAL_MARKS_SUPPLEMENT = UBlockCode.COMBINING_DIACRITICAL_MARKS_SUPPLEMENT; pub const UBLOCK_COPTIC = UBlockCode.COPTIC; pub const UBLOCK_ETHIOPIC_EXTENDED = UBlockCode.ETHIOPIC_EXTENDED; pub const UBLOCK_ETHIOPIC_SUPPLEMENT = UBlockCode.ETHIOPIC_SUPPLEMENT; pub const UBLOCK_GEORGIAN_SUPPLEMENT = UBlockCode.GEORGIAN_SUPPLEMENT; pub const UBLOCK_GLAGOLITIC = UBlockCode.GLAGOLITIC; pub const UBLOCK_KHAROSHTHI = UBlockCode.KHAROSHTHI; pub const UBLOCK_MODIFIER_TONE_LETTERS = UBlockCode.MODIFIER_TONE_LETTERS; pub const UBLOCK_NEW_TAI_LUE = UBlockCode.NEW_TAI_LUE; pub const UBLOCK_OLD_PERSIAN = UBlockCode.OLD_PERSIAN; pub const UBLOCK_PHONETIC_EXTENSIONS_SUPPLEMENT = UBlockCode.PHONETIC_EXTENSIONS_SUPPLEMENT; pub const UBLOCK_SUPPLEMENTAL_PUNCTUATION = UBlockCode.SUPPLEMENTAL_PUNCTUATION; pub const UBLOCK_SYLOTI_NAGRI = UBlockCode.SYLOTI_NAGRI; pub const UBLOCK_TIFINAGH = UBlockCode.TIFINAGH; pub const UBLOCK_VERTICAL_FORMS = UBlockCode.VERTICAL_FORMS; pub const UBLOCK_NKO = UBlockCode.NKO; pub const UBLOCK_BALINESE = UBlockCode.BALINESE; pub const UBLOCK_LATIN_EXTENDED_C = UBlockCode.LATIN_EXTENDED_C; pub const UBLOCK_LATIN_EXTENDED_D = UBlockCode.LATIN_EXTENDED_D; pub const UBLOCK_PHAGS_PA = UBlockCode.PHAGS_PA; pub const UBLOCK_PHOENICIAN = UBlockCode.PHOENICIAN; pub const UBLOCK_CUNEIFORM = UBlockCode.CUNEIFORM; pub const UBLOCK_CUNEIFORM_NUMBERS_AND_PUNCTUATION = UBlockCode.CUNEIFORM_NUMBERS_AND_PUNCTUATION; pub const UBLOCK_COUNTING_ROD_NUMERALS = UBlockCode.COUNTING_ROD_NUMERALS; pub const UBLOCK_SUNDANESE = UBlockCode.SUNDANESE; pub const UBLOCK_LEPCHA = UBlockCode.LEPCHA; pub const UBLOCK_OL_CHIKI = UBlockCode.OL_CHIKI; pub const UBLOCK_CYRILLIC_EXTENDED_A = UBlockCode.CYRILLIC_EXTENDED_A; pub const UBLOCK_VAI = UBlockCode.VAI; pub const UBLOCK_CYRILLIC_EXTENDED_B = UBlockCode.CYRILLIC_EXTENDED_B; pub const UBLOCK_SAURASHTRA = UBlockCode.SAURASHTRA; pub const UBLOCK_KAYAH_LI = UBlockCode.KAYAH_LI; pub const UBLOCK_REJANG = UBlockCode.REJANG; pub const UBLOCK_CHAM = UBlockCode.CHAM; pub const UBLOCK_ANCIENT_SYMBOLS = UBlockCode.ANCIENT_SYMBOLS; pub const UBLOCK_PHAISTOS_DISC = UBlockCode.PHAISTOS_DISC; pub const UBLOCK_LYCIAN = UBlockCode.LYCIAN; pub const UBLOCK_CARIAN = UBlockCode.CARIAN; pub const UBLOCK_LYDIAN = UBlockCode.LYDIAN; pub const UBLOCK_MAHJONG_TILES = UBlockCode.MAHJONG_TILES; pub const UBLOCK_DOMINO_TILES = UBlockCode.DOMINO_TILES; pub const UBLOCK_SAMARITAN = UBlockCode.SAMARITAN; pub const UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED = UBlockCode.UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED; pub const UBLOCK_TAI_THAM = UBlockCode.TAI_THAM; pub const UBLOCK_VEDIC_EXTENSIONS = UBlockCode.VEDIC_EXTENSIONS; pub const UBLOCK_LISU = UBlockCode.LISU; pub const UBLOCK_BAMUM = UBlockCode.BAMUM; pub const UBLOCK_COMMON_INDIC_NUMBER_FORMS = UBlockCode.COMMON_INDIC_NUMBER_FORMS; pub const UBLOCK_DEVANAGARI_EXTENDED = UBlockCode.DEVANAGARI_EXTENDED; pub const UBLOCK_HANGUL_JAMO_EXTENDED_A = UBlockCode.HANGUL_JAMO_EXTENDED_A; pub const UBLOCK_JAVANESE = UBlockCode.JAVANESE; pub const UBLOCK_MYANMAR_EXTENDED_A = UBlockCode.MYANMAR_EXTENDED_A; pub const UBLOCK_TAI_VIET = UBlockCode.TAI_VIET; pub const UBLOCK_MEETEI_MAYEK = UBlockCode.MEETEI_MAYEK; pub const UBLOCK_HANGUL_JAMO_EXTENDED_B = UBlockCode.HANGUL_JAMO_EXTENDED_B; pub const UBLOCK_IMPERIAL_ARAMAIC = UBlockCode.IMPERIAL_ARAMAIC; pub const UBLOCK_OLD_SOUTH_ARABIAN = UBlockCode.OLD_SOUTH_ARABIAN; pub const UBLOCK_AVESTAN = UBlockCode.AVESTAN; pub const UBLOCK_INSCRIPTIONAL_PARTHIAN = UBlockCode.INSCRIPTIONAL_PARTHIAN; pub const UBLOCK_INSCRIPTIONAL_PAHLAVI = UBlockCode.INSCRIPTIONAL_PAHLAVI; pub const UBLOCK_OLD_TURKIC = UBlockCode.OLD_TURKIC; pub const UBLOCK_RUMI_NUMERAL_SYMBOLS = UBlockCode.RUMI_NUMERAL_SYMBOLS; pub const UBLOCK_KAITHI = UBlockCode.KAITHI; pub const UBLOCK_EGYPTIAN_HIEROGLYPHS = UBlockCode.EGYPTIAN_HIEROGLYPHS; pub const UBLOCK_ENCLOSED_ALPHANUMERIC_SUPPLEMENT = UBlockCode.ENCLOSED_ALPHANUMERIC_SUPPLEMENT; pub const UBLOCK_ENCLOSED_IDEOGRAPHIC_SUPPLEMENT = UBlockCode.ENCLOSED_IDEOGRAPHIC_SUPPLEMENT; pub const UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C = UBlockCode.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C; pub const UBLOCK_MANDAIC = UBlockCode.MANDAIC; pub const UBLOCK_BATAK = UBlockCode.BATAK; pub const UBLOCK_ETHIOPIC_EXTENDED_A = UBlockCode.ETHIOPIC_EXTENDED_A; pub const UBLOCK_BRAHMI = UBlockCode.BRAHMI; pub const UBLOCK_BAMUM_SUPPLEMENT = UBlockCode.BAMUM_SUPPLEMENT; pub const UBLOCK_KANA_SUPPLEMENT = UBlockCode.KANA_SUPPLEMENT; pub const UBLOCK_PLAYING_CARDS = UBlockCode.PLAYING_CARDS; pub const UBLOCK_MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS = UBlockCode.MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS; pub const UBLOCK_EMOTICONS = UBlockCode.EMOTICONS; pub const UBLOCK_TRANSPORT_AND_MAP_SYMBOLS = UBlockCode.TRANSPORT_AND_MAP_SYMBOLS; pub const UBLOCK_ALCHEMICAL_SYMBOLS = UBlockCode.ALCHEMICAL_SYMBOLS; pub const UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D = UBlockCode.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D; pub const UBLOCK_ARABIC_EXTENDED_A = UBlockCode.ARABIC_EXTENDED_A; pub const UBLOCK_ARABIC_MATHEMATICAL_ALPHABETIC_SYMBOLS = UBlockCode.ARABIC_MATHEMATICAL_ALPHABETIC_SYMBOLS; pub const UBLOCK_CHAKMA = UBlockCode.CHAKMA; pub const UBLOCK_MEETEI_MAYEK_EXTENSIONS = UBlockCode.MEETEI_MAYEK_EXTENSIONS; pub const UBLOCK_MEROITIC_CURSIVE = UBlockCode.MEROITIC_CURSIVE; pub const UBLOCK_MEROITIC_HIEROGLYPHS = UBlockCode.MEROITIC_HIEROGLYPHS; pub const UBLOCK_MIAO = UBlockCode.MIAO; pub const UBLOCK_SHARADA = UBlockCode.SHARADA; pub const UBLOCK_SORA_SOMPENG = UBlockCode.SORA_SOMPENG; pub const UBLOCK_SUNDANESE_SUPPLEMENT = UBlockCode.SUNDANESE_SUPPLEMENT; pub const UBLOCK_TAKRI = UBlockCode.TAKRI; pub const UBLOCK_BASSA_VAH = UBlockCode.BASSA_VAH; pub const UBLOCK_CAUCASIAN_ALBANIAN = UBlockCode.CAUCASIAN_ALBANIAN; pub const UBLOCK_COPTIC_EPACT_NUMBERS = UBlockCode.COPTIC_EPACT_NUMBERS; pub const UBLOCK_COMBINING_DIACRITICAL_MARKS_EXTENDED = UBlockCode.COMBINING_DIACRITICAL_MARKS_EXTENDED; pub const UBLOCK_DUPLOYAN = UBlockCode.DUPLOYAN; pub const UBLOCK_ELBASAN = UBlockCode.ELBASAN; pub const UBLOCK_GEOMETRIC_SHAPES_EXTENDED = UBlockCode.GEOMETRIC_SHAPES_EXTENDED; pub const UBLOCK_GRANTHA = UBlockCode.GRANTHA; pub const UBLOCK_KHOJKI = UBlockCode.KHOJKI; pub const UBLOCK_KHUDAWADI = UBlockCode.KHUDAWADI; pub const UBLOCK_LATIN_EXTENDED_E = UBlockCode.LATIN_EXTENDED_E; pub const UBLOCK_LINEAR_A = UBlockCode.LINEAR_A; pub const UBLOCK_MAHAJANI = UBlockCode.MAHAJANI; pub const UBLOCK_MANICHAEAN = UBlockCode.MANICHAEAN; pub const UBLOCK_MENDE_KIKAKUI = UBlockCode.MENDE_KIKAKUI; pub const UBLOCK_MODI = UBlockCode.MODI; pub const UBLOCK_MRO = UBlockCode.MRO; pub const UBLOCK_MYANMAR_EXTENDED_B = UBlockCode.MYANMAR_EXTENDED_B; pub const UBLOCK_NABATAEAN = UBlockCode.NABATAEAN; pub const UBLOCK_OLD_NORTH_ARABIAN = UBlockCode.OLD_NORTH_ARABIAN; pub const UBLOCK_OLD_PERMIC = UBlockCode.OLD_PERMIC; pub const UBLOCK_ORNAMENTAL_DINGBATS = UBlockCode.ORNAMENTAL_DINGBATS; pub const UBLOCK_PAHAWH_HMONG = UBlockCode.PAHAWH_HMONG; pub const UBLOCK_PALMYRENE = UBlockCode.PALMYRENE; pub const UBLOCK_PAU_CIN_HAU = UBlockCode.PAU_CIN_HAU; pub const UBLOCK_PSALTER_PAHLAVI = UBlockCode.PSALTER_PAHLAVI; pub const UBLOCK_SHORTHAND_FORMAT_CONTROLS = UBlockCode.SHORTHAND_FORMAT_CONTROLS; pub const UBLOCK_SIDDHAM = UBlockCode.SIDDHAM; pub const UBLOCK_SINHALA_ARCHAIC_NUMBERS = UBlockCode.SINHALA_ARCHAIC_NUMBERS; pub const UBLOCK_SUPPLEMENTAL_ARROWS_C = UBlockCode.SUPPLEMENTAL_ARROWS_C; pub const UBLOCK_TIRHUTA = UBlockCode.TIRHUTA; pub const UBLOCK_WARANG_CITI = UBlockCode.WARANG_CITI; pub const UBLOCK_AHOM = UBlockCode.AHOM; pub const UBLOCK_ANATOLIAN_HIEROGLYPHS = UBlockCode.ANATOLIAN_HIEROGLYPHS; pub const UBLOCK_CHEROKEE_SUPPLEMENT = UBlockCode.CHEROKEE_SUPPLEMENT; pub const UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_E = UBlockCode.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_E; pub const UBLOCK_EARLY_DYNASTIC_CUNEIFORM = UBlockCode.EARLY_DYNASTIC_CUNEIFORM; pub const UBLOCK_HATRAN = UBlockCode.HATRAN; pub const UBLOCK_MULTANI = UBlockCode.MULTANI; pub const UBLOCK_OLD_HUNGARIAN = UBlockCode.OLD_HUNGARIAN; pub const UBLOCK_SUPPLEMENTAL_SYMBOLS_AND_PICTOGRAPHS = UBlockCode.SUPPLEMENTAL_SYMBOLS_AND_PICTOGRAPHS; pub const UBLOCK_SUTTON_SIGNWRITING = UBlockCode.SUTTON_SIGNWRITING; pub const UBLOCK_ADLAM = UBlockCode.ADLAM; pub const UBLOCK_BHAIKSUKI = UBlockCode.BHAIKSUKI; pub const UBLOCK_CYRILLIC_EXTENDED_C = UBlockCode.CYRILLIC_EXTENDED_C; pub const UBLOCK_GLAGOLITIC_SUPPLEMENT = UBlockCode.GLAGOLITIC_SUPPLEMENT; pub const UBLOCK_IDEOGRAPHIC_SYMBOLS_AND_PUNCTUATION = UBlockCode.IDEOGRAPHIC_SYMBOLS_AND_PUNCTUATION; pub const UBLOCK_MARCHEN = UBlockCode.MARCHEN; pub const UBLOCK_MONGOLIAN_SUPPLEMENT = UBlockCode.MONGOLIAN_SUPPLEMENT; pub const UBLOCK_NEWA = UBlockCode.NEWA; pub const UBLOCK_OSAGE = UBlockCode.OSAGE; pub const UBLOCK_TANGUT = UBlockCode.TANGUT; pub const UBLOCK_TANGUT_COMPONENTS = UBlockCode.TANGUT_COMPONENTS; pub const UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_F = UBlockCode.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_F; pub const UBLOCK_KANA_EXTENDED_A = UBlockCode.KANA_EXTENDED_A; pub const UBLOCK_MASARAM_GONDI = UBlockCode.MASARAM_GONDI; pub const UBLOCK_NUSHU = UBlockCode.NUSHU; pub const UBLOCK_SOYOMBO = UBlockCode.SOYOMBO; pub const UBLOCK_SYRIAC_SUPPLEMENT = UBlockCode.SYRIAC_SUPPLEMENT; pub const UBLOCK_ZANABAZAR_SQUARE = UBlockCode.ZANABAZAR_SQUARE; pub const UBLOCK_CHESS_SYMBOLS = UBlockCode.CHESS_SYMBOLS; pub const UBLOCK_DOGRA = UBlockCode.DOGRA; pub const UBLOCK_GEORGIAN_EXTENDED = UBlockCode.GEORGIAN_EXTENDED; pub const UBLOCK_GUNJALA_GONDI = UBlockCode.GUNJALA_GONDI; pub const UBLOCK_HANIFI_ROHINGYA = UBlockCode.HANIFI_ROHINGYA; pub const UBLOCK_INDIC_SIYAQ_NUMBERS = UBlockCode.INDIC_SIYAQ_NUMBERS; pub const UBLOCK_MAKASAR = UBlockCode.MAKASAR; pub const UBLOCK_MAYAN_NUMERALS = UBlockCode.MAYAN_NUMERALS; pub const UBLOCK_MEDEFAIDRIN = UBlockCode.MEDEFAIDRIN; pub const UBLOCK_OLD_SOGDIAN = UBlockCode.OLD_SOGDIAN; pub const UBLOCK_SOGDIAN = UBlockCode.SOGDIAN; pub const UBLOCK_EGYPTIAN_HIEROGLYPH_FORMAT_CONTROLS = UBlockCode.EGYPTIAN_HIEROGLYPH_FORMAT_CONTROLS; pub const UBLOCK_ELYMAIC = UBlockCode.ELYMAIC; pub const UBLOCK_NANDINAGARI = UBlockCode.NANDINAGARI; pub const UBLOCK_NYIAKENG_PUACHUE_HMONG = UBlockCode.NYIAKENG_PUACHUE_HMONG; pub const UBLOCK_OTTOMAN_SIYAQ_NUMBERS = UBlockCode.OTTOMAN_SIYAQ_NUMBERS; pub const UBLOCK_SMALL_KANA_EXTENSION = UBlockCode.SMALL_KANA_EXTENSION; pub const UBLOCK_SYMBOLS_AND_PICTOGRAPHS_EXTENDED_A = UBlockCode.SYMBOLS_AND_PICTOGRAPHS_EXTENDED_A; pub const UBLOCK_TAMIL_SUPPLEMENT = UBlockCode.TAMIL_SUPPLEMENT; pub const UBLOCK_WANCHO = UBlockCode.WANCHO; pub const UBLOCK_INVALID_CODE = UBlockCode.INVALID_CODE; pub const UEastAsianWidth = enum(i32) { NEUTRAL = 0, AMBIGUOUS = 1, HALFWIDTH = 2, FULLWIDTH = 3, NARROW = 4, WIDE = 5, }; pub const U_EA_NEUTRAL = UEastAsianWidth.NEUTRAL; pub const U_EA_AMBIGUOUS = UEastAsianWidth.AMBIGUOUS; pub const U_EA_HALFWIDTH = UEastAsianWidth.HALFWIDTH; pub const U_EA_FULLWIDTH = UEastAsianWidth.FULLWIDTH; pub const U_EA_NARROW = UEastAsianWidth.NARROW; pub const U_EA_WIDE = UEastAsianWidth.WIDE; pub const UCharNameChoice = enum(i32) { UNICODE_CHAR_NAME = 0, EXTENDED_CHAR_NAME = 2, CHAR_NAME_ALIAS = 3, }; pub const U_UNICODE_CHAR_NAME = UCharNameChoice.UNICODE_CHAR_NAME; pub const U_EXTENDED_CHAR_NAME = UCharNameChoice.EXTENDED_CHAR_NAME; pub const U_CHAR_NAME_ALIAS = UCharNameChoice.CHAR_NAME_ALIAS; pub const UPropertyNameChoice = enum(i32) { SHORT_PROPERTY_NAME = 0, LONG_PROPERTY_NAME = 1, }; pub const U_SHORT_PROPERTY_NAME = UPropertyNameChoice.SHORT_PROPERTY_NAME; pub const U_LONG_PROPERTY_NAME = UPropertyNameChoice.LONG_PROPERTY_NAME; pub const UDecompositionType = enum(i32) { NONE = 0, CANONICAL = 1, COMPAT = 2, CIRCLE = 3, FINAL = 4, FONT = 5, FRACTION = 6, INITIAL = 7, ISOLATED = 8, MEDIAL = 9, NARROW = 10, NOBREAK = 11, SMALL = 12, SQUARE = 13, SUB = 14, SUPER = 15, VERTICAL = 16, WIDE = 17, }; pub const U_DT_NONE = UDecompositionType.NONE; pub const U_DT_CANONICAL = UDecompositionType.CANONICAL; pub const U_DT_COMPAT = UDecompositionType.COMPAT; pub const U_DT_CIRCLE = UDecompositionType.CIRCLE; pub const U_DT_FINAL = UDecompositionType.FINAL; pub const U_DT_FONT = UDecompositionType.FONT; pub const U_DT_FRACTION = UDecompositionType.FRACTION; pub const U_DT_INITIAL = UDecompositionType.INITIAL; pub const U_DT_ISOLATED = UDecompositionType.ISOLATED; pub const U_DT_MEDIAL = UDecompositionType.MEDIAL; pub const U_DT_NARROW = UDecompositionType.NARROW; pub const U_DT_NOBREAK = UDecompositionType.NOBREAK; pub const U_DT_SMALL = UDecompositionType.SMALL; pub const U_DT_SQUARE = UDecompositionType.SQUARE; pub const U_DT_SUB = UDecompositionType.SUB; pub const U_DT_SUPER = UDecompositionType.SUPER; pub const U_DT_VERTICAL = UDecompositionType.VERTICAL; pub const U_DT_WIDE = UDecompositionType.WIDE; pub const UJoiningType = enum(i32) { NON_JOINING = 0, JOIN_CAUSING = 1, DUAL_JOINING = 2, LEFT_JOINING = 3, RIGHT_JOINING = 4, TRANSPARENT = 5, }; pub const U_JT_NON_JOINING = UJoiningType.NON_JOINING; pub const U_JT_JOIN_CAUSING = UJoiningType.JOIN_CAUSING; pub const U_JT_DUAL_JOINING = UJoiningType.DUAL_JOINING; pub const U_JT_LEFT_JOINING = UJoiningType.LEFT_JOINING; pub const U_JT_RIGHT_JOINING = UJoiningType.RIGHT_JOINING; pub const U_JT_TRANSPARENT = UJoiningType.TRANSPARENT; pub const UJoiningGroup = enum(i32) { NO_JOINING_GROUP = 0, AIN = 1, ALAPH = 2, ALEF = 3, BEH = 4, BETH = 5, DAL = 6, DALATH_RISH = 7, E = 8, FEH = 9, FINAL_SEMKATH = 10, GAF = 11, GAMAL = 12, HAH = 13, TEH_MARBUTA_GOAL = 14, // HAMZA_ON_HEH_GOAL = 14, this enum value conflicts with TEH_MARBUTA_GOAL HE = 15, HEH = 16, HEH_GOAL = 17, HETH = 18, KAF = 19, KAPH = 20, KNOTTED_HEH = 21, LAM = 22, LAMADH = 23, MEEM = 24, MIM = 25, NOON = 26, NUN = 27, PE = 28, QAF = 29, QAPH = 30, REH = 31, REVERSED_PE = 32, SAD = 33, SADHE = 34, SEEN = 35, SEMKATH = 36, SHIN = 37, SWASH_KAF = 38, SYRIAC_WAW = 39, TAH = 40, TAW = 41, TEH_MARBUTA = 42, TETH = 43, WAW = 44, YEH = 45, YEH_BARREE = 46, YEH_WITH_TAIL = 47, YUDH = 48, YUDH_HE = 49, ZAIN = 50, FE = 51, KHAPH = 52, ZHAIN = 53, BURUSHASKI_YEH_BARREE = 54, FARSI_YEH = 55, NYA = 56, ROHINGYA_YEH = 57, MANICHAEAN_ALEPH = 58, MANICHAEAN_AYIN = 59, MANICHAEAN_BETH = 60, MANICHAEAN_DALETH = 61, MANICHAEAN_DHAMEDH = 62, MANICHAEAN_FIVE = 63, MANICHAEAN_GIMEL = 64, MANICHAEAN_HETH = 65, MANICHAEAN_HUNDRED = 66, MANICHAEAN_KAPH = 67, MANICHAEAN_LAMEDH = 68, MANICHAEAN_MEM = 69, MANICHAEAN_NUN = 70, MANICHAEAN_ONE = 71, MANICHAEAN_PE = 72, MANICHAEAN_QOPH = 73, MANICHAEAN_RESH = 74, MANICHAEAN_SADHE = 75, MANICHAEAN_SAMEKH = 76, MANICHAEAN_TAW = 77, MANICHAEAN_TEN = 78, MANICHAEAN_TETH = 79, MANICHAEAN_THAMEDH = 80, MANICHAEAN_TWENTY = 81, MANICHAEAN_WAW = 82, MANICHAEAN_YODH = 83, MANICHAEAN_ZAYIN = 84, STRAIGHT_WAW = 85, AFRICAN_FEH = 86, AFRICAN_NOON = 87, AFRICAN_QAF = 88, MALAYALAM_BHA = 89, MALAYALAM_JA = 90, MALAYALAM_LLA = 91, MALAYALAM_LLLA = 92, MALAYALAM_NGA = 93, MALAYALAM_NNA = 94, MALAYALAM_NNNA = 95, MALAYALAM_NYA = 96, MALAYALAM_RA = 97, MALAYALAM_SSA = 98, MALAYALAM_TTA = 99, HANIFI_ROHINGYA_KINNA_YA = 100, HANIFI_ROHINGYA_PA = 101, }; pub const U_JG_NO_JOINING_GROUP = UJoiningGroup.NO_JOINING_GROUP; pub const U_JG_AIN = UJoiningGroup.AIN; pub const U_JG_ALAPH = UJoiningGroup.ALAPH; pub const U_JG_ALEF = UJoiningGroup.ALEF; pub const U_JG_BEH = UJoiningGroup.BEH; pub const U_JG_BETH = UJoiningGroup.BETH; pub const U_JG_DAL = UJoiningGroup.DAL; pub const U_JG_DALATH_RISH = UJoiningGroup.DALATH_RISH; pub const U_JG_E = UJoiningGroup.E; pub const U_JG_FEH = UJoiningGroup.FEH; pub const U_JG_FINAL_SEMKATH = UJoiningGroup.FINAL_SEMKATH; pub const U_JG_GAF = UJoiningGroup.GAF; pub const U_JG_GAMAL = UJoiningGroup.GAMAL; pub const U_JG_HAH = UJoiningGroup.HAH; pub const U_JG_TEH_MARBUTA_GOAL = UJoiningGroup.TEH_MARBUTA_GOAL; pub const U_JG_HAMZA_ON_HEH_GOAL = UJoiningGroup.TEH_MARBUTA_GOAL; pub const U_JG_HE = UJoiningGroup.HE; pub const U_JG_HEH = UJoiningGroup.HEH; pub const U_JG_HEH_GOAL = UJoiningGroup.HEH_GOAL; pub const U_JG_HETH = UJoiningGroup.HETH; pub const U_JG_KAF = UJoiningGroup.KAF; pub const U_JG_KAPH = UJoiningGroup.KAPH; pub const U_JG_KNOTTED_HEH = UJoiningGroup.KNOTTED_HEH; pub const U_JG_LAM = UJoiningGroup.LAM; pub const U_JG_LAMADH = UJoiningGroup.LAMADH; pub const U_JG_MEEM = UJoiningGroup.MEEM; pub const U_JG_MIM = UJoiningGroup.MIM; pub const U_JG_NOON = UJoiningGroup.NOON; pub const U_JG_NUN = UJoiningGroup.NUN; pub const U_JG_PE = UJoiningGroup.PE; pub const U_JG_QAF = UJoiningGroup.QAF; pub const U_JG_QAPH = UJoiningGroup.QAPH; pub const U_JG_REH = UJoiningGroup.REH; pub const U_JG_REVERSED_PE = UJoiningGroup.REVERSED_PE; pub const U_JG_SAD = UJoiningGroup.SAD; pub const U_JG_SADHE = UJoiningGroup.SADHE; pub const U_JG_SEEN = UJoiningGroup.SEEN; pub const U_JG_SEMKATH = UJoiningGroup.SEMKATH; pub const U_JG_SHIN = UJoiningGroup.SHIN; pub const U_JG_SWASH_KAF = UJoiningGroup.SWASH_KAF; pub const U_JG_SYRIAC_WAW = UJoiningGroup.SYRIAC_WAW; pub const U_JG_TAH = UJoiningGroup.TAH; pub const U_JG_TAW = UJoiningGroup.TAW; pub const U_JG_TEH_MARBUTA = UJoiningGroup.TEH_MARBUTA; pub const U_JG_TETH = UJoiningGroup.TETH; pub const U_JG_WAW = UJoiningGroup.WAW; pub const U_JG_YEH = UJoiningGroup.YEH; pub const U_JG_YEH_BARREE = UJoiningGroup.YEH_BARREE; pub const U_JG_YEH_WITH_TAIL = UJoiningGroup.YEH_WITH_TAIL; pub const U_JG_YUDH = UJoiningGroup.YUDH; pub const U_JG_YUDH_HE = UJoiningGroup.YUDH_HE; pub const U_JG_ZAIN = UJoiningGroup.ZAIN; pub const U_JG_FE = UJoiningGroup.FE; pub const U_JG_KHAPH = UJoiningGroup.KHAPH; pub const U_JG_ZHAIN = UJoiningGroup.ZHAIN; pub const U_JG_BURUSHASKI_YEH_BARREE = UJoiningGroup.BURUSHASKI_YEH_BARREE; pub const U_JG_FARSI_YEH = UJoiningGroup.FARSI_YEH; pub const U_JG_NYA = UJoiningGroup.NYA; pub const U_JG_ROHINGYA_YEH = UJoiningGroup.ROHINGYA_YEH; pub const U_JG_MANICHAEAN_ALEPH = UJoiningGroup.MANICHAEAN_ALEPH; pub const U_JG_MANICHAEAN_AYIN = UJoiningGroup.MANICHAEAN_AYIN; pub const U_JG_MANICHAEAN_BETH = UJoiningGroup.MANICHAEAN_BETH; pub const U_JG_MANICHAEAN_DALETH = UJoiningGroup.MANICHAEAN_DALETH; pub const U_JG_MANICHAEAN_DHAMEDH = UJoiningGroup.MANICHAEAN_DHAMEDH; pub const U_JG_MANICHAEAN_FIVE = UJoiningGroup.MANICHAEAN_FIVE; pub const U_JG_MANICHAEAN_GIMEL = UJoiningGroup.MANICHAEAN_GIMEL; pub const U_JG_MANICHAEAN_HETH = UJoiningGroup.MANICHAEAN_HETH; pub const U_JG_MANICHAEAN_HUNDRED = UJoiningGroup.MANICHAEAN_HUNDRED; pub const U_JG_MANICHAEAN_KAPH = UJoiningGroup.MANICHAEAN_KAPH; pub const U_JG_MANICHAEAN_LAMEDH = UJoiningGroup.MANICHAEAN_LAMEDH; pub const U_JG_MANICHAEAN_MEM = UJoiningGroup.MANICHAEAN_MEM; pub const U_JG_MANICHAEAN_NUN = UJoiningGroup.MANICHAEAN_NUN; pub const U_JG_MANICHAEAN_ONE = UJoiningGroup.MANICHAEAN_ONE; pub const U_JG_MANICHAEAN_PE = UJoiningGroup.MANICHAEAN_PE; pub const U_JG_MANICHAEAN_QOPH = UJoiningGroup.MANICHAEAN_QOPH; pub const U_JG_MANICHAEAN_RESH = UJoiningGroup.MANICHAEAN_RESH; pub const U_JG_MANICHAEAN_SADHE = UJoiningGroup.MANICHAEAN_SADHE; pub const U_JG_MANICHAEAN_SAMEKH = UJoiningGroup.MANICHAEAN_SAMEKH; pub const U_JG_MANICHAEAN_TAW = UJoiningGroup.MANICHAEAN_TAW; pub const U_JG_MANICHAEAN_TEN = UJoiningGroup.MANICHAEAN_TEN; pub const U_JG_MANICHAEAN_TETH = UJoiningGroup.MANICHAEAN_TETH; pub const U_JG_MANICHAEAN_THAMEDH = UJoiningGroup.MANICHAEAN_THAMEDH; pub const U_JG_MANICHAEAN_TWENTY = UJoiningGroup.MANICHAEAN_TWENTY; pub const U_JG_MANICHAEAN_WAW = UJoiningGroup.MANICHAEAN_WAW; pub const U_JG_MANICHAEAN_YODH = UJoiningGroup.MANICHAEAN_YODH; pub const U_JG_MANICHAEAN_ZAYIN = UJoiningGroup.MANICHAEAN_ZAYIN; pub const U_JG_STRAIGHT_WAW = UJoiningGroup.STRAIGHT_WAW; pub const U_JG_AFRICAN_FEH = UJoiningGroup.AFRICAN_FEH; pub const U_JG_AFRICAN_NOON = UJoiningGroup.AFRICAN_NOON; pub const U_JG_AFRICAN_QAF = UJoiningGroup.AFRICAN_QAF; pub const U_JG_MALAYALAM_BHA = UJoiningGroup.MALAYALAM_BHA; pub const U_JG_MALAYALAM_JA = UJoiningGroup.MALAYALAM_JA; pub const U_JG_MALAYALAM_LLA = UJoiningGroup.MALAYALAM_LLA; pub const U_JG_MALAYALAM_LLLA = UJoiningGroup.MALAYALAM_LLLA; pub const U_JG_MALAYALAM_NGA = UJoiningGroup.MALAYALAM_NGA; pub const U_JG_MALAYALAM_NNA = UJoiningGroup.MALAYALAM_NNA; pub const U_JG_MALAYALAM_NNNA = UJoiningGroup.MALAYALAM_NNNA; pub const U_JG_MALAYALAM_NYA = UJoiningGroup.MALAYALAM_NYA; pub const U_JG_MALAYALAM_RA = UJoiningGroup.MALAYALAM_RA; pub const U_JG_MALAYALAM_SSA = UJoiningGroup.MALAYALAM_SSA; pub const U_JG_MALAYALAM_TTA = UJoiningGroup.MALAYALAM_TTA; pub const U_JG_HANIFI_ROHINGYA_KINNA_YA = UJoiningGroup.HANIFI_ROHINGYA_KINNA_YA; pub const U_JG_HANIFI_ROHINGYA_PA = UJoiningGroup.HANIFI_ROHINGYA_PA; pub const UGraphemeClusterBreak = enum(i32) { OTHER = 0, CONTROL = 1, CR = 2, EXTEND = 3, L = 4, LF = 5, LV = 6, LVT = 7, T = 8, V = 9, SPACING_MARK = 10, PREPEND = 11, REGIONAL_INDICATOR = 12, E_BASE = 13, E_BASE_GAZ = 14, E_MODIFIER = 15, GLUE_AFTER_ZWJ = 16, ZWJ = 17, }; pub const U_GCB_OTHER = UGraphemeClusterBreak.OTHER; pub const U_GCB_CONTROL = UGraphemeClusterBreak.CONTROL; pub const U_GCB_CR = UGraphemeClusterBreak.CR; pub const U_GCB_EXTEND = UGraphemeClusterBreak.EXTEND; pub const U_GCB_L = UGraphemeClusterBreak.L; pub const U_GCB_LF = UGraphemeClusterBreak.LF; pub const U_GCB_LV = UGraphemeClusterBreak.LV; pub const U_GCB_LVT = UGraphemeClusterBreak.LVT; pub const U_GCB_T = UGraphemeClusterBreak.T; pub const U_GCB_V = UGraphemeClusterBreak.V; pub const U_GCB_SPACING_MARK = UGraphemeClusterBreak.SPACING_MARK; pub const U_GCB_PREPEND = UGraphemeClusterBreak.PREPEND; pub const U_GCB_REGIONAL_INDICATOR = UGraphemeClusterBreak.REGIONAL_INDICATOR; pub const U_GCB_E_BASE = UGraphemeClusterBreak.E_BASE; pub const U_GCB_E_BASE_GAZ = UGraphemeClusterBreak.E_BASE_GAZ; pub const U_GCB_E_MODIFIER = UGraphemeClusterBreak.E_MODIFIER; pub const U_GCB_GLUE_AFTER_ZWJ = UGraphemeClusterBreak.GLUE_AFTER_ZWJ; pub const U_GCB_ZWJ = UGraphemeClusterBreak.ZWJ; pub const UWordBreakValues = enum(i32) { OTHER = 0, ALETTER = 1, FORMAT = 2, KATAKANA = 3, MIDLETTER = 4, MIDNUM = 5, NUMERIC = 6, EXTENDNUMLET = 7, CR = 8, EXTEND = 9, LF = 10, MIDNUMLET = 11, NEWLINE = 12, REGIONAL_INDICATOR = 13, HEBREW_LETTER = 14, SINGLE_QUOTE = 15, DOUBLE_QUOTE = 16, E_BASE = 17, E_BASE_GAZ = 18, E_MODIFIER = 19, GLUE_AFTER_ZWJ = 20, ZWJ = 21, WSEGSPACE = 22, }; pub const U_WB_OTHER = UWordBreakValues.OTHER; pub const U_WB_ALETTER = UWordBreakValues.ALETTER; pub const U_WB_FORMAT = UWordBreakValues.FORMAT; pub const U_WB_KATAKANA = UWordBreakValues.KATAKANA; pub const U_WB_MIDLETTER = UWordBreakValues.MIDLETTER; pub const U_WB_MIDNUM = UWordBreakValues.MIDNUM; pub const U_WB_NUMERIC = UWordBreakValues.NUMERIC; pub const U_WB_EXTENDNUMLET = UWordBreakValues.EXTENDNUMLET; pub const U_WB_CR = UWordBreakValues.CR; pub const U_WB_EXTEND = UWordBreakValues.EXTEND; pub const U_WB_LF = UWordBreakValues.LF; pub const U_WB_MIDNUMLET = UWordBreakValues.MIDNUMLET; pub const U_WB_NEWLINE = UWordBreakValues.NEWLINE; pub const U_WB_REGIONAL_INDICATOR = UWordBreakValues.REGIONAL_INDICATOR; pub const U_WB_HEBREW_LETTER = UWordBreakValues.HEBREW_LETTER; pub const U_WB_SINGLE_QUOTE = UWordBreakValues.SINGLE_QUOTE; pub const U_WB_DOUBLE_QUOTE = UWordBreakValues.DOUBLE_QUOTE; pub const U_WB_E_BASE = UWordBreakValues.E_BASE; pub const U_WB_E_BASE_GAZ = UWordBreakValues.E_BASE_GAZ; pub const U_WB_E_MODIFIER = UWordBreakValues.E_MODIFIER; pub const U_WB_GLUE_AFTER_ZWJ = UWordBreakValues.GLUE_AFTER_ZWJ; pub const U_WB_ZWJ = UWordBreakValues.ZWJ; pub const U_WB_WSEGSPACE = UWordBreakValues.WSEGSPACE; pub const USentenceBreak = enum(i32) { OTHER = 0, ATERM = 1, CLOSE = 2, FORMAT = 3, LOWER = 4, NUMERIC = 5, OLETTER = 6, SEP = 7, SP = 8, STERM = 9, UPPER = 10, CR = 11, EXTEND = 12, LF = 13, SCONTINUE = 14, }; pub const U_SB_OTHER = USentenceBreak.OTHER; pub const U_SB_ATERM = USentenceBreak.ATERM; pub const U_SB_CLOSE = USentenceBreak.CLOSE; pub const U_SB_FORMAT = USentenceBreak.FORMAT; pub const U_SB_LOWER = USentenceBreak.LOWER; pub const U_SB_NUMERIC = USentenceBreak.NUMERIC; pub const U_SB_OLETTER = USentenceBreak.OLETTER; pub const U_SB_SEP = USentenceBreak.SEP; pub const U_SB_SP = USentenceBreak.SP; pub const U_SB_STERM = USentenceBreak.STERM; pub const U_SB_UPPER = USentenceBreak.UPPER; pub const U_SB_CR = USentenceBreak.CR; pub const U_SB_EXTEND = USentenceBreak.EXTEND; pub const U_SB_LF = USentenceBreak.LF; pub const U_SB_SCONTINUE = USentenceBreak.SCONTINUE; pub const ULineBreak = enum(i32) { UNKNOWN = 0, AMBIGUOUS = 1, ALPHABETIC = 2, BREAK_BOTH = 3, BREAK_AFTER = 4, BREAK_BEFORE = 5, MANDATORY_BREAK = 6, CONTINGENT_BREAK = 7, CLOSE_PUNCTUATION = 8, COMBINING_MARK = 9, CARRIAGE_RETURN = 10, EXCLAMATION = 11, GLUE = 12, HYPHEN = 13, IDEOGRAPHIC = 14, INSEPARABLE = 15, // INSEPERABLE = 15, this enum value conflicts with INSEPARABLE INFIX_NUMERIC = 16, LINE_FEED = 17, NONSTARTER = 18, NUMERIC = 19, OPEN_PUNCTUATION = 20, POSTFIX_NUMERIC = 21, PREFIX_NUMERIC = 22, QUOTATION = 23, COMPLEX_CONTEXT = 24, SURROGATE = 25, SPACE = 26, BREAK_SYMBOLS = 27, ZWSPACE = 28, NEXT_LINE = 29, WORD_JOINER = 30, H2 = 31, H3 = 32, JL = 33, JT = 34, JV = 35, CLOSE_PARENTHESIS = 36, CONDITIONAL_JAPANESE_STARTER = 37, HEBREW_LETTER = 38, REGIONAL_INDICATOR = 39, E_BASE = 40, E_MODIFIER = 41, ZWJ = 42, }; pub const U_LB_UNKNOWN = ULineBreak.UNKNOWN; pub const U_LB_AMBIGUOUS = ULineBreak.AMBIGUOUS; pub const U_LB_ALPHABETIC = ULineBreak.ALPHABETIC; pub const U_LB_BREAK_BOTH = ULineBreak.BREAK_BOTH; pub const U_LB_BREAK_AFTER = ULineBreak.BREAK_AFTER; pub const U_LB_BREAK_BEFORE = ULineBreak.BREAK_BEFORE; pub const U_LB_MANDATORY_BREAK = ULineBreak.MANDATORY_BREAK; pub const U_LB_CONTINGENT_BREAK = ULineBreak.CONTINGENT_BREAK; pub const U_LB_CLOSE_PUNCTUATION = ULineBreak.CLOSE_PUNCTUATION; pub const U_LB_COMBINING_MARK = ULineBreak.COMBINING_MARK; pub const U_LB_CARRIAGE_RETURN = ULineBreak.CARRIAGE_RETURN; pub const U_LB_EXCLAMATION = ULineBreak.EXCLAMATION; pub const U_LB_GLUE = ULineBreak.GLUE; pub const U_LB_HYPHEN = ULineBreak.HYPHEN; pub const U_LB_IDEOGRAPHIC = ULineBreak.IDEOGRAPHIC; pub const U_LB_INSEPARABLE = ULineBreak.INSEPARABLE; pub const U_LB_INSEPERABLE = ULineBreak.INSEPARABLE; pub const U_LB_INFIX_NUMERIC = ULineBreak.INFIX_NUMERIC; pub const U_LB_LINE_FEED = ULineBreak.LINE_FEED; pub const U_LB_NONSTARTER = ULineBreak.NONSTARTER; pub const U_LB_NUMERIC = ULineBreak.NUMERIC; pub const U_LB_OPEN_PUNCTUATION = ULineBreak.OPEN_PUNCTUATION; pub const U_LB_POSTFIX_NUMERIC = ULineBreak.POSTFIX_NUMERIC; pub const U_LB_PREFIX_NUMERIC = ULineBreak.PREFIX_NUMERIC; pub const U_LB_QUOTATION = ULineBreak.QUOTATION; pub const U_LB_COMPLEX_CONTEXT = ULineBreak.COMPLEX_CONTEXT; pub const U_LB_SURROGATE = ULineBreak.SURROGATE; pub const U_LB_SPACE = ULineBreak.SPACE; pub const U_LB_BREAK_SYMBOLS = ULineBreak.BREAK_SYMBOLS; pub const U_LB_ZWSPACE = ULineBreak.ZWSPACE; pub const U_LB_NEXT_LINE = ULineBreak.NEXT_LINE; pub const U_LB_WORD_JOINER = ULineBreak.WORD_JOINER; pub const U_LB_H2 = ULineBreak.H2; pub const U_LB_H3 = ULineBreak.H3; pub const U_LB_JL = ULineBreak.JL; pub const U_LB_JT = ULineBreak.JT; pub const U_LB_JV = ULineBreak.JV; pub const U_LB_CLOSE_PARENTHESIS = ULineBreak.CLOSE_PARENTHESIS; pub const U_LB_CONDITIONAL_JAPANESE_STARTER = ULineBreak.CONDITIONAL_JAPANESE_STARTER; pub const U_LB_HEBREW_LETTER = ULineBreak.HEBREW_LETTER; pub const U_LB_REGIONAL_INDICATOR = ULineBreak.REGIONAL_INDICATOR; pub const U_LB_E_BASE = ULineBreak.E_BASE; pub const U_LB_E_MODIFIER = ULineBreak.E_MODIFIER; pub const U_LB_ZWJ = ULineBreak.ZWJ; pub const UNumericType = enum(i32) { NONE = 0, DECIMAL = 1, DIGIT = 2, NUMERIC = 3, }; pub const U_NT_NONE = UNumericType.NONE; pub const U_NT_DECIMAL = UNumericType.DECIMAL; pub const U_NT_DIGIT = UNumericType.DIGIT; pub const U_NT_NUMERIC = UNumericType.NUMERIC; pub const UHangulSyllableType = enum(i32) { NOT_APPLICABLE = 0, LEADING_JAMO = 1, VOWEL_JAMO = 2, TRAILING_JAMO = 3, LV_SYLLABLE = 4, LVT_SYLLABLE = 5, }; pub const U_HST_NOT_APPLICABLE = UHangulSyllableType.NOT_APPLICABLE; pub const U_HST_LEADING_JAMO = UHangulSyllableType.LEADING_JAMO; pub const U_HST_VOWEL_JAMO = UHangulSyllableType.VOWEL_JAMO; pub const U_HST_TRAILING_JAMO = UHangulSyllableType.TRAILING_JAMO; pub const U_HST_LV_SYLLABLE = UHangulSyllableType.LV_SYLLABLE; pub const U_HST_LVT_SYLLABLE = UHangulSyllableType.LVT_SYLLABLE; pub const UIndicPositionalCategory = enum(i32) { NA = 0, BOTTOM = 1, BOTTOM_AND_LEFT = 2, BOTTOM_AND_RIGHT = 3, LEFT = 4, LEFT_AND_RIGHT = 5, OVERSTRUCK = 6, RIGHT = 7, TOP = 8, TOP_AND_BOTTOM = 9, TOP_AND_BOTTOM_AND_RIGHT = 10, TOP_AND_LEFT = 11, TOP_AND_LEFT_AND_RIGHT = 12, TOP_AND_RIGHT = 13, VISUAL_ORDER_LEFT = 14, }; pub const U_INPC_NA = UIndicPositionalCategory.NA; pub const U_INPC_BOTTOM = UIndicPositionalCategory.BOTTOM; pub const U_INPC_BOTTOM_AND_LEFT = UIndicPositionalCategory.BOTTOM_AND_LEFT; pub const U_INPC_BOTTOM_AND_RIGHT = UIndicPositionalCategory.BOTTOM_AND_RIGHT; pub const U_INPC_LEFT = UIndicPositionalCategory.LEFT; pub const U_INPC_LEFT_AND_RIGHT = UIndicPositionalCategory.LEFT_AND_RIGHT; pub const U_INPC_OVERSTRUCK = UIndicPositionalCategory.OVERSTRUCK; pub const U_INPC_RIGHT = UIndicPositionalCategory.RIGHT; pub const U_INPC_TOP = UIndicPositionalCategory.TOP; pub const U_INPC_TOP_AND_BOTTOM = UIndicPositionalCategory.TOP_AND_BOTTOM; pub const U_INPC_TOP_AND_BOTTOM_AND_RIGHT = UIndicPositionalCategory.TOP_AND_BOTTOM_AND_RIGHT; pub const U_INPC_TOP_AND_LEFT = UIndicPositionalCategory.TOP_AND_LEFT; pub const U_INPC_TOP_AND_LEFT_AND_RIGHT = UIndicPositionalCategory.TOP_AND_LEFT_AND_RIGHT; pub const U_INPC_TOP_AND_RIGHT = UIndicPositionalCategory.TOP_AND_RIGHT; pub const U_INPC_VISUAL_ORDER_LEFT = UIndicPositionalCategory.VISUAL_ORDER_LEFT; pub const UIndicSyllabicCategory = enum(i32) { OTHER = 0, AVAGRAHA = 1, BINDU = 2, BRAHMI_JOINING_NUMBER = 3, CANTILLATION_MARK = 4, CONSONANT = 5, CONSONANT_DEAD = 6, CONSONANT_FINAL = 7, CONSONANT_HEAD_LETTER = 8, CONSONANT_INITIAL_POSTFIXED = 9, CONSONANT_KILLER = 10, CONSONANT_MEDIAL = 11, CONSONANT_PLACEHOLDER = 12, CONSONANT_PRECEDING_REPHA = 13, CONSONANT_PREFIXED = 14, CONSONANT_SUBJOINED = 15, CONSONANT_SUCCEEDING_REPHA = 16, CONSONANT_WITH_STACKER = 17, GEMINATION_MARK = 18, INVISIBLE_STACKER = 19, JOINER = 20, MODIFYING_LETTER = 21, NON_JOINER = 22, NUKTA = 23, NUMBER = 24, NUMBER_JOINER = 25, PURE_KILLER = 26, REGISTER_SHIFTER = 27, SYLLABLE_MODIFIER = 28, TONE_LETTER = 29, TONE_MARK = 30, VIRAMA = 31, VISARGA = 32, VOWEL = 33, VOWEL_DEPENDENT = 34, VOWEL_INDEPENDENT = 35, }; pub const U_INSC_OTHER = UIndicSyllabicCategory.OTHER; pub const U_INSC_AVAGRAHA = UIndicSyllabicCategory.AVAGRAHA; pub const U_INSC_BINDU = UIndicSyllabicCategory.BINDU; pub const U_INSC_BRAHMI_JOINING_NUMBER = UIndicSyllabicCategory.BRAHMI_JOINING_NUMBER; pub const U_INSC_CANTILLATION_MARK = UIndicSyllabicCategory.CANTILLATION_MARK; pub const U_INSC_CONSONANT = UIndicSyllabicCategory.CONSONANT; pub const U_INSC_CONSONANT_DEAD = UIndicSyllabicCategory.CONSONANT_DEAD; pub const U_INSC_CONSONANT_FINAL = UIndicSyllabicCategory.CONSONANT_FINAL; pub const U_INSC_CONSONANT_HEAD_LETTER = UIndicSyllabicCategory.CONSONANT_HEAD_LETTER; pub const U_INSC_CONSONANT_INITIAL_POSTFIXED = UIndicSyllabicCategory.CONSONANT_INITIAL_POSTFIXED; pub const U_INSC_CONSONANT_KILLER = UIndicSyllabicCategory.CONSONANT_KILLER; pub const U_INSC_CONSONANT_MEDIAL = UIndicSyllabicCategory.CONSONANT_MEDIAL; pub const U_INSC_CONSONANT_PLACEHOLDER = UIndicSyllabicCategory.CONSONANT_PLACEHOLDER; pub const U_INSC_CONSONANT_PRECEDING_REPHA = UIndicSyllabicCategory.CONSONANT_PRECEDING_REPHA; pub const U_INSC_CONSONANT_PREFIXED = UIndicSyllabicCategory.CONSONANT_PREFIXED; pub const U_INSC_CONSONANT_SUBJOINED = UIndicSyllabicCategory.CONSONANT_SUBJOINED; pub const U_INSC_CONSONANT_SUCCEEDING_REPHA = UIndicSyllabicCategory.CONSONANT_SUCCEEDING_REPHA; pub const U_INSC_CONSONANT_WITH_STACKER = UIndicSyllabicCategory.CONSONANT_WITH_STACKER; pub const U_INSC_GEMINATION_MARK = UIndicSyllabicCategory.GEMINATION_MARK; pub const U_INSC_INVISIBLE_STACKER = UIndicSyllabicCategory.INVISIBLE_STACKER; pub const U_INSC_JOINER = UIndicSyllabicCategory.JOINER; pub const U_INSC_MODIFYING_LETTER = UIndicSyllabicCategory.MODIFYING_LETTER; pub const U_INSC_NON_JOINER = UIndicSyllabicCategory.NON_JOINER; pub const U_INSC_NUKTA = UIndicSyllabicCategory.NUKTA; pub const U_INSC_NUMBER = UIndicSyllabicCategory.NUMBER; pub const U_INSC_NUMBER_JOINER = UIndicSyllabicCategory.NUMBER_JOINER; pub const U_INSC_PURE_KILLER = UIndicSyllabicCategory.PURE_KILLER; pub const U_INSC_REGISTER_SHIFTER = UIndicSyllabicCategory.REGISTER_SHIFTER; pub const U_INSC_SYLLABLE_MODIFIER = UIndicSyllabicCategory.SYLLABLE_MODIFIER; pub const U_INSC_TONE_LETTER = UIndicSyllabicCategory.TONE_LETTER; pub const U_INSC_TONE_MARK = UIndicSyllabicCategory.TONE_MARK; pub const U_INSC_VIRAMA = UIndicSyllabicCategory.VIRAMA; pub const U_INSC_VISARGA = UIndicSyllabicCategory.VISARGA; pub const U_INSC_VOWEL = UIndicSyllabicCategory.VOWEL; pub const U_INSC_VOWEL_DEPENDENT = UIndicSyllabicCategory.VOWEL_DEPENDENT; pub const U_INSC_VOWEL_INDEPENDENT = UIndicSyllabicCategory.VOWEL_INDEPENDENT; pub const UVerticalOrientation = enum(i32) { ROTATED = 0, TRANSFORMED_ROTATED = 1, TRANSFORMED_UPRIGHT = 2, UPRIGHT = 3, }; pub const U_VO_ROTATED = UVerticalOrientation.ROTATED; pub const U_VO_TRANSFORMED_ROTATED = UVerticalOrientation.TRANSFORMED_ROTATED; pub const U_VO_TRANSFORMED_UPRIGHT = UVerticalOrientation.TRANSFORMED_UPRIGHT; pub const U_VO_UPRIGHT = UVerticalOrientation.UPRIGHT; pub const UCharEnumTypeRange = fn( context: ?*const c_void, start: i32, limit: i32, type: UCharCategory, ) callconv(@import("std").os.windows.WINAPI) i8; pub const UEnumCharNamesFn = fn( context: ?*c_void, code: i32, nameChoice: UCharNameChoice, name: ?[*:0]const u8, length: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub const UBiDiDirection = enum(i32) { LTR = 0, RTL = 1, MIXED = 2, NEUTRAL = 3, }; pub const UBIDI_LTR = UBiDiDirection.LTR; pub const UBIDI_RTL = UBiDiDirection.RTL; pub const UBIDI_MIXED = UBiDiDirection.MIXED; pub const UBIDI_NEUTRAL = UBiDiDirection.NEUTRAL; pub const UBiDiReorderingMode = enum(i32) { DEFAULT = 0, NUMBERS_SPECIAL = 1, GROUP_NUMBERS_WITH_R = 2, RUNS_ONLY = 3, INVERSE_NUMBERS_AS_L = 4, INVERSE_LIKE_DIRECT = 5, INVERSE_FOR_NUMBERS_SPECIAL = 6, }; pub const UBIDI_REORDER_DEFAULT = UBiDiReorderingMode.DEFAULT; pub const UBIDI_REORDER_NUMBERS_SPECIAL = UBiDiReorderingMode.NUMBERS_SPECIAL; pub const UBIDI_REORDER_GROUP_NUMBERS_WITH_R = UBiDiReorderingMode.GROUP_NUMBERS_WITH_R; pub const UBIDI_REORDER_RUNS_ONLY = UBiDiReorderingMode.RUNS_ONLY; pub const UBIDI_REORDER_INVERSE_NUMBERS_AS_L = UBiDiReorderingMode.INVERSE_NUMBERS_AS_L; pub const UBIDI_REORDER_INVERSE_LIKE_DIRECT = UBiDiReorderingMode.INVERSE_LIKE_DIRECT; pub const UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL = UBiDiReorderingMode.INVERSE_FOR_NUMBERS_SPECIAL; pub const UBiDiReorderingOption = enum(i32) { DEFAULT = 0, INSERT_MARKS = 1, REMOVE_CONTROLS = 2, STREAMING = 4, }; pub const UBIDI_OPTION_DEFAULT = UBiDiReorderingOption.DEFAULT; pub const UBIDI_OPTION_INSERT_MARKS = UBiDiReorderingOption.INSERT_MARKS; pub const UBIDI_OPTION_REMOVE_CONTROLS = UBiDiReorderingOption.REMOVE_CONTROLS; pub const UBIDI_OPTION_STREAMING = UBiDiReorderingOption.STREAMING; pub const UBiDiClassCallback = fn( context: ?*const c_void, c: i32, ) callconv(@import("std").os.windows.WINAPI) UCharDirection; pub const UBiDiOrder = enum(i32) { LOGICAL = 0, VISUAL = 1, }; pub const UBIDI_LOGICAL = UBiDiOrder.LOGICAL; pub const UBIDI_VISUAL = UBiDiOrder.VISUAL; pub const UBiDiMirroring = enum(i32) { FF = 0, N = 1, }; pub const UBIDI_MIRRORING_OFF = UBiDiMirroring.FF; pub const UBIDI_MIRRORING_ON = UBiDiMirroring.N; pub const UTextClone = fn( dest: ?*UText, src: ?*const UText, deep: i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UText; pub const UTextNativeLength = fn( ut: ?*UText, ) callconv(@import("std").os.windows.WINAPI) i64; pub const UTextAccess = fn( ut: ?*UText, nativeIndex: i64, forward: i8, ) callconv(@import("std").os.windows.WINAPI) i8; pub const UTextExtract = fn( ut: ?*UText, nativeStart: i64, nativeLimit: i64, dest: ?*u16, destCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub const UTextReplace = fn( ut: ?*UText, nativeStart: i64, nativeLimit: i64, replacementText: ?*const u16, replacmentLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub const UTextCopy = fn( ut: ?*UText, nativeStart: i64, nativeLimit: i64, nativeDest: i64, move: i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub const UTextMapOffsetToNative = fn( ut: ?*const UText, ) callconv(@import("std").os.windows.WINAPI) i64; pub const UTextMapNativeIndexToUTF16 = fn( ut: ?*const UText, nativeIndex: i64, ) callconv(@import("std").os.windows.WINAPI) i32; pub const UTextClose = fn( ut: ?*UText, ) callconv(@import("std").os.windows.WINAPI) void; pub const UTextFuncs = extern struct { tableSize: i32, reserved1: i32, reserved2: i32, reserved3: i32, clone: ?UTextClone, nativeLength: ?UTextNativeLength, access: ?UTextAccess, extract: ?UTextExtract, replace: ?UTextReplace, copy: ?UTextCopy, mapOffsetToNative: ?UTextMapOffsetToNative, mapNativeIndexToUTF16: ?UTextMapNativeIndexToUTF16, close: ?UTextClose, spare1: ?UTextClose, spare2: ?UTextClose, spare3: ?UTextClose, }; pub const UText = extern struct { magic: u32, flags: i32, providerProperties: i32, sizeOfStruct: i32, chunkNativeLimit: i64, extraSize: i32, nativeIndexingLimit: i32, chunkNativeStart: i64, chunkOffset: i32, chunkLength: i32, chunkContents: ?*const u16, pFuncs: ?*const UTextFuncs, pExtra: ?*c_void, context: ?*const c_void, p: ?*const c_void, q: ?*const c_void, r: ?*const c_void, privP: ?*c_void, a: i64, b: i32, c: i32, privA: i64, privB: i32, privC: i32, }; pub const USetSpanCondition = enum(i32) { NOT_CONTAINED = 0, CONTAINED = 1, SIMPLE = 2, }; pub const USET_SPAN_NOT_CONTAINED = USetSpanCondition.NOT_CONTAINED; pub const USET_SPAN_CONTAINED = USetSpanCondition.CONTAINED; pub const USET_SPAN_SIMPLE = USetSpanCondition.SIMPLE; pub const USerializedSet = extern struct { array: ?*const u16, bmpLength: i32, length: i32, staticArray: [8]u16, }; pub const UNormalization2Mode = enum(i32) { COMPOSE = 0, DECOMPOSE = 1, FCD = 2, COMPOSE_CONTIGUOUS = 3, }; pub const UNORM2_COMPOSE = UNormalization2Mode.COMPOSE; pub const UNORM2_DECOMPOSE = UNormalization2Mode.DECOMPOSE; pub const UNORM2_FCD = UNormalization2Mode.FCD; pub const UNORM2_COMPOSE_CONTIGUOUS = UNormalization2Mode.COMPOSE_CONTIGUOUS; pub const UNormalizationCheckResult = enum(i32) { NO = 0, YES = 1, MAYBE = 2, }; pub const UNORM_NO = UNormalizationCheckResult.NO; pub const UNORM_YES = UNormalizationCheckResult.YES; pub const UNORM_MAYBE = UNormalizationCheckResult.MAYBE; pub const UNormalizationMode = enum(i32) { NONE = 1, NFD = 2, NFKD = 3, NFC = 4, // DEFAULT = 4, this enum value conflicts with NFC NFKC = 5, FCD = 6, MODE_COUNT = 7, }; pub const UNORM_NONE = UNormalizationMode.NONE; pub const UNORM_NFD = UNormalizationMode.NFD; pub const UNORM_NFKD = UNormalizationMode.NFKD; pub const UNORM_NFC = UNormalizationMode.NFC; pub const UNORM_DEFAULT = UNormalizationMode.NFC; pub const UNORM_NFKC = UNormalizationMode.NFKC; pub const UNORM_FCD = UNormalizationMode.FCD; pub const UNORM_MODE_COUNT = UNormalizationMode.MODE_COUNT; pub const UNESCAPE_CHAR_AT = fn( offset: i32, context: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) u16; pub const UParseError = extern struct { line: i32, offset: i32, preContext: [16]u16, postContext: [16]u16, }; pub const UStringPrepProfileType = enum(i32) { @"3491_NAMEPREP" = 0, @"3530_NFS4_CS_PREP" = 1, @"3530_NFS4_CS_PREP_CI" = 2, @"3530_NFS4_CIS_PREP" = 3, @"3530_NFS4_MIXED_PREP_PREFIX" = 4, @"3530_NFS4_MIXED_PREP_SUFFIX" = 5, @"3722_ISCSI" = 6, @"3920_NODEPREP" = 7, @"3920_RESOURCEPREP" = 8, @"4011_MIB" = 9, @"4013_SASLPREP" = 10, @"4505_TRACE" = 11, @"4518_LDAP" = 12, @"4518_LDAP_CI" = 13, }; pub const USPREP_RFC3491_NAMEPREP = UStringPrepProfileType.@"3491_NAMEPREP"; pub const USPREP_RFC3530_NFS4_CS_PREP = UStringPrepProfileType.@"3530_NFS4_CS_PREP"; pub const USPREP_RFC3530_NFS4_CS_PREP_CI = UStringPrepProfileType.@"3530_NFS4_CS_PREP_CI"; pub const USPREP_RFC3530_NFS4_CIS_PREP = UStringPrepProfileType.@"3530_NFS4_CIS_PREP"; pub const USPREP_RFC3530_NFS4_MIXED_PREP_PREFIX = UStringPrepProfileType.@"3530_NFS4_MIXED_PREP_PREFIX"; pub const USPREP_RFC3530_NFS4_MIXED_PREP_SUFFIX = UStringPrepProfileType.@"3530_NFS4_MIXED_PREP_SUFFIX"; pub const USPREP_RFC3722_ISCSI = UStringPrepProfileType.@"3722_ISCSI"; pub const USPREP_RFC3920_NODEPREP = UStringPrepProfileType.@"3920_NODEPREP"; pub const USPREP_RFC3920_RESOURCEPREP = UStringPrepProfileType.@"3920_RESOURCEPREP"; pub const USPREP_RFC4011_MIB = UStringPrepProfileType.@"4011_MIB"; pub const USPREP_RFC4013_SASLPREP = UStringPrepProfileType.@"4013_SASLPREP"; pub const USPREP_RFC4505_TRACE = UStringPrepProfileType.@"4505_TRACE"; pub const USPREP_RFC4518_LDAP = UStringPrepProfileType.@"4518_LDAP"; pub const USPREP_RFC4518_LDAP_CI = UStringPrepProfileType.@"4518_LDAP_CI"; pub const UIDNAInfo = extern struct { size: i16, isTransitionalDifferent: i8, reservedB3: i8, errors: u32, reservedI2: i32, reservedI3: i32, }; pub const UBreakIteratorType = enum(i32) { CHARACTER = 0, WORD = 1, LINE = 2, SENTENCE = 3, }; pub const UBRK_CHARACTER = UBreakIteratorType.CHARACTER; pub const UBRK_WORD = UBreakIteratorType.WORD; pub const UBRK_LINE = UBreakIteratorType.LINE; pub const UBRK_SENTENCE = UBreakIteratorType.SENTENCE; pub const UWordBreak = enum(i32) { NONE = 0, NONE_LIMIT = 100, // NUMBER = 100, this enum value conflicts with NONE_LIMIT NUMBER_LIMIT = 200, // LETTER = 200, this enum value conflicts with NUMBER_LIMIT LETTER_LIMIT = 300, // KANA = 300, this enum value conflicts with LETTER_LIMIT KANA_LIMIT = 400, // IDEO = 400, this enum value conflicts with KANA_LIMIT IDEO_LIMIT = 500, }; pub const UBRK_WORD_NONE = UWordBreak.NONE; pub const UBRK_WORD_NONE_LIMIT = UWordBreak.NONE_LIMIT; pub const UBRK_WORD_NUMBER = UWordBreak.NONE_LIMIT; pub const UBRK_WORD_NUMBER_LIMIT = UWordBreak.NUMBER_LIMIT; pub const UBRK_WORD_LETTER = UWordBreak.NUMBER_LIMIT; pub const UBRK_WORD_LETTER_LIMIT = UWordBreak.LETTER_LIMIT; pub const UBRK_WORD_KANA = UWordBreak.LETTER_LIMIT; pub const UBRK_WORD_KANA_LIMIT = UWordBreak.KANA_LIMIT; pub const UBRK_WORD_IDEO = UWordBreak.KANA_LIMIT; pub const UBRK_WORD_IDEO_LIMIT = UWordBreak.IDEO_LIMIT; pub const ULineBreakTag = enum(i32) { SOFT = 0, SOFT_LIMIT = 100, // HARD = 100, this enum value conflicts with SOFT_LIMIT HARD_LIMIT = 200, }; pub const UBRK_LINE_SOFT = ULineBreakTag.SOFT; pub const UBRK_LINE_SOFT_LIMIT = ULineBreakTag.SOFT_LIMIT; pub const UBRK_LINE_HARD = ULineBreakTag.SOFT_LIMIT; pub const UBRK_LINE_HARD_LIMIT = ULineBreakTag.HARD_LIMIT; pub const USentenceBreakTag = enum(i32) { TERM = 0, TERM_LIMIT = 100, // SEP = 100, this enum value conflicts with TERM_LIMIT SEP_LIMIT = 200, }; pub const UBRK_SENTENCE_TERM = USentenceBreakTag.TERM; pub const UBRK_SENTENCE_TERM_LIMIT = USentenceBreakTag.TERM_LIMIT; pub const UBRK_SENTENCE_SEP = USentenceBreakTag.TERM_LIMIT; pub const UBRK_SENTENCE_SEP_LIMIT = USentenceBreakTag.SEP_LIMIT; pub const UCalendarType = enum(i32) { TRADITIONAL = 0, // DEFAULT = 0, this enum value conflicts with TRADITIONAL GREGORIAN = 1, }; pub const UCAL_TRADITIONAL = UCalendarType.TRADITIONAL; pub const UCAL_DEFAULT = UCalendarType.TRADITIONAL; pub const UCAL_GREGORIAN = UCalendarType.GREGORIAN; pub const UCalendarDateFields = enum(i32) { ERA = 0, YEAR = 1, MONTH = 2, WEEK_OF_YEAR = 3, WEEK_OF_MONTH = 4, DATE = 5, DAY_OF_YEAR = 6, DAY_OF_WEEK = 7, DAY_OF_WEEK_IN_MONTH = 8, AM_PM = 9, HOUR = 10, HOUR_OF_DAY = 11, MINUTE = 12, SECOND = 13, MILLISECOND = 14, ZONE_OFFSET = 15, DST_OFFSET = 16, YEAR_WOY = 17, DOW_LOCAL = 18, EXTENDED_YEAR = 19, JULIAN_DAY = 20, MILLISECONDS_IN_DAY = 21, IS_LEAP_MONTH = 22, FIELD_COUNT = 23, // DAY_OF_MONTH = 5, this enum value conflicts with DATE }; pub const UCAL_ERA = UCalendarDateFields.ERA; pub const UCAL_YEAR = UCalendarDateFields.YEAR; pub const UCAL_MONTH = UCalendarDateFields.MONTH; pub const UCAL_WEEK_OF_YEAR = UCalendarDateFields.WEEK_OF_YEAR; pub const UCAL_WEEK_OF_MONTH = UCalendarDateFields.WEEK_OF_MONTH; pub const UCAL_DATE = UCalendarDateFields.DATE; pub const UCAL_DAY_OF_YEAR = UCalendarDateFields.DAY_OF_YEAR; pub const UCAL_DAY_OF_WEEK = UCalendarDateFields.DAY_OF_WEEK; pub const UCAL_DAY_OF_WEEK_IN_MONTH = UCalendarDateFields.DAY_OF_WEEK_IN_MONTH; pub const UCAL_AM_PM = UCalendarDateFields.AM_PM; pub const UCAL_HOUR = UCalendarDateFields.HOUR; pub const UCAL_HOUR_OF_DAY = UCalendarDateFields.HOUR_OF_DAY; pub const UCAL_MINUTE = UCalendarDateFields.MINUTE; pub const UCAL_SECOND = UCalendarDateFields.SECOND; pub const UCAL_MILLISECOND = UCalendarDateFields.MILLISECOND; pub const UCAL_ZONE_OFFSET = UCalendarDateFields.ZONE_OFFSET; pub const UCAL_DST_OFFSET = UCalendarDateFields.DST_OFFSET; pub const UCAL_YEAR_WOY = UCalendarDateFields.YEAR_WOY; pub const UCAL_DOW_LOCAL = UCalendarDateFields.DOW_LOCAL; pub const UCAL_EXTENDED_YEAR = UCalendarDateFields.EXTENDED_YEAR; pub const UCAL_JULIAN_DAY = UCalendarDateFields.JULIAN_DAY; pub const UCAL_MILLISECONDS_IN_DAY = UCalendarDateFields.MILLISECONDS_IN_DAY; pub const UCAL_IS_LEAP_MONTH = UCalendarDateFields.IS_LEAP_MONTH; pub const UCAL_FIELD_COUNT = UCalendarDateFields.FIELD_COUNT; pub const UCAL_DAY_OF_MONTH = UCalendarDateFields.DATE; pub const UCalendarDaysOfWeek = enum(i32) { SUNDAY = 1, MONDAY = 2, TUESDAY = 3, WEDNESDAY = 4, THURSDAY = 5, FRIDAY = 6, SATURDAY = 7, }; pub const UCAL_SUNDAY = UCalendarDaysOfWeek.SUNDAY; pub const UCAL_MONDAY = UCalendarDaysOfWeek.MONDAY; pub const UCAL_TUESDAY = UCalendarDaysOfWeek.TUESDAY; pub const UCAL_WEDNESDAY = UCalendarDaysOfWeek.WEDNESDAY; pub const UCAL_THURSDAY = UCalendarDaysOfWeek.THURSDAY; pub const UCAL_FRIDAY = UCalendarDaysOfWeek.FRIDAY; pub const UCAL_SATURDAY = UCalendarDaysOfWeek.SATURDAY; pub const UCalendarMonths = enum(i32) { JANUARY = 0, FEBRUARY = 1, MARCH = 2, APRIL = 3, MAY = 4, JUNE = 5, JULY = 6, AUGUST = 7, SEPTEMBER = 8, OCTOBER = 9, NOVEMBER = 10, DECEMBER = 11, UNDECIMBER = 12, }; pub const UCAL_JANUARY = UCalendarMonths.JANUARY; pub const UCAL_FEBRUARY = UCalendarMonths.FEBRUARY; pub const UCAL_MARCH = UCalendarMonths.MARCH; pub const UCAL_APRIL = UCalendarMonths.APRIL; pub const UCAL_MAY = UCalendarMonths.MAY; pub const UCAL_JUNE = UCalendarMonths.JUNE; pub const UCAL_JULY = UCalendarMonths.JULY; pub const UCAL_AUGUST = UCalendarMonths.AUGUST; pub const UCAL_SEPTEMBER = UCalendarMonths.SEPTEMBER; pub const UCAL_OCTOBER = UCalendarMonths.OCTOBER; pub const UCAL_NOVEMBER = UCalendarMonths.NOVEMBER; pub const UCAL_DECEMBER = UCalendarMonths.DECEMBER; pub const UCAL_UNDECIMBER = UCalendarMonths.UNDECIMBER; pub const UCalendarAMPMs = enum(i32) { AM = 0, PM = 1, }; pub const UCAL_AM = UCalendarAMPMs.AM; pub const UCAL_PM = UCalendarAMPMs.PM; pub const USystemTimeZoneType = enum(i32) { ANY = 0, CANONICAL = 1, CANONICAL_LOCATION = 2, }; pub const UCAL_ZONE_TYPE_ANY = USystemTimeZoneType.ANY; pub const UCAL_ZONE_TYPE_CANONICAL = USystemTimeZoneType.CANONICAL; pub const UCAL_ZONE_TYPE_CANONICAL_LOCATION = USystemTimeZoneType.CANONICAL_LOCATION; pub const UCalendarDisplayNameType = enum(i32) { STANDARD = 0, SHORT_STANDARD = 1, DST = 2, SHORT_DST = 3, }; pub const UCAL_STANDARD = UCalendarDisplayNameType.STANDARD; pub const UCAL_SHORT_STANDARD = UCalendarDisplayNameType.SHORT_STANDARD; pub const UCAL_DST = UCalendarDisplayNameType.DST; pub const UCAL_SHORT_DST = UCalendarDisplayNameType.SHORT_DST; pub const UCalendarAttribute = enum(i32) { LENIENT = 0, FIRST_DAY_OF_WEEK = 1, MINIMAL_DAYS_IN_FIRST_WEEK = 2, REPEATED_WALL_TIME = 3, SKIPPED_WALL_TIME = 4, }; pub const UCAL_LENIENT = UCalendarAttribute.LENIENT; pub const UCAL_FIRST_DAY_OF_WEEK = UCalendarAttribute.FIRST_DAY_OF_WEEK; pub const UCAL_MINIMAL_DAYS_IN_FIRST_WEEK = UCalendarAttribute.MINIMAL_DAYS_IN_FIRST_WEEK; pub const UCAL_REPEATED_WALL_TIME = UCalendarAttribute.REPEATED_WALL_TIME; pub const UCAL_SKIPPED_WALL_TIME = UCalendarAttribute.SKIPPED_WALL_TIME; pub const UCalendarWallTimeOption = enum(i32) { LAST = 0, FIRST = 1, NEXT_VALID = 2, }; pub const UCAL_WALLTIME_LAST = UCalendarWallTimeOption.LAST; pub const UCAL_WALLTIME_FIRST = UCalendarWallTimeOption.FIRST; pub const UCAL_WALLTIME_NEXT_VALID = UCalendarWallTimeOption.NEXT_VALID; pub const UCalendarLimitType = enum(i32) { MINIMUM = 0, MAXIMUM = 1, GREATEST_MINIMUM = 2, LEAST_MAXIMUM = 3, ACTUAL_MINIMUM = 4, ACTUAL_MAXIMUM = 5, }; pub const UCAL_MINIMUM = UCalendarLimitType.MINIMUM; pub const UCAL_MAXIMUM = UCalendarLimitType.MAXIMUM; pub const UCAL_GREATEST_MINIMUM = UCalendarLimitType.GREATEST_MINIMUM; pub const UCAL_LEAST_MAXIMUM = UCalendarLimitType.LEAST_MAXIMUM; pub const UCAL_ACTUAL_MINIMUM = UCalendarLimitType.ACTUAL_MINIMUM; pub const UCAL_ACTUAL_MAXIMUM = UCalendarLimitType.ACTUAL_MAXIMUM; pub const UCalendarWeekdayType = enum(i32) { DAY = 0, END = 1, END_ONSET = 2, END_CEASE = 3, }; pub const UCAL_WEEKDAY = UCalendarWeekdayType.DAY; pub const UCAL_WEEKEND = UCalendarWeekdayType.END; pub const UCAL_WEEKEND_ONSET = UCalendarWeekdayType.END_ONSET; pub const UCAL_WEEKEND_CEASE = UCalendarWeekdayType.END_CEASE; pub const UTimeZoneTransitionType = enum(i32) { NEXT = 0, NEXT_INCLUSIVE = 1, PREVIOUS = 2, PREVIOUS_INCLUSIVE = 3, }; pub const UCAL_TZ_TRANSITION_NEXT = UTimeZoneTransitionType.NEXT; pub const UCAL_TZ_TRANSITION_NEXT_INCLUSIVE = UTimeZoneTransitionType.NEXT_INCLUSIVE; pub const UCAL_TZ_TRANSITION_PREVIOUS = UTimeZoneTransitionType.PREVIOUS; pub const UCAL_TZ_TRANSITION_PREVIOUS_INCLUSIVE = UTimeZoneTransitionType.PREVIOUS_INCLUSIVE; pub const UCollationResult = enum(i32) { EQUAL = 0, GREATER = 1, LESS = -1, }; pub const UCOL_EQUAL = UCollationResult.EQUAL; pub const UCOL_GREATER = UCollationResult.GREATER; pub const UCOL_LESS = UCollationResult.LESS; pub const UColAttributeValue = enum(i32) { DEFAULT = -1, PRIMARY = 0, SECONDARY = 1, TERTIARY = 2, // DEFAULT_STRENGTH = 2, this enum value conflicts with TERTIARY CE_STRENGTH_LIMIT = 3, // QUATERNARY = 3, this enum value conflicts with CE_STRENGTH_LIMIT IDENTICAL = 15, STRENGTH_LIMIT = 16, // OFF = 16, this enum value conflicts with STRENGTH_LIMIT ON = 17, SHIFTED = 20, NON_IGNORABLE = 21, LOWER_FIRST = 24, UPPER_FIRST = 25, }; pub const UCOL_DEFAULT = UColAttributeValue.DEFAULT; pub const UCOL_PRIMARY = UColAttributeValue.PRIMARY; pub const UCOL_SECONDARY = UColAttributeValue.SECONDARY; pub const UCOL_TERTIARY = UColAttributeValue.TERTIARY; pub const UCOL_DEFAULT_STRENGTH = UColAttributeValue.TERTIARY; pub const UCOL_CE_STRENGTH_LIMIT = UColAttributeValue.CE_STRENGTH_LIMIT; pub const UCOL_QUATERNARY = UColAttributeValue.CE_STRENGTH_LIMIT; pub const UCOL_IDENTICAL = UColAttributeValue.IDENTICAL; pub const UCOL_STRENGTH_LIMIT = UColAttributeValue.STRENGTH_LIMIT; pub const UCOL_OFF = UColAttributeValue.STRENGTH_LIMIT; pub const UCOL_ON = UColAttributeValue.ON; pub const UCOL_SHIFTED = UColAttributeValue.SHIFTED; pub const UCOL_NON_IGNORABLE = UColAttributeValue.NON_IGNORABLE; pub const UCOL_LOWER_FIRST = UColAttributeValue.LOWER_FIRST; pub const UCOL_UPPER_FIRST = UColAttributeValue.UPPER_FIRST; pub const UColReorderCode = enum(i32) { DEFAULT = -1, NONE = 103, // OTHERS = 103, this enum value conflicts with NONE SPACE = 4096, // FIRST = 4096, this enum value conflicts with SPACE PUNCTUATION = 4097, SYMBOL = 4098, CURRENCY = 4099, DIGIT = 4100, }; pub const UCOL_REORDER_CODE_DEFAULT = UColReorderCode.DEFAULT; pub const UCOL_REORDER_CODE_NONE = UColReorderCode.NONE; pub const UCOL_REORDER_CODE_OTHERS = UColReorderCode.NONE; pub const UCOL_REORDER_CODE_SPACE = UColReorderCode.SPACE; pub const UCOL_REORDER_CODE_FIRST = UColReorderCode.SPACE; pub const UCOL_REORDER_CODE_PUNCTUATION = UColReorderCode.PUNCTUATION; pub const UCOL_REORDER_CODE_SYMBOL = UColReorderCode.SYMBOL; pub const UCOL_REORDER_CODE_CURRENCY = UColReorderCode.CURRENCY; pub const UCOL_REORDER_CODE_DIGIT = UColReorderCode.DIGIT; pub const UColAttribute = enum(i32) { FRENCH_COLLATION = 0, ALTERNATE_HANDLING = 1, CASE_FIRST = 2, CASE_LEVEL = 3, NORMALIZATION_MODE = 4, // DECOMPOSITION_MODE = 4, this enum value conflicts with NORMALIZATION_MODE STRENGTH = 5, NUMERIC_COLLATION = 7, ATTRIBUTE_COUNT = 8, }; pub const UCOL_FRENCH_COLLATION = UColAttribute.FRENCH_COLLATION; pub const UCOL_ALTERNATE_HANDLING = UColAttribute.ALTERNATE_HANDLING; pub const UCOL_CASE_FIRST = UColAttribute.CASE_FIRST; pub const UCOL_CASE_LEVEL = UColAttribute.CASE_LEVEL; pub const UCOL_NORMALIZATION_MODE = UColAttribute.NORMALIZATION_MODE; pub const UCOL_DECOMPOSITION_MODE = UColAttribute.NORMALIZATION_MODE; pub const UCOL_STRENGTH = UColAttribute.STRENGTH; pub const UCOL_NUMERIC_COLLATION = UColAttribute.NUMERIC_COLLATION; pub const UCOL_ATTRIBUTE_COUNT = UColAttribute.ATTRIBUTE_COUNT; pub const UColRuleOption = enum(i32) { TAILORING_ONLY = 0, FULL_RULES = 1, }; pub const UCOL_TAILORING_ONLY = UColRuleOption.TAILORING_ONLY; pub const UCOL_FULL_RULES = UColRuleOption.FULL_RULES; pub const UColBoundMode = enum(i32) { LOWER = 0, UPPER = 1, UPPER_LONG = 2, }; pub const UCOL_BOUND_LOWER = UColBoundMode.LOWER; pub const UCOL_BOUND_UPPER = UColBoundMode.UPPER; pub const UCOL_BOUND_UPPER_LONG = UColBoundMode.UPPER_LONG; pub const UDateTimePatternField = enum(i32) { ERA_FIELD = 0, YEAR_FIELD = 1, QUARTER_FIELD = 2, MONTH_FIELD = 3, WEEK_OF_YEAR_FIELD = 4, WEEK_OF_MONTH_FIELD = 5, WEEKDAY_FIELD = 6, DAY_OF_YEAR_FIELD = 7, DAY_OF_WEEK_IN_MONTH_FIELD = 8, DAY_FIELD = 9, DAYPERIOD_FIELD = 10, HOUR_FIELD = 11, MINUTE_FIELD = 12, SECOND_FIELD = 13, FRACTIONAL_SECOND_FIELD = 14, ZONE_FIELD = 15, FIELD_COUNT = 16, }; pub const UDATPG_ERA_FIELD = UDateTimePatternField.ERA_FIELD; pub const UDATPG_YEAR_FIELD = UDateTimePatternField.YEAR_FIELD; pub const UDATPG_QUARTER_FIELD = UDateTimePatternField.QUARTER_FIELD; pub const UDATPG_MONTH_FIELD = UDateTimePatternField.MONTH_FIELD; pub const UDATPG_WEEK_OF_YEAR_FIELD = UDateTimePatternField.WEEK_OF_YEAR_FIELD; pub const UDATPG_WEEK_OF_MONTH_FIELD = UDateTimePatternField.WEEK_OF_MONTH_FIELD; pub const UDATPG_WEEKDAY_FIELD = UDateTimePatternField.WEEKDAY_FIELD; pub const UDATPG_DAY_OF_YEAR_FIELD = UDateTimePatternField.DAY_OF_YEAR_FIELD; pub const UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD = UDateTimePatternField.DAY_OF_WEEK_IN_MONTH_FIELD; pub const UDATPG_DAY_FIELD = UDateTimePatternField.DAY_FIELD; pub const UDATPG_DAYPERIOD_FIELD = UDateTimePatternField.DAYPERIOD_FIELD; pub const UDATPG_HOUR_FIELD = UDateTimePatternField.HOUR_FIELD; pub const UDATPG_MINUTE_FIELD = UDateTimePatternField.MINUTE_FIELD; pub const UDATPG_SECOND_FIELD = UDateTimePatternField.SECOND_FIELD; pub const UDATPG_FRACTIONAL_SECOND_FIELD = UDateTimePatternField.FRACTIONAL_SECOND_FIELD; pub const UDATPG_ZONE_FIELD = UDateTimePatternField.ZONE_FIELD; pub const UDATPG_FIELD_COUNT = UDateTimePatternField.FIELD_COUNT; pub const UDateTimePGDisplayWidth = enum(i32) { WIDE = 0, ABBREVIATED = 1, NARROW = 2, }; pub const UDATPG_WIDE = UDateTimePGDisplayWidth.WIDE; pub const UDATPG_ABBREVIATED = UDateTimePGDisplayWidth.ABBREVIATED; pub const UDATPG_NARROW = UDateTimePGDisplayWidth.NARROW; pub const UDateTimePatternMatchOptions = enum(i32) { NO_OPTIONS = 0, HOUR_FIELD_LENGTH = 2048, ALL_FIELDS_LENGTH = 65535, }; pub const UDATPG_MATCH_NO_OPTIONS = UDateTimePatternMatchOptions.NO_OPTIONS; pub const UDATPG_MATCH_HOUR_FIELD_LENGTH = UDateTimePatternMatchOptions.HOUR_FIELD_LENGTH; pub const UDATPG_MATCH_ALL_FIELDS_LENGTH = UDateTimePatternMatchOptions.ALL_FIELDS_LENGTH; pub const UDateTimePatternConflict = enum(i32) { NO_CONFLICT = 0, BASE_CONFLICT = 1, CONFLICT = 2, }; pub const UDATPG_NO_CONFLICT = UDateTimePatternConflict.NO_CONFLICT; pub const UDATPG_BASE_CONFLICT = UDateTimePatternConflict.BASE_CONFLICT; pub const UDATPG_CONFLICT = UDateTimePatternConflict.CONFLICT; pub const UFormattableType = enum(i32) { DATE = 0, DOUBLE = 1, LONG = 2, STRING = 3, ARRAY = 4, INT64 = 5, OBJECT = 6, }; pub const UFMT_DATE = UFormattableType.DATE; pub const UFMT_DOUBLE = UFormattableType.DOUBLE; pub const UFMT_LONG = UFormattableType.LONG; pub const UFMT_STRING = UFormattableType.STRING; pub const UFMT_ARRAY = UFormattableType.ARRAY; pub const UFMT_INT64 = UFormattableType.INT64; pub const UFMT_OBJECT = UFormattableType.OBJECT; pub const UGender = enum(i32) { MALE = 0, FEMALE = 1, OTHER = 2, }; pub const UGENDER_MALE = UGender.MALE; pub const UGENDER_FEMALE = UGender.FEMALE; pub const UGENDER_OTHER = UGender.OTHER; pub const ULocaleDataExemplarSetType = enum(i32) { STANDARD = 0, AUXILIARY = 1, INDEX = 2, PUNCTUATION = 3, }; pub const ULOCDATA_ES_STANDARD = ULocaleDataExemplarSetType.STANDARD; pub const ULOCDATA_ES_AUXILIARY = ULocaleDataExemplarSetType.AUXILIARY; pub const ULOCDATA_ES_INDEX = ULocaleDataExemplarSetType.INDEX; pub const ULOCDATA_ES_PUNCTUATION = ULocaleDataExemplarSetType.PUNCTUATION; pub const ULocaleDataDelimiterType = enum(i32) { QUOTATION_START = 0, QUOTATION_END = 1, ALT_QUOTATION_START = 2, ALT_QUOTATION_END = 3, }; pub const ULOCDATA_QUOTATION_START = ULocaleDataDelimiterType.QUOTATION_START; pub const ULOCDATA_QUOTATION_END = ULocaleDataDelimiterType.QUOTATION_END; pub const ULOCDATA_ALT_QUOTATION_START = ULocaleDataDelimiterType.ALT_QUOTATION_START; pub const ULOCDATA_ALT_QUOTATION_END = ULocaleDataDelimiterType.ALT_QUOTATION_END; pub const UMeasurementSystem = enum(i32) { SI = 0, US = 1, UK = 2, }; pub const UMS_SI = UMeasurementSystem.SI; pub const UMS_US = UMeasurementSystem.US; pub const UMS_UK = UMeasurementSystem.UK; pub const UNumberFormatStyle = enum(i32) { PATTERN_DECIMAL = 0, DECIMAL = 1, CURRENCY = 2, PERCENT = 3, SCIENTIFIC = 4, SPELLOUT = 5, ORDINAL = 6, DURATION = 7, NUMBERING_SYSTEM = 8, PATTERN_RULEBASED = 9, CURRENCY_ISO = 10, CURRENCY_PLURAL = 11, CURRENCY_ACCOUNTING = 12, CASH_CURRENCY = 13, DECIMAL_COMPACT_SHORT = 14, DECIMAL_COMPACT_LONG = 15, CURRENCY_STANDARD = 16, // DEFAULT = 1, this enum value conflicts with DECIMAL // IGNORE = 0, this enum value conflicts with PATTERN_DECIMAL }; pub const UNUM_PATTERN_DECIMAL = UNumberFormatStyle.PATTERN_DECIMAL; pub const UNUM_DECIMAL = UNumberFormatStyle.DECIMAL; pub const UNUM_CURRENCY = UNumberFormatStyle.CURRENCY; pub const UNUM_PERCENT = UNumberFormatStyle.PERCENT; pub const UNUM_SCIENTIFIC = UNumberFormatStyle.SCIENTIFIC; pub const UNUM_SPELLOUT = UNumberFormatStyle.SPELLOUT; pub const UNUM_ORDINAL = UNumberFormatStyle.ORDINAL; pub const UNUM_DURATION = UNumberFormatStyle.DURATION; pub const UNUM_NUMBERING_SYSTEM = UNumberFormatStyle.NUMBERING_SYSTEM; pub const UNUM_PATTERN_RULEBASED = UNumberFormatStyle.PATTERN_RULEBASED; pub const UNUM_CURRENCY_ISO = UNumberFormatStyle.CURRENCY_ISO; pub const UNUM_CURRENCY_PLURAL = UNumberFormatStyle.CURRENCY_PLURAL; pub const UNUM_CURRENCY_ACCOUNTING = UNumberFormatStyle.CURRENCY_ACCOUNTING; pub const UNUM_CASH_CURRENCY = UNumberFormatStyle.CASH_CURRENCY; pub const UNUM_DECIMAL_COMPACT_SHORT = UNumberFormatStyle.DECIMAL_COMPACT_SHORT; pub const UNUM_DECIMAL_COMPACT_LONG = UNumberFormatStyle.DECIMAL_COMPACT_LONG; pub const UNUM_CURRENCY_STANDARD = UNumberFormatStyle.CURRENCY_STANDARD; pub const UNUM_DEFAULT = UNumberFormatStyle.DECIMAL; pub const UNUM_IGNORE = UNumberFormatStyle.PATTERN_DECIMAL; pub const UNumberFormatRoundingMode = enum(i32) { CEILING = 0, FLOOR = 1, DOWN = 2, UP = 3, HALFEVEN = 4, HALFDOWN = 5, HALFUP = 6, UNNECESSARY = 7, }; pub const UNUM_ROUND_CEILING = UNumberFormatRoundingMode.CEILING; pub const UNUM_ROUND_FLOOR = UNumberFormatRoundingMode.FLOOR; pub const UNUM_ROUND_DOWN = UNumberFormatRoundingMode.DOWN; pub const UNUM_ROUND_UP = UNumberFormatRoundingMode.UP; pub const UNUM_ROUND_HALFEVEN = UNumberFormatRoundingMode.HALFEVEN; pub const UNUM_ROUND_HALFDOWN = UNumberFormatRoundingMode.HALFDOWN; pub const UNUM_ROUND_HALFUP = UNumberFormatRoundingMode.HALFUP; pub const UNUM_ROUND_UNNECESSARY = UNumberFormatRoundingMode.UNNECESSARY; pub const UNumberFormatPadPosition = enum(i32) { BEFORE_PREFIX = 0, AFTER_PREFIX = 1, BEFORE_SUFFIX = 2, AFTER_SUFFIX = 3, }; pub const UNUM_PAD_BEFORE_PREFIX = UNumberFormatPadPosition.BEFORE_PREFIX; pub const UNUM_PAD_AFTER_PREFIX = UNumberFormatPadPosition.AFTER_PREFIX; pub const UNUM_PAD_BEFORE_SUFFIX = UNumberFormatPadPosition.BEFORE_SUFFIX; pub const UNUM_PAD_AFTER_SUFFIX = UNumberFormatPadPosition.AFTER_SUFFIX; pub const UNumberCompactStyle = enum(i32) { SHORT = 0, LONG = 1, }; pub const UNUM_SHORT = UNumberCompactStyle.SHORT; pub const UNUM_LONG = UNumberCompactStyle.LONG; pub const UCurrencySpacing = enum(i32) { MATCH = 0, SURROUNDING_MATCH = 1, INSERT = 2, SPACING_COUNT = 3, }; pub const UNUM_CURRENCY_MATCH = UCurrencySpacing.MATCH; pub const UNUM_CURRENCY_SURROUNDING_MATCH = UCurrencySpacing.SURROUNDING_MATCH; pub const UNUM_CURRENCY_INSERT = UCurrencySpacing.INSERT; pub const UNUM_CURRENCY_SPACING_COUNT = UCurrencySpacing.SPACING_COUNT; pub const UNumberFormatFields = enum(i32) { INTEGER_FIELD = 0, FRACTION_FIELD = 1, DECIMAL_SEPARATOR_FIELD = 2, EXPONENT_SYMBOL_FIELD = 3, EXPONENT_SIGN_FIELD = 4, EXPONENT_FIELD = 5, GROUPING_SEPARATOR_FIELD = 6, CURRENCY_FIELD = 7, PERCENT_FIELD = 8, PERMILL_FIELD = 9, SIGN_FIELD = 10, }; pub const UNUM_INTEGER_FIELD = UNumberFormatFields.INTEGER_FIELD; pub const UNUM_FRACTION_FIELD = UNumberFormatFields.FRACTION_FIELD; pub const UNUM_DECIMAL_SEPARATOR_FIELD = UNumberFormatFields.DECIMAL_SEPARATOR_FIELD; pub const UNUM_EXPONENT_SYMBOL_FIELD = UNumberFormatFields.EXPONENT_SYMBOL_FIELD; pub const UNUM_EXPONENT_SIGN_FIELD = UNumberFormatFields.EXPONENT_SIGN_FIELD; pub const UNUM_EXPONENT_FIELD = UNumberFormatFields.EXPONENT_FIELD; pub const UNUM_GROUPING_SEPARATOR_FIELD = UNumberFormatFields.GROUPING_SEPARATOR_FIELD; pub const UNUM_CURRENCY_FIELD = UNumberFormatFields.CURRENCY_FIELD; pub const UNUM_PERCENT_FIELD = UNumberFormatFields.PERCENT_FIELD; pub const UNUM_PERMILL_FIELD = UNumberFormatFields.PERMILL_FIELD; pub const UNUM_SIGN_FIELD = UNumberFormatFields.SIGN_FIELD; pub const UNumberFormatAttributeValue = enum(i32) { N = 0, }; pub const UNUM_FORMAT_ATTRIBUTE_VALUE_HIDDEN = UNumberFormatAttributeValue.N; pub const UNumberFormatAttribute = enum(i32) { PARSE_INT_ONLY = 0, GROUPING_USED = 1, DECIMAL_ALWAYS_SHOWN = 2, MAX_INTEGER_DIGITS = 3, MIN_INTEGER_DIGITS = 4, INTEGER_DIGITS = 5, MAX_FRACTION_DIGITS = 6, MIN_FRACTION_DIGITS = 7, FRACTION_DIGITS = 8, MULTIPLIER = 9, GROUPING_SIZE = 10, ROUNDING_MODE = 11, ROUNDING_INCREMENT = 12, FORMAT_WIDTH = 13, PADDING_POSITION = 14, SECONDARY_GROUPING_SIZE = 15, SIGNIFICANT_DIGITS_USED = 16, MIN_SIGNIFICANT_DIGITS = 17, MAX_SIGNIFICANT_DIGITS = 18, LENIENT_PARSE = 19, PARSE_ALL_INPUT = 20, SCALE = 21, CURRENCY_USAGE = 23, FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS = 4096, PARSE_NO_EXPONENT = 4097, PARSE_DECIMAL_MARK_REQUIRED = 4098, }; pub const UNUM_PARSE_INT_ONLY = UNumberFormatAttribute.PARSE_INT_ONLY; pub const UNUM_GROUPING_USED = UNumberFormatAttribute.GROUPING_USED; pub const UNUM_DECIMAL_ALWAYS_SHOWN = UNumberFormatAttribute.DECIMAL_ALWAYS_SHOWN; pub const UNUM_MAX_INTEGER_DIGITS = UNumberFormatAttribute.MAX_INTEGER_DIGITS; pub const UNUM_MIN_INTEGER_DIGITS = UNumberFormatAttribute.MIN_INTEGER_DIGITS; pub const UNUM_INTEGER_DIGITS = UNumberFormatAttribute.INTEGER_DIGITS; pub const UNUM_MAX_FRACTION_DIGITS = UNumberFormatAttribute.MAX_FRACTION_DIGITS; pub const UNUM_MIN_FRACTION_DIGITS = UNumberFormatAttribute.MIN_FRACTION_DIGITS; pub const UNUM_FRACTION_DIGITS = UNumberFormatAttribute.FRACTION_DIGITS; pub const UNUM_MULTIPLIER = UNumberFormatAttribute.MULTIPLIER; pub const UNUM_GROUPING_SIZE = UNumberFormatAttribute.GROUPING_SIZE; pub const UNUM_ROUNDING_MODE = UNumberFormatAttribute.ROUNDING_MODE; pub const UNUM_ROUNDING_INCREMENT = UNumberFormatAttribute.ROUNDING_INCREMENT; pub const UNUM_FORMAT_WIDTH = UNumberFormatAttribute.FORMAT_WIDTH; pub const UNUM_PADDING_POSITION = UNumberFormatAttribute.PADDING_POSITION; pub const UNUM_SECONDARY_GROUPING_SIZE = UNumberFormatAttribute.SECONDARY_GROUPING_SIZE; pub const UNUM_SIGNIFICANT_DIGITS_USED = UNumberFormatAttribute.SIGNIFICANT_DIGITS_USED; pub const UNUM_MIN_SIGNIFICANT_DIGITS = UNumberFormatAttribute.MIN_SIGNIFICANT_DIGITS; pub const UNUM_MAX_SIGNIFICANT_DIGITS = UNumberFormatAttribute.MAX_SIGNIFICANT_DIGITS; pub const UNUM_LENIENT_PARSE = UNumberFormatAttribute.LENIENT_PARSE; pub const UNUM_PARSE_ALL_INPUT = UNumberFormatAttribute.PARSE_ALL_INPUT; pub const UNUM_SCALE = UNumberFormatAttribute.SCALE; pub const UNUM_CURRENCY_USAGE = UNumberFormatAttribute.CURRENCY_USAGE; pub const UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS = UNumberFormatAttribute.FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS; pub const UNUM_PARSE_NO_EXPONENT = UNumberFormatAttribute.PARSE_NO_EXPONENT; pub const UNUM_PARSE_DECIMAL_MARK_REQUIRED = UNumberFormatAttribute.PARSE_DECIMAL_MARK_REQUIRED; pub const UNumberFormatTextAttribute = enum(i32) { POSITIVE_PREFIX = 0, POSITIVE_SUFFIX = 1, NEGATIVE_PREFIX = 2, NEGATIVE_SUFFIX = 3, PADDING_CHARACTER = 4, CURRENCY_CODE = 5, DEFAULT_RULESET = 6, PUBLIC_RULESETS = 7, }; pub const UNUM_POSITIVE_PREFIX = UNumberFormatTextAttribute.POSITIVE_PREFIX; pub const UNUM_POSITIVE_SUFFIX = UNumberFormatTextAttribute.POSITIVE_SUFFIX; pub const UNUM_NEGATIVE_PREFIX = UNumberFormatTextAttribute.NEGATIVE_PREFIX; pub const UNUM_NEGATIVE_SUFFIX = UNumberFormatTextAttribute.NEGATIVE_SUFFIX; pub const UNUM_PADDING_CHARACTER = UNumberFormatTextAttribute.PADDING_CHARACTER; pub const UNUM_CURRENCY_CODE = UNumberFormatTextAttribute.CURRENCY_CODE; pub const UNUM_DEFAULT_RULESET = UNumberFormatTextAttribute.DEFAULT_RULESET; pub const UNUM_PUBLIC_RULESETS = UNumberFormatTextAttribute.PUBLIC_RULESETS; pub const UNumberFormatSymbol = enum(i32) { DECIMAL_SEPARATOR_SYMBOL = 0, GROUPING_SEPARATOR_SYMBOL = 1, PATTERN_SEPARATOR_SYMBOL = 2, PERCENT_SYMBOL = 3, ZERO_DIGIT_SYMBOL = 4, DIGIT_SYMBOL = 5, MINUS_SIGN_SYMBOL = 6, PLUS_SIGN_SYMBOL = 7, CURRENCY_SYMBOL = 8, INTL_CURRENCY_SYMBOL = 9, MONETARY_SEPARATOR_SYMBOL = 10, EXPONENTIAL_SYMBOL = 11, PERMILL_SYMBOL = 12, PAD_ESCAPE_SYMBOL = 13, INFINITY_SYMBOL = 14, NAN_SYMBOL = 15, SIGNIFICANT_DIGIT_SYMBOL = 16, MONETARY_GROUPING_SEPARATOR_SYMBOL = 17, ONE_DIGIT_SYMBOL = 18, TWO_DIGIT_SYMBOL = 19, THREE_DIGIT_SYMBOL = 20, FOUR_DIGIT_SYMBOL = 21, FIVE_DIGIT_SYMBOL = 22, SIX_DIGIT_SYMBOL = 23, SEVEN_DIGIT_SYMBOL = 24, EIGHT_DIGIT_SYMBOL = 25, NINE_DIGIT_SYMBOL = 26, EXPONENT_MULTIPLICATION_SYMBOL = 27, }; pub const UNUM_DECIMAL_SEPARATOR_SYMBOL = UNumberFormatSymbol.DECIMAL_SEPARATOR_SYMBOL; pub const UNUM_GROUPING_SEPARATOR_SYMBOL = UNumberFormatSymbol.GROUPING_SEPARATOR_SYMBOL; pub const UNUM_PATTERN_SEPARATOR_SYMBOL = UNumberFormatSymbol.PATTERN_SEPARATOR_SYMBOL; pub const UNUM_PERCENT_SYMBOL = UNumberFormatSymbol.PERCENT_SYMBOL; pub const UNUM_ZERO_DIGIT_SYMBOL = UNumberFormatSymbol.ZERO_DIGIT_SYMBOL; pub const UNUM_DIGIT_SYMBOL = UNumberFormatSymbol.DIGIT_SYMBOL; pub const UNUM_MINUS_SIGN_SYMBOL = UNumberFormatSymbol.MINUS_SIGN_SYMBOL; pub const UNUM_PLUS_SIGN_SYMBOL = UNumberFormatSymbol.PLUS_SIGN_SYMBOL; pub const UNUM_CURRENCY_SYMBOL = UNumberFormatSymbol.CURRENCY_SYMBOL; pub const UNUM_INTL_CURRENCY_SYMBOL = UNumberFormatSymbol.INTL_CURRENCY_SYMBOL; pub const UNUM_MONETARY_SEPARATOR_SYMBOL = UNumberFormatSymbol.MONETARY_SEPARATOR_SYMBOL; pub const UNUM_EXPONENTIAL_SYMBOL = UNumberFormatSymbol.EXPONENTIAL_SYMBOL; pub const UNUM_PERMILL_SYMBOL = UNumberFormatSymbol.PERMILL_SYMBOL; pub const UNUM_PAD_ESCAPE_SYMBOL = UNumberFormatSymbol.PAD_ESCAPE_SYMBOL; pub const UNUM_INFINITY_SYMBOL = UNumberFormatSymbol.INFINITY_SYMBOL; pub const UNUM_NAN_SYMBOL = UNumberFormatSymbol.NAN_SYMBOL; pub const UNUM_SIGNIFICANT_DIGIT_SYMBOL = UNumberFormatSymbol.SIGNIFICANT_DIGIT_SYMBOL; pub const UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL = UNumberFormatSymbol.MONETARY_GROUPING_SEPARATOR_SYMBOL; pub const UNUM_ONE_DIGIT_SYMBOL = UNumberFormatSymbol.ONE_DIGIT_SYMBOL; pub const UNUM_TWO_DIGIT_SYMBOL = UNumberFormatSymbol.TWO_DIGIT_SYMBOL; pub const UNUM_THREE_DIGIT_SYMBOL = UNumberFormatSymbol.THREE_DIGIT_SYMBOL; pub const UNUM_FOUR_DIGIT_SYMBOL = UNumberFormatSymbol.FOUR_DIGIT_SYMBOL; pub const UNUM_FIVE_DIGIT_SYMBOL = UNumberFormatSymbol.FIVE_DIGIT_SYMBOL; pub const UNUM_SIX_DIGIT_SYMBOL = UNumberFormatSymbol.SIX_DIGIT_SYMBOL; pub const UNUM_SEVEN_DIGIT_SYMBOL = UNumberFormatSymbol.SEVEN_DIGIT_SYMBOL; pub const UNUM_EIGHT_DIGIT_SYMBOL = UNumberFormatSymbol.EIGHT_DIGIT_SYMBOL; pub const UNUM_NINE_DIGIT_SYMBOL = UNumberFormatSymbol.NINE_DIGIT_SYMBOL; pub const UNUM_EXPONENT_MULTIPLICATION_SYMBOL = UNumberFormatSymbol.EXPONENT_MULTIPLICATION_SYMBOL; pub const UDateFormatStyle = enum(i32) { FULL = 0, LONG = 1, MEDIUM = 2, SHORT = 3, // DEFAULT = 2, this enum value conflicts with MEDIUM RELATIVE = 128, // FULL_RELATIVE = 128, this enum value conflicts with RELATIVE LONG_RELATIVE = 129, MEDIUM_RELATIVE = 130, SHORT_RELATIVE = 131, NONE = -1, PATTERN = -2, }; pub const UDAT_FULL = UDateFormatStyle.FULL; pub const UDAT_LONG = UDateFormatStyle.LONG; pub const UDAT_MEDIUM = UDateFormatStyle.MEDIUM; pub const UDAT_SHORT = UDateFormatStyle.SHORT; pub const UDAT_DEFAULT = UDateFormatStyle.MEDIUM; pub const UDAT_RELATIVE = UDateFormatStyle.RELATIVE; pub const UDAT_FULL_RELATIVE = UDateFormatStyle.RELATIVE; pub const UDAT_LONG_RELATIVE = UDateFormatStyle.LONG_RELATIVE; pub const UDAT_MEDIUM_RELATIVE = UDateFormatStyle.MEDIUM_RELATIVE; pub const UDAT_SHORT_RELATIVE = UDateFormatStyle.SHORT_RELATIVE; pub const UDAT_NONE = UDateFormatStyle.NONE; pub const UDAT_PATTERN = UDateFormatStyle.PATTERN; pub const UDateFormatField = enum(i32) { ERA_FIELD = 0, YEAR_FIELD = 1, MONTH_FIELD = 2, DATE_FIELD = 3, HOUR_OF_DAY1_FIELD = 4, HOUR_OF_DAY0_FIELD = 5, MINUTE_FIELD = 6, SECOND_FIELD = 7, FRACTIONAL_SECOND_FIELD = 8, DAY_OF_WEEK_FIELD = 9, DAY_OF_YEAR_FIELD = 10, DAY_OF_WEEK_IN_MONTH_FIELD = 11, WEEK_OF_YEAR_FIELD = 12, WEEK_OF_MONTH_FIELD = 13, AM_PM_FIELD = 14, HOUR1_FIELD = 15, HOUR0_FIELD = 16, TIMEZONE_FIELD = 17, YEAR_WOY_FIELD = 18, DOW_LOCAL_FIELD = 19, EXTENDED_YEAR_FIELD = 20, JULIAN_DAY_FIELD = 21, MILLISECONDS_IN_DAY_FIELD = 22, TIMEZONE_RFC_FIELD = 23, TIMEZONE_GENERIC_FIELD = 24, STANDALONE_DAY_FIELD = 25, STANDALONE_MONTH_FIELD = 26, QUARTER_FIELD = 27, STANDALONE_QUARTER_FIELD = 28, TIMEZONE_SPECIAL_FIELD = 29, YEAR_NAME_FIELD = 30, TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD = 31, TIMEZONE_ISO_FIELD = 32, TIMEZONE_ISO_LOCAL_FIELD = 33, AM_PM_MIDNIGHT_NOON_FIELD = 35, FLEXIBLE_DAY_PERIOD_FIELD = 36, }; pub const UDAT_ERA_FIELD = UDateFormatField.ERA_FIELD; pub const UDAT_YEAR_FIELD = UDateFormatField.YEAR_FIELD; pub const UDAT_MONTH_FIELD = UDateFormatField.MONTH_FIELD; pub const UDAT_DATE_FIELD = UDateFormatField.DATE_FIELD; pub const UDAT_HOUR_OF_DAY1_FIELD = UDateFormatField.HOUR_OF_DAY1_FIELD; pub const UDAT_HOUR_OF_DAY0_FIELD = UDateFormatField.HOUR_OF_DAY0_FIELD; pub const UDAT_MINUTE_FIELD = UDateFormatField.MINUTE_FIELD; pub const UDAT_SECOND_FIELD = UDateFormatField.SECOND_FIELD; pub const UDAT_FRACTIONAL_SECOND_FIELD = UDateFormatField.FRACTIONAL_SECOND_FIELD; pub const UDAT_DAY_OF_WEEK_FIELD = UDateFormatField.DAY_OF_WEEK_FIELD; pub const UDAT_DAY_OF_YEAR_FIELD = UDateFormatField.DAY_OF_YEAR_FIELD; pub const UDAT_DAY_OF_WEEK_IN_MONTH_FIELD = UDateFormatField.DAY_OF_WEEK_IN_MONTH_FIELD; pub const UDAT_WEEK_OF_YEAR_FIELD = UDateFormatField.WEEK_OF_YEAR_FIELD; pub const UDAT_WEEK_OF_MONTH_FIELD = UDateFormatField.WEEK_OF_MONTH_FIELD; pub const UDAT_AM_PM_FIELD = UDateFormatField.AM_PM_FIELD; pub const UDAT_HOUR1_FIELD = UDateFormatField.HOUR1_FIELD; pub const UDAT_HOUR0_FIELD = UDateFormatField.HOUR0_FIELD; pub const UDAT_TIMEZONE_FIELD = UDateFormatField.TIMEZONE_FIELD; pub const UDAT_YEAR_WOY_FIELD = UDateFormatField.YEAR_WOY_FIELD; pub const UDAT_DOW_LOCAL_FIELD = UDateFormatField.DOW_LOCAL_FIELD; pub const UDAT_EXTENDED_YEAR_FIELD = UDateFormatField.EXTENDED_YEAR_FIELD; pub const UDAT_JULIAN_DAY_FIELD = UDateFormatField.JULIAN_DAY_FIELD; pub const UDAT_MILLISECONDS_IN_DAY_FIELD = UDateFormatField.MILLISECONDS_IN_DAY_FIELD; pub const UDAT_TIMEZONE_RFC_FIELD = UDateFormatField.TIMEZONE_RFC_FIELD; pub const UDAT_TIMEZONE_GENERIC_FIELD = UDateFormatField.TIMEZONE_GENERIC_FIELD; pub const UDAT_STANDALONE_DAY_FIELD = UDateFormatField.STANDALONE_DAY_FIELD; pub const UDAT_STANDALONE_MONTH_FIELD = UDateFormatField.STANDALONE_MONTH_FIELD; pub const UDAT_QUARTER_FIELD = UDateFormatField.QUARTER_FIELD; pub const UDAT_STANDALONE_QUARTER_FIELD = UDateFormatField.STANDALONE_QUARTER_FIELD; pub const UDAT_TIMEZONE_SPECIAL_FIELD = UDateFormatField.TIMEZONE_SPECIAL_FIELD; pub const UDAT_YEAR_NAME_FIELD = UDateFormatField.YEAR_NAME_FIELD; pub const UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD = UDateFormatField.TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD; pub const UDAT_TIMEZONE_ISO_FIELD = UDateFormatField.TIMEZONE_ISO_FIELD; pub const UDAT_TIMEZONE_ISO_LOCAL_FIELD = UDateFormatField.TIMEZONE_ISO_LOCAL_FIELD; pub const UDAT_AM_PM_MIDNIGHT_NOON_FIELD = UDateFormatField.AM_PM_MIDNIGHT_NOON_FIELD; pub const UDAT_FLEXIBLE_DAY_PERIOD_FIELD = UDateFormatField.FLEXIBLE_DAY_PERIOD_FIELD; pub const UDateFormatBooleanAttribute = enum(i32) { PARSE_ALLOW_WHITESPACE = 0, PARSE_ALLOW_NUMERIC = 1, PARSE_PARTIAL_LITERAL_MATCH = 2, PARSE_MULTIPLE_PATTERNS_FOR_MATCH = 3, BOOLEAN_ATTRIBUTE_COUNT = 4, }; pub const UDAT_PARSE_ALLOW_WHITESPACE = UDateFormatBooleanAttribute.PARSE_ALLOW_WHITESPACE; pub const UDAT_PARSE_ALLOW_NUMERIC = UDateFormatBooleanAttribute.PARSE_ALLOW_NUMERIC; pub const UDAT_PARSE_PARTIAL_LITERAL_MATCH = UDateFormatBooleanAttribute.PARSE_PARTIAL_LITERAL_MATCH; pub const UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH = UDateFormatBooleanAttribute.PARSE_MULTIPLE_PATTERNS_FOR_MATCH; pub const UDAT_BOOLEAN_ATTRIBUTE_COUNT = UDateFormatBooleanAttribute.BOOLEAN_ATTRIBUTE_COUNT; pub const UDateFormatSymbolType = enum(i32) { ERAS = 0, MONTHS = 1, SHORT_MONTHS = 2, WEEKDAYS = 3, SHORT_WEEKDAYS = 4, AM_PMS = 5, LOCALIZED_CHARS = 6, ERA_NAMES = 7, NARROW_MONTHS = 8, NARROW_WEEKDAYS = 9, STANDALONE_MONTHS = 10, STANDALONE_SHORT_MONTHS = 11, STANDALONE_NARROW_MONTHS = 12, STANDALONE_WEEKDAYS = 13, STANDALONE_SHORT_WEEKDAYS = 14, STANDALONE_NARROW_WEEKDAYS = 15, QUARTERS = 16, SHORT_QUARTERS = 17, STANDALONE_QUARTERS = 18, STANDALONE_SHORT_QUARTERS = 19, SHORTER_WEEKDAYS = 20, STANDALONE_SHORTER_WEEKDAYS = 21, CYCLIC_YEARS_WIDE = 22, CYCLIC_YEARS_ABBREVIATED = 23, CYCLIC_YEARS_NARROW = 24, ZODIAC_NAMES_WIDE = 25, ZODIAC_NAMES_ABBREVIATED = 26, ZODIAC_NAMES_NARROW = 27, }; pub const UDAT_ERAS = UDateFormatSymbolType.ERAS; pub const UDAT_MONTHS = UDateFormatSymbolType.MONTHS; pub const UDAT_SHORT_MONTHS = UDateFormatSymbolType.SHORT_MONTHS; pub const UDAT_WEEKDAYS = UDateFormatSymbolType.WEEKDAYS; pub const UDAT_SHORT_WEEKDAYS = UDateFormatSymbolType.SHORT_WEEKDAYS; pub const UDAT_AM_PMS = UDateFormatSymbolType.AM_PMS; pub const UDAT_LOCALIZED_CHARS = UDateFormatSymbolType.LOCALIZED_CHARS; pub const UDAT_ERA_NAMES = UDateFormatSymbolType.ERA_NAMES; pub const UDAT_NARROW_MONTHS = UDateFormatSymbolType.NARROW_MONTHS; pub const UDAT_NARROW_WEEKDAYS = UDateFormatSymbolType.NARROW_WEEKDAYS; pub const UDAT_STANDALONE_MONTHS = UDateFormatSymbolType.STANDALONE_MONTHS; pub const UDAT_STANDALONE_SHORT_MONTHS = UDateFormatSymbolType.STANDALONE_SHORT_MONTHS; pub const UDAT_STANDALONE_NARROW_MONTHS = UDateFormatSymbolType.STANDALONE_NARROW_MONTHS; pub const UDAT_STANDALONE_WEEKDAYS = UDateFormatSymbolType.STANDALONE_WEEKDAYS; pub const UDAT_STANDALONE_SHORT_WEEKDAYS = UDateFormatSymbolType.STANDALONE_SHORT_WEEKDAYS; pub const UDAT_STANDALONE_NARROW_WEEKDAYS = UDateFormatSymbolType.STANDALONE_NARROW_WEEKDAYS; pub const UDAT_QUARTERS = UDateFormatSymbolType.QUARTERS; pub const UDAT_SHORT_QUARTERS = UDateFormatSymbolType.SHORT_QUARTERS; pub const UDAT_STANDALONE_QUARTERS = UDateFormatSymbolType.STANDALONE_QUARTERS; pub const UDAT_STANDALONE_SHORT_QUARTERS = UDateFormatSymbolType.STANDALONE_SHORT_QUARTERS; pub const UDAT_SHORTER_WEEKDAYS = UDateFormatSymbolType.SHORTER_WEEKDAYS; pub const UDAT_STANDALONE_SHORTER_WEEKDAYS = UDateFormatSymbolType.STANDALONE_SHORTER_WEEKDAYS; pub const UDAT_CYCLIC_YEARS_WIDE = UDateFormatSymbolType.CYCLIC_YEARS_WIDE; pub const UDAT_CYCLIC_YEARS_ABBREVIATED = UDateFormatSymbolType.CYCLIC_YEARS_ABBREVIATED; pub const UDAT_CYCLIC_YEARS_NARROW = UDateFormatSymbolType.CYCLIC_YEARS_NARROW; pub const UDAT_ZODIAC_NAMES_WIDE = UDateFormatSymbolType.ZODIAC_NAMES_WIDE; pub const UDAT_ZODIAC_NAMES_ABBREVIATED = UDateFormatSymbolType.ZODIAC_NAMES_ABBREVIATED; pub const UDAT_ZODIAC_NAMES_NARROW = UDateFormatSymbolType.ZODIAC_NAMES_NARROW; pub const UPluralType = enum(i32) { CARDINAL = 0, ORDINAL = 1, }; pub const UPLURAL_TYPE_CARDINAL = UPluralType.CARDINAL; pub const UPLURAL_TYPE_ORDINAL = UPluralType.ORDINAL; pub const URegexpFlag = enum(i32) { CASE_INSENSITIVE = 2, COMMENTS = 4, DOTALL = 32, LITERAL = 16, MULTILINE = 8, UNIX_LINES = 1, UWORD = 256, ERROR_ON_UNKNOWN_ESCAPES = 512, }; pub const UREGEX_CASE_INSENSITIVE = URegexpFlag.CASE_INSENSITIVE; pub const UREGEX_COMMENTS = URegexpFlag.COMMENTS; pub const UREGEX_DOTALL = URegexpFlag.DOTALL; pub const UREGEX_LITERAL = URegexpFlag.LITERAL; pub const UREGEX_MULTILINE = URegexpFlag.MULTILINE; pub const UREGEX_UNIX_LINES = URegexpFlag.UNIX_LINES; pub const UREGEX_UWORD = URegexpFlag.UWORD; pub const UREGEX_ERROR_ON_UNKNOWN_ESCAPES = URegexpFlag.ERROR_ON_UNKNOWN_ESCAPES; pub const URegexMatchCallback = fn( context: ?*const c_void, steps: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub const URegexFindProgressCallback = fn( context: ?*const c_void, matchIndex: i64, ) callconv(@import("std").os.windows.WINAPI) i8; pub const URegionType = enum(i32) { UNKNOWN = 0, TERRITORY = 1, WORLD = 2, CONTINENT = 3, SUBCONTINENT = 4, GROUPING = 5, DEPRECATED = 6, }; pub const URGN_UNKNOWN = URegionType.UNKNOWN; pub const URGN_TERRITORY = URegionType.TERRITORY; pub const URGN_WORLD = URegionType.WORLD; pub const URGN_CONTINENT = URegionType.CONTINENT; pub const URGN_SUBCONTINENT = URegionType.SUBCONTINENT; pub const URGN_GROUPING = URegionType.GROUPING; pub const URGN_DEPRECATED = URegionType.DEPRECATED; pub const UDateRelativeDateTimeFormatterStyle = enum(i32) { LONG = 0, SHORT = 1, NARROW = 2, }; pub const UDAT_STYLE_LONG = UDateRelativeDateTimeFormatterStyle.LONG; pub const UDAT_STYLE_SHORT = UDateRelativeDateTimeFormatterStyle.SHORT; pub const UDAT_STYLE_NARROW = UDateRelativeDateTimeFormatterStyle.NARROW; pub const URelativeDateTimeUnit = enum(i32) { YEAR = 0, QUARTER = 1, MONTH = 2, WEEK = 3, DAY = 4, HOUR = 5, MINUTE = 6, SECOND = 7, SUNDAY = 8, MONDAY = 9, TUESDAY = 10, WEDNESDAY = 11, THURSDAY = 12, FRIDAY = 13, SATURDAY = 14, }; pub const UDAT_REL_UNIT_YEAR = URelativeDateTimeUnit.YEAR; pub const UDAT_REL_UNIT_QUARTER = URelativeDateTimeUnit.QUARTER; pub const UDAT_REL_UNIT_MONTH = URelativeDateTimeUnit.MONTH; pub const UDAT_REL_UNIT_WEEK = URelativeDateTimeUnit.WEEK; pub const UDAT_REL_UNIT_DAY = URelativeDateTimeUnit.DAY; pub const UDAT_REL_UNIT_HOUR = URelativeDateTimeUnit.HOUR; pub const UDAT_REL_UNIT_MINUTE = URelativeDateTimeUnit.MINUTE; pub const UDAT_REL_UNIT_SECOND = URelativeDateTimeUnit.SECOND; pub const UDAT_REL_UNIT_SUNDAY = URelativeDateTimeUnit.SUNDAY; pub const UDAT_REL_UNIT_MONDAY = URelativeDateTimeUnit.MONDAY; pub const UDAT_REL_UNIT_TUESDAY = URelativeDateTimeUnit.TUESDAY; pub const UDAT_REL_UNIT_WEDNESDAY = URelativeDateTimeUnit.WEDNESDAY; pub const UDAT_REL_UNIT_THURSDAY = URelativeDateTimeUnit.THURSDAY; pub const UDAT_REL_UNIT_FRIDAY = URelativeDateTimeUnit.FRIDAY; pub const UDAT_REL_UNIT_SATURDAY = URelativeDateTimeUnit.SATURDAY; pub const USearchAttribute = enum(i32) { OVERLAP = 0, ELEMENT_COMPARISON = 2, }; pub const USEARCH_OVERLAP = USearchAttribute.OVERLAP; pub const USEARCH_ELEMENT_COMPARISON = USearchAttribute.ELEMENT_COMPARISON; pub const USearchAttributeValue = enum(i32) { DEFAULT = -1, OFF = 0, ON = 1, STANDARD_ELEMENT_COMPARISON = 2, PATTERN_BASE_WEIGHT_IS_WILDCARD = 3, ANY_BASE_WEIGHT_IS_WILDCARD = 4, }; pub const USEARCH_DEFAULT = USearchAttributeValue.DEFAULT; pub const USEARCH_OFF = USearchAttributeValue.OFF; pub const USEARCH_ON = USearchAttributeValue.ON; pub const USEARCH_STANDARD_ELEMENT_COMPARISON = USearchAttributeValue.STANDARD_ELEMENT_COMPARISON; pub const USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD = USearchAttributeValue.PATTERN_BASE_WEIGHT_IS_WILDCARD; pub const USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD = USearchAttributeValue.ANY_BASE_WEIGHT_IS_WILDCARD; pub const USpoofChecks = enum(i32) { SINGLE_SCRIPT_CONFUSABLE = 1, MIXED_SCRIPT_CONFUSABLE = 2, WHOLE_SCRIPT_CONFUSABLE = 4, CONFUSABLE = 7, RESTRICTION_LEVEL = 16, INVISIBLE = 32, CHAR_LIMIT = 64, MIXED_NUMBERS = 128, ALL_CHECKS = 65535, AUX_INFO = 1073741824, }; pub const USPOOF_SINGLE_SCRIPT_CONFUSABLE = USpoofChecks.SINGLE_SCRIPT_CONFUSABLE; pub const USPOOF_MIXED_SCRIPT_CONFUSABLE = USpoofChecks.MIXED_SCRIPT_CONFUSABLE; pub const USPOOF_WHOLE_SCRIPT_CONFUSABLE = USpoofChecks.WHOLE_SCRIPT_CONFUSABLE; pub const USPOOF_CONFUSABLE = USpoofChecks.CONFUSABLE; pub const USPOOF_RESTRICTION_LEVEL = USpoofChecks.RESTRICTION_LEVEL; pub const USPOOF_INVISIBLE = USpoofChecks.INVISIBLE; pub const USPOOF_CHAR_LIMIT = USpoofChecks.CHAR_LIMIT; pub const USPOOF_MIXED_NUMBERS = USpoofChecks.MIXED_NUMBERS; pub const USPOOF_ALL_CHECKS = USpoofChecks.ALL_CHECKS; pub const USPOOF_AUX_INFO = USpoofChecks.AUX_INFO; pub const URestrictionLevel = enum(i32) { ASCII = 268435456, SINGLE_SCRIPT_RESTRICTIVE = 536870912, HIGHLY_RESTRICTIVE = 805306368, MODERATELY_RESTRICTIVE = 1073741824, MINIMALLY_RESTRICTIVE = 1342177280, UNRESTRICTIVE = 1610612736, RESTRICTION_LEVEL_MASK = 2130706432, }; pub const USPOOF_ASCII = URestrictionLevel.ASCII; pub const USPOOF_SINGLE_SCRIPT_RESTRICTIVE = URestrictionLevel.SINGLE_SCRIPT_RESTRICTIVE; pub const USPOOF_HIGHLY_RESTRICTIVE = URestrictionLevel.HIGHLY_RESTRICTIVE; pub const USPOOF_MODERATELY_RESTRICTIVE = URestrictionLevel.MODERATELY_RESTRICTIVE; pub const USPOOF_MINIMALLY_RESTRICTIVE = URestrictionLevel.MINIMALLY_RESTRICTIVE; pub const USPOOF_UNRESTRICTIVE = URestrictionLevel.UNRESTRICTIVE; pub const USPOOF_RESTRICTION_LEVEL_MASK = URestrictionLevel.RESTRICTION_LEVEL_MASK; pub const UDateTimeScale = enum(i32) { JAVA_TIME = 0, UNIX_TIME = 1, ICU4C_TIME = 2, WINDOWS_FILE_TIME = 3, DOTNET_DATE_TIME = 4, MAC_OLD_TIME = 5, MAC_TIME = 6, EXCEL_TIME = 7, DB2_TIME = 8, UNIX_MICROSECONDS_TIME = 9, }; pub const UDTS_JAVA_TIME = UDateTimeScale.JAVA_TIME; pub const UDTS_UNIX_TIME = UDateTimeScale.UNIX_TIME; pub const UDTS_ICU4C_TIME = UDateTimeScale.ICU4C_TIME; pub const UDTS_WINDOWS_FILE_TIME = UDateTimeScale.WINDOWS_FILE_TIME; pub const UDTS_DOTNET_DATE_TIME = UDateTimeScale.DOTNET_DATE_TIME; pub const UDTS_MAC_OLD_TIME = UDateTimeScale.MAC_OLD_TIME; pub const UDTS_MAC_TIME = UDateTimeScale.MAC_TIME; pub const UDTS_EXCEL_TIME = UDateTimeScale.EXCEL_TIME; pub const UDTS_DB2_TIME = UDateTimeScale.DB2_TIME; pub const UDTS_UNIX_MICROSECONDS_TIME = UDateTimeScale.UNIX_MICROSECONDS_TIME; pub const UTimeScaleValue = enum(i32) { UNITS_VALUE = 0, EPOCH_OFFSET_VALUE = 1, FROM_MIN_VALUE = 2, FROM_MAX_VALUE = 3, TO_MIN_VALUE = 4, TO_MAX_VALUE = 5, }; pub const UTSV_UNITS_VALUE = UTimeScaleValue.UNITS_VALUE; pub const UTSV_EPOCH_OFFSET_VALUE = UTimeScaleValue.EPOCH_OFFSET_VALUE; pub const UTSV_FROM_MIN_VALUE = UTimeScaleValue.FROM_MIN_VALUE; pub const UTSV_FROM_MAX_VALUE = UTimeScaleValue.FROM_MAX_VALUE; pub const UTSV_TO_MIN_VALUE = UTimeScaleValue.TO_MIN_VALUE; pub const UTSV_TO_MAX_VALUE = UTimeScaleValue.TO_MAX_VALUE; pub const UTransDirection = enum(i32) { FORWARD = 0, REVERSE = 1, }; pub const UTRANS_FORWARD = UTransDirection.FORWARD; pub const UTRANS_REVERSE = UTransDirection.REVERSE; pub const UTransPosition = extern struct { contextStart: i32, contextLimit: i32, start: i32, limit: i32, }; const CLSID_CActiveIMM_Value = @import("zig.zig").Guid.initString("4955dd33-b159-11d0-8fcf-00aa006bcc59"); pub const CLSID_CActiveIMM = &CLSID_CActiveIMM_Value; const IID_IEnumRegisterWordA_Value = @import("zig.zig").Guid.initString("08c03412-f96b-11d0-a475-00aa006bcc59"); pub const IID_IEnumRegisterWordA = &IID_IEnumRegisterWordA_Value; pub const IEnumRegisterWordA = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Clone: fn( self: *const IEnumRegisterWordA, ppEnum: ?*?*IEnumRegisterWordA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Next: fn( self: *const IEnumRegisterWordA, ulCount: u32, rgRegisterWord: ?*REGISTERWORDA, pcFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumRegisterWordA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumRegisterWordA, ulCount: 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 IEnumRegisterWordA_Clone(self: *const T, ppEnum: ?*?*IEnumRegisterWordA) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumRegisterWordA.VTable, self.vtable).Clone(@ptrCast(*const IEnumRegisterWordA, self), ppEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumRegisterWordA_Next(self: *const T, ulCount: u32, rgRegisterWord: ?*REGISTERWORDA, pcFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumRegisterWordA.VTable, self.vtable).Next(@ptrCast(*const IEnumRegisterWordA, self), ulCount, rgRegisterWord, pcFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumRegisterWordA_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumRegisterWordA.VTable, self.vtable).Reset(@ptrCast(*const IEnumRegisterWordA, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumRegisterWordA_Skip(self: *const T, ulCount: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumRegisterWordA.VTable, self.vtable).Skip(@ptrCast(*const IEnumRegisterWordA, self), ulCount); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IEnumRegisterWordW_Value = @import("zig.zig").Guid.initString("4955dd31-b159-11d0-8fcf-00aa006bcc59"); pub const IID_IEnumRegisterWordW = &IID_IEnumRegisterWordW_Value; pub const IEnumRegisterWordW = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Clone: fn( self: *const IEnumRegisterWordW, ppEnum: ?*?*IEnumRegisterWordW, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Next: fn( self: *const IEnumRegisterWordW, ulCount: u32, rgRegisterWord: ?*REGISTERWORDW, pcFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumRegisterWordW, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumRegisterWordW, ulCount: 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 IEnumRegisterWordW_Clone(self: *const T, ppEnum: ?*?*IEnumRegisterWordW) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumRegisterWordW.VTable, self.vtable).Clone(@ptrCast(*const IEnumRegisterWordW, self), ppEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumRegisterWordW_Next(self: *const T, ulCount: u32, rgRegisterWord: ?*REGISTERWORDW, pcFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumRegisterWordW.VTable, self.vtable).Next(@ptrCast(*const IEnumRegisterWordW, self), ulCount, rgRegisterWord, pcFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumRegisterWordW_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumRegisterWordW.VTable, self.vtable).Reset(@ptrCast(*const IEnumRegisterWordW, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumRegisterWordW_Skip(self: *const T, ulCount: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumRegisterWordW.VTable, self.vtable).Skip(@ptrCast(*const IEnumRegisterWordW, self), ulCount); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IEnumInputContext_Value = @import("zig.zig").Guid.initString("09b5eab0-f997-11d1-93d4-0060b067b86e"); pub const IID_IEnumInputContext = &IID_IEnumInputContext_Value; pub const IEnumInputContext = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Clone: fn( self: *const IEnumInputContext, ppEnum: ?*?*IEnumInputContext, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Next: fn( self: *const IEnumInputContext, ulCount: u32, rgInputContext: ?*?HIMC, pcFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumInputContext, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumInputContext, ulCount: 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 IEnumInputContext_Clone(self: *const T, ppEnum: ?*?*IEnumInputContext) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumInputContext.VTable, self.vtable).Clone(@ptrCast(*const IEnumInputContext, self), ppEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumInputContext_Next(self: *const T, ulCount: u32, rgInputContext: ?*?HIMC, pcFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumInputContext.VTable, self.vtable).Next(@ptrCast(*const IEnumInputContext, self), ulCount, rgInputContext, pcFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumInputContext_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumInputContext.VTable, self.vtable).Reset(@ptrCast(*const IEnumInputContext, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumInputContext_Skip(self: *const T, ulCount: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumInputContext.VTable, self.vtable).Skip(@ptrCast(*const IEnumInputContext, self), ulCount); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IActiveIMMRegistrar_Value = @import("zig.zig").Guid.initString("b3458082-bd00-11d1-939b-0060b067b86e"); pub const IID_IActiveIMMRegistrar = &IID_IActiveIMMRegistrar_Value; pub const IActiveIMMRegistrar = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, RegisterIME: fn( self: *const IActiveIMMRegistrar, rclsid: ?*const Guid, lgid: u16, pszIconFile: ?[*:0]const u16, pszDesc: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnregisterIME: fn( self: *const IActiveIMMRegistrar, rclsid: ?*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 IActiveIMMRegistrar_RegisterIME(self: *const T, rclsid: ?*const Guid, lgid: u16, pszIconFile: ?[*:0]const u16, pszDesc: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMRegistrar.VTable, self.vtable).RegisterIME(@ptrCast(*const IActiveIMMRegistrar, self), rclsid, lgid, pszIconFile, pszDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMRegistrar_UnregisterIME(self: *const T, rclsid: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMRegistrar.VTable, self.vtable).UnregisterIME(@ptrCast(*const IActiveIMMRegistrar, self), rclsid); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IActiveIMMMessagePumpOwner_Value = @import("zig.zig").Guid.initString("b5cf2cfa-8aeb-11d1-9364-0060b067b86e"); pub const IID_IActiveIMMMessagePumpOwner = &IID_IActiveIMMMessagePumpOwner_Value; pub const IActiveIMMMessagePumpOwner = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Start: fn( self: *const IActiveIMMMessagePumpOwner, ) callconv(@import("std").os.windows.WINAPI) HRESULT, End: fn( self: *const IActiveIMMMessagePumpOwner, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnTranslateMessage: fn( self: *const IActiveIMMMessagePumpOwner, pMsg: ?*const MSG, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Pause: fn( self: *const IActiveIMMMessagePumpOwner, pdwCookie: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Resume: fn( self: *const IActiveIMMMessagePumpOwner, 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 IActiveIMMMessagePumpOwner_Start(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMMessagePumpOwner.VTable, self.vtable).Start(@ptrCast(*const IActiveIMMMessagePumpOwner, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMMessagePumpOwner_End(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMMessagePumpOwner.VTable, self.vtable).End(@ptrCast(*const IActiveIMMMessagePumpOwner, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMMessagePumpOwner_OnTranslateMessage(self: *const T, pMsg: ?*const MSG) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMMessagePumpOwner.VTable, self.vtable).OnTranslateMessage(@ptrCast(*const IActiveIMMMessagePumpOwner, self), pMsg); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMMessagePumpOwner_Pause(self: *const T, pdwCookie: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMMessagePumpOwner.VTable, self.vtable).Pause(@ptrCast(*const IActiveIMMMessagePumpOwner, self), pdwCookie); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMMessagePumpOwner_Resume(self: *const T, dwCookie: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMMessagePumpOwner.VTable, self.vtable).Resume(@ptrCast(*const IActiveIMMMessagePumpOwner, self), dwCookie); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IActiveIMMApp_Value = @import("zig.zig").Guid.initString("08c0e040-62d1-11d1-9326-0060b067b86e"); pub const IID_IActiveIMMApp = &IID_IActiveIMMApp_Value; pub const IActiveIMMApp = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AssociateContext: fn( self: *const IActiveIMMApp, hWnd: ?HWND, hIME: ?HIMC, phPrev: ?*?HIMC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ConfigureIMEA: fn( self: *const IActiveIMMApp, hKL: ?HKL, hWnd: ?HWND, dwMode: u32, pData: ?*REGISTERWORDA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ConfigureIMEW: fn( self: *const IActiveIMMApp, hKL: ?HKL, hWnd: ?HWND, dwMode: u32, pData: ?*REGISTERWORDW, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateContext: fn( self: *const IActiveIMMApp, phIMC: ?*?HIMC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DestroyContext: fn( self: *const IActiveIMMApp, hIME: ?HIMC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumRegisterWordA: fn( self: *const IActiveIMMApp, hKL: ?HKL, szReading: ?PSTR, dwStyle: u32, szRegister: ?PSTR, pData: ?*c_void, pEnum: ?*?*IEnumRegisterWordA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumRegisterWordW: fn( self: *const IActiveIMMApp, hKL: ?HKL, szReading: ?PWSTR, dwStyle: u32, szRegister: ?PWSTR, pData: ?*c_void, pEnum: ?*?*IEnumRegisterWordW, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EscapeA: fn( self: *const IActiveIMMApp, hKL: ?HKL, hIMC: ?HIMC, uEscape: u32, pData: ?*c_void, plResult: ?*LRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EscapeW: fn( self: *const IActiveIMMApp, hKL: ?HKL, hIMC: ?HIMC, uEscape: u32, pData: ?*c_void, plResult: ?*LRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCandidateListA: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, dwIndex: u32, uBufLen: u32, pCandList: ?*CANDIDATELIST, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCandidateListW: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, dwIndex: u32, uBufLen: u32, pCandList: ?*CANDIDATELIST, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCandidateListCountA: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, pdwListSize: ?*u32, pdwBufLen: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCandidateListCountW: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, pdwListSize: ?*u32, pdwBufLen: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCandidateWindow: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, dwIndex: u32, pCandidate: ?*CANDIDATEFORM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCompositionFontA: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, plf: ?*LOGFONTA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCompositionFontW: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, plf: ?*LOGFONTW, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCompositionStringA: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, dwIndex: u32, dwBufLen: u32, plCopied: ?*i32, pBuf: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCompositionStringW: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, dwIndex: u32, dwBufLen: u32, plCopied: ?*i32, pBuf: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCompositionWindow: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, pCompForm: ?*COMPOSITIONFORM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetContext: fn( self: *const IActiveIMMApp, hWnd: ?HWND, phIMC: ?*?HIMC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConversionListA: fn( self: *const IActiveIMMApp, hKL: ?HKL, hIMC: ?HIMC, pSrc: ?PSTR, uBufLen: u32, uFlag: u32, pDst: ?*CANDIDATELIST, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConversionListW: fn( self: *const IActiveIMMApp, hKL: ?HKL, hIMC: ?HIMC, pSrc: ?PWSTR, uBufLen: u32, uFlag: u32, pDst: ?*CANDIDATELIST, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConversionStatus: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, pfdwConversion: ?*u32, pfdwSentence: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDefaultIMEWnd: fn( self: *const IActiveIMMApp, hWnd: ?HWND, phDefWnd: ?*?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDescriptionA: fn( self: *const IActiveIMMApp, hKL: ?HKL, uBufLen: u32, szDescription: ?PSTR, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDescriptionW: fn( self: *const IActiveIMMApp, hKL: ?HKL, uBufLen: u32, szDescription: ?PWSTR, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetGuideLineA: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, dwIndex: u32, dwBufLen: u32, pBuf: ?PSTR, pdwResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetGuideLineW: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, dwIndex: u32, dwBufLen: u32, pBuf: ?PWSTR, pdwResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIMEFileNameA: fn( self: *const IActiveIMMApp, hKL: ?HKL, uBufLen: u32, szFileName: ?PSTR, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIMEFileNameW: fn( self: *const IActiveIMMApp, hKL: ?HKL, uBufLen: u32, szFileName: ?PWSTR, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetOpenStatus: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetProperty: fn( self: *const IActiveIMMApp, hKL: ?HKL, fdwIndex: u32, pdwProperty: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRegisterWordStyleA: fn( self: *const IActiveIMMApp, hKL: ?HKL, nItem: u32, pStyleBuf: ?*STYLEBUFA, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRegisterWordStyleW: fn( self: *const IActiveIMMApp, hKL: ?HKL, nItem: u32, pStyleBuf: ?*STYLEBUFW, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStatusWindowPos: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, pptPos: ?*POINT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetVirtualKey: fn( self: *const IActiveIMMApp, hWnd: ?HWND, puVirtualKey: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InstallIMEA: fn( self: *const IActiveIMMApp, szIMEFileName: ?PSTR, szLayoutText: ?PSTR, phKL: ?*?HKL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InstallIMEW: fn( self: *const IActiveIMMApp, szIMEFileName: ?PWSTR, szLayoutText: ?PWSTR, phKL: ?*?HKL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsIME: fn( self: *const IActiveIMMApp, hKL: ?HKL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsUIMessageA: fn( self: *const IActiveIMMApp, hWndIME: ?HWND, msg: u32, wParam: WPARAM, lParam: LPARAM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsUIMessageW: fn( self: *const IActiveIMMApp, hWndIME: ?HWND, msg: u32, wParam: WPARAM, lParam: LPARAM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, NotifyIME: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, dwAction: u32, dwIndex: u32, dwValue: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterWordA: fn( self: *const IActiveIMMApp, hKL: ?HKL, szReading: ?PSTR, dwStyle: u32, szRegister: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterWordW: fn( self: *const IActiveIMMApp, hKL: ?HKL, szReading: ?PWSTR, dwStyle: u32, szRegister: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReleaseContext: fn( self: *const IActiveIMMApp, hWnd: ?HWND, hIMC: ?HIMC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCandidateWindow: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, pCandidate: ?*CANDIDATEFORM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCompositionFontA: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, plf: ?*LOGFONTA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCompositionFontW: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, plf: ?*LOGFONTW, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCompositionStringA: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, dwIndex: u32, pComp: ?*c_void, dwCompLen: u32, pRead: ?*c_void, dwReadLen: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCompositionStringW: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, dwIndex: u32, pComp: ?*c_void, dwCompLen: u32, pRead: ?*c_void, dwReadLen: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCompositionWindow: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, pCompForm: ?*COMPOSITIONFORM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetConversionStatus: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, fdwConversion: u32, fdwSentence: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetOpenStatus: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, fOpen: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetStatusWindowPos: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, pptPos: ?*POINT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SimulateHotKey: fn( self: *const IActiveIMMApp, hWnd: ?HWND, dwHotKeyID: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnregisterWordA: fn( self: *const IActiveIMMApp, hKL: ?HKL, szReading: ?PSTR, dwStyle: u32, szUnregister: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnregisterWordW: fn( self: *const IActiveIMMApp, hKL: ?HKL, szReading: ?PWSTR, dwStyle: u32, szUnregister: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Activate: fn( self: *const IActiveIMMApp, fRestoreLayout: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Deactivate: fn( self: *const IActiveIMMApp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnDefWindowProc: fn( self: *const IActiveIMMApp, hWnd: ?HWND, Msg: u32, wParam: WPARAM, lParam: LPARAM, plResult: ?*LRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FilterClientWindows: fn( self: *const IActiveIMMApp, aaClassList: ?*u16, uSize: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCodePageA: fn( self: *const IActiveIMMApp, hKL: ?HKL, uCodePage: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLangId: fn( self: *const IActiveIMMApp, hKL: ?HKL, plid: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AssociateContextEx: fn( self: *const IActiveIMMApp, hWnd: ?HWND, hIMC: ?HIMC, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DisableIME: fn( self: *const IActiveIMMApp, idThread: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetImeMenuItemsA: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, dwFlags: u32, dwType: u32, pImeParentMenu: ?*IMEMENUITEMINFOA, pImeMenu: ?*IMEMENUITEMINFOA, dwSize: u32, pdwResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetImeMenuItemsW: fn( self: *const IActiveIMMApp, hIMC: ?HIMC, dwFlags: u32, dwType: u32, pImeParentMenu: ?*IMEMENUITEMINFOW, pImeMenu: ?*IMEMENUITEMINFOW, dwSize: u32, pdwResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumInputContext: fn( self: *const IActiveIMMApp, idThread: u32, ppEnum: ?*?*IEnumInputContext, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_AssociateContext(self: *const T, hWnd: ?HWND, hIME: ?HIMC, phPrev: ?*?HIMC) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).AssociateContext(@ptrCast(*const IActiveIMMApp, self), hWnd, hIME, phPrev); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_ConfigureIMEA(self: *const T, hKL: ?HKL, hWnd: ?HWND, dwMode: u32, pData: ?*REGISTERWORDA) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).ConfigureIMEA(@ptrCast(*const IActiveIMMApp, self), hKL, hWnd, dwMode, pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_ConfigureIMEW(self: *const T, hKL: ?HKL, hWnd: ?HWND, dwMode: u32, pData: ?*REGISTERWORDW) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).ConfigureIMEW(@ptrCast(*const IActiveIMMApp, self), hKL, hWnd, dwMode, pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_CreateContext(self: *const T, phIMC: ?*?HIMC) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).CreateContext(@ptrCast(*const IActiveIMMApp, self), phIMC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_DestroyContext(self: *const T, hIME: ?HIMC) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).DestroyContext(@ptrCast(*const IActiveIMMApp, self), hIME); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_EnumRegisterWordA(self: *const T, hKL: ?HKL, szReading: ?PSTR, dwStyle: u32, szRegister: ?PSTR, pData: ?*c_void, pEnum: ?*?*IEnumRegisterWordA) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).EnumRegisterWordA(@ptrCast(*const IActiveIMMApp, self), hKL, szReading, dwStyle, szRegister, pData, pEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_EnumRegisterWordW(self: *const T, hKL: ?HKL, szReading: ?PWSTR, dwStyle: u32, szRegister: ?PWSTR, pData: ?*c_void, pEnum: ?*?*IEnumRegisterWordW) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).EnumRegisterWordW(@ptrCast(*const IActiveIMMApp, self), hKL, szReading, dwStyle, szRegister, pData, pEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_EscapeA(self: *const T, hKL: ?HKL, hIMC: ?HIMC, uEscape: u32, pData: ?*c_void, plResult: ?*LRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).EscapeA(@ptrCast(*const IActiveIMMApp, self), hKL, hIMC, uEscape, pData, plResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_EscapeW(self: *const T, hKL: ?HKL, hIMC: ?HIMC, uEscape: u32, pData: ?*c_void, plResult: ?*LRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).EscapeW(@ptrCast(*const IActiveIMMApp, self), hKL, hIMC, uEscape, pData, plResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetCandidateListA(self: *const T, hIMC: ?HIMC, dwIndex: u32, uBufLen: u32, pCandList: ?*CANDIDATELIST, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetCandidateListA(@ptrCast(*const IActiveIMMApp, self), hIMC, dwIndex, uBufLen, pCandList, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetCandidateListW(self: *const T, hIMC: ?HIMC, dwIndex: u32, uBufLen: u32, pCandList: ?*CANDIDATELIST, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetCandidateListW(@ptrCast(*const IActiveIMMApp, self), hIMC, dwIndex, uBufLen, pCandList, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetCandidateListCountA(self: *const T, hIMC: ?HIMC, pdwListSize: ?*u32, pdwBufLen: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetCandidateListCountA(@ptrCast(*const IActiveIMMApp, self), hIMC, pdwListSize, pdwBufLen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetCandidateListCountW(self: *const T, hIMC: ?HIMC, pdwListSize: ?*u32, pdwBufLen: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetCandidateListCountW(@ptrCast(*const IActiveIMMApp, self), hIMC, pdwListSize, pdwBufLen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetCandidateWindow(self: *const T, hIMC: ?HIMC, dwIndex: u32, pCandidate: ?*CANDIDATEFORM) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetCandidateWindow(@ptrCast(*const IActiveIMMApp, self), hIMC, dwIndex, pCandidate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetCompositionFontA(self: *const T, hIMC: ?HIMC, plf: ?*LOGFONTA) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetCompositionFontA(@ptrCast(*const IActiveIMMApp, self), hIMC, plf); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetCompositionFontW(self: *const T, hIMC: ?HIMC, plf: ?*LOGFONTW) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetCompositionFontW(@ptrCast(*const IActiveIMMApp, self), hIMC, plf); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetCompositionStringA(self: *const T, hIMC: ?HIMC, dwIndex: u32, dwBufLen: u32, plCopied: ?*i32, pBuf: ?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetCompositionStringA(@ptrCast(*const IActiveIMMApp, self), hIMC, dwIndex, dwBufLen, plCopied, pBuf); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetCompositionStringW(self: *const T, hIMC: ?HIMC, dwIndex: u32, dwBufLen: u32, plCopied: ?*i32, pBuf: ?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetCompositionStringW(@ptrCast(*const IActiveIMMApp, self), hIMC, dwIndex, dwBufLen, plCopied, pBuf); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetCompositionWindow(self: *const T, hIMC: ?HIMC, pCompForm: ?*COMPOSITIONFORM) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetCompositionWindow(@ptrCast(*const IActiveIMMApp, self), hIMC, pCompForm); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetContext(self: *const T, hWnd: ?HWND, phIMC: ?*?HIMC) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetContext(@ptrCast(*const IActiveIMMApp, self), hWnd, phIMC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetConversionListA(self: *const T, hKL: ?HKL, hIMC: ?HIMC, pSrc: ?PSTR, uBufLen: u32, uFlag: u32, pDst: ?*CANDIDATELIST, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetConversionListA(@ptrCast(*const IActiveIMMApp, self), hKL, hIMC, pSrc, uBufLen, uFlag, pDst, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetConversionListW(self: *const T, hKL: ?HKL, hIMC: ?HIMC, pSrc: ?PWSTR, uBufLen: u32, uFlag: u32, pDst: ?*CANDIDATELIST, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetConversionListW(@ptrCast(*const IActiveIMMApp, self), hKL, hIMC, pSrc, uBufLen, uFlag, pDst, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetConversionStatus(self: *const T, hIMC: ?HIMC, pfdwConversion: ?*u32, pfdwSentence: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetConversionStatus(@ptrCast(*const IActiveIMMApp, self), hIMC, pfdwConversion, pfdwSentence); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetDefaultIMEWnd(self: *const T, hWnd: ?HWND, phDefWnd: ?*?HWND) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetDefaultIMEWnd(@ptrCast(*const IActiveIMMApp, self), hWnd, phDefWnd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetDescriptionA(self: *const T, hKL: ?HKL, uBufLen: u32, szDescription: ?PSTR, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetDescriptionA(@ptrCast(*const IActiveIMMApp, self), hKL, uBufLen, szDescription, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetDescriptionW(self: *const T, hKL: ?HKL, uBufLen: u32, szDescription: ?PWSTR, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetDescriptionW(@ptrCast(*const IActiveIMMApp, self), hKL, uBufLen, szDescription, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetGuideLineA(self: *const T, hIMC: ?HIMC, dwIndex: u32, dwBufLen: u32, pBuf: ?PSTR, pdwResult: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetGuideLineA(@ptrCast(*const IActiveIMMApp, self), hIMC, dwIndex, dwBufLen, pBuf, pdwResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetGuideLineW(self: *const T, hIMC: ?HIMC, dwIndex: u32, dwBufLen: u32, pBuf: ?PWSTR, pdwResult: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetGuideLineW(@ptrCast(*const IActiveIMMApp, self), hIMC, dwIndex, dwBufLen, pBuf, pdwResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetIMEFileNameA(self: *const T, hKL: ?HKL, uBufLen: u32, szFileName: ?PSTR, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetIMEFileNameA(@ptrCast(*const IActiveIMMApp, self), hKL, uBufLen, szFileName, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetIMEFileNameW(self: *const T, hKL: ?HKL, uBufLen: u32, szFileName: ?PWSTR, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetIMEFileNameW(@ptrCast(*const IActiveIMMApp, self), hKL, uBufLen, szFileName, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetOpenStatus(self: *const T, hIMC: ?HIMC) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetOpenStatus(@ptrCast(*const IActiveIMMApp, self), hIMC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetProperty(self: *const T, hKL: ?HKL, fdwIndex: u32, pdwProperty: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetProperty(@ptrCast(*const IActiveIMMApp, self), hKL, fdwIndex, pdwProperty); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetRegisterWordStyleA(self: *const T, hKL: ?HKL, nItem: u32, pStyleBuf: ?*STYLEBUFA, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetRegisterWordStyleA(@ptrCast(*const IActiveIMMApp, self), hKL, nItem, pStyleBuf, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetRegisterWordStyleW(self: *const T, hKL: ?HKL, nItem: u32, pStyleBuf: ?*STYLEBUFW, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetRegisterWordStyleW(@ptrCast(*const IActiveIMMApp, self), hKL, nItem, pStyleBuf, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetStatusWindowPos(self: *const T, hIMC: ?HIMC, pptPos: ?*POINT) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetStatusWindowPos(@ptrCast(*const IActiveIMMApp, self), hIMC, pptPos); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetVirtualKey(self: *const T, hWnd: ?HWND, puVirtualKey: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetVirtualKey(@ptrCast(*const IActiveIMMApp, self), hWnd, puVirtualKey); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_InstallIMEA(self: *const T, szIMEFileName: ?PSTR, szLayoutText: ?PSTR, phKL: ?*?HKL) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).InstallIMEA(@ptrCast(*const IActiveIMMApp, self), szIMEFileName, szLayoutText, phKL); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_InstallIMEW(self: *const T, szIMEFileName: ?PWSTR, szLayoutText: ?PWSTR, phKL: ?*?HKL) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).InstallIMEW(@ptrCast(*const IActiveIMMApp, self), szIMEFileName, szLayoutText, phKL); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_IsIME(self: *const T, hKL: ?HKL) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).IsIME(@ptrCast(*const IActiveIMMApp, self), hKL); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_IsUIMessageA(self: *const T, hWndIME: ?HWND, msg: u32, wParam: WPARAM, lParam: LPARAM) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).IsUIMessageA(@ptrCast(*const IActiveIMMApp, self), hWndIME, msg, wParam, lParam); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_IsUIMessageW(self: *const T, hWndIME: ?HWND, msg: u32, wParam: WPARAM, lParam: LPARAM) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).IsUIMessageW(@ptrCast(*const IActiveIMMApp, self), hWndIME, msg, wParam, lParam); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_NotifyIME(self: *const T, hIMC: ?HIMC, dwAction: u32, dwIndex: u32, dwValue: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).NotifyIME(@ptrCast(*const IActiveIMMApp, self), hIMC, dwAction, dwIndex, dwValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_RegisterWordA(self: *const T, hKL: ?HKL, szReading: ?PSTR, dwStyle: u32, szRegister: ?PSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).RegisterWordA(@ptrCast(*const IActiveIMMApp, self), hKL, szReading, dwStyle, szRegister); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_RegisterWordW(self: *const T, hKL: ?HKL, szReading: ?PWSTR, dwStyle: u32, szRegister: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).RegisterWordW(@ptrCast(*const IActiveIMMApp, self), hKL, szReading, dwStyle, szRegister); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_ReleaseContext(self: *const T, hWnd: ?HWND, hIMC: ?HIMC) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).ReleaseContext(@ptrCast(*const IActiveIMMApp, self), hWnd, hIMC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_SetCandidateWindow(self: *const T, hIMC: ?HIMC, pCandidate: ?*CANDIDATEFORM) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).SetCandidateWindow(@ptrCast(*const IActiveIMMApp, self), hIMC, pCandidate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_SetCompositionFontA(self: *const T, hIMC: ?HIMC, plf: ?*LOGFONTA) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).SetCompositionFontA(@ptrCast(*const IActiveIMMApp, self), hIMC, plf); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_SetCompositionFontW(self: *const T, hIMC: ?HIMC, plf: ?*LOGFONTW) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).SetCompositionFontW(@ptrCast(*const IActiveIMMApp, self), hIMC, plf); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_SetCompositionStringA(self: *const T, hIMC: ?HIMC, dwIndex: u32, pComp: ?*c_void, dwCompLen: u32, pRead: ?*c_void, dwReadLen: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).SetCompositionStringA(@ptrCast(*const IActiveIMMApp, self), hIMC, dwIndex, pComp, dwCompLen, pRead, dwReadLen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_SetCompositionStringW(self: *const T, hIMC: ?HIMC, dwIndex: u32, pComp: ?*c_void, dwCompLen: u32, pRead: ?*c_void, dwReadLen: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).SetCompositionStringW(@ptrCast(*const IActiveIMMApp, self), hIMC, dwIndex, pComp, dwCompLen, pRead, dwReadLen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_SetCompositionWindow(self: *const T, hIMC: ?HIMC, pCompForm: ?*COMPOSITIONFORM) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).SetCompositionWindow(@ptrCast(*const IActiveIMMApp, self), hIMC, pCompForm); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_SetConversionStatus(self: *const T, hIMC: ?HIMC, fdwConversion: u32, fdwSentence: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).SetConversionStatus(@ptrCast(*const IActiveIMMApp, self), hIMC, fdwConversion, fdwSentence); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_SetOpenStatus(self: *const T, hIMC: ?HIMC, fOpen: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).SetOpenStatus(@ptrCast(*const IActiveIMMApp, self), hIMC, fOpen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_SetStatusWindowPos(self: *const T, hIMC: ?HIMC, pptPos: ?*POINT) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).SetStatusWindowPos(@ptrCast(*const IActiveIMMApp, self), hIMC, pptPos); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_SimulateHotKey(self: *const T, hWnd: ?HWND, dwHotKeyID: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).SimulateHotKey(@ptrCast(*const IActiveIMMApp, self), hWnd, dwHotKeyID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_UnregisterWordA(self: *const T, hKL: ?HKL, szReading: ?PSTR, dwStyle: u32, szUnregister: ?PSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).UnregisterWordA(@ptrCast(*const IActiveIMMApp, self), hKL, szReading, dwStyle, szUnregister); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_UnregisterWordW(self: *const T, hKL: ?HKL, szReading: ?PWSTR, dwStyle: u32, szUnregister: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).UnregisterWordW(@ptrCast(*const IActiveIMMApp, self), hKL, szReading, dwStyle, szUnregister); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_Activate(self: *const T, fRestoreLayout: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).Activate(@ptrCast(*const IActiveIMMApp, self), fRestoreLayout); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_Deactivate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).Deactivate(@ptrCast(*const IActiveIMMApp, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_OnDefWindowProc(self: *const T, hWnd: ?HWND, Msg: u32, wParam: WPARAM, lParam: LPARAM, plResult: ?*LRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).OnDefWindowProc(@ptrCast(*const IActiveIMMApp, self), hWnd, Msg, wParam, lParam, plResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_FilterClientWindows(self: *const T, aaClassList: ?*u16, uSize: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).FilterClientWindows(@ptrCast(*const IActiveIMMApp, self), aaClassList, uSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetCodePageA(self: *const T, hKL: ?HKL, uCodePage: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetCodePageA(@ptrCast(*const IActiveIMMApp, self), hKL, uCodePage); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetLangId(self: *const T, hKL: ?HKL, plid: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetLangId(@ptrCast(*const IActiveIMMApp, self), hKL, plid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_AssociateContextEx(self: *const T, hWnd: ?HWND, hIMC: ?HIMC, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).AssociateContextEx(@ptrCast(*const IActiveIMMApp, self), hWnd, hIMC, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_DisableIME(self: *const T, idThread: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).DisableIME(@ptrCast(*const IActiveIMMApp, self), idThread); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetImeMenuItemsA(self: *const T, hIMC: ?HIMC, dwFlags: u32, dwType: u32, pImeParentMenu: ?*IMEMENUITEMINFOA, pImeMenu: ?*IMEMENUITEMINFOA, dwSize: u32, pdwResult: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetImeMenuItemsA(@ptrCast(*const IActiveIMMApp, self), hIMC, dwFlags, dwType, pImeParentMenu, pImeMenu, dwSize, pdwResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_GetImeMenuItemsW(self: *const T, hIMC: ?HIMC, dwFlags: u32, dwType: u32, pImeParentMenu: ?*IMEMENUITEMINFOW, pImeMenu: ?*IMEMENUITEMINFOW, dwSize: u32, pdwResult: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).GetImeMenuItemsW(@ptrCast(*const IActiveIMMApp, self), hIMC, dwFlags, dwType, pImeParentMenu, pImeMenu, dwSize, pdwResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMApp_EnumInputContext(self: *const T, idThread: u32, ppEnum: ?*?*IEnumInputContext) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMApp.VTable, self.vtable).EnumInputContext(@ptrCast(*const IActiveIMMApp, self), idThread, ppEnum); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IActiveIMMIME_Value = @import("zig.zig").Guid.initString("08c03411-f96b-11d0-a475-00aa006bcc59"); pub const IID_IActiveIMMIME = &IID_IActiveIMMIME_Value; pub const IActiveIMMIME = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AssociateContext: fn( self: *const IActiveIMMIME, hWnd: ?HWND, hIME: ?HIMC, phPrev: ?*?HIMC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ConfigureIMEA: fn( self: *const IActiveIMMIME, hKL: ?HKL, hWnd: ?HWND, dwMode: u32, pData: ?*REGISTERWORDA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ConfigureIMEW: fn( self: *const IActiveIMMIME, hKL: ?HKL, hWnd: ?HWND, dwMode: u32, pData: ?*REGISTERWORDW, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateContext: fn( self: *const IActiveIMMIME, phIMC: ?*?HIMC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DestroyContext: fn( self: *const IActiveIMMIME, hIME: ?HIMC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumRegisterWordA: fn( self: *const IActiveIMMIME, hKL: ?HKL, szReading: ?PSTR, dwStyle: u32, szRegister: ?PSTR, pData: ?*c_void, pEnum: ?*?*IEnumRegisterWordA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumRegisterWordW: fn( self: *const IActiveIMMIME, hKL: ?HKL, szReading: ?PWSTR, dwStyle: u32, szRegister: ?PWSTR, pData: ?*c_void, pEnum: ?*?*IEnumRegisterWordW, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EscapeA: fn( self: *const IActiveIMMIME, hKL: ?HKL, hIMC: ?HIMC, uEscape: u32, pData: ?*c_void, plResult: ?*LRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EscapeW: fn( self: *const IActiveIMMIME, hKL: ?HKL, hIMC: ?HIMC, uEscape: u32, pData: ?*c_void, plResult: ?*LRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCandidateListA: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, dwIndex: u32, uBufLen: u32, pCandList: ?*CANDIDATELIST, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCandidateListW: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, dwIndex: u32, uBufLen: u32, pCandList: ?*CANDIDATELIST, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCandidateListCountA: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, pdwListSize: ?*u32, pdwBufLen: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCandidateListCountW: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, pdwListSize: ?*u32, pdwBufLen: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCandidateWindow: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, dwIndex: u32, pCandidate: ?*CANDIDATEFORM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCompositionFontA: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, plf: ?*LOGFONTA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCompositionFontW: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, plf: ?*LOGFONTW, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCompositionStringA: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, dwIndex: u32, dwBufLen: u32, plCopied: ?*i32, pBuf: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCompositionStringW: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, dwIndex: u32, dwBufLen: u32, plCopied: ?*i32, pBuf: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCompositionWindow: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, pCompForm: ?*COMPOSITIONFORM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetContext: fn( self: *const IActiveIMMIME, hWnd: ?HWND, phIMC: ?*?HIMC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConversionListA: fn( self: *const IActiveIMMIME, hKL: ?HKL, hIMC: ?HIMC, pSrc: ?PSTR, uBufLen: u32, uFlag: u32, pDst: ?*CANDIDATELIST, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConversionListW: fn( self: *const IActiveIMMIME, hKL: ?HKL, hIMC: ?HIMC, pSrc: ?PWSTR, uBufLen: u32, uFlag: u32, pDst: ?*CANDIDATELIST, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConversionStatus: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, pfdwConversion: ?*u32, pfdwSentence: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDefaultIMEWnd: fn( self: *const IActiveIMMIME, hWnd: ?HWND, phDefWnd: ?*?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDescriptionA: fn( self: *const IActiveIMMIME, hKL: ?HKL, uBufLen: u32, szDescription: ?PSTR, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDescriptionW: fn( self: *const IActiveIMMIME, hKL: ?HKL, uBufLen: u32, szDescription: ?PWSTR, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetGuideLineA: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, dwIndex: u32, dwBufLen: u32, pBuf: ?PSTR, pdwResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetGuideLineW: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, dwIndex: u32, dwBufLen: u32, pBuf: ?PWSTR, pdwResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIMEFileNameA: fn( self: *const IActiveIMMIME, hKL: ?HKL, uBufLen: u32, szFileName: ?PSTR, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIMEFileNameW: fn( self: *const IActiveIMMIME, hKL: ?HKL, uBufLen: u32, szFileName: ?PWSTR, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetOpenStatus: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetProperty: fn( self: *const IActiveIMMIME, hKL: ?HKL, fdwIndex: u32, pdwProperty: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRegisterWordStyleA: fn( self: *const IActiveIMMIME, hKL: ?HKL, nItem: u32, pStyleBuf: ?*STYLEBUFA, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRegisterWordStyleW: fn( self: *const IActiveIMMIME, hKL: ?HKL, nItem: u32, pStyleBuf: ?*STYLEBUFW, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStatusWindowPos: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, pptPos: ?*POINT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetVirtualKey: fn( self: *const IActiveIMMIME, hWnd: ?HWND, puVirtualKey: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InstallIMEA: fn( self: *const IActiveIMMIME, szIMEFileName: ?PSTR, szLayoutText: ?PSTR, phKL: ?*?HKL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InstallIMEW: fn( self: *const IActiveIMMIME, szIMEFileName: ?PWSTR, szLayoutText: ?PWSTR, phKL: ?*?HKL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsIME: fn( self: *const IActiveIMMIME, hKL: ?HKL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsUIMessageA: fn( self: *const IActiveIMMIME, hWndIME: ?HWND, msg: u32, wParam: WPARAM, lParam: LPARAM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsUIMessageW: fn( self: *const IActiveIMMIME, hWndIME: ?HWND, msg: u32, wParam: WPARAM, lParam: LPARAM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, NotifyIME: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, dwAction: u32, dwIndex: u32, dwValue: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterWordA: fn( self: *const IActiveIMMIME, hKL: ?HKL, szReading: ?PSTR, dwStyle: u32, szRegister: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterWordW: fn( self: *const IActiveIMMIME, hKL: ?HKL, szReading: ?PWSTR, dwStyle: u32, szRegister: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReleaseContext: fn( self: *const IActiveIMMIME, hWnd: ?HWND, hIMC: ?HIMC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCandidateWindow: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, pCandidate: ?*CANDIDATEFORM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCompositionFontA: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, plf: ?*LOGFONTA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCompositionFontW: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, plf: ?*LOGFONTW, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCompositionStringA: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, dwIndex: u32, pComp: ?*c_void, dwCompLen: u32, pRead: ?*c_void, dwReadLen: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCompositionStringW: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, dwIndex: u32, pComp: ?*c_void, dwCompLen: u32, pRead: ?*c_void, dwReadLen: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCompositionWindow: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, pCompForm: ?*COMPOSITIONFORM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetConversionStatus: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, fdwConversion: u32, fdwSentence: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetOpenStatus: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, fOpen: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetStatusWindowPos: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, pptPos: ?*POINT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SimulateHotKey: fn( self: *const IActiveIMMIME, hWnd: ?HWND, dwHotKeyID: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnregisterWordA: fn( self: *const IActiveIMMIME, hKL: ?HKL, szReading: ?PSTR, dwStyle: u32, szUnregister: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnregisterWordW: fn( self: *const IActiveIMMIME, hKL: ?HKL, szReading: ?PWSTR, dwStyle: u32, szUnregister: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GenerateMessage: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, LockIMC: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, ppIMC: ?*?*INPUTCONTEXT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnlockIMC: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIMCLockCount: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, pdwLockCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateIMCC: fn( self: *const IActiveIMMIME, dwSize: u32, phIMCC: ?*?HIMCC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DestroyIMCC: fn( self: *const IActiveIMMIME, hIMCC: ?HIMCC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, LockIMCC: fn( self: *const IActiveIMMIME, hIMCC: ?HIMCC, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnlockIMCC: fn( self: *const IActiveIMMIME, hIMCC: ?HIMCC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReSizeIMCC: fn( self: *const IActiveIMMIME, hIMCC: ?HIMCC, dwSize: u32, phIMCC: ?*?HIMCC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIMCCSize: fn( self: *const IActiveIMMIME, hIMCC: ?HIMCC, pdwSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIMCCLockCount: fn( self: *const IActiveIMMIME, hIMCC: ?HIMCC, pdwLockCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetHotKey: fn( self: *const IActiveIMMIME, dwHotKeyID: u32, puModifiers: ?*u32, puVKey: ?*u32, phKL: ?*?HKL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetHotKey: fn( self: *const IActiveIMMIME, dwHotKeyID: u32, uModifiers: u32, uVKey: u32, hKL: ?HKL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateSoftKeyboard: fn( self: *const IActiveIMMIME, uType: u32, hOwner: ?HWND, x: i32, y: i32, phSoftKbdWnd: ?*?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DestroySoftKeyboard: fn( self: *const IActiveIMMIME, hSoftKbdWnd: ?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ShowSoftKeyboard: fn( self: *const IActiveIMMIME, hSoftKbdWnd: ?HWND, nCmdShow: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCodePageA: fn( self: *const IActiveIMMIME, hKL: ?HKL, uCodePage: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLangId: fn( self: *const IActiveIMMIME, hKL: ?HKL, plid: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, KeybdEvent: fn( self: *const IActiveIMMIME, lgidIME: u16, bVk: u8, bScan: u8, dwFlags: u32, dwExtraInfo: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, LockModal: fn( self: *const IActiveIMMIME, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnlockModal: fn( self: *const IActiveIMMIME, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AssociateContextEx: fn( self: *const IActiveIMMIME, hWnd: ?HWND, hIMC: ?HIMC, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DisableIME: fn( self: *const IActiveIMMIME, idThread: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetImeMenuItemsA: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, dwFlags: u32, dwType: u32, pImeParentMenu: ?*IMEMENUITEMINFOA, pImeMenu: ?*IMEMENUITEMINFOA, dwSize: u32, pdwResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetImeMenuItemsW: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, dwFlags: u32, dwType: u32, pImeParentMenu: ?*IMEMENUITEMINFOW, pImeMenu: ?*IMEMENUITEMINFOW, dwSize: u32, pdwResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumInputContext: fn( self: *const IActiveIMMIME, idThread: u32, ppEnum: ?*?*IEnumInputContext, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RequestMessageA: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, wParam: WPARAM, lParam: LPARAM, plResult: ?*LRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RequestMessageW: fn( self: *const IActiveIMMIME, hIMC: ?HIMC, wParam: WPARAM, lParam: LPARAM, plResult: ?*LRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendIMCA: fn( self: *const IActiveIMMIME, hWnd: ?HWND, uMsg: u32, wParam: WPARAM, lParam: LPARAM, plResult: ?*LRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendIMCW: fn( self: *const IActiveIMMIME, hWnd: ?HWND, uMsg: u32, wParam: WPARAM, lParam: LPARAM, plResult: ?*LRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsSleeping: fn( self: *const IActiveIMMIME, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_AssociateContext(self: *const T, hWnd: ?HWND, hIME: ?HIMC, phPrev: ?*?HIMC) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).AssociateContext(@ptrCast(*const IActiveIMMIME, self), hWnd, hIME, phPrev); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_ConfigureIMEA(self: *const T, hKL: ?HKL, hWnd: ?HWND, dwMode: u32, pData: ?*REGISTERWORDA) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).ConfigureIMEA(@ptrCast(*const IActiveIMMIME, self), hKL, hWnd, dwMode, pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_ConfigureIMEW(self: *const T, hKL: ?HKL, hWnd: ?HWND, dwMode: u32, pData: ?*REGISTERWORDW) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).ConfigureIMEW(@ptrCast(*const IActiveIMMIME, self), hKL, hWnd, dwMode, pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_CreateContext(self: *const T, phIMC: ?*?HIMC) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).CreateContext(@ptrCast(*const IActiveIMMIME, self), phIMC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_DestroyContext(self: *const T, hIME: ?HIMC) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).DestroyContext(@ptrCast(*const IActiveIMMIME, self), hIME); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_EnumRegisterWordA(self: *const T, hKL: ?HKL, szReading: ?PSTR, dwStyle: u32, szRegister: ?PSTR, pData: ?*c_void, pEnum: ?*?*IEnumRegisterWordA) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).EnumRegisterWordA(@ptrCast(*const IActiveIMMIME, self), hKL, szReading, dwStyle, szRegister, pData, pEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_EnumRegisterWordW(self: *const T, hKL: ?HKL, szReading: ?PWSTR, dwStyle: u32, szRegister: ?PWSTR, pData: ?*c_void, pEnum: ?*?*IEnumRegisterWordW) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).EnumRegisterWordW(@ptrCast(*const IActiveIMMIME, self), hKL, szReading, dwStyle, szRegister, pData, pEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_EscapeA(self: *const T, hKL: ?HKL, hIMC: ?HIMC, uEscape: u32, pData: ?*c_void, plResult: ?*LRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).EscapeA(@ptrCast(*const IActiveIMMIME, self), hKL, hIMC, uEscape, pData, plResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_EscapeW(self: *const T, hKL: ?HKL, hIMC: ?HIMC, uEscape: u32, pData: ?*c_void, plResult: ?*LRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).EscapeW(@ptrCast(*const IActiveIMMIME, self), hKL, hIMC, uEscape, pData, plResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetCandidateListA(self: *const T, hIMC: ?HIMC, dwIndex: u32, uBufLen: u32, pCandList: ?*CANDIDATELIST, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetCandidateListA(@ptrCast(*const IActiveIMMIME, self), hIMC, dwIndex, uBufLen, pCandList, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetCandidateListW(self: *const T, hIMC: ?HIMC, dwIndex: u32, uBufLen: u32, pCandList: ?*CANDIDATELIST, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetCandidateListW(@ptrCast(*const IActiveIMMIME, self), hIMC, dwIndex, uBufLen, pCandList, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetCandidateListCountA(self: *const T, hIMC: ?HIMC, pdwListSize: ?*u32, pdwBufLen: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetCandidateListCountA(@ptrCast(*const IActiveIMMIME, self), hIMC, pdwListSize, pdwBufLen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetCandidateListCountW(self: *const T, hIMC: ?HIMC, pdwListSize: ?*u32, pdwBufLen: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetCandidateListCountW(@ptrCast(*const IActiveIMMIME, self), hIMC, pdwListSize, pdwBufLen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetCandidateWindow(self: *const T, hIMC: ?HIMC, dwIndex: u32, pCandidate: ?*CANDIDATEFORM) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetCandidateWindow(@ptrCast(*const IActiveIMMIME, self), hIMC, dwIndex, pCandidate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetCompositionFontA(self: *const T, hIMC: ?HIMC, plf: ?*LOGFONTA) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetCompositionFontA(@ptrCast(*const IActiveIMMIME, self), hIMC, plf); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetCompositionFontW(self: *const T, hIMC: ?HIMC, plf: ?*LOGFONTW) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetCompositionFontW(@ptrCast(*const IActiveIMMIME, self), hIMC, plf); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetCompositionStringA(self: *const T, hIMC: ?HIMC, dwIndex: u32, dwBufLen: u32, plCopied: ?*i32, pBuf: ?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetCompositionStringA(@ptrCast(*const IActiveIMMIME, self), hIMC, dwIndex, dwBufLen, plCopied, pBuf); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetCompositionStringW(self: *const T, hIMC: ?HIMC, dwIndex: u32, dwBufLen: u32, plCopied: ?*i32, pBuf: ?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetCompositionStringW(@ptrCast(*const IActiveIMMIME, self), hIMC, dwIndex, dwBufLen, plCopied, pBuf); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetCompositionWindow(self: *const T, hIMC: ?HIMC, pCompForm: ?*COMPOSITIONFORM) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetCompositionWindow(@ptrCast(*const IActiveIMMIME, self), hIMC, pCompForm); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetContext(self: *const T, hWnd: ?HWND, phIMC: ?*?HIMC) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetContext(@ptrCast(*const IActiveIMMIME, self), hWnd, phIMC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetConversionListA(self: *const T, hKL: ?HKL, hIMC: ?HIMC, pSrc: ?PSTR, uBufLen: u32, uFlag: u32, pDst: ?*CANDIDATELIST, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetConversionListA(@ptrCast(*const IActiveIMMIME, self), hKL, hIMC, pSrc, uBufLen, uFlag, pDst, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetConversionListW(self: *const T, hKL: ?HKL, hIMC: ?HIMC, pSrc: ?PWSTR, uBufLen: u32, uFlag: u32, pDst: ?*CANDIDATELIST, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetConversionListW(@ptrCast(*const IActiveIMMIME, self), hKL, hIMC, pSrc, uBufLen, uFlag, pDst, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetConversionStatus(self: *const T, hIMC: ?HIMC, pfdwConversion: ?*u32, pfdwSentence: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetConversionStatus(@ptrCast(*const IActiveIMMIME, self), hIMC, pfdwConversion, pfdwSentence); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetDefaultIMEWnd(self: *const T, hWnd: ?HWND, phDefWnd: ?*?HWND) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetDefaultIMEWnd(@ptrCast(*const IActiveIMMIME, self), hWnd, phDefWnd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetDescriptionA(self: *const T, hKL: ?HKL, uBufLen: u32, szDescription: ?PSTR, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetDescriptionA(@ptrCast(*const IActiveIMMIME, self), hKL, uBufLen, szDescription, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetDescriptionW(self: *const T, hKL: ?HKL, uBufLen: u32, szDescription: ?PWSTR, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetDescriptionW(@ptrCast(*const IActiveIMMIME, self), hKL, uBufLen, szDescription, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetGuideLineA(self: *const T, hIMC: ?HIMC, dwIndex: u32, dwBufLen: u32, pBuf: ?PSTR, pdwResult: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetGuideLineA(@ptrCast(*const IActiveIMMIME, self), hIMC, dwIndex, dwBufLen, pBuf, pdwResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetGuideLineW(self: *const T, hIMC: ?HIMC, dwIndex: u32, dwBufLen: u32, pBuf: ?PWSTR, pdwResult: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetGuideLineW(@ptrCast(*const IActiveIMMIME, self), hIMC, dwIndex, dwBufLen, pBuf, pdwResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetIMEFileNameA(self: *const T, hKL: ?HKL, uBufLen: u32, szFileName: ?PSTR, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetIMEFileNameA(@ptrCast(*const IActiveIMMIME, self), hKL, uBufLen, szFileName, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetIMEFileNameW(self: *const T, hKL: ?HKL, uBufLen: u32, szFileName: ?PWSTR, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetIMEFileNameW(@ptrCast(*const IActiveIMMIME, self), hKL, uBufLen, szFileName, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetOpenStatus(self: *const T, hIMC: ?HIMC) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetOpenStatus(@ptrCast(*const IActiveIMMIME, self), hIMC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetProperty(self: *const T, hKL: ?HKL, fdwIndex: u32, pdwProperty: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetProperty(@ptrCast(*const IActiveIMMIME, self), hKL, fdwIndex, pdwProperty); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetRegisterWordStyleA(self: *const T, hKL: ?HKL, nItem: u32, pStyleBuf: ?*STYLEBUFA, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetRegisterWordStyleA(@ptrCast(*const IActiveIMMIME, self), hKL, nItem, pStyleBuf, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetRegisterWordStyleW(self: *const T, hKL: ?HKL, nItem: u32, pStyleBuf: ?*STYLEBUFW, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetRegisterWordStyleW(@ptrCast(*const IActiveIMMIME, self), hKL, nItem, pStyleBuf, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetStatusWindowPos(self: *const T, hIMC: ?HIMC, pptPos: ?*POINT) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetStatusWindowPos(@ptrCast(*const IActiveIMMIME, self), hIMC, pptPos); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetVirtualKey(self: *const T, hWnd: ?HWND, puVirtualKey: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetVirtualKey(@ptrCast(*const IActiveIMMIME, self), hWnd, puVirtualKey); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_InstallIMEA(self: *const T, szIMEFileName: ?PSTR, szLayoutText: ?PSTR, phKL: ?*?HKL) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).InstallIMEA(@ptrCast(*const IActiveIMMIME, self), szIMEFileName, szLayoutText, phKL); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_InstallIMEW(self: *const T, szIMEFileName: ?PWSTR, szLayoutText: ?PWSTR, phKL: ?*?HKL) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).InstallIMEW(@ptrCast(*const IActiveIMMIME, self), szIMEFileName, szLayoutText, phKL); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_IsIME(self: *const T, hKL: ?HKL) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).IsIME(@ptrCast(*const IActiveIMMIME, self), hKL); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_IsUIMessageA(self: *const T, hWndIME: ?HWND, msg: u32, wParam: WPARAM, lParam: LPARAM) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).IsUIMessageA(@ptrCast(*const IActiveIMMIME, self), hWndIME, msg, wParam, lParam); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_IsUIMessageW(self: *const T, hWndIME: ?HWND, msg: u32, wParam: WPARAM, lParam: LPARAM) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).IsUIMessageW(@ptrCast(*const IActiveIMMIME, self), hWndIME, msg, wParam, lParam); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_NotifyIME(self: *const T, hIMC: ?HIMC, dwAction: u32, dwIndex: u32, dwValue: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).NotifyIME(@ptrCast(*const IActiveIMMIME, self), hIMC, dwAction, dwIndex, dwValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_RegisterWordA(self: *const T, hKL: ?HKL, szReading: ?PSTR, dwStyle: u32, szRegister: ?PSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).RegisterWordA(@ptrCast(*const IActiveIMMIME, self), hKL, szReading, dwStyle, szRegister); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_RegisterWordW(self: *const T, hKL: ?HKL, szReading: ?PWSTR, dwStyle: u32, szRegister: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).RegisterWordW(@ptrCast(*const IActiveIMMIME, self), hKL, szReading, dwStyle, szRegister); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_ReleaseContext(self: *const T, hWnd: ?HWND, hIMC: ?HIMC) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).ReleaseContext(@ptrCast(*const IActiveIMMIME, self), hWnd, hIMC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_SetCandidateWindow(self: *const T, hIMC: ?HIMC, pCandidate: ?*CANDIDATEFORM) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).SetCandidateWindow(@ptrCast(*const IActiveIMMIME, self), hIMC, pCandidate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_SetCompositionFontA(self: *const T, hIMC: ?HIMC, plf: ?*LOGFONTA) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).SetCompositionFontA(@ptrCast(*const IActiveIMMIME, self), hIMC, plf); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_SetCompositionFontW(self: *const T, hIMC: ?HIMC, plf: ?*LOGFONTW) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).SetCompositionFontW(@ptrCast(*const IActiveIMMIME, self), hIMC, plf); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_SetCompositionStringA(self: *const T, hIMC: ?HIMC, dwIndex: u32, pComp: ?*c_void, dwCompLen: u32, pRead: ?*c_void, dwReadLen: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).SetCompositionStringA(@ptrCast(*const IActiveIMMIME, self), hIMC, dwIndex, pComp, dwCompLen, pRead, dwReadLen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_SetCompositionStringW(self: *const T, hIMC: ?HIMC, dwIndex: u32, pComp: ?*c_void, dwCompLen: u32, pRead: ?*c_void, dwReadLen: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).SetCompositionStringW(@ptrCast(*const IActiveIMMIME, self), hIMC, dwIndex, pComp, dwCompLen, pRead, dwReadLen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_SetCompositionWindow(self: *const T, hIMC: ?HIMC, pCompForm: ?*COMPOSITIONFORM) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).SetCompositionWindow(@ptrCast(*const IActiveIMMIME, self), hIMC, pCompForm); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_SetConversionStatus(self: *const T, hIMC: ?HIMC, fdwConversion: u32, fdwSentence: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).SetConversionStatus(@ptrCast(*const IActiveIMMIME, self), hIMC, fdwConversion, fdwSentence); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_SetOpenStatus(self: *const T, hIMC: ?HIMC, fOpen: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).SetOpenStatus(@ptrCast(*const IActiveIMMIME, self), hIMC, fOpen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_SetStatusWindowPos(self: *const T, hIMC: ?HIMC, pptPos: ?*POINT) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).SetStatusWindowPos(@ptrCast(*const IActiveIMMIME, self), hIMC, pptPos); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_SimulateHotKey(self: *const T, hWnd: ?HWND, dwHotKeyID: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).SimulateHotKey(@ptrCast(*const IActiveIMMIME, self), hWnd, dwHotKeyID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_UnregisterWordA(self: *const T, hKL: ?HKL, szReading: ?PSTR, dwStyle: u32, szUnregister: ?PSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).UnregisterWordA(@ptrCast(*const IActiveIMMIME, self), hKL, szReading, dwStyle, szUnregister); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_UnregisterWordW(self: *const T, hKL: ?HKL, szReading: ?PWSTR, dwStyle: u32, szUnregister: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).UnregisterWordW(@ptrCast(*const IActiveIMMIME, self), hKL, szReading, dwStyle, szUnregister); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GenerateMessage(self: *const T, hIMC: ?HIMC) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GenerateMessage(@ptrCast(*const IActiveIMMIME, self), hIMC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_LockIMC(self: *const T, hIMC: ?HIMC, ppIMC: ?*?*INPUTCONTEXT) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).LockIMC(@ptrCast(*const IActiveIMMIME, self), hIMC, ppIMC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_UnlockIMC(self: *const T, hIMC: ?HIMC) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).UnlockIMC(@ptrCast(*const IActiveIMMIME, self), hIMC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetIMCLockCount(self: *const T, hIMC: ?HIMC, pdwLockCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetIMCLockCount(@ptrCast(*const IActiveIMMIME, self), hIMC, pdwLockCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_CreateIMCC(self: *const T, dwSize: u32, phIMCC: ?*?HIMCC) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).CreateIMCC(@ptrCast(*const IActiveIMMIME, self), dwSize, phIMCC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_DestroyIMCC(self: *const T, hIMCC: ?HIMCC) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).DestroyIMCC(@ptrCast(*const IActiveIMMIME, self), hIMCC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_LockIMCC(self: *const T, hIMCC: ?HIMCC, ppv: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).LockIMCC(@ptrCast(*const IActiveIMMIME, self), hIMCC, ppv); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_UnlockIMCC(self: *const T, hIMCC: ?HIMCC) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).UnlockIMCC(@ptrCast(*const IActiveIMMIME, self), hIMCC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_ReSizeIMCC(self: *const T, hIMCC: ?HIMCC, dwSize: u32, phIMCC: ?*?HIMCC) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).ReSizeIMCC(@ptrCast(*const IActiveIMMIME, self), hIMCC, dwSize, phIMCC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetIMCCSize(self: *const T, hIMCC: ?HIMCC, pdwSize: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetIMCCSize(@ptrCast(*const IActiveIMMIME, self), hIMCC, pdwSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetIMCCLockCount(self: *const T, hIMCC: ?HIMCC, pdwLockCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetIMCCLockCount(@ptrCast(*const IActiveIMMIME, self), hIMCC, pdwLockCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetHotKey(self: *const T, dwHotKeyID: u32, puModifiers: ?*u32, puVKey: ?*u32, phKL: ?*?HKL) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetHotKey(@ptrCast(*const IActiveIMMIME, self), dwHotKeyID, puModifiers, puVKey, phKL); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_SetHotKey(self: *const T, dwHotKeyID: u32, uModifiers: u32, uVKey: u32, hKL: ?HKL) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).SetHotKey(@ptrCast(*const IActiveIMMIME, self), dwHotKeyID, uModifiers, uVKey, hKL); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_CreateSoftKeyboard(self: *const T, uType: u32, hOwner: ?HWND, x: i32, y: i32, phSoftKbdWnd: ?*?HWND) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).CreateSoftKeyboard(@ptrCast(*const IActiveIMMIME, self), uType, hOwner, x, y, phSoftKbdWnd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_DestroySoftKeyboard(self: *const T, hSoftKbdWnd: ?HWND) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).DestroySoftKeyboard(@ptrCast(*const IActiveIMMIME, self), hSoftKbdWnd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_ShowSoftKeyboard(self: *const T, hSoftKbdWnd: ?HWND, nCmdShow: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).ShowSoftKeyboard(@ptrCast(*const IActiveIMMIME, self), hSoftKbdWnd, nCmdShow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetCodePageA(self: *const T, hKL: ?HKL, uCodePage: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetCodePageA(@ptrCast(*const IActiveIMMIME, self), hKL, uCodePage); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetLangId(self: *const T, hKL: ?HKL, plid: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetLangId(@ptrCast(*const IActiveIMMIME, self), hKL, plid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_KeybdEvent(self: *const T, lgidIME: u16, bVk: u8, bScan: u8, dwFlags: u32, dwExtraInfo: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).KeybdEvent(@ptrCast(*const IActiveIMMIME, self), lgidIME, bVk, bScan, dwFlags, dwExtraInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_LockModal(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).LockModal(@ptrCast(*const IActiveIMMIME, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_UnlockModal(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).UnlockModal(@ptrCast(*const IActiveIMMIME, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_AssociateContextEx(self: *const T, hWnd: ?HWND, hIMC: ?HIMC, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).AssociateContextEx(@ptrCast(*const IActiveIMMIME, self), hWnd, hIMC, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_DisableIME(self: *const T, idThread: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).DisableIME(@ptrCast(*const IActiveIMMIME, self), idThread); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetImeMenuItemsA(self: *const T, hIMC: ?HIMC, dwFlags: u32, dwType: u32, pImeParentMenu: ?*IMEMENUITEMINFOA, pImeMenu: ?*IMEMENUITEMINFOA, dwSize: u32, pdwResult: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetImeMenuItemsA(@ptrCast(*const IActiveIMMIME, self), hIMC, dwFlags, dwType, pImeParentMenu, pImeMenu, dwSize, pdwResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_GetImeMenuItemsW(self: *const T, hIMC: ?HIMC, dwFlags: u32, dwType: u32, pImeParentMenu: ?*IMEMENUITEMINFOW, pImeMenu: ?*IMEMENUITEMINFOW, dwSize: u32, pdwResult: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).GetImeMenuItemsW(@ptrCast(*const IActiveIMMIME, self), hIMC, dwFlags, dwType, pImeParentMenu, pImeMenu, dwSize, pdwResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_EnumInputContext(self: *const T, idThread: u32, ppEnum: ?*?*IEnumInputContext) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).EnumInputContext(@ptrCast(*const IActiveIMMIME, self), idThread, ppEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_RequestMessageA(self: *const T, hIMC: ?HIMC, wParam: WPARAM, lParam: LPARAM, plResult: ?*LRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).RequestMessageA(@ptrCast(*const IActiveIMMIME, self), hIMC, wParam, lParam, plResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_RequestMessageW(self: *const T, hIMC: ?HIMC, wParam: WPARAM, lParam: LPARAM, plResult: ?*LRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).RequestMessageW(@ptrCast(*const IActiveIMMIME, self), hIMC, wParam, lParam, plResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_SendIMCA(self: *const T, hWnd: ?HWND, uMsg: u32, wParam: WPARAM, lParam: LPARAM, plResult: ?*LRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).SendIMCA(@ptrCast(*const IActiveIMMIME, self), hWnd, uMsg, wParam, lParam, plResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_SendIMCW(self: *const T, hWnd: ?HWND, uMsg: u32, wParam: WPARAM, lParam: LPARAM, plResult: ?*LRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).SendIMCW(@ptrCast(*const IActiveIMMIME, self), hWnd, uMsg, wParam, lParam, plResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIMMIME_IsSleeping(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIMMIME.VTable, self.vtable).IsSleeping(@ptrCast(*const IActiveIMMIME, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IActiveIME_Value = @import("zig.zig").Guid.initString("6fe20962-d077-11d0-8fe7-00aa006bcc59"); pub const IID_IActiveIME = &IID_IActiveIME_Value; pub const IActiveIME = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Inquire: fn( self: *const IActiveIME, dwSystemInfoFlags: u32, pIMEInfo: ?*IMEINFO, szWndClass: ?PWSTR, pdwPrivate: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ConversionList: fn( self: *const IActiveIME, hIMC: ?HIMC, szSource: ?PWSTR, uFlag: u32, uBufLen: u32, pDest: ?*CANDIDATELIST, puCopied: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Configure: fn( self: *const IActiveIME, hKL: ?HKL, hWnd: ?HWND, dwMode: u32, pRegisterWord: ?*REGISTERWORDW, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Destroy: fn( self: *const IActiveIME, uReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Escape: fn( self: *const IActiveIME, hIMC: ?HIMC, uEscape: u32, pData: ?*c_void, plResult: ?*LRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetActiveContext: fn( self: *const IActiveIME, hIMC: ?HIMC, fFlag: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ProcessKey: fn( self: *const IActiveIME, hIMC: ?HIMC, uVirKey: u32, lParam: u32, pbKeyState: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Notify: fn( self: *const IActiveIME, hIMC: ?HIMC, dwAction: u32, dwIndex: u32, dwValue: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Select: fn( self: *const IActiveIME, hIMC: ?HIMC, fSelect: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCompositionString: fn( self: *const IActiveIME, hIMC: ?HIMC, dwIndex: u32, pComp: ?*c_void, dwCompLen: u32, pRead: ?*c_void, dwReadLen: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ToAsciiEx: fn( self: *const IActiveIME, uVirKey: u32, uScanCode: u32, pbKeyState: ?*u8, fuState: u32, hIMC: ?HIMC, pdwTransBuf: ?*u32, puSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterWord: fn( self: *const IActiveIME, szReading: ?PWSTR, dwStyle: u32, szString: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnregisterWord: fn( self: *const IActiveIME, szReading: ?PWSTR, dwStyle: u32, szString: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRegisterWordStyle: fn( self: *const IActiveIME, nItem: u32, pStyleBuf: ?*STYLEBUFW, puBufSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumRegisterWord: fn( self: *const IActiveIME, szReading: ?PWSTR, dwStyle: u32, szRegister: ?PWSTR, pData: ?*c_void, ppEnum: ?*?*IEnumRegisterWordW, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCodePageA: fn( self: *const IActiveIME, uCodePage: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLangId: fn( self: *const IActiveIME, plid: ?*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 IActiveIME_Inquire(self: *const T, dwSystemInfoFlags: u32, pIMEInfo: ?*IMEINFO, szWndClass: ?PWSTR, pdwPrivate: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIME.VTable, self.vtable).Inquire(@ptrCast(*const IActiveIME, self), dwSystemInfoFlags, pIMEInfo, szWndClass, pdwPrivate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIME_ConversionList(self: *const T, hIMC: ?HIMC, szSource: ?PWSTR, uFlag: u32, uBufLen: u32, pDest: ?*CANDIDATELIST, puCopied: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIME.VTable, self.vtable).ConversionList(@ptrCast(*const IActiveIME, self), hIMC, szSource, uFlag, uBufLen, pDest, puCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIME_Configure(self: *const T, hKL: ?HKL, hWnd: ?HWND, dwMode: u32, pRegisterWord: ?*REGISTERWORDW) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIME.VTable, self.vtable).Configure(@ptrCast(*const IActiveIME, self), hKL, hWnd, dwMode, pRegisterWord); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIME_Destroy(self: *const T, uReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIME.VTable, self.vtable).Destroy(@ptrCast(*const IActiveIME, self), uReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIME_Escape(self: *const T, hIMC: ?HIMC, uEscape: u32, pData: ?*c_void, plResult: ?*LRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIME.VTable, self.vtable).Escape(@ptrCast(*const IActiveIME, self), hIMC, uEscape, pData, plResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIME_SetActiveContext(self: *const T, hIMC: ?HIMC, fFlag: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIME.VTable, self.vtable).SetActiveContext(@ptrCast(*const IActiveIME, self), hIMC, fFlag); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIME_ProcessKey(self: *const T, hIMC: ?HIMC, uVirKey: u32, lParam: u32, pbKeyState: ?*u8) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIME.VTable, self.vtable).ProcessKey(@ptrCast(*const IActiveIME, self), hIMC, uVirKey, lParam, pbKeyState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIME_Notify(self: *const T, hIMC: ?HIMC, dwAction: u32, dwIndex: u32, dwValue: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIME.VTable, self.vtable).Notify(@ptrCast(*const IActiveIME, self), hIMC, dwAction, dwIndex, dwValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIME_Select(self: *const T, hIMC: ?HIMC, fSelect: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIME.VTable, self.vtable).Select(@ptrCast(*const IActiveIME, self), hIMC, fSelect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIME_SetCompositionString(self: *const T, hIMC: ?HIMC, dwIndex: u32, pComp: ?*c_void, dwCompLen: u32, pRead: ?*c_void, dwReadLen: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIME.VTable, self.vtable).SetCompositionString(@ptrCast(*const IActiveIME, self), hIMC, dwIndex, pComp, dwCompLen, pRead, dwReadLen); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIME_ToAsciiEx(self: *const T, uVirKey: u32, uScanCode: u32, pbKeyState: ?*u8, fuState: u32, hIMC: ?HIMC, pdwTransBuf: ?*u32, puSize: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIME.VTable, self.vtable).ToAsciiEx(@ptrCast(*const IActiveIME, self), uVirKey, uScanCode, pbKeyState, fuState, hIMC, pdwTransBuf, puSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIME_RegisterWord(self: *const T, szReading: ?PWSTR, dwStyle: u32, szString: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIME.VTable, self.vtable).RegisterWord(@ptrCast(*const IActiveIME, self), szReading, dwStyle, szString); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIME_UnregisterWord(self: *const T, szReading: ?PWSTR, dwStyle: u32, szString: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIME.VTable, self.vtable).UnregisterWord(@ptrCast(*const IActiveIME, self), szReading, dwStyle, szString); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIME_GetRegisterWordStyle(self: *const T, nItem: u32, pStyleBuf: ?*STYLEBUFW, puBufSize: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIME.VTable, self.vtable).GetRegisterWordStyle(@ptrCast(*const IActiveIME, self), nItem, pStyleBuf, puBufSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIME_EnumRegisterWord(self: *const T, szReading: ?PWSTR, dwStyle: u32, szRegister: ?PWSTR, pData: ?*c_void, ppEnum: ?*?*IEnumRegisterWordW) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIME.VTable, self.vtable).EnumRegisterWord(@ptrCast(*const IActiveIME, self), szReading, dwStyle, szRegister, pData, ppEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIME_GetCodePageA(self: *const T, uCodePage: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIME.VTable, self.vtable).GetCodePageA(@ptrCast(*const IActiveIME, self), uCodePage); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIME_GetLangId(self: *const T, plid: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIME.VTable, self.vtable).GetLangId(@ptrCast(*const IActiveIME, self), plid); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IActiveIME2_Value = @import("zig.zig").Guid.initString("e1c4bf0e-2d53-11d2-93e1-0060b067b86e"); pub const IID_IActiveIME2 = &IID_IActiveIME2_Value; pub const IActiveIME2 = extern struct { pub const VTable = extern struct { base: IActiveIME.VTable, Sleep: fn( self: *const IActiveIME2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unsleep: fn( self: *const IActiveIME2, fDead: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IActiveIME.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIME2_Sleep(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIME2.VTable, self.vtable).Sleep(@ptrCast(*const IActiveIME2, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActiveIME2_Unsleep(self: *const T, fDead: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IActiveIME2.VTable, self.vtable).Unsleep(@ptrCast(*const IActiveIME2, self), fDead); } };} pub usingnamespace MethodMixin(@This()); }; //-------------------------------------------------------------------------------- // Section: Functions (1237) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows5.0' pub extern "GDI32" fn GetTextCharset( hdc: ?HDC, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "GDI32" fn GetTextCharsetInfo( hdc: ?HDC, lpSig: ?*FONTSIGNATURE, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "GDI32" fn TranslateCharsetInfo( lpSrc: ?*u32, lpCs: ?*CHARSETINFO, dwFlags: TRANSLATE_CHARSET_INFO_FLAGS, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetDateFormatA( Locale: u32, dwFlags: u32, lpDate: ?*const SYSTEMTIME, lpFormat: ?[*:0]const u8, lpDateStr: ?[*:0]u8, cchDate: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetDateFormatW( Locale: u32, dwFlags: u32, lpDate: ?*const SYSTEMTIME, lpFormat: ?[*:0]const u16, lpDateStr: ?[*:0]u16, cchDate: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetTimeFormatA( Locale: u32, dwFlags: u32, lpTime: ?*const SYSTEMTIME, lpFormat: ?[*:0]const u8, lpTimeStr: ?[*:0]u8, cchTime: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetTimeFormatW( Locale: u32, dwFlags: u32, lpTime: ?*const SYSTEMTIME, lpFormat: ?[*:0]const u16, lpTimeStr: ?[*:0]u16, cchTime: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetTimeFormatEx( lpLocaleName: ?[*:0]const u16, dwFlags: TIME_FORMAT_FLAGS, lpTime: ?*const SYSTEMTIME, lpFormat: ?[*:0]const u16, lpTimeStr: ?[*:0]u16, cchTime: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetDateFormatEx( lpLocaleName: ?[*:0]const u16, dwFlags: ENUM_DATE_FORMATS_FLAGS, lpDate: ?*const SYSTEMTIME, lpFormat: ?[*:0]const u16, lpDateStr: ?[*:0]u16, cchDate: i32, lpCalendar: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetDurationFormatEx( lpLocaleName: ?[*:0]const u16, dwFlags: u32, lpDuration: ?*const SYSTEMTIME, ullDuration: u64, lpFormat: ?[*:0]const u16, lpDurationStr: ?[*:0]u16, cchDuration: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn CompareStringEx( lpLocaleName: ?[*:0]const u16, dwCmpFlags: COMPARE_STRING_FLAGS, lpString1: [*:0]const u16, cchCount1: i32, lpString2: [*:0]const u16, cchCount2: i32, lpVersionInformation: ?*NLSVERSIONINFO, lpReserved: ?*c_void, lParam: LPARAM, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn CompareStringOrdinal( lpString1: [*:0]const u16, cchCount1: i32, lpString2: [*:0]const u16, cchCount2: i32, bIgnoreCase: BOOL, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn CompareStringW( Locale: u32, dwCmpFlags: u32, lpString1: [*:0]const u16, cchCount1: i32, lpString2: [*:0]const u16, cchCount2: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn FoldStringW( dwMapFlags: FOLD_STRING_MAP_FLAGS, lpSrcStr: [*:0]const u16, cchSrc: i32, lpDestStr: ?[*:0]u16, cchDest: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetStringTypeExW( Locale: u32, dwInfoType: u32, lpSrcStr: [*:0]const u16, cchSrc: i32, lpCharType: [*:0]u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetStringTypeW( dwInfoType: u32, lpSrcStr: [*:0]const u16, cchSrc: i32, lpCharType: ?*u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn MultiByteToWideChar( CodePage: u32, dwFlags: MULTI_BYTE_TO_WIDE_CHAR_FLAGS, lpMultiByteStr: [*]const u8, cbMultiByte: i32, lpWideCharStr: ?[*:0]u16, cchWideChar: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn WideCharToMultiByte( CodePage: u32, dwFlags: u32, lpWideCharStr: [*:0]const u16, cchWideChar: i32, // TODO: what to do with BytesParamIndex 5? lpMultiByteStr: ?PSTR, cbMultiByte: i32, lpDefaultChar: ?[*]const u8, lpUsedDefaultChar: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn IsValidCodePage( CodePage: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetACP( ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetOEMCP( ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetCPInfo( CodePage: u32, lpCPInfo: ?*CPINFO, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetCPInfoExA( CodePage: u32, dwFlags: u32, lpCPInfoEx: ?*CPINFOEXA, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetCPInfoExW( CodePage: u32, dwFlags: u32, lpCPInfoEx: ?*CPINFOEXW, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn CompareStringA( Locale: u32, dwCmpFlags: u32, lpString1: [*]i8, cchCount1: i32, lpString2: [*]i8, cchCount2: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn FindNLSString( Locale: u32, dwFindNLSStringFlags: u32, lpStringSource: [*:0]const u16, cchSource: i32, lpStringValue: [*:0]const u16, cchValue: i32, pcchFound: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn LCMapStringW( Locale: u32, dwMapFlags: u32, lpSrcStr: [*:0]const u16, cchSrc: i32, lpDestStr: ?PWSTR, cchDest: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn LCMapStringA( Locale: u32, dwMapFlags: u32, lpSrcStr: [*:0]const u8, cchSrc: i32, lpDestStr: ?PSTR, cchDest: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetLocaleInfoW( Locale: u32, LCType: u32, lpLCData: ?[*:0]u16, cchData: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetLocaleInfoA( Locale: u32, LCType: u32, lpLCData: ?[*:0]u8, cchData: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn SetLocaleInfoA( Locale: u32, LCType: u32, lpLCData: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn SetLocaleInfoW( Locale: u32, LCType: u32, lpLCData: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetCalendarInfoA( Locale: u32, Calendar: u32, CalType: u32, lpCalData: ?[*:0]u8, cchData: i32, lpValue: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetCalendarInfoW( Locale: u32, Calendar: u32, CalType: u32, lpCalData: ?[*:0]u16, cchData: i32, lpValue: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn SetCalendarInfoA( Locale: u32, Calendar: u32, CalType: u32, lpCalData: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn SetCalendarInfoW( Locale: u32, Calendar: u32, CalType: u32, lpCalData: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn IsDBCSLeadByte( TestChar: u8, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn IsDBCSLeadByteEx( CodePage: u32, TestChar: u8, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn LocaleNameToLCID( lpName: ?[*:0]const u16, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn LCIDToLocaleName( Locale: u32, lpName: ?[*:0]u16, cchName: i32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetDurationFormat( Locale: u32, dwFlags: u32, lpDuration: ?*const SYSTEMTIME, ullDuration: u64, lpFormat: ?[*:0]const u16, lpDurationStr: ?[*:0]u16, cchDuration: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetNumberFormatA( Locale: u32, dwFlags: u32, lpValue: ?[*:0]const u8, lpFormat: ?*const NUMBERFMTA, lpNumberStr: ?[*:0]u8, cchNumber: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetNumberFormatW( Locale: u32, dwFlags: u32, lpValue: ?[*:0]const u16, lpFormat: ?*const NUMBERFMTW, lpNumberStr: ?[*:0]u16, cchNumber: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetCurrencyFormatA( Locale: u32, dwFlags: u32, lpValue: ?[*:0]const u8, lpFormat: ?*const CURRENCYFMTA, lpCurrencyStr: ?[*:0]u8, cchCurrency: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetCurrencyFormatW( Locale: u32, dwFlags: u32, lpValue: ?[*:0]const u16, lpFormat: ?*const CURRENCYFMTW, lpCurrencyStr: ?[*:0]u16, cchCurrency: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumCalendarInfoA( lpCalInfoEnumProc: ?CALINFO_ENUMPROCA, Locale: u32, Calendar: u32, CalType: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumCalendarInfoW( lpCalInfoEnumProc: ?CALINFO_ENUMPROCW, Locale: u32, Calendar: u32, CalType: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumCalendarInfoExA( lpCalInfoEnumProcEx: ?CALINFO_ENUMPROCEXA, Locale: u32, Calendar: u32, CalType: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumCalendarInfoExW( lpCalInfoEnumProcEx: ?CALINFO_ENUMPROCEXW, Locale: u32, Calendar: u32, CalType: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumTimeFormatsA( lpTimeFmtEnumProc: ?TIMEFMT_ENUMPROCA, Locale: u32, dwFlags: TIME_FORMAT_FLAGS, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumTimeFormatsW( lpTimeFmtEnumProc: ?TIMEFMT_ENUMPROCW, Locale: u32, dwFlags: TIME_FORMAT_FLAGS, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumDateFormatsA( lpDateFmtEnumProc: ?DATEFMT_ENUMPROCA, Locale: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumDateFormatsW( lpDateFmtEnumProc: ?DATEFMT_ENUMPROCW, Locale: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumDateFormatsExA( lpDateFmtEnumProcEx: ?DATEFMT_ENUMPROCEXA, Locale: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumDateFormatsExW( lpDateFmtEnumProcEx: ?DATEFMT_ENUMPROCEXW, Locale: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn IsValidLanguageGroup( LanguageGroup: u32, dwFlags: ENUM_SYSTEM_LANGUAGE_GROUPS_FLAGS, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetNLSVersion( Function: u32, Locale: u32, lpVersionInformation: ?*NLSVERSIONINFO, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn IsValidLocale( Locale: u32, dwFlags: IS_VALID_LOCALE_FLAGS, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn GetGeoInfoA( Location: i32, GeoType: u32, lpGeoData: ?[*:0]u8, cchData: i32, LangId: u16, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn GetGeoInfoW( Location: i32, GeoType: u32, lpGeoData: ?[*:0]u16, cchData: i32, LangId: u16, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows10.0.16299' pub extern "KERNEL32" fn GetGeoInfoEx( location: ?PWSTR, geoType: u32, geoData: ?[*:0]u16, geoDataCount: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn EnumSystemGeoID( GeoClass: u32, ParentGeoId: i32, lpGeoEnumProc: ?GEO_ENUMPROC, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows10.0.16299' pub extern "KERNEL32" fn EnumSystemGeoNames( geoClass: u32, geoEnumProc: ?GEO_ENUMNAMEPROC, data: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn GetUserGeoID( GeoClass: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows10.0.16299' pub extern "KERNEL32" fn GetUserDefaultGeoName( geoName: [*:0]u16, geoNameCount: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn SetUserGeoID( GeoId: i32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows10.0.16299' pub extern "KERNEL32" fn SetUserGeoName( geoName: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn ConvertDefaultLocale( Locale: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetSystemDefaultUILanguage( ) callconv(@import("std").os.windows.WINAPI) u16; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetThreadLocale( ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn SetThreadLocale( Locale: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetUserDefaultUILanguage( ) callconv(@import("std").os.windows.WINAPI) u16; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetUserDefaultLangID( ) callconv(@import("std").os.windows.WINAPI) u16; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetSystemDefaultLangID( ) callconv(@import("std").os.windows.WINAPI) u16; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetSystemDefaultLCID( ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetUserDefaultLCID( ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn SetThreadUILanguage( LangId: u16, ) callconv(@import("std").os.windows.WINAPI) u16; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetThreadUILanguage( ) callconv(@import("std").os.windows.WINAPI) u16; // TODO: this type is limited to platform 'windows6.1' pub extern "KERNEL32" fn GetProcessPreferredUILanguages( dwFlags: u32, pulNumLanguages: ?*u32, pwszLanguagesBuffer: ?[*]u16, pcchLanguagesBuffer: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.1' pub extern "KERNEL32" fn SetProcessPreferredUILanguages( dwFlags: u32, pwszLanguagesBuffer: ?[*]const u16, pulNumLanguages: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetUserPreferredUILanguages( dwFlags: u32, pulNumLanguages: ?*u32, pwszLanguagesBuffer: ?[*]u16, pcchLanguagesBuffer: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetSystemPreferredUILanguages( dwFlags: u32, pulNumLanguages: ?*u32, pwszLanguagesBuffer: ?[*]u16, pcchLanguagesBuffer: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetThreadPreferredUILanguages( dwFlags: u32, pulNumLanguages: ?*u32, pwszLanguagesBuffer: ?[*]u16, pcchLanguagesBuffer: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn SetThreadPreferredUILanguages( dwFlags: u32, pwszLanguagesBuffer: ?[*]const u16, pulNumLanguages: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetFileMUIInfo( dwFlags: u32, pcwszFilePath: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 3? pFileMUIInfo: ?*FILEMUIINFO, pcbFileMUIInfo: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetFileMUIPath( dwFlags: u32, pcwszFilePath: ?[*:0]const u16, pwszLanguage: ?[*:0]u16, pcchLanguage: ?*u32, pwszFileMUIPath: ?[*:0]u16, pcchFileMUIPath: ?*u32, pululEnumerator: ?*u64, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetUILanguageInfo( dwFlags: u32, pwmszLanguage: ?[*]const u16, pwszFallbackLanguages: ?[*]u16, pcchFallbackLanguages: ?*u32, pAttributes: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "KERNEL32" fn SetThreadPreferredUILanguages2( flags: u32, languages: ?[*]const u16, numLanguagesSet: ?*u32, snapshot: ?*?HSAVEDUILANGUAGES, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "KERNEL32" fn RestoreThreadPreferredUILanguages( snapshot: ?HSAVEDUILANGUAGES, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows6.1' pub extern "KERNEL32" fn NotifyUILanguageChange( dwFlags: u32, pcwstrNewLanguage: ?[*:0]const u16, pcwstrPreviousLanguage: ?[*:0]const u16, dwReserved: u32, pdwStatusRtrn: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "KERNEL32" fn GetStringTypeExA( Locale: u32, dwInfoType: u32, lpSrcStr: [*:0]const u8, cchSrc: i32, lpCharType: [*:0]u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetStringTypeA( Locale: u32, dwInfoType: u32, lpSrcStr: [*:0]const u8, cchSrc: i32, lpCharType: ?*u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn FoldStringA( dwMapFlags: FOLD_STRING_MAP_FLAGS, lpSrcStr: [*:0]const u8, cchSrc: i32, lpDestStr: ?[*:0]u8, cchDest: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumSystemLocalesA( lpLocaleEnumProc: ?LOCALE_ENUMPROCA, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumSystemLocalesW( lpLocaleEnumProc: ?LOCALE_ENUMPROCW, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumSystemLanguageGroupsA( lpLanguageGroupEnumProc: ?LANGUAGEGROUP_ENUMPROCA, dwFlags: ENUM_SYSTEM_LANGUAGE_GROUPS_FLAGS, lParam: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumSystemLanguageGroupsW( lpLanguageGroupEnumProc: ?LANGUAGEGROUP_ENUMPROCW, dwFlags: ENUM_SYSTEM_LANGUAGE_GROUPS_FLAGS, lParam: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumLanguageGroupLocalesA( lpLangGroupLocaleEnumProc: ?LANGGROUPLOCALE_ENUMPROCA, LanguageGroup: u32, dwFlags: u32, lParam: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumLanguageGroupLocalesW( lpLangGroupLocaleEnumProc: ?LANGGROUPLOCALE_ENUMPROCW, LanguageGroup: u32, dwFlags: u32, lParam: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumUILanguagesA( lpUILanguageEnumProc: ?UILANGUAGE_ENUMPROCA, dwFlags: u32, lParam: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumUILanguagesW( lpUILanguageEnumProc: ?UILANGUAGE_ENUMPROCW, dwFlags: u32, lParam: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumSystemCodePagesA( lpCodePageEnumProc: ?CODEPAGE_ENUMPROCA, dwFlags: ENUM_SYSTEM_CODE_PAGES_FLAGS, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumSystemCodePagesW( lpCodePageEnumProc: ?CODEPAGE_ENUMPROCW, dwFlags: ENUM_SYSTEM_CODE_PAGES_FLAGS, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "NORMALIZ" fn IdnToAscii( dwFlags: u32, lpUnicodeCharStr: [*:0]const u16, cchUnicodeChar: i32, lpASCIICharStr: ?[*:0]u16, cchASCIIChar: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "NORMALIZ" fn IdnToUnicode( dwFlags: u32, lpASCIICharStr: [*:0]const u16, cchASCIIChar: i32, lpUnicodeCharStr: ?[*:0]u16, cchUnicodeChar: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn IdnToNameprepUnicode( dwFlags: u32, lpUnicodeCharStr: [*:0]const u16, cchUnicodeChar: i32, lpNameprepCharStr: ?[*:0]u16, cchNameprepChar: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn NormalizeString( NormForm: NORM_FORM, lpSrcString: [*:0]const u16, cwSrcLength: i32, lpDstString: ?[*:0]u16, cwDstLength: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn IsNormalizedString( NormForm: NORM_FORM, lpString: [*:0]const u16, cwLength: i32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn VerifyScripts( dwFlags: u32, lpLocaleScripts: ?[*:0]const u16, cchLocaleScripts: i32, lpTestScripts: ?[*:0]const u16, cchTestScripts: i32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetStringScripts( dwFlags: u32, lpString: ?[*:0]const u16, cchString: i32, lpScripts: ?[*:0]u16, cchScripts: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetLocaleInfoEx( lpLocaleName: ?[*:0]const u16, LCType: u32, lpLCData: ?[*:0]u16, cchData: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetCalendarInfoEx( lpLocaleName: ?[*:0]const u16, Calendar: u32, lpReserved: ?[*:0]const u16, CalType: u32, lpCalData: ?[*:0]u16, cchData: i32, lpValue: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetNumberFormatEx( lpLocaleName: ?[*:0]const u16, dwFlags: u32, lpValue: ?[*:0]const u16, lpFormat: ?*const NUMBERFMTW, lpNumberStr: ?[*:0]u16, cchNumber: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetCurrencyFormatEx( lpLocaleName: ?[*:0]const u16, dwFlags: u32, lpValue: ?[*:0]const u16, lpFormat: ?*const CURRENCYFMTW, lpCurrencyStr: ?[*:0]u16, cchCurrency: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetUserDefaultLocaleName( lpLocaleName: [*:0]u16, cchLocaleName: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetSystemDefaultLocaleName( lpLocaleName: [*:0]u16, cchLocaleName: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn IsNLSDefinedString( Function: u32, dwFlags: u32, lpVersionInformation: ?*NLSVERSIONINFO, lpString: [*:0]const u16, cchStr: i32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetNLSVersionEx( function: u32, lpLocaleName: ?[*:0]const u16, lpVersionInformation: ?*NLSVERSIONINFOEX, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.0' pub extern "KERNEL32" fn IsValidNLSVersion( function: u32, lpLocaleName: ?[*:0]const u16, lpVersionInformation: ?*NLSVERSIONINFOEX, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn FindNLSStringEx( lpLocaleName: ?[*:0]const u16, dwFindNLSStringFlags: u32, lpStringSource: [*:0]const u16, cchSource: i32, lpStringValue: [*:0]const u16, cchValue: i32, pcchFound: ?*i32, lpVersionInformation: ?*NLSVERSIONINFO, lpReserved: ?*c_void, sortHandle: LPARAM, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn LCMapStringEx( lpLocaleName: ?[*:0]const u16, dwMapFlags: u32, lpSrcStr: [*:0]const u16, cchSrc: i32, lpDestStr: ?[*:0]u16, cchDest: i32, lpVersionInformation: ?*NLSVERSIONINFO, lpReserved: ?*c_void, sortHandle: LPARAM, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn IsValidLocaleName( lpLocaleName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn EnumCalendarInfoExEx( pCalInfoEnumProcExEx: ?CALINFO_ENUMPROCEXEX, lpLocaleName: ?[*:0]const u16, Calendar: u32, lpReserved: ?[*:0]const u16, CalType: u32, lParam: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn EnumDateFormatsExEx( lpDateFmtEnumProcExEx: ?DATEFMT_ENUMPROCEXEX, lpLocaleName: ?[*:0]const u16, dwFlags: ENUM_DATE_FORMATS_FLAGS, lParam: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn EnumTimeFormatsEx( lpTimeFmtEnumProcEx: ?TIMEFMT_ENUMPROCEX, lpLocaleName: ?[*:0]const u16, dwFlags: u32, lParam: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn EnumSystemLocalesEx( lpLocaleEnumProcEx: ?LOCALE_ENUMPROCEX, dwFlags: u32, lParam: LPARAM, lpReserved: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.1' pub extern "KERNEL32" fn ResolveLocaleName( lpNameToResolve: ?[*:0]const u16, lpLocaleName: ?[*:0]u16, cchLocaleName: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmInstallIMEA( lpszIMEFileName: ?[*:0]const u8, lpszLayoutText: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?HKL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmInstallIMEW( lpszIMEFileName: ?[*:0]const u16, lpszLayoutText: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?HKL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetDefaultIMEWnd( param0: ?HWND, ) callconv(@import("std").os.windows.WINAPI) ?HWND; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetDescriptionA( param0: ?HKL, lpszDescription: ?[*:0]u8, uBufLen: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetDescriptionW( param0: ?HKL, lpszDescription: ?[*:0]u16, uBufLen: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetIMEFileNameA( param0: ?HKL, lpszFileName: ?[*:0]u8, uBufLen: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetIMEFileNameW( param0: ?HKL, lpszFileName: ?[*:0]u16, uBufLen: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetProperty( param0: ?HKL, param1: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmIsIME( param0: ?HKL, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmSimulateHotKey( param0: ?HWND, param1: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmCreateContext( ) callconv(@import("std").os.windows.WINAPI) ?HIMC; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmDestroyContext( param0: ?HIMC, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetContext( param0: ?HWND, ) callconv(@import("std").os.windows.WINAPI) ?HIMC; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmReleaseContext( param0: ?HWND, param1: ?HIMC, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmAssociateContext( param0: ?HWND, param1: ?HIMC, ) callconv(@import("std").os.windows.WINAPI) ?HIMC; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmAssociateContextEx( param0: ?HWND, param1: ?HIMC, param2: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetCompositionStringA( param0: ?HIMC, param1: u32, // TODO: what to do with BytesParamIndex 3? lpBuf: ?*c_void, dwBufLen: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetCompositionStringW( param0: ?HIMC, param1: u32, // TODO: what to do with BytesParamIndex 3? lpBuf: ?*c_void, dwBufLen: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmSetCompositionStringA( param0: ?HIMC, dwIndex: SET_COMPOSITION_STRING_TYPE, // TODO: what to do with BytesParamIndex 3? lpComp: ?*c_void, dwCompLen: u32, // TODO: what to do with BytesParamIndex 5? lpRead: ?*c_void, dwReadLen: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmSetCompositionStringW( param0: ?HIMC, dwIndex: SET_COMPOSITION_STRING_TYPE, // TODO: what to do with BytesParamIndex 3? lpComp: ?*c_void, dwCompLen: u32, // TODO: what to do with BytesParamIndex 5? lpRead: ?*c_void, dwReadLen: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetCandidateListCountA( param0: ?HIMC, lpdwListCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetCandidateListCountW( param0: ?HIMC, lpdwListCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetCandidateListA( param0: ?HIMC, deIndex: u32, // TODO: what to do with BytesParamIndex 3? lpCandList: ?*CANDIDATELIST, dwBufLen: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetCandidateListW( param0: ?HIMC, deIndex: u32, // TODO: what to do with BytesParamIndex 3? lpCandList: ?*CANDIDATELIST, dwBufLen: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetGuideLineA( param0: ?HIMC, dwIndex: GET_GUIDE_LINE_TYPE, // TODO: what to do with BytesParamIndex 3? lpBuf: ?PSTR, dwBufLen: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetGuideLineW( param0: ?HIMC, dwIndex: GET_GUIDE_LINE_TYPE, // TODO: what to do with BytesParamIndex 3? lpBuf: ?PWSTR, dwBufLen: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetConversionStatus( param0: ?HIMC, lpfdwConversion: ?*u32, lpfdwSentence: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmSetConversionStatus( param0: ?HIMC, param1: u32, param2: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetOpenStatus( param0: ?HIMC, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmSetOpenStatus( param0: ?HIMC, param1: BOOL, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetCompositionFontA( param0: ?HIMC, lplf: ?*LOGFONTA, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetCompositionFontW( param0: ?HIMC, lplf: ?*LOGFONTW, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmSetCompositionFontA( param0: ?HIMC, lplf: ?*LOGFONTA, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmSetCompositionFontW( param0: ?HIMC, lplf: ?*LOGFONTW, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmConfigureIMEA( param0: ?HKL, param1: ?HWND, param2: u32, param3: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmConfigureIMEW( param0: ?HKL, param1: ?HWND, param2: u32, param3: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmEscapeA( param0: ?HKL, param1: ?HIMC, param2: u32, param3: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) LRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmEscapeW( param0: ?HKL, param1: ?HIMC, param2: u32, param3: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) LRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetConversionListA( param0: ?HKL, param1: ?HIMC, lpSrc: ?[*:0]const u8, // TODO: what to do with BytesParamIndex 4? lpDst: ?*CANDIDATELIST, dwBufLen: u32, uFlag: GET_CONVERSION_LIST_FLAG, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetConversionListW( param0: ?HKL, param1: ?HIMC, lpSrc: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 4? lpDst: ?*CANDIDATELIST, dwBufLen: u32, uFlag: GET_CONVERSION_LIST_FLAG, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmNotifyIME( param0: ?HIMC, dwAction: NOTIFY_IME_ACTION, dwIndex: NOTIFY_IME_INDEX, dwValue: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetStatusWindowPos( param0: ?HIMC, lpptPos: ?*POINT, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmSetStatusWindowPos( param0: ?HIMC, lpptPos: ?*POINT, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetCompositionWindow( param0: ?HIMC, lpCompForm: ?*COMPOSITIONFORM, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmSetCompositionWindow( param0: ?HIMC, lpCompForm: ?*COMPOSITIONFORM, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetCandidateWindow( param0: ?HIMC, param1: u32, lpCandidate: ?*CANDIDATEFORM, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmSetCandidateWindow( param0: ?HIMC, lpCandidate: ?*CANDIDATEFORM, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmIsUIMessageA( param0: ?HWND, param1: u32, param2: WPARAM, param3: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmIsUIMessageW( param0: ?HWND, param1: u32, param2: WPARAM, param3: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetVirtualKey( param0: ?HWND, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmRegisterWordA( param0: ?HKL, lpszReading: ?[*:0]const u8, param2: u32, lpszRegister: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmRegisterWordW( param0: ?HKL, lpszReading: ?[*:0]const u16, param2: u32, lpszRegister: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmUnregisterWordA( param0: ?HKL, lpszReading: ?[*:0]const u8, param2: u32, lpszUnregister: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmUnregisterWordW( param0: ?HKL, lpszReading: ?[*:0]const u16, param2: u32, lpszUnregister: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetRegisterWordStyleA( param0: ?HKL, nItem: u32, lpStyleBuf: [*]STYLEBUFA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetRegisterWordStyleW( param0: ?HKL, nItem: u32, lpStyleBuf: [*]STYLEBUFW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmEnumRegisterWordA( param0: ?HKL, param1: ?REGISTERWORDENUMPROCA, lpszReading: ?[*:0]const u8, param3: u32, lpszRegister: ?[*:0]const u8, param5: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmEnumRegisterWordW( param0: ?HKL, param1: ?REGISTERWORDENUMPROCW, lpszReading: ?[*:0]const u16, param3: u32, lpszRegister: ?[*:0]const u16, param5: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmDisableIME( param0: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmEnumInputContext( idThread: u32, lpfn: ?IMCENUMPROC, lParam: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetImeMenuItemsA( param0: ?HIMC, param1: u32, param2: u32, lpImeParentMenu: ?*IMEMENUITEMINFOA, // TODO: what to do with BytesParamIndex 5? lpImeMenu: ?*IMEMENUITEMINFOA, dwSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmGetImeMenuItemsW( param0: ?HIMC, param1: u32, param2: u32, lpImeParentMenu: ?*IMEMENUITEMINFOW, // TODO: what to do with BytesParamIndex 5? lpImeMenu: ?*IMEMENUITEMINFOW, dwSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmDisableTextFrameService( idThread: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.0' pub extern "IMM32" fn ImmDisableLegacyIME( ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.1' pub extern "elscore" fn MappingGetServices( pOptions: ?*MAPPING_ENUM_OPTIONS, prgServices: ?*?*MAPPING_SERVICE_INFO, pdwServicesCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows6.1' pub extern "elscore" fn MappingFreeServices( pServiceInfo: ?*MAPPING_SERVICE_INFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows6.1' pub extern "elscore" fn MappingRecognizeText( pServiceInfo: ?*MAPPING_SERVICE_INFO, pszText: [*:0]const u16, dwLength: u32, dwIndex: u32, pOptions: ?*MAPPING_OPTIONS, pbag: ?*MAPPING_PROPERTY_BAG, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows6.1' pub extern "elscore" fn MappingDoAction( pBag: ?*MAPPING_PROPERTY_BAG, dwRangeIndex: u32, pszActionId: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows6.1' pub extern "elscore" fn MappingFreePropertyBag( pBag: ?*MAPPING_PROPERTY_BAG, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "IMM32" fn ImmGetHotKey( param0: u32, lpuModifiers: ?*u32, lpuVKey: ?*u32, phKL: ?*isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "IMM32" fn ImmSetHotKey( param0: u32, param1: u32, param2: u32, param3: ?HKL, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "IMM32" fn ImmGenerateMessage( param0: ?HIMC, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmRequestMessageA( param0: ?HIMC, param1: WPARAM, param2: LPARAM, ) callconv(@import("std").os.windows.WINAPI) LRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "IMM32" fn ImmRequestMessageW( param0: ?HIMC, param1: WPARAM, param2: LPARAM, ) callconv(@import("std").os.windows.WINAPI) LRESULT; pub extern "IMM32" fn ImmCreateSoftKeyboard( param0: u32, param1: ?HWND, param2: i32, param3: i32, ) callconv(@import("std").os.windows.WINAPI) ?HWND; pub extern "IMM32" fn ImmDestroySoftKeyboard( param0: ?HWND, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "IMM32" fn ImmShowSoftKeyboard( param0: ?HWND, param1: i32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "IMM32" fn ImmLockIMC( param0: ?HIMC, ) callconv(@import("std").os.windows.WINAPI) ?*INPUTCONTEXT; pub extern "IMM32" fn ImmUnlockIMC( param0: ?HIMC, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "IMM32" fn ImmGetIMCLockCount( param0: ?HIMC, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "IMM32" fn ImmCreateIMCC( param0: u32, ) callconv(@import("std").os.windows.WINAPI) ?HIMCC; pub extern "IMM32" fn ImmDestroyIMCC( param0: ?HIMCC, ) callconv(@import("std").os.windows.WINAPI) ?HIMCC; pub extern "IMM32" fn ImmLockIMCC( param0: ?HIMCC, ) callconv(@import("std").os.windows.WINAPI) ?*c_void; pub extern "IMM32" fn ImmUnlockIMCC( param0: ?HIMCC, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "IMM32" fn ImmGetIMCCLockCount( param0: ?HIMCC, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "IMM32" fn ImmReSizeIMCC( param0: ?HIMCC, param1: u32, ) callconv(@import("std").os.windows.WINAPI) ?HIMCC; pub extern "IMM32" fn ImmGetIMCCSize( param0: ?HIMCC, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptFreeCache( psc: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptItemize( pwcInChars: [*:0]const u16, cInChars: i32, cMaxItems: i32, psControl: ?*const SCRIPT_CONTROL, psState: ?*const SCRIPT_STATE, pItems: [*]SCRIPT_ITEM, pcItems: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptLayout( cRuns: i32, pbLevel: [*:0]const u8, piVisualToLogical: ?*i32, piLogicalToVisual: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptShape( hdc: ?HDC, psc: ?*?*c_void, pwcChars: [*:0]const u16, cChars: i32, cMaxGlyphs: i32, psa: ?*SCRIPT_ANALYSIS, pwOutGlyphs: [*:0]u16, pwLogClust: ?*u16, psva: [*]SCRIPT_VISATTR, pcGlyphs: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptPlace( hdc: ?HDC, psc: ?*?*c_void, pwGlyphs: [*:0]const u16, cGlyphs: i32, psva: [*]const SCRIPT_VISATTR, psa: ?*SCRIPT_ANALYSIS, piAdvance: ?*i32, pGoffset: ?*GOFFSET, pABC: ?*ABC, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptTextOut( hdc: ?HDC, psc: ?*?*c_void, x: i32, y: i32, fuOptions: u32, lprc: ?*const RECT, psa: ?*const SCRIPT_ANALYSIS, pwcReserved: ?[*:0]const u16, iReserved: i32, pwGlyphs: [*:0]const u16, cGlyphs: i32, piAdvance: [*]const i32, piJustify: ?[*]const i32, pGoffset: [*]const GOFFSET, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptJustify( psva: [*]const SCRIPT_VISATTR, piAdvance: [*]const i32, cGlyphs: i32, iDx: i32, iMinKashida: i32, piJustify: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptBreak( pwcChars: [*:0]const u16, cChars: i32, psa: ?*const SCRIPT_ANALYSIS, psla: ?*SCRIPT_LOGATTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptCPtoX( iCP: i32, fTrailing: BOOL, cChars: i32, cGlyphs: i32, pwLogClust: [*:0]const u16, psva: [*]const SCRIPT_VISATTR, piAdvance: [*]const i32, psa: ?*const SCRIPT_ANALYSIS, piX: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptXtoCP( iX: i32, cChars: i32, cGlyphs: i32, pwLogClust: [*:0]const u16, psva: [*]const SCRIPT_VISATTR, piAdvance: [*]const i32, psa: ?*const SCRIPT_ANALYSIS, piCP: ?*i32, piTrailing: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptGetLogicalWidths( psa: ?*const SCRIPT_ANALYSIS, cChars: i32, cGlyphs: i32, piGlyphWidth: [*]const i32, pwLogClust: [*:0]const u16, psva: [*]const SCRIPT_VISATTR, piDx: [*]i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptApplyLogicalWidth( piDx: [*]const i32, cChars: i32, cGlyphs: i32, pwLogClust: [*:0]const u16, psva: [*]const SCRIPT_VISATTR, piAdvance: [*]const i32, psa: ?*const SCRIPT_ANALYSIS, pABC: ?*ABC, piJustify: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptGetCMap( hdc: ?HDC, psc: ?*?*c_void, pwcInChars: [*:0]const u16, cChars: i32, dwFlags: u32, pwOutGlyphs: [*:0]u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptGetGlyphABCWidth( hdc: ?HDC, psc: ?*?*c_void, wGlyph: u16, pABC: ?*ABC, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptGetProperties( ppSp: ?*const ?*?*SCRIPT_PROPERTIES, piNumScripts: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptGetFontProperties( hdc: ?HDC, psc: ?*?*c_void, sfp: ?*SCRIPT_FONTPROPERTIES, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptCacheGetHeight( hdc: ?HDC, psc: ?*?*c_void, tmHeight: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptStringAnalyse( hdc: ?HDC, pString: ?*const c_void, cString: i32, cGlyphs: i32, iCharset: i32, dwFlags: u32, iReqWidth: i32, psControl: ?*SCRIPT_CONTROL, psState: ?*SCRIPT_STATE, piDx: ?[*]const i32, pTabdef: ?*SCRIPT_TABDEF, pbInClass: ?*const u8, pssa: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptStringFree( pssa: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptString_pSize( ssa: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) ?*SIZE; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptString_pcOutChars( ssa: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) ?*i32; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptString_pLogAttr( ssa: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) ?*SCRIPT_LOGATTR; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptStringGetOrder( ssa: ?*c_void, puOrder: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptStringCPtoX( ssa: ?*c_void, icp: i32, fTrailing: BOOL, pX: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptStringXtoCP( ssa: ?*c_void, iX: i32, piCh: ?*i32, piTrailing: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptStringGetLogicalWidths( ssa: ?*c_void, piDx: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptStringValidate( ssa: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptStringOut( ssa: ?*c_void, iX: i32, iY: i32, uOptions: ETO_OPTIONS, prc: ?*const RECT, iMinSel: i32, iMaxSel: i32, fDisabled: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptIsComplex( pwcInChars: [*:0]const u16, cInChars: i32, dwFlags: SCRIPT_IS_COMPLEX_FLAGS, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptRecordDigitSubstitution( Locale: u32, psds: ?*SCRIPT_DIGITSUBSTITUTE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "USP10" fn ScriptApplyDigitSubstitution( psds: ?*const SCRIPT_DIGITSUBSTITUTE, psc: ?*SCRIPT_CONTROL, pss: ?*SCRIPT_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "USP10" fn ScriptShapeOpenType( hdc: ?HDC, psc: ?*?*c_void, psa: ?*SCRIPT_ANALYSIS, tagScript: u32, tagLangSys: u32, rcRangeChars: ?[*]i32, rpRangeProperties: ?[*]?*textrange_properties, cRanges: i32, pwcChars: [*:0]const u16, cChars: i32, cMaxGlyphs: i32, pwLogClust: ?*u16, pCharProps: ?*script_charprop, pwOutGlyphs: [*:0]u16, pOutGlyphProps: [*]script_glyphprop, pcGlyphs: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "USP10" fn ScriptPlaceOpenType( hdc: ?HDC, psc: ?*?*c_void, psa: ?*SCRIPT_ANALYSIS, tagScript: u32, tagLangSys: u32, rcRangeChars: ?[*]i32, rpRangeProperties: ?[*]?*textrange_properties, cRanges: i32, pwcChars: [*:0]const u16, pwLogClust: [*:0]u16, pCharProps: [*]script_charprop, cChars: i32, pwGlyphs: [*:0]const u16, pGlyphProps: [*]const script_glyphprop, cGlyphs: i32, piAdvance: ?*i32, pGoffset: ?*GOFFSET, pABC: ?*ABC, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "USP10" fn ScriptItemizeOpenType( pwcInChars: [*:0]const u16, cInChars: i32, cMaxItems: i32, psControl: ?*const SCRIPT_CONTROL, psState: ?*const SCRIPT_STATE, pItems: [*]SCRIPT_ITEM, pScriptTags: [*]u32, pcItems: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "USP10" fn ScriptGetFontScriptTags( hdc: ?HDC, psc: ?*?*c_void, psa: ?*SCRIPT_ANALYSIS, cMaxTags: i32, pScriptTags: [*]u32, pcTags: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "USP10" fn ScriptGetFontLanguageTags( hdc: ?HDC, psc: ?*?*c_void, psa: ?*SCRIPT_ANALYSIS, tagScript: u32, cMaxTags: i32, pLangsysTags: [*]u32, pcTags: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "USP10" fn ScriptGetFontFeatureTags( hdc: ?HDC, psc: ?*?*c_void, psa: ?*SCRIPT_ANALYSIS, tagScript: u32, tagLangSys: u32, cMaxTags: i32, pFeatureTags: [*]u32, pcTags: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "USP10" fn ScriptGetFontAlternateGlyphs( hdc: ?HDC, psc: ?*?*c_void, psa: ?*SCRIPT_ANALYSIS, tagScript: u32, tagLangSys: u32, tagFeature: u32, wGlyphId: u16, cMaxAlternates: i32, pAlternateGlyphs: [*:0]u16, pcAlternates: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "USP10" fn ScriptSubstituteSingleGlyph( hdc: ?HDC, psc: ?*?*c_void, psa: ?*SCRIPT_ANALYSIS, tagScript: u32, tagLangSys: u32, tagFeature: u32, lParameter: i32, wGlyphId: u16, pwOutGlyphId: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "USP10" fn ScriptPositionSingleGlyph( hdc: ?HDC, psc: ?*?*c_void, psa: ?*SCRIPT_ANALYSIS, tagScript: u32, tagLangSys: u32, tagFeature: u32, lParameter: i32, wGlyphId: u16, iAdvance: i32, GOffset: GOFFSET, piOutAdvance: ?*i32, pOutGoffset: ?*GOFFSET, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "icu" fn utf8_nextCharSafeBody( s: ?*const u8, pi: ?*i32, length: i32, c: i32, strict: i8, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn utf8_appendCharSafeBody( s: ?*u8, i: i32, length: i32, c: i32, pIsError: ?*i8, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn utf8_prevCharSafeBody( s: ?*const u8, start: i32, pi: ?*i32, c: i32, strict: i8, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn utf8_back1SafeBody( s: ?*const u8, start: i32, i: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_versionFromString( versionArray: ?*u8, versionString: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn u_versionFromUString( versionArray: ?*u8, versionString: ?*const u16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn u_versionToString( versionArray: ?*const u8, versionString: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn u_getVersion( versionArray: ?*u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn u_errorName( code: UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn utrace_setLevel( traceLevel: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn utrace_getLevel( ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn utrace_setFunctions( context: ?*const c_void, e: ?UTraceEntry, x: ?UTraceExit, d: ?UTraceData, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn utrace_getFunctions( context: ?*const ?*c_void, e: ?*?UTraceEntry, x: ?*?UTraceExit, d: ?*?UTraceData, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn utrace_vformat( outBuf: ?PSTR, capacity: i32, indent: i32, fmt: ?[*:0]const u8, args: ?*i8, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn utrace_format( outBuf: ?PSTR, capacity: i32, indent: i32, fmt: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn utrace_functionName( fnNumber: i32, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn u_shapeArabic( source: ?*const u16, sourceLength: i32, dest: ?*u16, destSize: i32, options: u32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uscript_getCode( nameOrAbbrOrLocale: ?[*:0]const u8, fillIn: ?*UScriptCode, capacity: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uscript_getName( scriptCode: UScriptCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn uscript_getShortName( scriptCode: UScriptCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn uscript_getScript( codepoint: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) UScriptCode; pub extern "icu" fn uscript_hasScript( c: i32, sc: UScriptCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uscript_getScriptExtensions( c: i32, scripts: ?*UScriptCode, capacity: i32, errorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uscript_getSampleString( script: UScriptCode, dest: ?*u16, capacity: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uscript_getUsage( script: UScriptCode, ) callconv(@import("std").os.windows.WINAPI) UScriptUsage; pub extern "icu" fn uscript_isRightToLeft( script: UScriptCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uscript_breaksBetweenLetters( script: UScriptCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uscript_isCased( script: UScriptCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uiter_current32( iter: ?*UCharIterator, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uiter_next32( iter: ?*UCharIterator, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uiter_previous32( iter: ?*UCharIterator, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uiter_getState( iter: ?*const UCharIterator, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "icu" fn uiter_setState( iter: ?*UCharIterator, state: u32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uiter_setString( iter: ?*UCharIterator, s: ?*const u16, length: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uiter_setUTF16BE( iter: ?*UCharIterator, s: ?[*:0]const u8, length: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uiter_setUTF8( iter: ?*UCharIterator, s: ?[*:0]const u8, length: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uenum_close( en: ?*UEnumeration, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uenum_count( en: ?*UEnumeration, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uenum_unext( en: ?*UEnumeration, resultLength: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn uenum_next( en: ?*UEnumeration, resultLength: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn uenum_reset( en: ?*UEnumeration, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uenum_openUCharStringsEnumeration( strings: ?*const ?*u16, count: i32, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn uenum_openCharStringsEnumeration( strings: ?*const ?*i8, count: i32, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn uloc_getDefault( ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn uloc_setDefault( localeID: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uloc_getLanguage( localeID: ?[*:0]const u8, language: ?PSTR, languageCapacity: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_getScript( localeID: ?[*:0]const u8, script: ?PSTR, scriptCapacity: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_getCountry( localeID: ?[*:0]const u8, country: ?PSTR, countryCapacity: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_getVariant( localeID: ?[*:0]const u8, variant: ?PSTR, variantCapacity: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_getName( localeID: ?[*:0]const u8, name: ?PSTR, nameCapacity: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_canonicalize( localeID: ?[*:0]const u8, name: ?PSTR, nameCapacity: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_getISO3Language( localeID: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn uloc_getISO3Country( localeID: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn uloc_getLCID( localeID: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "icu" fn uloc_getDisplayLanguage( locale: ?[*:0]const u8, displayLocale: ?[*:0]const u8, language: ?*u16, languageCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_getDisplayScript( locale: ?[*:0]const u8, displayLocale: ?[*:0]const u8, script: ?*u16, scriptCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_getDisplayCountry( locale: ?[*:0]const u8, displayLocale: ?[*:0]const u8, country: ?*u16, countryCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_getDisplayVariant( locale: ?[*:0]const u8, displayLocale: ?[*:0]const u8, variant: ?*u16, variantCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_getDisplayKeyword( keyword: ?[*:0]const u8, displayLocale: ?[*:0]const u8, dest: ?*u16, destCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_getDisplayKeywordValue( locale: ?[*:0]const u8, keyword: ?[*:0]const u8, displayLocale: ?[*:0]const u8, dest: ?*u16, destCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_getDisplayName( localeID: ?[*:0]const u8, inLocaleID: ?[*:0]const u8, result: ?*u16, maxResultSize: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_getAvailable( n: i32, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn uloc_countAvailable( ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_getISOLanguages( ) callconv(@import("std").os.windows.WINAPI) ?*?*i8; pub extern "icu" fn uloc_getISOCountries( ) callconv(@import("std").os.windows.WINAPI) ?*?*i8; pub extern "icu" fn uloc_getParent( localeID: ?[*:0]const u8, parent: ?PSTR, parentCapacity: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_getBaseName( localeID: ?[*:0]const u8, name: ?PSTR, nameCapacity: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_openKeywords( localeID: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn uloc_getKeywordValue( localeID: ?[*:0]const u8, keywordName: ?[*:0]const u8, buffer: ?PSTR, bufferCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_setKeywordValue( keywordName: ?[*:0]const u8, keywordValue: ?[*:0]const u8, buffer: ?PSTR, bufferCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_isRightToLeft( locale: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uloc_getCharacterOrientation( localeId: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ULayoutType; pub extern "icu" fn uloc_getLineOrientation( localeId: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ULayoutType; pub extern "icu" fn uloc_acceptLanguageFromHTTP( result: ?PSTR, resultAvailable: i32, outResult: ?*UAcceptResult, httpAcceptLanguage: ?[*:0]const u8, availableLocales: ?*UEnumeration, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_acceptLanguage( result: ?PSTR, resultAvailable: i32, outResult: ?*UAcceptResult, acceptList: ?*const ?*i8, acceptListCount: i32, availableLocales: ?*UEnumeration, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_getLocaleForLCID( hostID: u32, locale: ?PSTR, localeCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_addLikelySubtags( localeID: ?[*:0]const u8, maximizedLocaleID: ?PSTR, maximizedLocaleIDCapacity: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_minimizeSubtags( localeID: ?[*:0]const u8, minimizedLocaleID: ?PSTR, minimizedLocaleIDCapacity: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_forLanguageTag( langtag: ?[*:0]const u8, localeID: ?PSTR, localeIDCapacity: i32, parsedLength: ?*i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_toLanguageTag( localeID: ?[*:0]const u8, langtag: ?PSTR, langtagCapacity: i32, strict: i8, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uloc_toUnicodeLocaleKey( keyword: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn uloc_toUnicodeLocaleType( keyword: ?[*:0]const u8, value: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn uloc_toLegacyKey( keyword: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn uloc_toLegacyType( keyword: ?[*:0]const u8, value: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ures_open( packageName: ?[*:0]const u8, locale: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UResourceBundle; pub extern "icu" fn ures_openDirect( packageName: ?[*:0]const u8, locale: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UResourceBundle; pub extern "icu" fn ures_openU( packageName: ?*const u16, locale: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UResourceBundle; pub extern "icu" fn ures_close( resourceBundle: ?*UResourceBundle, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ures_getVersion( resB: ?*const UResourceBundle, versionInfo: ?*u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ures_getLocaleByType( resourceBundle: ?*const UResourceBundle, type: ULocDataLocaleType, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ures_getString( resourceBundle: ?*const UResourceBundle, len: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn ures_getUTF8String( resB: ?*const UResourceBundle, dest: ?PSTR, length: ?*i32, forceCopy: i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ures_getBinary( resourceBundle: ?*const UResourceBundle, len: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "icu" fn ures_getIntVector( resourceBundle: ?*const UResourceBundle, len: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*i32; pub extern "icu" fn ures_getUInt( resourceBundle: ?*const UResourceBundle, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "icu" fn ures_getInt( resourceBundle: ?*const UResourceBundle, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ures_getSize( resourceBundle: ?*const UResourceBundle, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ures_getType( resourceBundle: ?*const UResourceBundle, ) callconv(@import("std").os.windows.WINAPI) UResType; pub extern "icu" fn ures_getKey( resourceBundle: ?*const UResourceBundle, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ures_resetIterator( resourceBundle: ?*UResourceBundle, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ures_hasNext( resourceBundle: ?*const UResourceBundle, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ures_getNextResource( resourceBundle: ?*UResourceBundle, fillIn: ?*UResourceBundle, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UResourceBundle; pub extern "icu" fn ures_getNextString( resourceBundle: ?*UResourceBundle, len: ?*i32, key: ?*const ?*i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn ures_getByIndex( resourceBundle: ?*const UResourceBundle, indexR: i32, fillIn: ?*UResourceBundle, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UResourceBundle; pub extern "icu" fn ures_getStringByIndex( resourceBundle: ?*const UResourceBundle, indexS: i32, len: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn ures_getUTF8StringByIndex( resB: ?*const UResourceBundle, stringIndex: i32, dest: ?PSTR, pLength: ?*i32, forceCopy: i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ures_getByKey( resourceBundle: ?*const UResourceBundle, key: ?[*:0]const u8, fillIn: ?*UResourceBundle, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UResourceBundle; pub extern "icu" fn ures_getStringByKey( resB: ?*const UResourceBundle, key: ?[*:0]const u8, len: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn ures_getUTF8StringByKey( resB: ?*const UResourceBundle, key: ?[*:0]const u8, dest: ?PSTR, pLength: ?*i32, forceCopy: i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ures_openAvailableLocales( packageName: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn uldn_open( locale: ?[*:0]const u8, dialectHandling: UDialectHandling, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*ULocaleDisplayNames; pub extern "icu" fn uldn_close( ldn: ?*ULocaleDisplayNames, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uldn_getLocale( ldn: ?*const ULocaleDisplayNames, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn uldn_getDialectHandling( ldn: ?*const ULocaleDisplayNames, ) callconv(@import("std").os.windows.WINAPI) UDialectHandling; pub extern "icu" fn uldn_localeDisplayName( ldn: ?*const ULocaleDisplayNames, locale: ?[*:0]const u8, result: ?*u16, maxResultSize: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uldn_languageDisplayName( ldn: ?*const ULocaleDisplayNames, lang: ?[*:0]const u8, result: ?*u16, maxResultSize: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uldn_scriptDisplayName( ldn: ?*const ULocaleDisplayNames, script: ?[*:0]const u8, result: ?*u16, maxResultSize: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uldn_scriptCodeDisplayName( ldn: ?*const ULocaleDisplayNames, scriptCode: UScriptCode, result: ?*u16, maxResultSize: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uldn_regionDisplayName( ldn: ?*const ULocaleDisplayNames, region: ?[*:0]const u8, result: ?*u16, maxResultSize: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uldn_variantDisplayName( ldn: ?*const ULocaleDisplayNames, variant: ?[*:0]const u8, result: ?*u16, maxResultSize: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uldn_keyDisplayName( ldn: ?*const ULocaleDisplayNames, key: ?[*:0]const u8, result: ?*u16, maxResultSize: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uldn_keyValueDisplayName( ldn: ?*const ULocaleDisplayNames, key: ?[*:0]const u8, value: ?[*:0]const u8, result: ?*u16, maxResultSize: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uldn_openForContext( locale: ?[*:0]const u8, contexts: ?*UDisplayContext, length: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*ULocaleDisplayNames; pub extern "icu" fn uldn_getContext( ldn: ?*const ULocaleDisplayNames, type: UDisplayContextType, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) UDisplayContext; pub extern "icu" fn ucurr_forLocale( locale: ?[*:0]const u8, buff: ?*u16, buffCapacity: i32, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucurr_register( isoCode: ?*const u16, locale: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*c_void; pub extern "icu" fn ucurr_unregister( key: ?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ucurr_getName( currency: ?*const u16, locale: ?[*:0]const u8, nameStyle: UCurrNameStyle, isChoiceFormat: ?*i8, len: ?*i32, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn ucurr_getPluralName( currency: ?*const u16, locale: ?[*:0]const u8, isChoiceFormat: ?*i8, pluralCount: ?[*:0]const u8, len: ?*i32, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn ucurr_getDefaultFractionDigits( currency: ?*const u16, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucurr_getDefaultFractionDigitsForUsage( currency: ?*const u16, usage: UCurrencyUsage, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucurr_getRoundingIncrement( currency: ?*const u16, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) f64; pub extern "icu" fn ucurr_getRoundingIncrementForUsage( currency: ?*const u16, usage: UCurrencyUsage, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) f64; pub extern "icu" fn ucurr_openISOCurrencies( currType: u32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn ucurr_isAvailable( isoCode: ?*const u16, from: f64, to: f64, errorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ucurr_countCurrencies( locale: ?[*:0]const u8, date: f64, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucurr_forLocaleAndDate( locale: ?[*:0]const u8, date: f64, index: i32, buff: ?*u16, buffCapacity: i32, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucurr_getKeywordValuesForLocale( key: ?[*:0]const u8, locale: ?[*:0]const u8, commonlyUsed: i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn ucurr_getNumericCode( currency: ?*const u16, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn UCNV_FROM_U_CALLBACK_STOP( context: ?*const c_void, fromUArgs: ?*UConverterFromUnicodeArgs, codeUnits: ?*const u16, length: i32, codePoint: i32, reason: UConverterCallbackReason, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn UCNV_TO_U_CALLBACK_STOP( context: ?*const c_void, toUArgs: ?*UConverterToUnicodeArgs, codeUnits: ?[*:0]const u8, length: i32, reason: UConverterCallbackReason, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn UCNV_FROM_U_CALLBACK_SKIP( context: ?*const c_void, fromUArgs: ?*UConverterFromUnicodeArgs, codeUnits: ?*const u16, length: i32, codePoint: i32, reason: UConverterCallbackReason, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn UCNV_FROM_U_CALLBACK_SUBSTITUTE( context: ?*const c_void, fromUArgs: ?*UConverterFromUnicodeArgs, codeUnits: ?*const u16, length: i32, codePoint: i32, reason: UConverterCallbackReason, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn UCNV_FROM_U_CALLBACK_ESCAPE( context: ?*const c_void, fromUArgs: ?*UConverterFromUnicodeArgs, codeUnits: ?*const u16, length: i32, codePoint: i32, reason: UConverterCallbackReason, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn UCNV_TO_U_CALLBACK_SKIP( context: ?*const c_void, toUArgs: ?*UConverterToUnicodeArgs, codeUnits: ?[*:0]const u8, length: i32, reason: UConverterCallbackReason, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn UCNV_TO_U_CALLBACK_SUBSTITUTE( context: ?*const c_void, toUArgs: ?*UConverterToUnicodeArgs, codeUnits: ?[*:0]const u8, length: i32, reason: UConverterCallbackReason, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn UCNV_TO_U_CALLBACK_ESCAPE( context: ?*const c_void, toUArgs: ?*UConverterToUnicodeArgs, codeUnits: ?[*:0]const u8, length: i32, reason: UConverterCallbackReason, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_compareNames( name1: ?[*:0]const u8, name2: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucnv_open( converterName: ?[*:0]const u8, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UConverter; pub extern "icu" fn ucnv_openU( name: ?*const u16, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UConverter; pub extern "icu" fn ucnv_openCCSID( codepage: i32, platform: UConverterPlatform, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UConverter; pub extern "icu" fn ucnv_openPackage( packageName: ?[*:0]const u8, converterName: ?[*:0]const u8, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UConverter; pub extern "icu" fn ucnv_safeClone( cnv: ?*const UConverter, stackBuffer: ?*c_void, pBufferSize: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UConverter; pub extern "icu" fn ucnv_close( converter: ?*UConverter, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_getSubstChars( converter: ?*const UConverter, subChars: ?PSTR, len: ?*i8, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_setSubstChars( converter: ?*UConverter, subChars: ?[*:0]const u8, len: i8, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_setSubstString( cnv: ?*UConverter, s: ?*const u16, length: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_getInvalidChars( converter: ?*const UConverter, errBytes: ?PSTR, len: ?*i8, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_getInvalidUChars( converter: ?*const UConverter, errUChars: ?*u16, len: ?*i8, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_reset( converter: ?*UConverter, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_resetToUnicode( converter: ?*UConverter, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_resetFromUnicode( converter: ?*UConverter, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_getMaxCharSize( converter: ?*const UConverter, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ucnv_getMinCharSize( converter: ?*const UConverter, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ucnv_getDisplayName( converter: ?*const UConverter, displayLocale: ?[*:0]const u8, displayName: ?*u16, displayNameCapacity: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucnv_getName( converter: ?*const UConverter, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ucnv_getCCSID( converter: ?*const UConverter, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucnv_getPlatform( converter: ?*const UConverter, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) UConverterPlatform; pub extern "icu" fn ucnv_getType( converter: ?*const UConverter, ) callconv(@import("std").os.windows.WINAPI) UConverterType; pub extern "icu" fn ucnv_getStarters( converter: ?*const UConverter, starters: ?*i8, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_getUnicodeSet( cnv: ?*const UConverter, setFillIn: ?*USet, whichSet: UConverterUnicodeSet, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_getToUCallBack( converter: ?*const UConverter, action: ?*?UConverterToUCallback, context: ?*const ?*c_void, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_getFromUCallBack( converter: ?*const UConverter, action: ?*?UConverterFromUCallback, context: ?*const ?*c_void, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_setToUCallBack( converter: ?*UConverter, newAction: ?UConverterToUCallback, newContext: ?*const c_void, oldAction: ?*?UConverterToUCallback, oldContext: ?*const ?*c_void, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_setFromUCallBack( converter: ?*UConverter, newAction: ?UConverterFromUCallback, newContext: ?*const c_void, oldAction: ?*?UConverterFromUCallback, oldContext: ?*const ?*c_void, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_fromUnicode( converter: ?*UConverter, target: ?*?*i8, targetLimit: ?[*:0]const u8, source: ?*const ?*u16, sourceLimit: ?*const u16, offsets: ?*i32, flush: i8, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_toUnicode( converter: ?*UConverter, target: ?*?*u16, targetLimit: ?*const u16, source: ?*const ?*i8, sourceLimit: ?[*:0]const u8, offsets: ?*i32, flush: i8, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_fromUChars( cnv: ?*UConverter, dest: ?PSTR, destCapacity: i32, src: ?*const u16, srcLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucnv_toUChars( cnv: ?*UConverter, dest: ?*u16, destCapacity: i32, src: ?[*:0]const u8, srcLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucnv_getNextUChar( converter: ?*UConverter, source: ?*const ?*i8, sourceLimit: ?[*:0]const u8, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucnv_convertEx( targetCnv: ?*UConverter, sourceCnv: ?*UConverter, target: ?*?*i8, targetLimit: ?[*:0]const u8, source: ?*const ?*i8, sourceLimit: ?[*:0]const u8, pivotStart: ?*u16, pivotSource: ?*?*u16, pivotTarget: ?*?*u16, pivotLimit: ?*const u16, reset: i8, flush: i8, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_convert( toConverterName: ?[*:0]const u8, fromConverterName: ?[*:0]const u8, target: ?PSTR, targetCapacity: i32, source: ?[*:0]const u8, sourceLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucnv_toAlgorithmic( algorithmicType: UConverterType, cnv: ?*UConverter, target: ?PSTR, targetCapacity: i32, source: ?[*:0]const u8, sourceLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucnv_fromAlgorithmic( cnv: ?*UConverter, algorithmicType: UConverterType, target: ?PSTR, targetCapacity: i32, source: ?[*:0]const u8, sourceLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucnv_flushCache( ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucnv_countAvailable( ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucnv_getAvailableName( n: i32, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ucnv_openAllNames( pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn ucnv_countAliases( alias: ?[*:0]const u8, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) u16; pub extern "icu" fn ucnv_getAlias( alias: ?[*:0]const u8, n: u16, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ucnv_getAliases( alias: ?[*:0]const u8, aliases: ?*const ?*i8, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_openStandardNames( convName: ?[*:0]const u8, standard: ?[*:0]const u8, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn ucnv_countStandards( ) callconv(@import("std").os.windows.WINAPI) u16; pub extern "icu" fn ucnv_getStandard( n: u16, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ucnv_getStandardName( name: ?[*:0]const u8, standard: ?[*:0]const u8, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ucnv_getCanonicalName( alias: ?[*:0]const u8, standard: ?[*:0]const u8, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ucnv_getDefaultName( ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ucnv_setDefaultName( name: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_fixFileSeparator( cnv: ?*const UConverter, source: ?*u16, sourceLen: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_isAmbiguous( cnv: ?*const UConverter, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ucnv_setFallback( cnv: ?*UConverter, usesFallback: i8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_usesFallback( cnv: ?*const UConverter, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ucnv_detectUnicodeSignature( source: ?[*:0]const u8, sourceLength: i32, signatureLength: ?*i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ucnv_fromUCountPending( cnv: ?*const UConverter, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucnv_toUCountPending( cnv: ?*const UConverter, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucnv_isFixedWidth( cnv: ?*UConverter, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ucnv_cbFromUWriteBytes( args: ?*UConverterFromUnicodeArgs, source: ?[*:0]const u8, length: i32, offsetIndex: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_cbFromUWriteSub( args: ?*UConverterFromUnicodeArgs, offsetIndex: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_cbFromUWriteUChars( args: ?*UConverterFromUnicodeArgs, source: ?*const ?*u16, sourceLimit: ?*const u16, offsetIndex: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_cbToUWriteUChars( args: ?*UConverterToUnicodeArgs, source: ?*const u16, length: i32, offsetIndex: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnv_cbToUWriteSub( args: ?*UConverterToUnicodeArgs, offsetIndex: i32, err: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn u_init( status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn u_cleanup( ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn u_setMemoryFunctions( context: ?*const c_void, a: ?*?UMemAllocFn, r: ?*?UMemReallocFn, f: ?*?UMemFreeFn, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn u_catopen( name: ?[*:0]const u8, locale: ?[*:0]const u8, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UResourceBundle; pub extern "icu" fn u_catclose( catd: ?*UResourceBundle, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn u_catgets( catd: ?*UResourceBundle, set_num: i32, msg_num: i32, s: ?*const u16, len: ?*i32, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_hasBinaryProperty( c: i32, which: UProperty, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isUAlphabetic( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isULowercase( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isUUppercase( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isUWhiteSpace( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_getIntPropertyValue( c: i32, which: UProperty, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_getIntPropertyMinValue( which: UProperty, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_getIntPropertyMaxValue( which: UProperty, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_getNumericValue( c: i32, ) callconv(@import("std").os.windows.WINAPI) f64; pub extern "icu" fn u_islower( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isupper( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_istitle( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isdigit( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isalpha( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isalnum( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isxdigit( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_ispunct( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isgraph( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isblank( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isdefined( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isspace( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isJavaSpaceChar( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isWhitespace( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_iscntrl( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isISOControl( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isprint( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isbase( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_charDirection( c: i32, ) callconv(@import("std").os.windows.WINAPI) UCharDirection; pub extern "icu" fn u_isMirrored( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_charMirror( c: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_getBidiPairedBracket( c: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_charType( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_enumCharTypes( enumRange: ?*?UCharEnumTypeRange, context: ?*const c_void, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn u_getCombiningClass( c: i32, ) callconv(@import("std").os.windows.WINAPI) u8; pub extern "icu" fn u_charDigitValue( c: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ublock_getCode( c: i32, ) callconv(@import("std").os.windows.WINAPI) UBlockCode; pub extern "icu" fn u_charName( code: i32, nameChoice: UCharNameChoice, buffer: ?PSTR, bufferLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_charFromName( nameChoice: UCharNameChoice, name: ?[*:0]const u8, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_enumCharNames( start: i32, limit: i32, @"fn": ?*?UEnumCharNamesFn, context: ?*c_void, nameChoice: UCharNameChoice, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn u_getPropertyName( property: UProperty, nameChoice: UPropertyNameChoice, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn u_getPropertyEnum( alias: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) UProperty; pub extern "icu" fn u_getPropertyValueName( property: UProperty, value: i32, nameChoice: UPropertyNameChoice, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn u_getPropertyValueEnum( property: UProperty, alias: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_isIDStart( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isIDPart( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isIDIgnorable( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isJavaIDStart( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_isJavaIDPart( c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_tolower( c: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_toupper( c: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_totitle( c: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_foldCase( c: i32, options: u32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_digit( ch: i32, radix: i8, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_forDigit( digit: i32, radix: i8, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_charAge( c: i32, versionArray: ?*u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn u_getUnicodeVersion( versionArray: ?*u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn u_getFC_NFKC_Closure( c: i32, dest: ?*u16, destCapacity: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubidi_open( ) callconv(@import("std").os.windows.WINAPI) ?*UBiDi; pub extern "icu" fn ubidi_openSized( maxLength: i32, maxRunCount: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UBiDi; pub extern "icu" fn ubidi_close( pBiDi: ?*UBiDi, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubidi_setInverse( pBiDi: ?*UBiDi, isInverse: i8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubidi_isInverse( pBiDi: ?*UBiDi, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ubidi_orderParagraphsLTR( pBiDi: ?*UBiDi, orderParagraphsLTR: i8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubidi_isOrderParagraphsLTR( pBiDi: ?*UBiDi, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ubidi_setReorderingMode( pBiDi: ?*UBiDi, reorderingMode: UBiDiReorderingMode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubidi_getReorderingMode( pBiDi: ?*UBiDi, ) callconv(@import("std").os.windows.WINAPI) UBiDiReorderingMode; pub extern "icu" fn ubidi_setReorderingOptions( pBiDi: ?*UBiDi, reorderingOptions: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubidi_getReorderingOptions( pBiDi: ?*UBiDi, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "icu" fn ubidi_setContext( pBiDi: ?*UBiDi, prologue: ?*const u16, proLength: i32, epilogue: ?*const u16, epiLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubidi_setPara( pBiDi: ?*UBiDi, text: ?*const u16, length: i32, paraLevel: u8, embeddingLevels: ?*u8, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubidi_setLine( pParaBiDi: ?*const UBiDi, start: i32, limit: i32, pLineBiDi: ?*UBiDi, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubidi_getDirection( pBiDi: ?*const UBiDi, ) callconv(@import("std").os.windows.WINAPI) UBiDiDirection; pub extern "icu" fn ubidi_getBaseDirection( text: ?*const u16, length: i32, ) callconv(@import("std").os.windows.WINAPI) UBiDiDirection; pub extern "icu" fn ubidi_getText( pBiDi: ?*const UBiDi, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn ubidi_getLength( pBiDi: ?*const UBiDi, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubidi_getParaLevel( pBiDi: ?*const UBiDi, ) callconv(@import("std").os.windows.WINAPI) u8; pub extern "icu" fn ubidi_countParagraphs( pBiDi: ?*UBiDi, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubidi_getParagraph( pBiDi: ?*const UBiDi, charIndex: i32, pParaStart: ?*i32, pParaLimit: ?*i32, pParaLevel: ?*u8, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubidi_getParagraphByIndex( pBiDi: ?*const UBiDi, paraIndex: i32, pParaStart: ?*i32, pParaLimit: ?*i32, pParaLevel: ?*u8, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubidi_getLevelAt( pBiDi: ?*const UBiDi, charIndex: i32, ) callconv(@import("std").os.windows.WINAPI) u8; pub extern "icu" fn ubidi_getLevels( pBiDi: ?*UBiDi, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "icu" fn ubidi_getLogicalRun( pBiDi: ?*const UBiDi, logicalPosition: i32, pLogicalLimit: ?*i32, pLevel: ?*u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubidi_countRuns( pBiDi: ?*UBiDi, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubidi_getVisualRun( pBiDi: ?*UBiDi, runIndex: i32, pLogicalStart: ?*i32, pLength: ?*i32, ) callconv(@import("std").os.windows.WINAPI) UBiDiDirection; pub extern "icu" fn ubidi_getVisualIndex( pBiDi: ?*UBiDi, logicalIndex: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubidi_getLogicalIndex( pBiDi: ?*UBiDi, visualIndex: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubidi_getLogicalMap( pBiDi: ?*UBiDi, indexMap: ?*i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubidi_getVisualMap( pBiDi: ?*UBiDi, indexMap: ?*i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubidi_reorderLogical( levels: ?*const u8, length: i32, indexMap: ?*i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubidi_reorderVisual( levels: ?*const u8, length: i32, indexMap: ?*i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubidi_invertMap( srcMap: ?*const i32, destMap: ?*i32, length: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubidi_getProcessedLength( pBiDi: ?*const UBiDi, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubidi_getResultLength( pBiDi: ?*const UBiDi, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubidi_getCustomizedClass( pBiDi: ?*UBiDi, c: i32, ) callconv(@import("std").os.windows.WINAPI) UCharDirection; pub extern "icu" fn ubidi_setClassCallback( pBiDi: ?*UBiDi, newFn: ?UBiDiClassCallback, newContext: ?*const c_void, oldFn: ?*?UBiDiClassCallback, oldContext: ?*const ?*c_void, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubidi_getClassCallback( pBiDi: ?*UBiDi, @"fn": ?*?UBiDiClassCallback, context: ?*const ?*c_void, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubidi_writeReordered( pBiDi: ?*UBiDi, dest: ?*u16, destSize: i32, options: u16, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubidi_writeReverse( src: ?*const u16, srcLength: i32, dest: ?*u16, destSize: i32, options: u16, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubiditransform_transform( pBiDiTransform: ?*UBiDiTransform, src: ?*const u16, srcLength: i32, dest: ?*u16, destSize: i32, inParaLevel: u8, inOrder: UBiDiOrder, outParaLevel: u8, outOrder: UBiDiOrder, doMirroring: UBiDiMirroring, shapingOptions: u32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "icu" fn ubiditransform_open( pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UBiDiTransform; pub extern "icu" fn ubiditransform_close( pBidiTransform: ?*UBiDiTransform, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn utext_close( ut: ?*UText, ) callconv(@import("std").os.windows.WINAPI) ?*UText; pub extern "icu" fn utext_openUTF8( ut: ?*UText, s: ?[*:0]const u8, length: i64, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UText; pub extern "icu" fn utext_openUChars( ut: ?*UText, s: ?*const u16, length: i64, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UText; pub extern "icu" fn utext_clone( dest: ?*UText, src: ?*const UText, deep: i8, readOnly: i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UText; pub extern "icu" fn utext_equals( a: ?*const UText, b: ?*const UText, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn utext_nativeLength( ut: ?*UText, ) callconv(@import("std").os.windows.WINAPI) i64; pub extern "icu" fn utext_isLengthExpensive( ut: ?*const UText, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn utext_char32At( ut: ?*UText, nativeIndex: i64, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn utext_current32( ut: ?*UText, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn utext_next32( ut: ?*UText, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn utext_previous32( ut: ?*UText, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn utext_next32From( ut: ?*UText, nativeIndex: i64, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn utext_previous32From( ut: ?*UText, nativeIndex: i64, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn utext_getNativeIndex( ut: ?*const UText, ) callconv(@import("std").os.windows.WINAPI) i64; pub extern "icu" fn utext_setNativeIndex( ut: ?*UText, nativeIndex: i64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn utext_moveIndex32( ut: ?*UText, delta: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn utext_getPreviousNativeIndex( ut: ?*UText, ) callconv(@import("std").os.windows.WINAPI) i64; pub extern "icu" fn utext_extract( ut: ?*UText, nativeStart: i64, nativeLimit: i64, dest: ?*u16, destCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn utext_isWritable( ut: ?*const UText, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn utext_hasMetaData( ut: ?*const UText, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn utext_replace( ut: ?*UText, nativeStart: i64, nativeLimit: i64, replacementText: ?*const u16, replacementLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn utext_copy( ut: ?*UText, nativeStart: i64, nativeLimit: i64, destIndex: i64, move: i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn utext_freeze( ut: ?*UText, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn utext_setup( ut: ?*UText, extraSpace: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UText; pub extern "icu" fn uset_openEmpty( ) callconv(@import("std").os.windows.WINAPI) ?*USet; pub extern "icu" fn uset_open( start: i32, end: i32, ) callconv(@import("std").os.windows.WINAPI) ?*USet; pub extern "icu" fn uset_openPattern( pattern: ?*const u16, patternLength: i32, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*USet; pub extern "icu" fn uset_openPatternOptions( pattern: ?*const u16, patternLength: i32, options: u32, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*USet; pub extern "icu" fn uset_close( set: ?*USet, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_clone( set: ?*const USet, ) callconv(@import("std").os.windows.WINAPI) ?*USet; pub extern "icu" fn uset_isFrozen( set: ?*const USet, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uset_freeze( set: ?*USet, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_cloneAsThawed( set: ?*const USet, ) callconv(@import("std").os.windows.WINAPI) ?*USet; pub extern "icu" fn uset_set( set: ?*USet, start: i32, end: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_applyPattern( set: ?*USet, pattern: ?*const u16, patternLength: i32, options: u32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uset_applyIntPropertyValue( set: ?*USet, prop: UProperty, value: i32, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_applyPropertyAlias( set: ?*USet, prop: ?*const u16, propLength: i32, value: ?*const u16, valueLength: i32, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_resemblesPattern( pattern: ?*const u16, patternLength: i32, pos: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uset_toPattern( set: ?*const USet, result: ?*u16, resultCapacity: i32, escapeUnprintable: i8, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uset_add( set: ?*USet, c: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_addAll( set: ?*USet, additionalSet: ?*const USet, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_addRange( set: ?*USet, start: i32, end: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_addString( set: ?*USet, str: ?*const u16, strLen: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_addAllCodePoints( set: ?*USet, str: ?*const u16, strLen: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_remove( set: ?*USet, c: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_removeRange( set: ?*USet, start: i32, end: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_removeString( set: ?*USet, str: ?*const u16, strLen: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_removeAll( set: ?*USet, removeSet: ?*const USet, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_retain( set: ?*USet, start: i32, end: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_retainAll( set: ?*USet, retain: ?*const USet, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_compact( set: ?*USet, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_complement( set: ?*USet, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_complementAll( set: ?*USet, complement: ?*const USet, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_clear( set: ?*USet, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_closeOver( set: ?*USet, attributes: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_removeAllStrings( set: ?*USet, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_isEmpty( set: ?*const USet, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uset_contains( set: ?*const USet, c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uset_containsRange( set: ?*const USet, start: i32, end: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uset_containsString( set: ?*const USet, str: ?*const u16, strLen: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uset_indexOf( set: ?*const USet, c: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uset_charAt( set: ?*const USet, charIndex: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uset_size( set: ?*const USet, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uset_getItemCount( set: ?*const USet, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uset_getItem( set: ?*const USet, itemIndex: i32, start: ?*i32, end: ?*i32, str: ?*u16, strCapacity: i32, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uset_containsAll( set1: ?*const USet, set2: ?*const USet, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uset_containsAllCodePoints( set: ?*const USet, str: ?*const u16, strLen: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uset_containsNone( set1: ?*const USet, set2: ?*const USet, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uset_containsSome( set1: ?*const USet, set2: ?*const USet, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uset_span( set: ?*const USet, s: ?*const u16, length: i32, spanCondition: USetSpanCondition, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uset_spanBack( set: ?*const USet, s: ?*const u16, length: i32, spanCondition: USetSpanCondition, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uset_spanUTF8( set: ?*const USet, s: ?[*:0]const u8, length: i32, spanCondition: USetSpanCondition, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uset_spanBackUTF8( set: ?*const USet, s: ?[*:0]const u8, length: i32, spanCondition: USetSpanCondition, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uset_equals( set1: ?*const USet, set2: ?*const USet, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uset_serialize( set: ?*const USet, dest: ?*u16, destCapacity: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uset_getSerializedSet( fillSet: ?*USerializedSet, src: ?*const u16, srcLength: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uset_setSerializedToOne( fillSet: ?*USerializedSet, c: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uset_serializedContains( set: ?*const USerializedSet, c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uset_getSerializedRangeCount( set: ?*const USerializedSet, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uset_getSerializedRange( set: ?*const USerializedSet, rangeIndex: i32, pStart: ?*i32, pEnd: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn unorm2_getNFCInstance( pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UNormalizer2; pub extern "icu" fn unorm2_getNFDInstance( pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UNormalizer2; pub extern "icu" fn unorm2_getNFKCInstance( pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UNormalizer2; pub extern "icu" fn unorm2_getNFKDInstance( pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UNormalizer2; pub extern "icu" fn unorm2_getNFKCCasefoldInstance( pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UNormalizer2; pub extern "icu" fn unorm2_getInstance( packageName: ?[*:0]const u8, name: ?[*:0]const u8, mode: UNormalization2Mode, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UNormalizer2; pub extern "icu" fn unorm2_openFiltered( norm2: ?*const UNormalizer2, filterSet: ?*const USet, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UNormalizer2; pub extern "icu" fn unorm2_close( norm2: ?*UNormalizer2, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn unorm2_normalize( norm2: ?*const UNormalizer2, src: ?*const u16, length: i32, dest: ?*u16, capacity: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unorm2_normalizeSecondAndAppend( norm2: ?*const UNormalizer2, first: ?*u16, firstLength: i32, firstCapacity: i32, second: ?*const u16, secondLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unorm2_append( norm2: ?*const UNormalizer2, first: ?*u16, firstLength: i32, firstCapacity: i32, second: ?*const u16, secondLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unorm2_getDecomposition( norm2: ?*const UNormalizer2, c: i32, decomposition: ?*u16, capacity: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unorm2_getRawDecomposition( norm2: ?*const UNormalizer2, c: i32, decomposition: ?*u16, capacity: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unorm2_composePair( norm2: ?*const UNormalizer2, a: i32, b: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unorm2_getCombiningClass( norm2: ?*const UNormalizer2, c: i32, ) callconv(@import("std").os.windows.WINAPI) u8; pub extern "icu" fn unorm2_isNormalized( norm2: ?*const UNormalizer2, s: ?*const u16, length: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn unorm2_quickCheck( norm2: ?*const UNormalizer2, s: ?*const u16, length: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) UNormalizationCheckResult; pub extern "icu" fn unorm2_spanQuickCheckYes( norm2: ?*const UNormalizer2, s: ?*const u16, length: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unorm2_hasBoundaryBefore( norm2: ?*const UNormalizer2, c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn unorm2_hasBoundaryAfter( norm2: ?*const UNormalizer2, c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn unorm2_isInert( norm2: ?*const UNormalizer2, c: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn unorm_compare( s1: ?*const u16, length1: i32, s2: ?*const u16, length2: i32, options: u32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucnvsel_open( converterList: ?*const ?*i8, converterListSize: i32, excludedCodePoints: ?*const USet, whichSet: UConverterUnicodeSet, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UConverterSelector; pub extern "icu" fn ucnvsel_close( sel: ?*UConverterSelector, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucnvsel_openFromSerialized( buffer: ?*const c_void, length: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UConverterSelector; pub extern "icu" fn ucnvsel_serialize( sel: ?*const UConverterSelector, buffer: ?*c_void, bufferCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucnvsel_selectForString( sel: ?*const UConverterSelector, s: ?*const u16, length: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn ucnvsel_selectForUTF8( sel: ?*const UConverterSelector, s: ?[*:0]const u8, length: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn u_charsToUChars( cs: ?[*:0]const u8, us: ?*u16, length: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn u_UCharsToChars( us: ?*const u16, cs: ?PSTR, length: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn u_strlen( s: ?*const u16, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_countChar32( s: ?*const u16, length: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_strHasMoreChar32Than( s: ?*const u16, length: i32, number: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn u_strcat( dst: ?*u16, src: ?*const u16, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_strncat( dst: ?*u16, src: ?*const u16, n: i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_strstr( s: ?*const u16, substring: ?*const u16, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_strFindFirst( s: ?*const u16, length: i32, substring: ?*const u16, subLength: i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_strchr( s: ?*const u16, c: u16, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_strchr32( s: ?*const u16, c: i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_strrstr( s: ?*const u16, substring: ?*const u16, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_strFindLast( s: ?*const u16, length: i32, substring: ?*const u16, subLength: i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_strrchr( s: ?*const u16, c: u16, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_strrchr32( s: ?*const u16, c: i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_strpbrk( string: ?*const u16, matchSet: ?*const u16, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_strcspn( string: ?*const u16, matchSet: ?*const u16, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_strspn( string: ?*const u16, matchSet: ?*const u16, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_strtok_r( src: ?*u16, delim: ?*const u16, saveState: ?*?*u16, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_strcmp( s1: ?*const u16, s2: ?*const u16, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_strcmpCodePointOrder( s1: ?*const u16, s2: ?*const u16, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_strCompare( s1: ?*const u16, length1: i32, s2: ?*const u16, length2: i32, codePointOrder: i8, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_strCompareIter( iter1: ?*UCharIterator, iter2: ?*UCharIterator, codePointOrder: i8, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_strCaseCompare( s1: ?*const u16, length1: i32, s2: ?*const u16, length2: i32, options: u32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_strncmp( ucs1: ?*const u16, ucs2: ?*const u16, n: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_strncmpCodePointOrder( s1: ?*const u16, s2: ?*const u16, n: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_strcasecmp( s1: ?*const u16, s2: ?*const u16, options: u32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_strncasecmp( s1: ?*const u16, s2: ?*const u16, n: i32, options: u32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_memcasecmp( s1: ?*const u16, s2: ?*const u16, length: i32, options: u32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_strcpy( dst: ?*u16, src: ?*const u16, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_strncpy( dst: ?*u16, src: ?*const u16, n: i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_uastrcpy( dst: ?*u16, src: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_uastrncpy( dst: ?*u16, src: ?[*:0]const u8, n: i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_austrcpy( dst: ?PSTR, src: ?*const u16, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn u_austrncpy( dst: ?PSTR, src: ?*const u16, n: i32, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn u_memcpy( dest: ?*u16, src: ?*const u16, count: i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_memmove( dest: ?*u16, src: ?*const u16, count: i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_memset( dest: ?*u16, c: u16, count: i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_memcmp( buf1: ?*const u16, buf2: ?*const u16, count: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_memcmpCodePointOrder( s1: ?*const u16, s2: ?*const u16, count: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_memchr( s: ?*const u16, c: u16, count: i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_memchr32( s: ?*const u16, c: i32, count: i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_memrchr( s: ?*const u16, c: u16, count: i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_memrchr32( s: ?*const u16, c: i32, count: i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_unescape( src: ?[*:0]const u8, dest: ?*u16, destCapacity: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_unescapeAt( charAt: ?UNESCAPE_CHAR_AT, offset: ?*i32, length: i32, context: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_strToUpper( dest: ?*u16, destCapacity: i32, src: ?*const u16, srcLength: i32, locale: ?[*:0]const u8, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_strToLower( dest: ?*u16, destCapacity: i32, src: ?*const u16, srcLength: i32, locale: ?[*:0]const u8, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_strToTitle( dest: ?*u16, destCapacity: i32, src: ?*const u16, srcLength: i32, titleIter: ?*UBreakIterator, locale: ?[*:0]const u8, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_strFoldCase( dest: ?*u16, destCapacity: i32, src: ?*const u16, srcLength: i32, options: u32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_strToWCS( dest: ?PWSTR, destCapacity: i32, pDestLength: ?*i32, src: ?*const u16, srcLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PWSTR; pub extern "icu" fn u_strFromWCS( dest: ?*u16, destCapacity: i32, pDestLength: ?*i32, src: ?[*:0]const u16, srcLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_strToUTF8( dest: ?PSTR, destCapacity: i32, pDestLength: ?*i32, src: ?*const u16, srcLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn u_strFromUTF8( dest: ?*u16, destCapacity: i32, pDestLength: ?*i32, src: ?[*:0]const u8, srcLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_strToUTF8WithSub( dest: ?PSTR, destCapacity: i32, pDestLength: ?*i32, src: ?*const u16, srcLength: i32, subchar: i32, pNumSubstitutions: ?*i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn u_strFromUTF8WithSub( dest: ?*u16, destCapacity: i32, pDestLength: ?*i32, src: ?[*:0]const u8, srcLength: i32, subchar: i32, pNumSubstitutions: ?*i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_strFromUTF8Lenient( dest: ?*u16, destCapacity: i32, pDestLength: ?*i32, src: ?[*:0]const u8, srcLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_strToUTF32( dest: ?*i32, destCapacity: i32, pDestLength: ?*i32, src: ?*const u16, srcLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*i32; pub extern "icu" fn u_strFromUTF32( dest: ?*u16, destCapacity: i32, pDestLength: ?*i32, src: ?*const i32, srcLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_strToUTF32WithSub( dest: ?*i32, destCapacity: i32, pDestLength: ?*i32, src: ?*const u16, srcLength: i32, subchar: i32, pNumSubstitutions: ?*i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*i32; pub extern "icu" fn u_strFromUTF32WithSub( dest: ?*u16, destCapacity: i32, pDestLength: ?*i32, src: ?*const i32, srcLength: i32, subchar: i32, pNumSubstitutions: ?*i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn u_strToJavaModifiedUTF8( dest: ?PSTR, destCapacity: i32, pDestLength: ?*i32, src: ?*const u16, srcLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn u_strFromJavaModifiedUTF8WithSub( dest: ?*u16, destCapacity: i32, pDestLength: ?*i32, src: ?[*:0]const u8, srcLength: i32, subchar: i32, pNumSubstitutions: ?*i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn ucasemap_open( locale: ?[*:0]const u8, options: u32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UCaseMap; pub extern "icu" fn ucasemap_close( csm: ?*UCaseMap, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucasemap_getLocale( csm: ?*const UCaseMap, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ucasemap_getOptions( csm: ?*const UCaseMap, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "icu" fn ucasemap_setLocale( csm: ?*UCaseMap, locale: ?[*:0]const u8, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucasemap_setOptions( csm: ?*UCaseMap, options: u32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucasemap_getBreakIterator( csm: ?*const UCaseMap, ) callconv(@import("std").os.windows.WINAPI) ?*UBreakIterator; pub extern "icu" fn ucasemap_setBreakIterator( csm: ?*UCaseMap, iterToAdopt: ?*UBreakIterator, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucasemap_toTitle( csm: ?*UCaseMap, dest: ?*u16, destCapacity: i32, src: ?*const u16, srcLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucasemap_utf8ToLower( csm: ?*const UCaseMap, dest: ?PSTR, destCapacity: i32, src: ?[*:0]const u8, srcLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucasemap_utf8ToUpper( csm: ?*const UCaseMap, dest: ?PSTR, destCapacity: i32, src: ?[*:0]const u8, srcLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucasemap_utf8ToTitle( csm: ?*UCaseMap, dest: ?PSTR, destCapacity: i32, src: ?[*:0]const u8, srcLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucasemap_utf8FoldCase( csm: ?*const UCaseMap, dest: ?PSTR, destCapacity: i32, src: ?[*:0]const u8, srcLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn usprep_open( path: ?[*:0]const u8, fileName: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UStringPrepProfile; pub extern "icu" fn usprep_openByType( type: UStringPrepProfileType, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UStringPrepProfile; pub extern "icu" fn usprep_close( profile: ?*UStringPrepProfile, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn usprep_prepare( prep: ?*const UStringPrepProfile, src: ?*const u16, srcLength: i32, dest: ?*u16, destCapacity: i32, options: i32, parseError: ?*UParseError, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uidna_openUTS46( options: u32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UIDNA; pub extern "icu" fn uidna_close( idna: ?*UIDNA, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uidna_labelToASCII( idna: ?*const UIDNA, label: ?*const u16, length: i32, dest: ?*u16, capacity: i32, pInfo: ?*UIDNAInfo, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uidna_labelToUnicode( idna: ?*const UIDNA, label: ?*const u16, length: i32, dest: ?*u16, capacity: i32, pInfo: ?*UIDNAInfo, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uidna_nameToASCII( idna: ?*const UIDNA, name: ?*const u16, length: i32, dest: ?*u16, capacity: i32, pInfo: ?*UIDNAInfo, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uidna_nameToUnicode( idna: ?*const UIDNA, name: ?*const u16, length: i32, dest: ?*u16, capacity: i32, pInfo: ?*UIDNAInfo, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uidna_labelToASCII_UTF8( idna: ?*const UIDNA, label: ?[*:0]const u8, length: i32, dest: ?PSTR, capacity: i32, pInfo: ?*UIDNAInfo, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uidna_labelToUnicodeUTF8( idna: ?*const UIDNA, label: ?[*:0]const u8, length: i32, dest: ?PSTR, capacity: i32, pInfo: ?*UIDNAInfo, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uidna_nameToASCII_UTF8( idna: ?*const UIDNA, name: ?[*:0]const u8, length: i32, dest: ?PSTR, capacity: i32, pInfo: ?*UIDNAInfo, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uidna_nameToUnicodeUTF8( idna: ?*const UIDNA, name: ?[*:0]const u8, length: i32, dest: ?PSTR, capacity: i32, pInfo: ?*UIDNAInfo, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubrk_open( type: UBreakIteratorType, locale: ?[*:0]const u8, text: ?*const u16, textLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UBreakIterator; pub extern "icu" fn ubrk_openRules( rules: ?*const u16, rulesLength: i32, text: ?*const u16, textLength: i32, parseErr: ?*UParseError, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UBreakIterator; pub extern "icu" fn ubrk_openBinaryRules( binaryRules: ?*const u8, rulesLength: i32, text: ?*const u16, textLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UBreakIterator; pub extern "icu" fn ubrk_safeClone( bi: ?*const UBreakIterator, stackBuffer: ?*c_void, pBufferSize: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UBreakIterator; pub extern "icu" fn ubrk_close( bi: ?*UBreakIterator, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubrk_setText( bi: ?*UBreakIterator, text: ?*const u16, textLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubrk_setUText( bi: ?*UBreakIterator, text: ?*UText, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubrk_current( bi: ?*const UBreakIterator, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubrk_next( bi: ?*UBreakIterator, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubrk_previous( bi: ?*UBreakIterator, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubrk_first( bi: ?*UBreakIterator, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubrk_last( bi: ?*UBreakIterator, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubrk_preceding( bi: ?*UBreakIterator, offset: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubrk_following( bi: ?*UBreakIterator, offset: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubrk_getAvailable( index: i32, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ubrk_countAvailable( ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubrk_isBoundary( bi: ?*UBreakIterator, offset: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ubrk_getRuleStatus( bi: ?*UBreakIterator, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubrk_getRuleStatusVec( bi: ?*UBreakIterator, fillInVec: ?*i32, capacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ubrk_getLocaleByType( bi: ?*const UBreakIterator, type: ULocDataLocaleType, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ubrk_refreshUText( bi: ?*UBreakIterator, text: ?*UText, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ubrk_getBinaryRules( bi: ?*UBreakIterator, binaryRules: ?*u8, rulesCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_getDataVersion( dataVersionFillin: ?*u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucal_openTimeZoneIDEnumeration( zoneType: USystemTimeZoneType, region: ?[*:0]const u8, rawOffset: ?*const i32, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn ucal_openTimeZones( ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn ucal_openCountryTimeZones( country: ?[*:0]const u8, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn ucal_getDefaultTimeZone( result: ?*u16, resultCapacity: i32, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucal_setDefaultTimeZone( zoneID: ?*const u16, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucal_getDSTSavings( zoneID: ?*const u16, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucal_getNow( ) callconv(@import("std").os.windows.WINAPI) f64; pub extern "icu" fn ucal_open( zoneID: ?*const u16, len: i32, locale: ?[*:0]const u8, type: UCalendarType, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*?*c_void; pub extern "icu" fn ucal_close( cal: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucal_clone( cal: ?*const ?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*?*c_void; pub extern "icu" fn ucal_setTimeZone( cal: ?*?*c_void, zoneID: ?*const u16, len: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucal_getTimeZoneID( cal: ?*const ?*c_void, result: ?*u16, resultLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucal_getTimeZoneDisplayName( cal: ?*const ?*c_void, type: UCalendarDisplayNameType, locale: ?[*:0]const u8, result: ?*u16, resultLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucal_inDaylightTime( cal: ?*const ?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ucal_setGregorianChange( cal: ?*?*c_void, date: f64, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucal_getGregorianChange( cal: ?*const ?*c_void, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) f64; pub extern "icu" fn ucal_getAttribute( cal: ?*const ?*c_void, attr: UCalendarAttribute, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucal_setAttribute( cal: ?*?*c_void, attr: UCalendarAttribute, newValue: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucal_getAvailable( localeIndex: i32, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ucal_countAvailable( ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucal_getMillis( cal: ?*const ?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) f64; pub extern "icu" fn ucal_setMillis( cal: ?*?*c_void, dateTime: f64, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucal_setDate( cal: ?*?*c_void, year: i32, month: i32, date: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucal_setDateTime( cal: ?*?*c_void, year: i32, month: i32, date: i32, hour: i32, minute: i32, second: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucal_equivalentTo( cal1: ?*const ?*c_void, cal2: ?*const ?*c_void, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ucal_add( cal: ?*?*c_void, field: UCalendarDateFields, amount: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucal_roll( cal: ?*?*c_void, field: UCalendarDateFields, amount: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucal_get( cal: ?*const ?*c_void, field: UCalendarDateFields, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucal_set( cal: ?*?*c_void, field: UCalendarDateFields, value: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucal_isSet( cal: ?*const ?*c_void, field: UCalendarDateFields, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ucal_clearField( cal: ?*?*c_void, field: UCalendarDateFields, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucal_clear( calendar: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucal_getLimit( cal: ?*const ?*c_void, field: UCalendarDateFields, type: UCalendarLimitType, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucal_getLocaleByType( cal: ?*const ?*c_void, type: ULocDataLocaleType, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ucal_getTZDataVersion( status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ucal_getCanonicalTimeZoneID( id: ?*const u16, len: i32, result: ?*u16, resultCapacity: i32, isSystemID: ?*i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucal_getType( cal: ?*const ?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ucal_getKeywordValuesForLocale( key: ?[*:0]const u8, locale: ?[*:0]const u8, commonlyUsed: i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn ucal_getDayOfWeekType( cal: ?*const ?*c_void, dayOfWeek: UCalendarDaysOfWeek, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) UCalendarWeekdayType; pub extern "icu" fn ucal_getWeekendTransition( cal: ?*const ?*c_void, dayOfWeek: UCalendarDaysOfWeek, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucal_isWeekend( cal: ?*const ?*c_void, date: f64, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ucal_getFieldDifference( cal: ?*?*c_void, target: f64, field: UCalendarDateFields, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucal_getTimeZoneTransitionDate( cal: ?*const ?*c_void, type: UTimeZoneTransitionType, transition: ?*f64, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ucal_getWindowsTimeZoneID( id: ?*const u16, len: i32, winid: ?*u16, winidCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucal_getTimeZoneIDForWindowsID( winid: ?*const u16, len: i32, region: ?[*:0]const u8, id: ?*u16, idCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucol_open( loc: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UCollator; pub extern "icu" fn ucol_openRules( rules: ?*const u16, rulesLength: i32, normalizationMode: UColAttributeValue, strength: UColAttributeValue, parseError: ?*UParseError, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UCollator; pub extern "icu" fn ucol_getContractionsAndExpansions( coll: ?*const UCollator, contractions: ?*USet, expansions: ?*USet, addPrefixes: i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucol_close( coll: ?*UCollator, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucol_strcoll( coll: ?*const UCollator, source: ?*const u16, sourceLength: i32, target: ?*const u16, targetLength: i32, ) callconv(@import("std").os.windows.WINAPI) UCollationResult; pub extern "icu" fn ucol_strcollUTF8( coll: ?*const UCollator, source: ?[*:0]const u8, sourceLength: i32, target: ?[*:0]const u8, targetLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) UCollationResult; pub extern "icu" fn ucol_greater( coll: ?*const UCollator, source: ?*const u16, sourceLength: i32, target: ?*const u16, targetLength: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ucol_greaterOrEqual( coll: ?*const UCollator, source: ?*const u16, sourceLength: i32, target: ?*const u16, targetLength: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ucol_equal( coll: ?*const UCollator, source: ?*const u16, sourceLength: i32, target: ?*const u16, targetLength: i32, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ucol_strcollIter( coll: ?*const UCollator, sIter: ?*UCharIterator, tIter: ?*UCharIterator, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) UCollationResult; pub extern "icu" fn ucol_getStrength( coll: ?*const UCollator, ) callconv(@import("std").os.windows.WINAPI) UColAttributeValue; pub extern "icu" fn ucol_setStrength( coll: ?*UCollator, strength: UColAttributeValue, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucol_getReorderCodes( coll: ?*const UCollator, dest: ?*i32, destCapacity: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucol_setReorderCodes( coll: ?*UCollator, reorderCodes: ?*const i32, reorderCodesLength: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucol_getEquivalentReorderCodes( reorderCode: i32, dest: ?*i32, destCapacity: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucol_getDisplayName( objLoc: ?[*:0]const u8, dispLoc: ?[*:0]const u8, result: ?*u16, resultLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucol_getAvailable( localeIndex: i32, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ucol_countAvailable( ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucol_openAvailableLocales( status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn ucol_getKeywords( status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn ucol_getKeywordValues( keyword: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn ucol_getKeywordValuesForLocale( key: ?[*:0]const u8, locale: ?[*:0]const u8, commonlyUsed: i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn ucol_getFunctionalEquivalent( result: ?PSTR, resultCapacity: i32, keyword: ?[*:0]const u8, locale: ?[*:0]const u8, isAvailable: ?*i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucol_getRules( coll: ?*const UCollator, length: ?*i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn ucol_getSortKey( coll: ?*const UCollator, source: ?*const u16, sourceLength: i32, result: ?*u8, resultLength: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucol_nextSortKeyPart( coll: ?*const UCollator, iter: ?*UCharIterator, state: ?*u32, dest: ?*u8, count: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucol_getBound( source: ?*const u8, sourceLength: i32, boundType: UColBoundMode, noOfLevels: u32, result: ?*u8, resultLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucol_getVersion( coll: ?*const UCollator, info: ?*u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucol_getUCAVersion( coll: ?*const UCollator, info: ?*u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucol_mergeSortkeys( src1: ?*const u8, src1Length: i32, src2: ?*const u8, src2Length: i32, dest: ?*u8, destCapacity: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucol_setAttribute( coll: ?*UCollator, attr: UColAttribute, value: UColAttributeValue, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucol_getAttribute( coll: ?*const UCollator, attr: UColAttribute, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) UColAttributeValue; pub extern "icu" fn ucol_setMaxVariable( coll: ?*UCollator, group: UColReorderCode, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucol_getMaxVariable( coll: ?*const UCollator, ) callconv(@import("std").os.windows.WINAPI) UColReorderCode; pub extern "icu" fn ucol_getVariableTop( coll: ?*const UCollator, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "icu" fn ucol_safeClone( coll: ?*const UCollator, stackBuffer: ?*c_void, pBufferSize: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UCollator; pub extern "icu" fn ucol_getRulesEx( coll: ?*const UCollator, delta: UColRuleOption, buffer: ?*u16, bufferLen: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucol_getLocaleByType( coll: ?*const UCollator, type: ULocDataLocaleType, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ucol_getTailoredSet( coll: ?*const UCollator, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*USet; pub extern "icu" fn ucol_cloneBinary( coll: ?*const UCollator, buffer: ?*u8, capacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucol_openBinary( bin: ?*const u8, length: i32, base: ?*const UCollator, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UCollator; pub extern "icu" fn ucol_openElements( coll: ?*const UCollator, text: ?*const u16, textLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UCollationElements; pub extern "icu" fn ucol_keyHashCode( key: ?*const u8, length: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucol_closeElements( elems: ?*UCollationElements, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucol_reset( elems: ?*UCollationElements, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucol_next( elems: ?*UCollationElements, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucol_previous( elems: ?*UCollationElements, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucol_getMaxExpansion( elems: ?*const UCollationElements, order: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucol_setText( elems: ?*UCollationElements, text: ?*const u16, textLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucol_getOffset( elems: ?*const UCollationElements, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucol_setOffset( elems: ?*UCollationElements, offset: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucol_primaryOrder( order: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucol_secondaryOrder( order: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucol_tertiaryOrder( order: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucsdet_open( status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UCharsetDetector; pub extern "icu" fn ucsdet_close( ucsd: ?*UCharsetDetector, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucsdet_setText( ucsd: ?*UCharsetDetector, textIn: ?[*:0]const u8, len: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucsdet_setDeclaredEncoding( ucsd: ?*UCharsetDetector, encoding: ?[*:0]const u8, length: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ucsdet_detect( ucsd: ?*UCharsetDetector, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UCharsetMatch; pub extern "icu" fn ucsdet_detectAll( ucsd: ?*UCharsetDetector, matchesFound: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*?*UCharsetMatch; pub extern "icu" fn ucsdet_getName( ucsm: ?*const UCharsetMatch, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ucsdet_getConfidence( ucsm: ?*const UCharsetMatch, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucsdet_getLanguage( ucsm: ?*const UCharsetMatch, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn ucsdet_getUChars( ucsm: ?*const UCharsetMatch, buf: ?*u16, cap: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ucsdet_getAllDetectableCharsets( ucsd: ?*const UCharsetDetector, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn ucsdet_isInputFilterEnabled( ucsd: ?*const UCharsetDetector, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ucsdet_enableInputFilter( ucsd: ?*UCharsetDetector, filter: i8, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn udatpg_open( locale: ?[*:0]const u8, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*?*c_void; pub extern "icu" fn udatpg_openEmpty( pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*?*c_void; pub extern "icu" fn udatpg_close( dtpg: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn udatpg_clone( dtpg: ?*const ?*c_void, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*?*c_void; pub extern "icu" fn udatpg_getBestPattern( dtpg: ?*?*c_void, skeleton: ?*const u16, length: i32, bestPattern: ?*u16, capacity: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn udatpg_getBestPatternWithOptions( dtpg: ?*?*c_void, skeleton: ?*const u16, length: i32, options: UDateTimePatternMatchOptions, bestPattern: ?*u16, capacity: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn udatpg_getSkeleton( unusedDtpg: ?*?*c_void, pattern: ?*const u16, length: i32, skeleton: ?*u16, capacity: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn udatpg_getBaseSkeleton( unusedDtpg: ?*?*c_void, pattern: ?*const u16, length: i32, baseSkeleton: ?*u16, capacity: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn udatpg_addPattern( dtpg: ?*?*c_void, pattern: ?*const u16, patternLength: i32, override: i8, conflictingPattern: ?*u16, capacity: i32, pLength: ?*i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) UDateTimePatternConflict; pub extern "icu" fn udatpg_setAppendItemFormat( dtpg: ?*?*c_void, field: UDateTimePatternField, value: ?*const u16, length: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn udatpg_getAppendItemFormat( dtpg: ?*const ?*c_void, field: UDateTimePatternField, pLength: ?*i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn udatpg_setAppendItemName( dtpg: ?*?*c_void, field: UDateTimePatternField, value: ?*const u16, length: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn udatpg_getAppendItemName( dtpg: ?*const ?*c_void, field: UDateTimePatternField, pLength: ?*i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn udatpg_getFieldDisplayName( dtpg: ?*const ?*c_void, field: UDateTimePatternField, width: UDateTimePGDisplayWidth, fieldName: ?*u16, capacity: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn udatpg_setDateTimeFormat( dtpg: ?*const ?*c_void, dtFormat: ?*const u16, length: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn udatpg_getDateTimeFormat( dtpg: ?*const ?*c_void, pLength: ?*i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn udatpg_setDecimal( dtpg: ?*?*c_void, decimal: ?*const u16, length: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn udatpg_getDecimal( dtpg: ?*const ?*c_void, pLength: ?*i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn udatpg_replaceFieldTypes( dtpg: ?*?*c_void, pattern: ?*const u16, patternLength: i32, skeleton: ?*const u16, skeletonLength: i32, dest: ?*u16, destCapacity: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn udatpg_replaceFieldTypesWithOptions( dtpg: ?*?*c_void, pattern: ?*const u16, patternLength: i32, skeleton: ?*const u16, skeletonLength: i32, options: UDateTimePatternMatchOptions, dest: ?*u16, destCapacity: i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn udatpg_openSkeletons( dtpg: ?*const ?*c_void, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn udatpg_openBaseSkeletons( dtpg: ?*const ?*c_void, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn udatpg_getPatternForSkeleton( dtpg: ?*const ?*c_void, skeleton: ?*const u16, skeletonLength: i32, pLength: ?*i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn ufieldpositer_open( status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UFieldPositionIterator; pub extern "icu" fn ufieldpositer_close( fpositer: ?*UFieldPositionIterator, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ufieldpositer_next( fpositer: ?*UFieldPositionIterator, beginIndex: ?*i32, endIndex: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ufmt_open( status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*?*c_void; pub extern "icu" fn ufmt_close( fmt: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ufmt_getType( fmt: ?*const ?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) UFormattableType; pub extern "icu" fn ufmt_isNumeric( fmt: ?*const ?*c_void, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ufmt_getDate( fmt: ?*const ?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) f64; pub extern "icu" fn ufmt_getDouble( fmt: ?*?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) f64; pub extern "icu" fn ufmt_getLong( fmt: ?*?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ufmt_getInt64( fmt: ?*?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i64; pub extern "icu" fn ufmt_getObject( fmt: ?*const ?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*c_void; pub extern "icu" fn ufmt_getUChars( fmt: ?*?*c_void, len: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn ufmt_getArrayLength( fmt: ?*const ?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ufmt_getArrayItemByIndex( fmt: ?*?*c_void, n: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*?*c_void; pub extern "icu" fn ufmt_getDecNumChars( fmt: ?*?*c_void, len: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn udtitvfmt_open( locale: ?[*:0]const u8, skeleton: ?*const u16, skeletonLength: i32, tzID: ?*const u16, tzIDLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UDateIntervalFormat; pub extern "icu" fn udtitvfmt_close( formatter: ?*UDateIntervalFormat, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn udtitvfmt_format( formatter: ?*const UDateIntervalFormat, fromDate: f64, toDate: f64, result: ?*u16, resultCapacity: i32, position: ?*UFieldPosition, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ugender_getInstance( locale: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UGenderInfo; pub extern "icu" fn ugender_getListGender( genderInfo: ?*const UGenderInfo, genders: ?*const UGender, size: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) UGender; pub extern "icu" fn ulistfmt_open( locale: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UListFormatter; pub extern "icu" fn ulistfmt_close( listfmt: ?*UListFormatter, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ulistfmt_format( listfmt: ?*const UListFormatter, strings: ?*const ?*u16, stringLengths: ?*const i32, stringCount: i32, result: ?*u16, resultCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ulocdata_open( localeID: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*ULocaleData; pub extern "icu" fn ulocdata_close( uld: ?*ULocaleData, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ulocdata_setNoSubstitute( uld: ?*ULocaleData, setting: i8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ulocdata_getNoSubstitute( uld: ?*ULocaleData, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn ulocdata_getExemplarSet( uld: ?*ULocaleData, fillIn: ?*USet, options: u32, extype: ULocaleDataExemplarSetType, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*USet; pub extern "icu" fn ulocdata_getDelimiter( uld: ?*ULocaleData, type: ULocaleDataDelimiterType, result: ?*u16, resultLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ulocdata_getMeasurementSystem( localeID: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) UMeasurementSystem; pub extern "icu" fn ulocdata_getPaperSize( localeID: ?[*:0]const u8, height: ?*i32, width: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ulocdata_getCLDRVersion( versionArray: ?*u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ulocdata_getLocaleDisplayPattern( uld: ?*ULocaleData, pattern: ?*u16, patternCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ulocdata_getLocaleSeparator( uld: ?*ULocaleData, separator: ?*u16, separatorCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_formatMessage( locale: ?[*:0]const u8, pattern: ?*const u16, patternLength: i32, result: ?*u16, resultLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_vformatMessage( locale: ?[*:0]const u8, pattern: ?*const u16, patternLength: i32, result: ?*u16, resultLength: i32, ap: ?*i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_parseMessage( locale: ?[*:0]const u8, pattern: ?*const u16, patternLength: i32, source: ?*const u16, sourceLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn u_vparseMessage( locale: ?[*:0]const u8, pattern: ?*const u16, patternLength: i32, source: ?*const u16, sourceLength: i32, ap: ?*i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn u_formatMessageWithError( locale: ?[*:0]const u8, pattern: ?*const u16, patternLength: i32, result: ?*u16, resultLength: i32, parseError: ?*UParseError, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_vformatMessageWithError( locale: ?[*:0]const u8, pattern: ?*const u16, patternLength: i32, result: ?*u16, resultLength: i32, parseError: ?*UParseError, ap: ?*i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn u_parseMessageWithError( locale: ?[*:0]const u8, pattern: ?*const u16, patternLength: i32, source: ?*const u16, sourceLength: i32, parseError: ?*UParseError, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn u_vparseMessageWithError( locale: ?[*:0]const u8, pattern: ?*const u16, patternLength: i32, source: ?*const u16, sourceLength: i32, ap: ?*i8, parseError: ?*UParseError, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn umsg_open( pattern: ?*const u16, patternLength: i32, locale: ?[*:0]const u8, parseError: ?*UParseError, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*?*c_void; pub extern "icu" fn umsg_close( format: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn umsg_clone( fmt: ?*const ?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*c_void; pub extern "icu" fn umsg_setLocale( fmt: ?*?*c_void, locale: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn umsg_getLocale( fmt: ?*const ?*c_void, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn umsg_applyPattern( fmt: ?*?*c_void, pattern: ?*const u16, patternLength: i32, parseError: ?*UParseError, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn umsg_toPattern( fmt: ?*const ?*c_void, result: ?*u16, resultLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn umsg_format( fmt: ?*const ?*c_void, result: ?*u16, resultLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn umsg_vformat( fmt: ?*const ?*c_void, result: ?*u16, resultLength: i32, ap: ?*i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn umsg_parse( fmt: ?*const ?*c_void, source: ?*const u16, sourceLength: i32, count: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn umsg_vparse( fmt: ?*const ?*c_void, source: ?*const u16, sourceLength: i32, count: ?*i32, ap: ?*i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn umsg_autoQuoteApostrophe( pattern: ?*const u16, patternLength: i32, dest: ?*u16, destCapacity: i32, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unum_open( style: UNumberFormatStyle, pattern: ?*const u16, patternLength: i32, locale: ?[*:0]const u8, parseErr: ?*UParseError, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*?*c_void; pub extern "icu" fn unum_close( fmt: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn unum_clone( fmt: ?*const ?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*?*c_void; pub extern "icu" fn unum_format( fmt: ?*const ?*c_void, number: i32, result: ?*u16, resultLength: i32, pos: ?*UFieldPosition, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unum_formatInt64( fmt: ?*const ?*c_void, number: i64, result: ?*u16, resultLength: i32, pos: ?*UFieldPosition, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unum_formatDouble( fmt: ?*const ?*c_void, number: f64, result: ?*u16, resultLength: i32, pos: ?*UFieldPosition, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unum_formatDoubleForFields( format: ?*const ?*c_void, number: f64, result: ?*u16, resultLength: i32, fpositer: ?*UFieldPositionIterator, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unum_formatDecimal( fmt: ?*const ?*c_void, number: ?[*:0]const u8, length: i32, result: ?*u16, resultLength: i32, pos: ?*UFieldPosition, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unum_formatDoubleCurrency( fmt: ?*const ?*c_void, number: f64, currency: ?*u16, result: ?*u16, resultLength: i32, pos: ?*UFieldPosition, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unum_formatUFormattable( fmt: ?*const ?*c_void, number: ?*const ?*c_void, result: ?*u16, resultLength: i32, pos: ?*UFieldPosition, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unum_parse( fmt: ?*const ?*c_void, text: ?*const u16, textLength: i32, parsePos: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unum_parseInt64( fmt: ?*const ?*c_void, text: ?*const u16, textLength: i32, parsePos: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i64; pub extern "icu" fn unum_parseDouble( fmt: ?*const ?*c_void, text: ?*const u16, textLength: i32, parsePos: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) f64; pub extern "icu" fn unum_parseDecimal( fmt: ?*const ?*c_void, text: ?*const u16, textLength: i32, parsePos: ?*i32, outBuf: ?PSTR, outBufLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unum_parseDoubleCurrency( fmt: ?*const ?*c_void, text: ?*const u16, textLength: i32, parsePos: ?*i32, currency: ?*u16, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) f64; pub extern "icu" fn unum_parseToUFormattable( fmt: ?*const ?*c_void, result: ?*?*c_void, text: ?*const u16, textLength: i32, parsePos: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*?*c_void; pub extern "icu" fn unum_applyPattern( format: ?*?*c_void, localized: i8, pattern: ?*const u16, patternLength: i32, parseError: ?*UParseError, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn unum_getAvailable( localeIndex: i32, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn unum_countAvailable( ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unum_getAttribute( fmt: ?*const ?*c_void, attr: UNumberFormatAttribute, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unum_setAttribute( fmt: ?*?*c_void, attr: UNumberFormatAttribute, newValue: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn unum_getDoubleAttribute( fmt: ?*const ?*c_void, attr: UNumberFormatAttribute, ) callconv(@import("std").os.windows.WINAPI) f64; pub extern "icu" fn unum_setDoubleAttribute( fmt: ?*?*c_void, attr: UNumberFormatAttribute, newValue: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn unum_getTextAttribute( fmt: ?*const ?*c_void, tag: UNumberFormatTextAttribute, result: ?*u16, resultLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unum_setTextAttribute( fmt: ?*?*c_void, tag: UNumberFormatTextAttribute, newValue: ?*const u16, newValueLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn unum_toPattern( fmt: ?*const ?*c_void, isPatternLocalized: i8, result: ?*u16, resultLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unum_getSymbol( fmt: ?*const ?*c_void, symbol: UNumberFormatSymbol, buffer: ?*u16, size: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unum_setSymbol( fmt: ?*?*c_void, symbol: UNumberFormatSymbol, value: ?*const u16, length: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn unum_getLocaleByType( fmt: ?*const ?*c_void, type: ULocDataLocaleType, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn unum_setContext( fmt: ?*?*c_void, value: UDisplayContext, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn unum_getContext( fmt: ?*const ?*c_void, type: UDisplayContextType, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) UDisplayContext; pub extern "icu" fn udat_toCalendarDateField( field: UDateFormatField, ) callconv(@import("std").os.windows.WINAPI) UCalendarDateFields; pub extern "icu" fn udat_open( timeStyle: UDateFormatStyle, dateStyle: UDateFormatStyle, locale: ?[*:0]const u8, tzID: ?*const u16, tzIDLength: i32, pattern: ?*const u16, patternLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*?*c_void; pub extern "icu" fn udat_close( format: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn udat_getBooleanAttribute( fmt: ?*const ?*c_void, attr: UDateFormatBooleanAttribute, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn udat_setBooleanAttribute( fmt: ?*?*c_void, attr: UDateFormatBooleanAttribute, newValue: i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn udat_clone( fmt: ?*const ?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*?*c_void; pub extern "icu" fn udat_format( format: ?*const ?*c_void, dateToFormat: f64, result: ?*u16, resultLength: i32, position: ?*UFieldPosition, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn udat_formatCalendar( format: ?*const ?*c_void, calendar: ?*?*c_void, result: ?*u16, capacity: i32, position: ?*UFieldPosition, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn udat_formatForFields( format: ?*const ?*c_void, dateToFormat: f64, result: ?*u16, resultLength: i32, fpositer: ?*UFieldPositionIterator, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn udat_formatCalendarForFields( format: ?*const ?*c_void, calendar: ?*?*c_void, result: ?*u16, capacity: i32, fpositer: ?*UFieldPositionIterator, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn udat_parse( format: ?*const ?*c_void, text: ?*const u16, textLength: i32, parsePos: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) f64; pub extern "icu" fn udat_parseCalendar( format: ?*const ?*c_void, calendar: ?*?*c_void, text: ?*const u16, textLength: i32, parsePos: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn udat_isLenient( fmt: ?*const ?*c_void, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn udat_setLenient( fmt: ?*?*c_void, isLenient: i8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn udat_getCalendar( fmt: ?*const ?*c_void, ) callconv(@import("std").os.windows.WINAPI) ?*?*c_void; pub extern "icu" fn udat_setCalendar( fmt: ?*?*c_void, calendarToSet: ?*const ?*c_void, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn udat_getNumberFormat( fmt: ?*const ?*c_void, ) callconv(@import("std").os.windows.WINAPI) ?*?*c_void; pub extern "icu" fn udat_getNumberFormatForField( fmt: ?*const ?*c_void, field: u16, ) callconv(@import("std").os.windows.WINAPI) ?*?*c_void; pub extern "icu" fn udat_adoptNumberFormatForFields( fmt: ?*?*c_void, fields: ?*const u16, numberFormatToSet: ?*?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn udat_setNumberFormat( fmt: ?*?*c_void, numberFormatToSet: ?*const ?*c_void, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn udat_adoptNumberFormat( fmt: ?*?*c_void, numberFormatToAdopt: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn udat_getAvailable( localeIndex: i32, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn udat_countAvailable( ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn udat_get2DigitYearStart( fmt: ?*const ?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) f64; pub extern "icu" fn udat_set2DigitYearStart( fmt: ?*?*c_void, d: f64, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn udat_toPattern( fmt: ?*const ?*c_void, localized: i8, result: ?*u16, resultLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn udat_applyPattern( format: ?*?*c_void, localized: i8, pattern: ?*const u16, patternLength: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn udat_getSymbols( fmt: ?*const ?*c_void, type: UDateFormatSymbolType, symbolIndex: i32, result: ?*u16, resultLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn udat_countSymbols( fmt: ?*const ?*c_void, type: UDateFormatSymbolType, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn udat_setSymbols( format: ?*?*c_void, type: UDateFormatSymbolType, symbolIndex: i32, value: ?*u16, valueLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn udat_getLocaleByType( fmt: ?*const ?*c_void, type: ULocDataLocaleType, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn udat_setContext( fmt: ?*?*c_void, value: UDisplayContext, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn udat_getContext( fmt: ?*const ?*c_void, type: UDisplayContextType, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) UDisplayContext; pub extern "icu" fn unumf_openForSkeletonAndLocale( skeleton: ?*const u16, skeletonLen: i32, locale: ?[*:0]const u8, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UNumberFormatter; pub extern "icu" fn unumf_openResult( ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UFormattedNumber; pub extern "icu" fn unumf_formatInt( uformatter: ?*const UNumberFormatter, value: i64, uresult: ?*UFormattedNumber, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn unumf_formatDouble( uformatter: ?*const UNumberFormatter, value: f64, uresult: ?*UFormattedNumber, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn unumf_formatDecimal( uformatter: ?*const UNumberFormatter, value: ?[*:0]const u8, valueLen: i32, uresult: ?*UFormattedNumber, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn unumf_resultToString( uresult: ?*const UFormattedNumber, buffer: ?*u16, bufferCapacity: i32, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unumf_resultNextFieldPosition( uresult: ?*const UFormattedNumber, ufpos: ?*UFieldPosition, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn unumf_resultGetAllFieldPositions( uresult: ?*const UFormattedNumber, ufpositer: ?*UFieldPositionIterator, ec: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn unumf_close( uformatter: ?*UNumberFormatter, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn unumf_closeResult( uresult: ?*UFormattedNumber, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn unumsys_open( locale: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UNumberingSystem; pub extern "icu" fn unumsys_openByName( name: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UNumberingSystem; pub extern "icu" fn unumsys_close( unumsys: ?*UNumberingSystem, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn unumsys_openAvailableNames( status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn unumsys_getName( unumsys: ?*const UNumberingSystem, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn unumsys_isAlgorithmic( unumsys: ?*const UNumberingSystem, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn unumsys_getRadix( unumsys: ?*const UNumberingSystem, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn unumsys_getDescription( unumsys: ?*const UNumberingSystem, result: ?*u16, resultLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uplrules_open( locale: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UPluralRules; pub extern "icu" fn uplrules_openForType( locale: ?[*:0]const u8, type: UPluralType, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UPluralRules; pub extern "icu" fn uplrules_close( uplrules: ?*UPluralRules, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uplrules_select( uplrules: ?*const UPluralRules, number: f64, keyword: ?*u16, capacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uplrules_getKeywords( uplrules: ?*const UPluralRules, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn uregex_open( pattern: ?*const u16, patternLength: i32, flags: u32, pe: ?*UParseError, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*URegularExpression; pub extern "icu" fn uregex_openUText( pattern: ?*UText, flags: u32, pe: ?*UParseError, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*URegularExpression; pub extern "icu" fn uregex_openC( pattern: ?[*:0]const u8, flags: u32, pe: ?*UParseError, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*URegularExpression; pub extern "icu" fn uregex_close( regexp: ?*URegularExpression, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uregex_clone( regexp: ?*const URegularExpression, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*URegularExpression; pub extern "icu" fn uregex_pattern( regexp: ?*const URegularExpression, patLength: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn uregex_patternUText( regexp: ?*const URegularExpression, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UText; pub extern "icu" fn uregex_flags( regexp: ?*const URegularExpression, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uregex_setText( regexp: ?*URegularExpression, text: ?*const u16, textLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uregex_setUText( regexp: ?*URegularExpression, text: ?*UText, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uregex_getText( regexp: ?*URegularExpression, textLength: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn uregex_getUText( regexp: ?*URegularExpression, dest: ?*UText, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UText; pub extern "icu" fn uregex_refreshUText( regexp: ?*URegularExpression, text: ?*UText, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uregex_matches( regexp: ?*URegularExpression, startIndex: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uregex_matches64( regexp: ?*URegularExpression, startIndex: i64, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uregex_lookingAt( regexp: ?*URegularExpression, startIndex: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uregex_lookingAt64( regexp: ?*URegularExpression, startIndex: i64, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uregex_find( regexp: ?*URegularExpression, startIndex: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uregex_find64( regexp: ?*URegularExpression, startIndex: i64, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uregex_findNext( regexp: ?*URegularExpression, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uregex_groupCount( regexp: ?*URegularExpression, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uregex_groupNumberFromName( regexp: ?*URegularExpression, groupName: ?*const u16, nameLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uregex_groupNumberFromCName( regexp: ?*URegularExpression, groupName: ?[*:0]const u8, nameLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uregex_group( regexp: ?*URegularExpression, groupNum: i32, dest: ?*u16, destCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uregex_groupUText( regexp: ?*URegularExpression, groupNum: i32, dest: ?*UText, groupLength: ?*i64, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UText; pub extern "icu" fn uregex_start( regexp: ?*URegularExpression, groupNum: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uregex_start64( regexp: ?*URegularExpression, groupNum: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i64; pub extern "icu" fn uregex_end( regexp: ?*URegularExpression, groupNum: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uregex_end64( regexp: ?*URegularExpression, groupNum: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i64; pub extern "icu" fn uregex_reset( regexp: ?*URegularExpression, index: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uregex_reset64( regexp: ?*URegularExpression, index: i64, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uregex_setRegion( regexp: ?*URegularExpression, regionStart: i32, regionLimit: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uregex_setRegion64( regexp: ?*URegularExpression, regionStart: i64, regionLimit: i64, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uregex_setRegionAndStart( regexp: ?*URegularExpression, regionStart: i64, regionLimit: i64, startIndex: i64, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uregex_regionStart( regexp: ?*const URegularExpression, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uregex_regionStart64( regexp: ?*const URegularExpression, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i64; pub extern "icu" fn uregex_regionEnd( regexp: ?*const URegularExpression, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uregex_regionEnd64( regexp: ?*const URegularExpression, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i64; pub extern "icu" fn uregex_hasTransparentBounds( regexp: ?*const URegularExpression, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uregex_useTransparentBounds( regexp: ?*URegularExpression, b: i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uregex_hasAnchoringBounds( regexp: ?*const URegularExpression, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uregex_useAnchoringBounds( regexp: ?*URegularExpression, b: i8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uregex_hitEnd( regexp: ?*const URegularExpression, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uregex_requireEnd( regexp: ?*const URegularExpression, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uregex_replaceAll( regexp: ?*URegularExpression, replacementText: ?*const u16, replacementLength: i32, destBuf: ?*u16, destCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uregex_replaceAllUText( regexp: ?*URegularExpression, replacement: ?*UText, dest: ?*UText, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UText; pub extern "icu" fn uregex_replaceFirst( regexp: ?*URegularExpression, replacementText: ?*const u16, replacementLength: i32, destBuf: ?*u16, destCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uregex_replaceFirstUText( regexp: ?*URegularExpression, replacement: ?*UText, dest: ?*UText, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UText; pub extern "icu" fn uregex_appendReplacement( regexp: ?*URegularExpression, replacementText: ?*const u16, replacementLength: i32, destBuf: ?*?*u16, destCapacity: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uregex_appendReplacementUText( regexp: ?*URegularExpression, replacementText: ?*UText, dest: ?*UText, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uregex_appendTail( regexp: ?*URegularExpression, destBuf: ?*?*u16, destCapacity: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uregex_appendTailUText( regexp: ?*URegularExpression, dest: ?*UText, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UText; pub extern "icu" fn uregex_split( regexp: ?*URegularExpression, destBuf: ?*u16, destCapacity: i32, requiredCapacity: ?*i32, destFields: ?*?*u16, destFieldsCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uregex_splitUText( regexp: ?*URegularExpression, destFields: ?*?*UText, destFieldsCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uregex_setTimeLimit( regexp: ?*URegularExpression, limit: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uregex_getTimeLimit( regexp: ?*const URegularExpression, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uregex_setStackLimit( regexp: ?*URegularExpression, limit: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uregex_getStackLimit( regexp: ?*const URegularExpression, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uregex_setMatchCallback( regexp: ?*URegularExpression, callback: ?URegexMatchCallback, context: ?*const c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uregex_getMatchCallback( regexp: ?*const URegularExpression, callback: ?*?URegexMatchCallback, context: ?*const ?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uregex_setFindProgressCallback( regexp: ?*URegularExpression, callback: ?URegexFindProgressCallback, context: ?*const c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uregex_getFindProgressCallback( regexp: ?*const URegularExpression, callback: ?*?URegexFindProgressCallback, context: ?*const ?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uregion_getRegionFromCode( regionCode: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*URegion; pub extern "icu" fn uregion_getRegionFromNumericCode( code: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*URegion; pub extern "icu" fn uregion_getAvailable( type: URegionType, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn uregion_areEqual( uregion: ?*const URegion, otherRegion: ?*const URegion, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uregion_getContainingRegion( uregion: ?*const URegion, ) callconv(@import("std").os.windows.WINAPI) ?*URegion; pub extern "icu" fn uregion_getContainingRegionOfType( uregion: ?*const URegion, type: URegionType, ) callconv(@import("std").os.windows.WINAPI) ?*URegion; pub extern "icu" fn uregion_getContainedRegions( uregion: ?*const URegion, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn uregion_getContainedRegionsOfType( uregion: ?*const URegion, type: URegionType, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn uregion_contains( uregion: ?*const URegion, otherRegion: ?*const URegion, ) callconv(@import("std").os.windows.WINAPI) i8; pub extern "icu" fn uregion_getPreferredValues( uregion: ?*const URegion, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn uregion_getRegionCode( uregion: ?*const URegion, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn uregion_getNumericCode( uregion: ?*const URegion, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uregion_getType( uregion: ?*const URegion, ) callconv(@import("std").os.windows.WINAPI) URegionType; pub extern "icu" fn ureldatefmt_open( locale: ?[*:0]const u8, nfToAdopt: ?*?*c_void, width: UDateRelativeDateTimeFormatterStyle, capitalizationContext: UDisplayContext, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*URelativeDateTimeFormatter; pub extern "icu" fn ureldatefmt_close( reldatefmt: ?*URelativeDateTimeFormatter, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn ureldatefmt_formatNumeric( reldatefmt: ?*const URelativeDateTimeFormatter, offset: f64, unit: URelativeDateTimeUnit, result: ?*u16, resultCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ureldatefmt_format( reldatefmt: ?*const URelativeDateTimeFormatter, offset: f64, unit: URelativeDateTimeUnit, result: ?*u16, resultCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn ureldatefmt_combineDateAndTime( reldatefmt: ?*const URelativeDateTimeFormatter, relativeDateString: ?*const u16, relativeDateStringLen: i32, timeString: ?*const u16, timeStringLen: i32, result: ?*u16, resultCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn usearch_open( pattern: ?*const u16, patternlength: i32, text: ?*const u16, textlength: i32, locale: ?[*:0]const u8, breakiter: ?*UBreakIterator, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UStringSearch; pub extern "icu" fn usearch_openFromCollator( pattern: ?*const u16, patternlength: i32, text: ?*const u16, textlength: i32, collator: ?*const UCollator, breakiter: ?*UBreakIterator, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UStringSearch; pub extern "icu" fn usearch_close( searchiter: ?*UStringSearch, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn usearch_setOffset( strsrch: ?*UStringSearch, position: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn usearch_getOffset( strsrch: ?*const UStringSearch, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn usearch_setAttribute( strsrch: ?*UStringSearch, attribute: USearchAttribute, value: USearchAttributeValue, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn usearch_getAttribute( strsrch: ?*const UStringSearch, attribute: USearchAttribute, ) callconv(@import("std").os.windows.WINAPI) USearchAttributeValue; pub extern "icu" fn usearch_getMatchedStart( strsrch: ?*const UStringSearch, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn usearch_getMatchedLength( strsrch: ?*const UStringSearch, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn usearch_getMatchedText( strsrch: ?*const UStringSearch, result: ?*u16, resultCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn usearch_setBreakIterator( strsrch: ?*UStringSearch, breakiter: ?*UBreakIterator, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn usearch_getBreakIterator( strsrch: ?*const UStringSearch, ) callconv(@import("std").os.windows.WINAPI) ?*UBreakIterator; pub extern "icu" fn usearch_setText( strsrch: ?*UStringSearch, text: ?*const u16, textlength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn usearch_getText( strsrch: ?*const UStringSearch, length: ?*i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn usearch_getCollator( strsrch: ?*const UStringSearch, ) callconv(@import("std").os.windows.WINAPI) ?*UCollator; pub extern "icu" fn usearch_setCollator( strsrch: ?*UStringSearch, collator: ?*const UCollator, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn usearch_setPattern( strsrch: ?*UStringSearch, pattern: ?*const u16, patternlength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn usearch_getPattern( strsrch: ?*const UStringSearch, length: ?*i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn usearch_first( strsrch: ?*UStringSearch, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn usearch_following( strsrch: ?*UStringSearch, position: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn usearch_last( strsrch: ?*UStringSearch, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn usearch_preceding( strsrch: ?*UStringSearch, position: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn usearch_next( strsrch: ?*UStringSearch, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn usearch_previous( strsrch: ?*UStringSearch, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn usearch_reset( strsrch: ?*UStringSearch, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uspoof_open( status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*USpoofChecker; pub extern "icu" fn uspoof_openFromSerialized( data: ?*const c_void, length: i32, pActualLength: ?*i32, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*USpoofChecker; pub extern "icu" fn uspoof_openFromSource( confusables: ?[*:0]const u8, confusablesLen: i32, confusablesWholeScript: ?[*:0]const u8, confusablesWholeScriptLen: i32, errType: ?*i32, pe: ?*UParseError, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*USpoofChecker; pub extern "icu" fn uspoof_close( sc: ?*USpoofChecker, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uspoof_clone( sc: ?*const USpoofChecker, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*USpoofChecker; pub extern "icu" fn uspoof_setChecks( sc: ?*USpoofChecker, checks: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uspoof_getChecks( sc: ?*const USpoofChecker, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uspoof_setRestrictionLevel( sc: ?*USpoofChecker, restrictionLevel: URestrictionLevel, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uspoof_getRestrictionLevel( sc: ?*const USpoofChecker, ) callconv(@import("std").os.windows.WINAPI) URestrictionLevel; pub extern "icu" fn uspoof_setAllowedLocales( sc: ?*USpoofChecker, localesList: ?[*:0]const u8, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uspoof_getAllowedLocales( sc: ?*USpoofChecker, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "icu" fn uspoof_setAllowedChars( sc: ?*USpoofChecker, chars: ?*const USet, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uspoof_getAllowedChars( sc: ?*const USpoofChecker, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*USet; pub extern "icu" fn uspoof_check( sc: ?*const USpoofChecker, id: ?*const u16, length: i32, position: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uspoof_checkUTF8( sc: ?*const USpoofChecker, id: ?[*:0]const u8, length: i32, position: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uspoof_check2( sc: ?*const USpoofChecker, id: ?*const u16, length: i32, checkResult: ?*USpoofCheckResult, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uspoof_check2UTF8( sc: ?*const USpoofChecker, id: ?[*:0]const u8, length: i32, checkResult: ?*USpoofCheckResult, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uspoof_openCheckResult( status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*USpoofCheckResult; pub extern "icu" fn uspoof_closeCheckResult( checkResult: ?*USpoofCheckResult, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn uspoof_getCheckResultChecks( checkResult: ?*const USpoofCheckResult, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uspoof_getCheckResultRestrictionLevel( checkResult: ?*const USpoofCheckResult, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) URestrictionLevel; pub extern "icu" fn uspoof_getCheckResultNumerics( checkResult: ?*const USpoofCheckResult, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*USet; pub extern "icu" fn uspoof_areConfusable( sc: ?*const USpoofChecker, id1: ?*const u16, length1: i32, id2: ?*const u16, length2: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uspoof_areConfusableUTF8( sc: ?*const USpoofChecker, id1: ?[*:0]const u8, length1: i32, id2: ?[*:0]const u8, length2: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uspoof_getSkeleton( sc: ?*const USpoofChecker, type: u32, id: ?*const u16, length: i32, dest: ?*u16, destCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uspoof_getSkeletonUTF8( sc: ?*const USpoofChecker, type: u32, id: ?[*:0]const u8, length: i32, dest: ?PSTR, destCapacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn uspoof_getInclusionSet( status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*USet; pub extern "icu" fn uspoof_getRecommendedSet( status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*USet; pub extern "icu" fn uspoof_serialize( sc: ?*USpoofChecker, data: ?*c_void, capacity: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn utmscale_getTimeScaleValue( timeScale: UDateTimeScale, value: UTimeScaleValue, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i64; pub extern "icu" fn utmscale_fromInt64( otherTime: i64, timeScale: UDateTimeScale, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i64; pub extern "icu" fn utmscale_toInt64( universalTime: i64, timeScale: UDateTimeScale, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i64; pub extern "icu" fn utrans_openU( id: ?*const u16, idLength: i32, dir: UTransDirection, rules: ?*const u16, rulesLength: i32, parseError: ?*UParseError, pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*?*c_void; pub extern "icu" fn utrans_openInverse( trans: ?*const ?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*?*c_void; pub extern "icu" fn utrans_clone( trans: ?*const ?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*?*c_void; pub extern "icu" fn utrans_close( trans: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn utrans_getUnicodeID( trans: ?*const ?*c_void, resultLength: ?*i32, ) callconv(@import("std").os.windows.WINAPI) ?*u16; pub extern "icu" fn utrans_register( adoptedTrans: ?*?*c_void, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn utrans_unregisterID( id: ?*const u16, idLength: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn utrans_setFilter( trans: ?*?*c_void, filterPattern: ?*const u16, filterPatternLen: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn utrans_countAvailableIDs( ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn utrans_openIDs( pErrorCode: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*UEnumeration; pub extern "icu" fn utrans_trans( trans: ?*const ?*c_void, rep: ?*?*c_void, repFunc: ?*const UReplaceableCallbacks, start: i32, limit: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn utrans_transIncremental( trans: ?*const ?*c_void, rep: ?*?*c_void, repFunc: ?*const UReplaceableCallbacks, pos: ?*UTransPosition, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn utrans_transUChars( trans: ?*const ?*c_void, text: ?*u16, textLength: ?*i32, textCapacity: i32, start: i32, limit: ?*i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn utrans_transIncrementalUChars( trans: ?*const ?*c_void, text: ?*u16, textLength: ?*i32, textCapacity: i32, pos: ?*UTransPosition, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "icu" fn utrans_toRules( trans: ?*const ?*c_void, escapeUnprintable: i8, result: ?*u16, resultLength: i32, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "icu" fn utrans_getSourceSet( trans: ?*const ?*c_void, ignoreFilter: i8, fillIn: ?*USet, status: ?*UErrorCode, ) callconv(@import("std").os.windows.WINAPI) ?*USet; // TODO: this type is limited to platform 'windows6.1' pub extern "KERNEL32" fn FindStringOrdinal( dwFindStringOrdinalFlags: u32, lpStringSource: [*:0]const u16, cchSource: i32, lpStringValue: [*:0]const u16, cchValue: i32, bIgnoreCase: BOOL, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn lstrcmpA( lpString1: ?[*:0]const u8, lpString2: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn lstrcmpW( lpString1: ?[*:0]const u16, lpString2: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn lstrcmpiA( lpString1: ?[*:0]const u8, lpString2: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn lstrcmpiW( lpString1: ?[*:0]const u16, lpString2: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn lstrcpynA( lpString1: [*:0]u8, lpString2: ?[*:0]const u8, iMaxLength: i32, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn lstrcpynW( lpString1: [*:0]u16, lpString2: ?[*:0]const u16, iMaxLength: i32, ) callconv(@import("std").os.windows.WINAPI) ?PWSTR; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn lstrcpyA( lpString1: ?PSTR, lpString2: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn lstrcpyW( lpString1: ?PWSTR, lpString2: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?PWSTR; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn lstrcatA( lpString1: ?PSTR, lpString2: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn lstrcatW( lpString1: ?PWSTR, lpString2: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?PWSTR; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn lstrlenA( lpString: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn lstrlenW( lpString: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "ADVAPI32" fn IsTextUnicode( // TODO: what to do with BytesParamIndex 1? lpv: ?*const c_void, iSize: i32, lpiResult: ?*IS_TEXT_UNICODE_RESULT, ) callconv(@import("std").os.windows.WINAPI) BOOL; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (69) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("zig.zig").unicode_mode) { .ansi => struct { pub const CPINFOEX = thismodule.CPINFOEXA; pub const NUMBERFMT = thismodule.NUMBERFMTA; pub const CURRENCYFMT = thismodule.CURRENCYFMTA; pub const LOCALE_ENUMPROC = thismodule.LOCALE_ENUMPROCA; pub const LANGUAGEGROUP_ENUMPROC = thismodule.LANGUAGEGROUP_ENUMPROCA; pub const LANGGROUPLOCALE_ENUMPROC = thismodule.LANGGROUPLOCALE_ENUMPROCA; pub const UILANGUAGE_ENUMPROC = thismodule.UILANGUAGE_ENUMPROCA; pub const CODEPAGE_ENUMPROC = thismodule.CODEPAGE_ENUMPROCA; pub const DATEFMT_ENUMPROC = thismodule.DATEFMT_ENUMPROCA; pub const DATEFMT_ENUMPROCEX = thismodule.DATEFMT_ENUMPROCEXA; pub const TIMEFMT_ENUMPROC = thismodule.TIMEFMT_ENUMPROCA; pub const CALINFO_ENUMPROC = thismodule.CALINFO_ENUMPROCA; pub const CALINFO_ENUMPROCEX = thismodule.CALINFO_ENUMPROCEXA; pub const REGISTERWORD = thismodule.REGISTERWORDA; pub const STYLEBUF = thismodule.STYLEBUFA; pub const IMEMENUITEMINFO = thismodule.IMEMENUITEMINFOA; pub const REGISTERWORDENUMPROC = thismodule.REGISTERWORDENUMPROCA; pub const IEnumRegisterWord = thismodule.IEnumRegisterWordA; pub const GetDateFormat = thismodule.GetDateFormatA; pub const GetTimeFormat = thismodule.GetTimeFormatA; pub const CompareString = thismodule.CompareStringA; pub const FoldString = thismodule.FoldStringA; pub const GetStringTypeEx = thismodule.GetStringTypeExA; pub const GetStringType = thismodule.GetStringTypeA; pub const GetCPInfoEx = thismodule.GetCPInfoExA; pub const LCMapString = thismodule.LCMapStringA; pub const GetLocaleInfo = thismodule.GetLocaleInfoA; pub const SetLocaleInfo = thismodule.SetLocaleInfoA; pub const GetCalendarInfo = thismodule.GetCalendarInfoA; pub const SetCalendarInfo = thismodule.SetCalendarInfoA; pub const GetNumberFormat = thismodule.GetNumberFormatA; pub const GetCurrencyFormat = thismodule.GetCurrencyFormatA; pub const EnumCalendarInfo = thismodule.EnumCalendarInfoA; pub const EnumCalendarInfoEx = thismodule.EnumCalendarInfoExA; pub const EnumTimeFormats = thismodule.EnumTimeFormatsA; pub const EnumDateFormats = thismodule.EnumDateFormatsA; pub const EnumDateFormatsEx = thismodule.EnumDateFormatsExA; pub const GetGeoInfo = thismodule.GetGeoInfoA; pub const EnumSystemLocales = thismodule.EnumSystemLocalesA; pub const EnumSystemLanguageGroups = thismodule.EnumSystemLanguageGroupsA; pub const EnumLanguageGroupLocales = thismodule.EnumLanguageGroupLocalesA; pub const EnumUILanguages = thismodule.EnumUILanguagesA; pub const EnumSystemCodePages = thismodule.EnumSystemCodePagesA; pub const ImmInstallIME = thismodule.ImmInstallIMEA; pub const ImmGetDescription = thismodule.ImmGetDescriptionA; pub const ImmGetIMEFileName = thismodule.ImmGetIMEFileNameA; pub const ImmGetCompositionString = thismodule.ImmGetCompositionStringA; pub const ImmSetCompositionString = thismodule.ImmSetCompositionStringA; pub const ImmGetCandidateListCount = thismodule.ImmGetCandidateListCountA; pub const ImmGetCandidateList = thismodule.ImmGetCandidateListA; pub const ImmGetGuideLine = thismodule.ImmGetGuideLineA; pub const ImmGetCompositionFont = thismodule.ImmGetCompositionFontA; pub const ImmSetCompositionFont = thismodule.ImmSetCompositionFontA; pub const ImmConfigureIME = thismodule.ImmConfigureIMEA; pub const ImmEscape = thismodule.ImmEscapeA; pub const ImmGetConversionList = thismodule.ImmGetConversionListA; pub const ImmIsUIMessage = thismodule.ImmIsUIMessageA; pub const ImmRegisterWord = thismodule.ImmRegisterWordA; pub const ImmUnregisterWord = thismodule.ImmUnregisterWordA; pub const ImmGetRegisterWordStyle = thismodule.ImmGetRegisterWordStyleA; pub const ImmEnumRegisterWord = thismodule.ImmEnumRegisterWordA; pub const ImmGetImeMenuItems = thismodule.ImmGetImeMenuItemsA; pub const ImmRequestMessage = thismodule.ImmRequestMessageA; pub const lstrcmp = thismodule.lstrcmpA; pub const lstrcmpi = thismodule.lstrcmpiA; pub const lstrcpyn = thismodule.lstrcpynA; pub const lstrcpy = thismodule.lstrcpyA; pub const lstrcat = thismodule.lstrcatA; pub const lstrlen = thismodule.lstrlenA; }, .wide => struct { pub const CPINFOEX = thismodule.CPINFOEXW; pub const NUMBERFMT = thismodule.NUMBERFMTW; pub const CURRENCYFMT = thismodule.CURRENCYFMTW; pub const LOCALE_ENUMPROC = thismodule.LOCALE_ENUMPROCW; pub const LANGUAGEGROUP_ENUMPROC = thismodule.LANGUAGEGROUP_ENUMPROCW; pub const LANGGROUPLOCALE_ENUMPROC = thismodule.LANGGROUPLOCALE_ENUMPROCW; pub const UILANGUAGE_ENUMPROC = thismodule.UILANGUAGE_ENUMPROCW; pub const CODEPAGE_ENUMPROC = thismodule.CODEPAGE_ENUMPROCW; pub const DATEFMT_ENUMPROC = thismodule.DATEFMT_ENUMPROCW; pub const DATEFMT_ENUMPROCEX = thismodule.DATEFMT_ENUMPROCEXW; pub const TIMEFMT_ENUMPROC = thismodule.TIMEFMT_ENUMPROCW; pub const CALINFO_ENUMPROC = thismodule.CALINFO_ENUMPROCW; pub const CALINFO_ENUMPROCEX = thismodule.CALINFO_ENUMPROCEXW; pub const REGISTERWORD = thismodule.REGISTERWORDW; pub const STYLEBUF = thismodule.STYLEBUFW; pub const IMEMENUITEMINFO = thismodule.IMEMENUITEMINFOW; pub const REGISTERWORDENUMPROC = thismodule.REGISTERWORDENUMPROCW; pub const IEnumRegisterWord = thismodule.IEnumRegisterWordW; pub const GetDateFormat = thismodule.GetDateFormatW; pub const GetTimeFormat = thismodule.GetTimeFormatW; pub const CompareString = thismodule.CompareStringW; pub const FoldString = thismodule.FoldStringW; pub const GetStringTypeEx = thismodule.GetStringTypeExW; pub const GetStringType = thismodule.GetStringTypeW; pub const GetCPInfoEx = thismodule.GetCPInfoExW; pub const LCMapString = thismodule.LCMapStringW; pub const GetLocaleInfo = thismodule.GetLocaleInfoW; pub const SetLocaleInfo = thismodule.SetLocaleInfoW; pub const GetCalendarInfo = thismodule.GetCalendarInfoW; pub const SetCalendarInfo = thismodule.SetCalendarInfoW; pub const GetNumberFormat = thismodule.GetNumberFormatW; pub const GetCurrencyFormat = thismodule.GetCurrencyFormatW; pub const EnumCalendarInfo = thismodule.EnumCalendarInfoW; pub const EnumCalendarInfoEx = thismodule.EnumCalendarInfoExW; pub const EnumTimeFormats = thismodule.EnumTimeFormatsW; pub const EnumDateFormats = thismodule.EnumDateFormatsW; pub const EnumDateFormatsEx = thismodule.EnumDateFormatsExW; pub const GetGeoInfo = thismodule.GetGeoInfoW; pub const EnumSystemLocales = thismodule.EnumSystemLocalesW; pub const EnumSystemLanguageGroups = thismodule.EnumSystemLanguageGroupsW; pub const EnumLanguageGroupLocales = thismodule.EnumLanguageGroupLocalesW; pub const EnumUILanguages = thismodule.EnumUILanguagesW; pub const EnumSystemCodePages = thismodule.EnumSystemCodePagesW; pub const ImmInstallIME = thismodule.ImmInstallIMEW; pub const ImmGetDescription = thismodule.ImmGetDescriptionW; pub const ImmGetIMEFileName = thismodule.ImmGetIMEFileNameW; pub const ImmGetCompositionString = thismodule.ImmGetCompositionStringW; pub const ImmSetCompositionString = thismodule.ImmSetCompositionStringW; pub const ImmGetCandidateListCount = thismodule.ImmGetCandidateListCountW; pub const ImmGetCandidateList = thismodule.ImmGetCandidateListW; pub const ImmGetGuideLine = thismodule.ImmGetGuideLineW; pub const ImmGetCompositionFont = thismodule.ImmGetCompositionFontW; pub const ImmSetCompositionFont = thismodule.ImmSetCompositionFontW; pub const ImmConfigureIME = thismodule.ImmConfigureIMEW; pub const ImmEscape = thismodule.ImmEscapeW; pub const ImmGetConversionList = thismodule.ImmGetConversionListW; pub const ImmIsUIMessage = thismodule.ImmIsUIMessageW; pub const ImmRegisterWord = thismodule.ImmRegisterWordW; pub const ImmUnregisterWord = thismodule.ImmUnregisterWordW; pub const ImmGetRegisterWordStyle = thismodule.ImmGetRegisterWordStyleW; pub const ImmEnumRegisterWord = thismodule.ImmEnumRegisterWordW; pub const ImmGetImeMenuItems = thismodule.ImmGetImeMenuItemsW; pub const ImmRequestMessage = thismodule.ImmRequestMessageW; pub const lstrcmp = thismodule.lstrcmpW; pub const lstrcmpi = thismodule.lstrcmpiW; pub const lstrcpyn = thismodule.lstrcpynW; pub const lstrcpy = thismodule.lstrcpyW; pub const lstrcat = thismodule.lstrcatW; pub const lstrlen = thismodule.lstrlenW; }, .unspecified => if (@import("builtin").is_test) struct { pub const CPINFOEX = *opaque{}; pub const NUMBERFMT = *opaque{}; pub const CURRENCYFMT = *opaque{}; pub const LOCALE_ENUMPROC = *opaque{}; pub const LANGUAGEGROUP_ENUMPROC = *opaque{}; pub const LANGGROUPLOCALE_ENUMPROC = *opaque{}; pub const UILANGUAGE_ENUMPROC = *opaque{}; pub const CODEPAGE_ENUMPROC = *opaque{}; pub const DATEFMT_ENUMPROC = *opaque{}; pub const DATEFMT_ENUMPROCEX = *opaque{}; pub const TIMEFMT_ENUMPROC = *opaque{}; pub const CALINFO_ENUMPROC = *opaque{}; pub const CALINFO_ENUMPROCEX = *opaque{}; pub const REGISTERWORD = *opaque{}; pub const STYLEBUF = *opaque{}; pub const IMEMENUITEMINFO = *opaque{}; pub const REGISTERWORDENUMPROC = *opaque{}; pub const IEnumRegisterWord = *opaque{}; pub const GetDateFormat = *opaque{}; pub const GetTimeFormat = *opaque{}; pub const CompareString = *opaque{}; pub const FoldString = *opaque{}; pub const GetStringTypeEx = *opaque{}; pub const GetStringType = *opaque{}; pub const GetCPInfoEx = *opaque{}; pub const LCMapString = *opaque{}; pub const GetLocaleInfo = *opaque{}; pub const SetLocaleInfo = *opaque{}; pub const GetCalendarInfo = *opaque{}; pub const SetCalendarInfo = *opaque{}; pub const GetNumberFormat = *opaque{}; pub const GetCurrencyFormat = *opaque{}; pub const EnumCalendarInfo = *opaque{}; pub const EnumCalendarInfoEx = *opaque{}; pub const EnumTimeFormats = *opaque{}; pub const EnumDateFormats = *opaque{}; pub const EnumDateFormatsEx = *opaque{}; pub const GetGeoInfo = *opaque{}; pub const EnumSystemLocales = *opaque{}; pub const EnumSystemLanguageGroups = *opaque{}; pub const EnumLanguageGroupLocales = *opaque{}; pub const EnumUILanguages = *opaque{}; pub const EnumSystemCodePages = *opaque{}; pub const ImmInstallIME = *opaque{}; pub const ImmGetDescription = *opaque{}; pub const ImmGetIMEFileName = *opaque{}; pub const ImmGetCompositionString = *opaque{}; pub const ImmSetCompositionString = *opaque{}; pub const ImmGetCandidateListCount = *opaque{}; pub const ImmGetCandidateList = *opaque{}; pub const ImmGetGuideLine = *opaque{}; pub const ImmGetCompositionFont = *opaque{}; pub const ImmSetCompositionFont = *opaque{}; pub const ImmConfigureIME = *opaque{}; pub const ImmEscape = *opaque{}; pub const ImmGetConversionList = *opaque{}; pub const ImmIsUIMessage = *opaque{}; pub const ImmRegisterWord = *opaque{}; pub const ImmUnregisterWord = *opaque{}; pub const ImmGetRegisterWordStyle = *opaque{}; pub const ImmEnumRegisterWord = *opaque{}; pub const ImmGetImeMenuItems = *opaque{}; pub const ImmRequestMessage = *opaque{}; pub const lstrcmp = *opaque{}; pub const lstrcmpi = *opaque{}; pub const lstrcpyn = *opaque{}; pub const lstrcpy = *opaque{}; pub const lstrcat = *opaque{}; pub const lstrlen = *opaque{}; } else struct { pub const CPINFOEX = @compileError("'CPINFOEX' requires that UNICODE be set to true or false in the root module"); pub const NUMBERFMT = @compileError("'NUMBERFMT' requires that UNICODE be set to true or false in the root module"); pub const CURRENCYFMT = @compileError("'CURRENCYFMT' requires that UNICODE be set to true or false in the root module"); pub const LOCALE_ENUMPROC = @compileError("'LOCALE_ENUMPROC' requires that UNICODE be set to true or false in the root module"); pub const LANGUAGEGROUP_ENUMPROC = @compileError("'LANGUAGEGROUP_ENUMPROC' requires that UNICODE be set to true or false in the root module"); pub const LANGGROUPLOCALE_ENUMPROC = @compileError("'LANGGROUPLOCALE_ENUMPROC' requires that UNICODE be set to true or false in the root module"); pub const UILANGUAGE_ENUMPROC = @compileError("'UILANGUAGE_ENUMPROC' requires that UNICODE be set to true or false in the root module"); pub const CODEPAGE_ENUMPROC = @compileError("'CODEPAGE_ENUMPROC' requires that UNICODE be set to true or false in the root module"); pub const DATEFMT_ENUMPROC = @compileError("'DATEFMT_ENUMPROC' requires that UNICODE be set to true or false in the root module"); pub const DATEFMT_ENUMPROCEX = @compileError("'DATEFMT_ENUMPROCEX' requires that UNICODE be set to true or false in the root module"); pub const TIMEFMT_ENUMPROC = @compileError("'TIMEFMT_ENUMPROC' requires that UNICODE be set to true or false in the root module"); pub const CALINFO_ENUMPROC = @compileError("'CALINFO_ENUMPROC' requires that UNICODE be set to true or false in the root module"); pub const CALINFO_ENUMPROCEX = @compileError("'CALINFO_ENUMPROCEX' requires that UNICODE be set to true or false in the root module"); pub const REGISTERWORD = @compileError("'REGISTERWORD' requires that UNICODE be set to true or false in the root module"); pub const STYLEBUF = @compileError("'STYLEBUF' requires that UNICODE be set to true or false in the root module"); pub const IMEMENUITEMINFO = @compileError("'IMEMENUITEMINFO' requires that UNICODE be set to true or false in the root module"); pub const REGISTERWORDENUMPROC = @compileError("'REGISTERWORDENUMPROC' requires that UNICODE be set to true or false in the root module"); pub const IEnumRegisterWord = @compileError("'IEnumRegisterWord' requires that UNICODE be set to true or false in the root module"); pub const GetDateFormat = @compileError("'GetDateFormat' requires that UNICODE be set to true or false in the root module"); pub const GetTimeFormat = @compileError("'GetTimeFormat' requires that UNICODE be set to true or false in the root module"); pub const CompareString = @compileError("'CompareString' requires that UNICODE be set to true or false in the root module"); pub const FoldString = @compileError("'FoldString' requires that UNICODE be set to true or false in the root module"); pub const GetStringTypeEx = @compileError("'GetStringTypeEx' requires that UNICODE be set to true or false in the root module"); pub const GetStringType = @compileError("'GetStringType' requires that UNICODE be set to true or false in the root module"); pub const GetCPInfoEx = @compileError("'GetCPInfoEx' requires that UNICODE be set to true or false in the root module"); pub const LCMapString = @compileError("'LCMapString' requires that UNICODE be set to true or false in the root module"); pub const GetLocaleInfo = @compileError("'GetLocaleInfo' requires that UNICODE be set to true or false in the root module"); pub const SetLocaleInfo = @compileError("'SetLocaleInfo' requires that UNICODE be set to true or false in the root module"); pub const GetCalendarInfo = @compileError("'GetCalendarInfo' requires that UNICODE be set to true or false in the root module"); pub const SetCalendarInfo = @compileError("'SetCalendarInfo' requires that UNICODE be set to true or false in the root module"); pub const GetNumberFormat = @compileError("'GetNumberFormat' requires that UNICODE be set to true or false in the root module"); pub const GetCurrencyFormat = @compileError("'GetCurrencyFormat' requires that UNICODE be set to true or false in the root module"); pub const EnumCalendarInfo = @compileError("'EnumCalendarInfo' requires that UNICODE be set to true or false in the root module"); pub const EnumCalendarInfoEx = @compileError("'EnumCalendarInfoEx' requires that UNICODE be set to true or false in the root module"); pub const EnumTimeFormats = @compileError("'EnumTimeFormats' requires that UNICODE be set to true or false in the root module"); pub const EnumDateFormats = @compileError("'EnumDateFormats' requires that UNICODE be set to true or false in the root module"); pub const EnumDateFormatsEx = @compileError("'EnumDateFormatsEx' requires that UNICODE be set to true or false in the root module"); pub const GetGeoInfo = @compileError("'GetGeoInfo' requires that UNICODE be set to true or false in the root module"); pub const EnumSystemLocales = @compileError("'EnumSystemLocales' requires that UNICODE be set to true or false in the root module"); pub const EnumSystemLanguageGroups = @compileError("'EnumSystemLanguageGroups' requires that UNICODE be set to true or false in the root module"); pub const EnumLanguageGroupLocales = @compileError("'EnumLanguageGroupLocales' requires that UNICODE be set to true or false in the root module"); pub const EnumUILanguages = @compileError("'EnumUILanguages' requires that UNICODE be set to true or false in the root module"); pub const EnumSystemCodePages = @compileError("'EnumSystemCodePages' requires that UNICODE be set to true or false in the root module"); pub const ImmInstallIME = @compileError("'ImmInstallIME' requires that UNICODE be set to true or false in the root module"); pub const ImmGetDescription = @compileError("'ImmGetDescription' requires that UNICODE be set to true or false in the root module"); pub const ImmGetIMEFileName = @compileError("'ImmGetIMEFileName' requires that UNICODE be set to true or false in the root module"); pub const ImmGetCompositionString = @compileError("'ImmGetCompositionString' requires that UNICODE be set to true or false in the root module"); pub const ImmSetCompositionString = @compileError("'ImmSetCompositionString' requires that UNICODE be set to true or false in the root module"); pub const ImmGetCandidateListCount = @compileError("'ImmGetCandidateListCount' requires that UNICODE be set to true or false in the root module"); pub const ImmGetCandidateList = @compileError("'ImmGetCandidateList' requires that UNICODE be set to true or false in the root module"); pub const ImmGetGuideLine = @compileError("'ImmGetGuideLine' requires that UNICODE be set to true or false in the root module"); pub const ImmGetCompositionFont = @compileError("'ImmGetCompositionFont' requires that UNICODE be set to true or false in the root module"); pub const ImmSetCompositionFont = @compileError("'ImmSetCompositionFont' requires that UNICODE be set to true or false in the root module"); pub const ImmConfigureIME = @compileError("'ImmConfigureIME' requires that UNICODE be set to true or false in the root module"); pub const ImmEscape = @compileError("'ImmEscape' requires that UNICODE be set to true or false in the root module"); pub const ImmGetConversionList = @compileError("'ImmGetConversionList' requires that UNICODE be set to true or false in the root module"); pub const ImmIsUIMessage = @compileError("'ImmIsUIMessage' requires that UNICODE be set to true or false in the root module"); pub const ImmRegisterWord = @compileError("'ImmRegisterWord' requires that UNICODE be set to true or false in the root module"); pub const ImmUnregisterWord = @compileError("'ImmUnregisterWord' requires that UNICODE be set to true or false in the root module"); pub const ImmGetRegisterWordStyle = @compileError("'ImmGetRegisterWordStyle' requires that UNICODE be set to true or false in the root module"); pub const ImmEnumRegisterWord = @compileError("'ImmEnumRegisterWord' requires that UNICODE be set to true or false in the root module"); pub const ImmGetImeMenuItems = @compileError("'ImmGetImeMenuItems' requires that UNICODE be set to true or false in the root module"); pub const ImmRequestMessage = @compileError("'ImmRequestMessage' requires that UNICODE be set to true or false in the root module"); pub const lstrcmp = @compileError("'lstrcmp' requires that UNICODE be set to true or false in the root module"); pub const lstrcmpi = @compileError("'lstrcmpi' requires that UNICODE be set to true or false in the root module"); pub const lstrcpyn = @compileError("'lstrcpyn' requires that UNICODE be set to true or false in the root module"); pub const lstrcpy = @compileError("'lstrcpy' requires that UNICODE be set to true or false in the root module"); pub const lstrcat = @compileError("'lstrcat' requires that UNICODE be set to true or false in the root module"); pub const lstrlen = @compileError("'lstrlen' requires that UNICODE be set to true or false in the root module"); }, }; //-------------------------------------------------------------------------------- // Section: Imports (28) //-------------------------------------------------------------------------------- const Guid = @import("zig.zig").Guid; const ABC = @import("graphics/gdi.zig").ABC; const BOOL = @import("foundation.zig").BOOL; const BSTR = @import("foundation.zig").BSTR; const CHAR = @import("system/system_services.zig").CHAR; const ETO_OPTIONS = @import("graphics/gdi.zig").ETO_OPTIONS; const HBITMAP = @import("graphics/gdi.zig").HBITMAP; const HDC = @import("graphics/gdi.zig").HDC; const HICON = @import("ui/windows_and_messaging.zig").HICON; const HKL = @import("ui/text_services.zig").HKL; const HRESULT = @import("foundation.zig").HRESULT; const HWND = @import("foundation.zig").HWND; const IClassFactory = @import("system/com.zig").IClassFactory; const IEnumString = @import("system/com.zig").IEnumString; const IUnknown = @import("system/com.zig").IUnknown; const LOGFONTA = @import("graphics/gdi.zig").LOGFONTA; const LOGFONTW = @import("graphics/gdi.zig").LOGFONTW; const LPARAM = @import("foundation.zig").LPARAM; const LRESULT = @import("foundation.zig").LRESULT; const MSG = @import("ui/windows_and_messaging.zig").MSG; const POINT = @import("foundation.zig").POINT; const PSTR = @import("foundation.zig").PSTR; const PWSTR = @import("foundation.zig").PWSTR; const RECT = @import("foundation.zig").RECT; const SAFEARRAY = @import("system/ole_automation.zig").SAFEARRAY; const SIZE = @import("foundation.zig").SIZE; const SYSTEMTIME = @import("foundation.zig").SYSTEMTIME; 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(), "LOCALE_ENUMPROCA")) { _ = LOCALE_ENUMPROCA; } if (@hasDecl(@This(), "LOCALE_ENUMPROCW")) { _ = LOCALE_ENUMPROCW; } if (@hasDecl(@This(), "LANGUAGEGROUP_ENUMPROCA")) { _ = LANGUAGEGROUP_ENUMPROCA; } if (@hasDecl(@This(), "LANGGROUPLOCALE_ENUMPROCA")) { _ = LANGGROUPLOCALE_ENUMPROCA; } if (@hasDecl(@This(), "UILANGUAGE_ENUMPROCA")) { _ = UILANGUAGE_ENUMPROCA; } if (@hasDecl(@This(), "CODEPAGE_ENUMPROCA")) { _ = CODEPAGE_ENUMPROCA; } if (@hasDecl(@This(), "DATEFMT_ENUMPROCA")) { _ = DATEFMT_ENUMPROCA; } if (@hasDecl(@This(), "DATEFMT_ENUMPROCEXA")) { _ = DATEFMT_ENUMPROCEXA; } if (@hasDecl(@This(), "TIMEFMT_ENUMPROCA")) { _ = TIMEFMT_ENUMPROCA; } if (@hasDecl(@This(), "CALINFO_ENUMPROCA")) { _ = CALINFO_ENUMPROCA; } if (@hasDecl(@This(), "CALINFO_ENUMPROCEXA")) { _ = CALINFO_ENUMPROCEXA; } if (@hasDecl(@This(), "LANGUAGEGROUP_ENUMPROCW")) { _ = LANGUAGEGROUP_ENUMPROCW; } if (@hasDecl(@This(), "LANGGROUPLOCALE_ENUMPROCW")) { _ = LANGGROUPLOCALE_ENUMPROCW; } if (@hasDecl(@This(), "UILANGUAGE_ENUMPROCW")) { _ = UILANGUAGE_ENUMPROCW; } if (@hasDecl(@This(), "CODEPAGE_ENUMPROCW")) { _ = CODEPAGE_ENUMPROCW; } if (@hasDecl(@This(), "DATEFMT_ENUMPROCW")) { _ = DATEFMT_ENUMPROCW; } if (@hasDecl(@This(), "DATEFMT_ENUMPROCEXW")) { _ = DATEFMT_ENUMPROCEXW; } if (@hasDecl(@This(), "TIMEFMT_ENUMPROCW")) { _ = TIMEFMT_ENUMPROCW; } if (@hasDecl(@This(), "CALINFO_ENUMPROCW")) { _ = CALINFO_ENUMPROCW; } if (@hasDecl(@This(), "CALINFO_ENUMPROCEXW")) { _ = CALINFO_ENUMPROCEXW; } if (@hasDecl(@This(), "GEO_ENUMPROC")) { _ = GEO_ENUMPROC; } if (@hasDecl(@This(), "GEO_ENUMNAMEPROC")) { _ = GEO_ENUMNAMEPROC; } if (@hasDecl(@This(), "CALINFO_ENUMPROCEXEX")) { _ = CALINFO_ENUMPROCEXEX; } if (@hasDecl(@This(), "DATEFMT_ENUMPROCEXEX")) { _ = DATEFMT_ENUMPROCEXEX; } if (@hasDecl(@This(), "TIMEFMT_ENUMPROCEX")) { _ = TIMEFMT_ENUMPROCEX; } if (@hasDecl(@This(), "LOCALE_ENUMPROCEX")) { _ = LOCALE_ENUMPROCEX; } if (@hasDecl(@This(), "IMCENUMPROC")) { _ = IMCENUMPROC; } if (@hasDecl(@This(), "REGISTERWORDENUMPROCA")) { _ = REGISTERWORDENUMPROCA; } if (@hasDecl(@This(), "REGISTERWORDENUMPROCW")) { _ = REGISTERWORDENUMPROCW; } if (@hasDecl(@This(), "PFN_MAPPINGCALLBACKPROC")) { _ = PFN_MAPPINGCALLBACKPROC; } if (@hasDecl(@This(), "PFNLOG")) { _ = PFNLOG; } if (@hasDecl(@This(), "fpCreateIFECommonInstanceType")) { _ = fpCreateIFECommonInstanceType; } if (@hasDecl(@This(), "fpCreateIFELanguageInstanceType")) { _ = fpCreateIFELanguageInstanceType; } if (@hasDecl(@This(), "fpCreateIFEDictionaryInstanceType")) { _ = fpCreateIFEDictionaryInstanceType; } if (@hasDecl(@This(), "UTraceEntry")) { _ = UTraceEntry; } if (@hasDecl(@This(), "UTraceExit")) { _ = UTraceExit; } if (@hasDecl(@This(), "UTraceData")) { _ = UTraceData; } if (@hasDecl(@This(), "UCharIteratorGetIndex")) { _ = UCharIteratorGetIndex; } if (@hasDecl(@This(), "UCharIteratorMove")) { _ = UCharIteratorMove; } if (@hasDecl(@This(), "UCharIteratorHasNext")) { _ = UCharIteratorHasNext; } if (@hasDecl(@This(), "UCharIteratorHasPrevious")) { _ = UCharIteratorHasPrevious; } if (@hasDecl(@This(), "UCharIteratorCurrent")) { _ = UCharIteratorCurrent; } if (@hasDecl(@This(), "UCharIteratorNext")) { _ = UCharIteratorNext; } if (@hasDecl(@This(), "UCharIteratorPrevious")) { _ = UCharIteratorPrevious; } if (@hasDecl(@This(), "UCharIteratorReserved")) { _ = UCharIteratorReserved; } if (@hasDecl(@This(), "UCharIteratorGetState")) { _ = UCharIteratorGetState; } if (@hasDecl(@This(), "UCharIteratorSetState")) { _ = UCharIteratorSetState; } if (@hasDecl(@This(), "UConverterToUCallback")) { _ = UConverterToUCallback; } if (@hasDecl(@This(), "UConverterFromUCallback")) { _ = UConverterFromUCallback; } if (@hasDecl(@This(), "UMemAllocFn")) { _ = UMemAllocFn; } if (@hasDecl(@This(), "UMemReallocFn")) { _ = UMemReallocFn; } if (@hasDecl(@This(), "UMemFreeFn")) { _ = UMemFreeFn; } if (@hasDecl(@This(), "UCharEnumTypeRange")) { _ = UCharEnumTypeRange; } if (@hasDecl(@This(), "UEnumCharNamesFn")) { _ = UEnumCharNamesFn; } if (@hasDecl(@This(), "UBiDiClassCallback")) { _ = UBiDiClassCallback; } if (@hasDecl(@This(), "UTextClone")) { _ = UTextClone; } if (@hasDecl(@This(), "UTextNativeLength")) { _ = UTextNativeLength; } if (@hasDecl(@This(), "UTextAccess")) { _ = UTextAccess; } if (@hasDecl(@This(), "UTextExtract")) { _ = UTextExtract; } if (@hasDecl(@This(), "UTextReplace")) { _ = UTextReplace; } if (@hasDecl(@This(), "UTextCopy")) { _ = UTextCopy; } if (@hasDecl(@This(), "UTextMapOffsetToNative")) { _ = UTextMapOffsetToNative; } if (@hasDecl(@This(), "UTextMapNativeIndexToUTF16")) { _ = UTextMapNativeIndexToUTF16; } if (@hasDecl(@This(), "UTextClose")) { _ = UTextClose; } if (@hasDecl(@This(), "UNESCAPE_CHAR_AT")) { _ = UNESCAPE_CHAR_AT; } if (@hasDecl(@This(), "URegexMatchCallback")) { _ = URegexMatchCallback; } if (@hasDecl(@This(), "URegexFindProgressCallback")) { _ = URegexFindProgressCallback; } @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/globalization.zig
const std = @import("std"); const debug = std.debug; const mem = std.mem; const testing = std.testing; const unicode = std.unicode; const wbp = @import("../ziglyph.zig").word_break_property; const CodePoint = @import("CodePoint.zig"); const CodePointIterator = CodePoint.CodePointIterator; const emoji = @import("../ziglyph.zig").emoji_data; pub const Word = @This(); bytes: []const u8, offset: usize, /// `eal` compares `str` with the bytes of this word for equality. pub fn eql(self: Word, str: []const u8) bool { return mem.eql(u8, self.bytes, str); } const Type = enum { aletter, cr, dquote, extend, extendnumlet, format, hletter, katakana, lf, midletter, midnum, midnumlet, newline, numeric, regional, squote, wsegspace, xpic, zwj, any, fn get(cp: CodePoint) Type { var ty: Type = .any; if (0x000D == cp.scalar) ty = .cr; if (0x000A == cp.scalar) ty = .lf; if (0x200D == cp.scalar) ty = .zwj; if (0x0022 == cp.scalar) ty = .dquote; if (0x0027 == cp.scalar) ty = .squote; if (wbp.isAletter(cp.scalar)) ty = .aletter; if (wbp.isExtend(cp.scalar)) ty = .extend; if (wbp.isExtendnumlet(cp.scalar)) ty = .extendnumlet; if (wbp.isFormat(cp.scalar)) ty = .format; if (wbp.isHebrewLetter(cp.scalar)) ty = .hletter; if (wbp.isKatakana(cp.scalar)) ty = .katakana; if (wbp.isMidletter(cp.scalar)) ty = .midletter; if (wbp.isMidnum(cp.scalar)) ty = .midnum; if (wbp.isMidnumlet(cp.scalar)) ty = .midnumlet; if (wbp.isNewline(cp.scalar)) ty = .newline; if (wbp.isNumeric(cp.scalar)) ty = .numeric; if (wbp.isRegionalIndicator(cp.scalar)) ty = .regional; if (wbp.isWsegspace(cp.scalar)) ty = .wsegspace; if (emoji.isExtendedPictographic(cp.scalar)) ty = .xpic; return ty; } }; const Token = struct { ty: Type, code_point: CodePoint, fn is(self: Token, ty: Type) bool { return self.ty == ty; } }; /// `WordIterator` iterates a Unicde string one word at-a-time. Note that whitespace and punctuation appear as separate /// elements in the iteration. pub const WordIterator = struct { cp_iter: CodePointIterator, current: ?Token = null, start: ?Token = null, const Self = @This(); pub fn init(str: []const u8) !Self { if (!unicode.utf8ValidateSlice(str)) return error.InvalidUtf8; return Self{ .cp_iter = CodePointIterator{ .bytes = str } }; } // Main API. pub fn next(self: *Self) ?Word { if (self.advance()) |latest_non_ignorable| { var end = self.current.?; var done = false; if (!done and isBreaker(latest_non_ignorable)) { if (latest_non_ignorable.is(.cr)) { if (self.peek()) |p| { // WB if (p.is(.lf)) { _ = self.advance(); end = self.current.?; done = true; } } } } if (!done and end.is(.zwj)) { if (self.peek()) |p| { // WB3c if (p.is(.xpic)) { _ = self.advance(); end = self.current.?; done = true; } } } if (!done and latest_non_ignorable.is(.wsegspace)) { if (self.peek()) |p| { // WB3d if (p.is(.wsegspace) and !isIgnorable(end)) { _ = self.advance(); end = self.current.?; done = true; } } } if (!done and (isAHLetter(latest_non_ignorable) or latest_non_ignorable.is(.numeric))) { if (self.peek()) |p| { // WB5, WB8, WB9, WB10 if (isAHLetter(p) or p.is(.numeric)) { self.run(isAlphaNum); end = self.current.?; done = true; } } } if (!done and isAHLetter(latest_non_ignorable)) { if (self.peek()) |p| { // WB6, WB7 if (p.is(.midletter) or isMidNumLetQ(p)) { // Save state const saved_i = self.cp_iter.i; const saved_current = self.current; const saved_start = self.start; _ = self.advance(); // (MidLetter|MidNumLetQ) if (self.peek()) |pp| { if (isAHLetter(pp)) { _ = self.advance(); // AHLetter end = self.current.?; done = true; } } if (!done) { // Restore state self.cp_iter.i = saved_i; self.current = saved_current; self.start = saved_start; } } } } if (!done and latest_non_ignorable.is(.hletter)) { if (self.peek()) |p| { // WB7a if (p.is(.squote)) { _ = self.advance(); end = self.current.?; done = true; } else if (p.is(.dquote)) { // WB7b, WB7c // Save state const saved_i = self.cp_iter.i; const saved_current = self.current; const saved_start = self.start; _ = self.advance(); // Double_Quote if (self.peek()) |pp| { if (pp.is(.hletter)) { _ = self.advance(); // Hebrew_Letter end = self.current.?; done = true; } } if (!done) { // Restore state self.cp_iter.i = saved_i; self.current = saved_current; self.start = saved_start; } } } } if (!done and latest_non_ignorable.is(.numeric)) { if (self.peek()) |p| { if (p.is(.midnum) or isMidNumLetQ(p)) { // WB11, WB12 // Save state const saved_i = self.cp_iter.i; const saved_current = self.current; const saved_start = self.start; _ = self.advance(); // (MidNum|MidNumLetQ) if (self.peek()) |pp| { if (pp.is(.numeric)) { _ = self.advance(); // Numeric end = self.current.?; done = true; } } if (!done) { // Restore state self.cp_iter.i = saved_i; self.current = saved_current; self.start = saved_start; } } } } if (!done and (isAHLetter(latest_non_ignorable) or latest_non_ignorable.is(.numeric) or latest_non_ignorable.is(.katakana) or latest_non_ignorable.is(.extendnumlet))) { while (true) { if (self.peek()) |p| { // WB13a if (p.is(.extendnumlet)) { _ = self.advance(); // ExtendNumLet if (self.peek()) |pp| { if (isAHLetter(pp) or isNumeric(pp) or pp.is(.katakana)) { // WB13b _ = self.advance(); // (AHLetter|Numeric|Katakana) } } end = self.current.?; done = true; } else break; } else break; } } if (!done and latest_non_ignorable.is(.extendnumlet)) { while (true) { if (self.peek()) |p| { // WB13b if (isAHLetter(p) or p.is(.numeric) or p.is(.katakana)) { _ = self.advance(); // (AHLetter|Numeric|Katakana) end = self.current.?; done = true; if (self.peek()) |pp| { // Chain. if (pp.is(.extendnumlet)) { _ = self.advance(); // ExtendNumLet continue; } } } else break; } else break; } } if (!done and latest_non_ignorable.is(.katakana)) { if (self.peek()) |p| { // WB13 if (p.is(.katakana)) { _ = self.advance(); end = self.current.?; done = true; } } } if (!done and latest_non_ignorable.is(.regional)) { if (self.peek()) |p| { // WB if (p.is(.regional)) { _ = self.advance(); end = self.current.?; done = true; } } } if (!done and latest_non_ignorable.is(.xpic)) { if (self.peek()) |p| { // WB if (p.is(.xpic) and end.is(.zwj)) { _ = self.advance(); end = self.current.?; done = true; } } } const start = self.start.?; self.start = self.peek(); // WB return self.emit(start, end); } return null; } fn peek(self: *Self) ?Token { const saved_i = self.cp_iter.i; defer self.cp_iter.i = saved_i; return if (self.cp_iter.next()) |cp| Token{ .ty = Type.get(cp), .code_point = cp, } else null; } fn advance(self: *Self) ?Token { const latest_non_ignorable = if (self.cp_iter.next()) |cp| Token{ .ty = Type.get(cp), .code_point = cp, } else return null; self.current = latest_non_ignorable; if (self.start == null) self.start = latest_non_ignorable; // Happens only at beginning. // WB3a, WB3b if (!isBreaker(latest_non_ignorable)) self.skipIgnorables(); return latest_non_ignorable; } fn run(self: *Self, predicate: TokenPredicate) void { while (self.peek()) |token| { if (!predicate(token)) break; _ = self.advance(); } } fn skipIgnorables(self: *Self) void { while (self.peek()) |peek_token| { if (!isIgnorable(peek_token)) break; _ = self.advance(); } } // Production. fn emit(self: Self, start_token: Token, end_token: Token) Word { const start = start_token.code_point.offset; const end = end_token.code_point.end(); return .{ .bytes = self.cp_iter.bytes[start..end], .offset = start, }; } }; // Predicates const TokenPredicate = fn (Token) bool; fn isAHLetter(token: Token) bool { return token.ty == .aletter or token.ty == .hletter; } fn isAlphaNum(token: Token) bool { return isAHLetter(token) or isNumeric(token); } fn isBreaker(token: Token) bool { return token.ty == .newline or token.ty == .cr or token.ty == .lf; } fn isIgnorable(token: Token) bool { return token.ty == .extend or token.ty == .format or token.ty == .zwj; } fn isMidNumLetQ(token: Token) bool { return token.ty == .midnumlet or token.ty == .squote; } fn isNumeric(token: Token) bool { return token.ty == .numeric; } test "Segmentation WordIterator" { var path_buf: [1024]u8 = undefined; var path = try std.fs.cwd().realpath(".", &path_buf); // Check if testing in this library path. if (!mem.endsWith(u8, path, "ziglyph")) return; var allocator = std.testing.allocator; var file = try std.fs.cwd().openFile("src/data/ucd/WordBreakTest.txt", .{}); defer file.close(); var buf_reader = std.io.bufferedReader(file.reader()); var input_stream = buf_reader.reader(); var buf: [4096]u8 = undefined; var line_no: usize = 1; while (try input_stream.readUntilDelimiterOrEof(&buf, '\n')) |raw| : (line_no += 1) { // Skip comments or empty lines. if (raw.len == 0 or raw[0] == '#' or raw[0] == '@') continue; // Clean up. var line = mem.trimLeft(u8, raw, "÷ "); if (mem.indexOf(u8, line, " ÷\t#")) |octo| { line = line[0..octo]; } //debug.print("\nline {}: {s}\n", .{ line_no, line }); // Iterate over fields. var want = std.ArrayList(Word).init(allocator); defer { for (want.items) |snt| { allocator.free(snt.bytes); } want.deinit(); } var all_bytes = std.ArrayList(u8).init(allocator); defer all_bytes.deinit(); var words = mem.split(u8, line, " ÷ "); var bytes_index: usize = 0; while (words.next()) |field| { var code_points = mem.split(u8, field, " "); var cp_buf: [4]u8 = undefined; var cp_index: usize = 0; var first: u21 = undefined; var cp_bytes = std.ArrayList(u8).init(allocator); defer cp_bytes.deinit(); while (code_points.next()) |code_point| { if (mem.eql(u8, code_point, "×")) continue; const cp: u21 = try std.fmt.parseInt(u21, code_point, 16); if (cp_index == 0) first = cp; const len = try unicode.utf8Encode(cp, &cp_buf); try all_bytes.appendSlice(cp_buf[0..len]); try cp_bytes.appendSlice(cp_buf[0..len]); cp_index += len; } try want.append(Word{ .bytes = cp_bytes.toOwnedSlice(), .offset = bytes_index, }); bytes_index += cp_index; } //debug.print("\nline {}: {s}\n", .{ line_no, all_bytes.items }); var iter = try WordIterator.init(all_bytes.items); // Chaeck. for (want.items) |w| { const g = (iter.next()).?; //debug.print("\n", .{}); //for (w.bytes) |b| { // debug.print("line {}: w:({x})\n", .{ line_no, b }); //} //for (g.bytes) |b| { // debug.print("line {}: g:({x})\n", .{ line_no, b }); //} //debug.print("line {}: w:({s}), g:({s})\n", .{ line_no, w.bytes, g.bytes }); try testing.expectEqualStrings(w.bytes, g.bytes); try testing.expectEqual(w.offset, g.offset); } } } test "Segmentation comptime WordIterator" { const want = [_][]const u8{ "Hello", " ", "World" }; comptime { var ct_iter = try WordIterator.init("Hello World"); var i = 0; while (ct_iter.next()) |word| : (i += 1) { try testing.expect(word.eql(want[i])); } } }
src/segmenter/Word.zig
const std = @import("std"); const prot = @import("../protocols.zig"); const Context = @import("../client.zig").Context; const Object = @import("../client.zig").Object; const Positioner = @import("../positioner.zig").Positioner; const Rectangle = @import("../rectangle.zig").Rectangle; fn destroy(context: *Context, xdg_positioner: Object) anyerror!void { try prot.wl_display_send_delete_id(context.client.wl_display, xdg_positioner.id); try context.unregister(xdg_positioner); } fn set_size(context: *Context, xdg_positioner: Object, width: i32, height: i32) anyerror!void { const positioner = @intToPtr(*Positioner, xdg_positioner.container); positioner.width = width; positioner.height = height; } fn set_anchor_rect(context: *Context, xdg_positioner: Object, x: i32, y: i32, width: i32, height: i32) anyerror!void { const positioner = @intToPtr(*Positioner, xdg_positioner.container); positioner.anchor_rect = Rectangle { .x = x, .y = y, .width = width, .height = height, }; } fn set_anchor(context: *Context, xdg_positioner: Object, anchor: u32) anyerror!void { const positioner = @intToPtr(*Positioner, xdg_positioner.container); positioner.anchor = @intToEnum(prot.xdg_positioner_anchor, anchor); } fn set_gravity(context: *Context, xdg_positioner: Object, gravity: u32) anyerror!void { const positioner = @intToPtr(*Positioner, xdg_positioner.container); positioner.gravity = @intToEnum(prot.xdg_positioner_gravity, gravity); } fn set_constraint_adjustment(context: *Context, xdg_positioner: Object, constraint_adjustment: u32) anyerror!void { const positioner = @intToPtr(*Positioner, xdg_positioner.container); // std.debug.warn("constraint_adjustment: {}\n", .{constraint_adjustment}); // positioner.constraint_adjustment = @intToEnum(prot.xdg_positioner_constraint_adjustment, constraint_adjustment); } fn set_offset(context: *Context, xdg_positioner: Object, x: i32, y: i32) anyerror!void { const positioner = @intToPtr(*Positioner, xdg_positioner.container); positioner.x = x; positioner.y = y; } pub fn init() void { prot.XDG_POSITIONER = prot.xdg_positioner_interface{ .destroy = destroy, .set_size = set_size, .set_anchor_rect = set_anchor_rect, .set_anchor = set_anchor, .set_gravity = set_gravity, .set_constraint_adjustment = set_constraint_adjustment, .set_offset = set_offset, }; }
src/implementations/xdg_positioner.zig
const std = @import("std"); const upaya = @import("upaya"); const math = upaya.math; const editor = @import("../editor.zig"); const Color = math.Color; usingnamespace @import("imgui"); const Camera = struct { pos: math.Vec2 = .{}, zoom: f32 = 1, pub fn transMat(self: Camera) math.Mat32 { var window_half_size = ogGetWindowSize().scale(0.5); var transform = math.Mat32.identity; var tmp = math.Mat32.identity; tmp.translate(-self.pos.x, -self.pos.y); transform = tmp.mul(transform); tmp = math.Mat32.identity; tmp.scale(self.zoom, self.zoom); transform = tmp.mul(transform); tmp = math.Mat32.identity; tmp.translate(window_half_size.x, window_half_size.y); transform = tmp.mul(transform); return transform; } pub fn clampZoom(self: *Camera) void { self.zoom = std.math.clamp(self.zoom, 0.1, 5); } }; var trans_mat: math.Mat32 = undefined; var camera: Camera = .{}; var screen_pos: ImVec2 = undefined; var tex: ?upaya.Texture = null; pub fn draw(state: *editor.AppState) void { _ = state; if (tex == null) tex = upaya.Texture.initFromFile("examples/assets/plant.png", .nearest) catch unreachable; if (begin("Scene")) { drawRect(.{}, 10, Color.white); drawRect(.{ .x = 30, .y = 30 }, 20, Color.dark_blue); if (upaya.math.isEven(@divTrunc(std.time.milliTimestamp(), 1000))) drawHollowRect(.{ .x = 30, .y = 30 }, .{ .x = 20, .y = 20 }, 3, Color.red); drawRect(.{ .x = 130, .y = 130 }, 20, Color.yellow); drawRect(.{ .x = 430, .y = 230 }, 20, Color.voilet); drawRect(.{ .x = 630, .y = 330 }, 20, Color.green); drawTex(tex.?, .{}); drawTexPortion(tex.?, .{ .x = -100, .y = -100 }, .{ .x = 0, .y = 0, .w = 18, .h = 18 }); drawTexPortion(tex.?, .{ .x = -82, .y = -100 }, .{ .x = 18, .y = 0, .w = 18, .h = 18 }); drawTexPortion(tex.?, .{ .x = -82, .y = -82 }, .{ .x = 18, .y = 18, .w = 18, .h = 18 }); drawTexPortion(tex.?, .{ .x = -100, .y = -82 }, .{ .x = 0, .y = 18, .w = 18, .h = 18 }); drawText("Text at origin", .{}); } end(); } fn begin(name: [*c]const u8) bool { if (!igBegin(name, null, ImGuiWindowFlags_None)) return false; screen_pos = ogGetCursorScreenPos(); const win_size = ogGetContentRegionAvail(); if (win_size.x == 0 or win_size.y == 0) return false; igSetCursorPosX(win_size.x - 150); igSetNextItemWidth(100); _ = igDragFloat2("Position", &camera.pos.x, 1, std.math.f32_min, std.math.f32_min, "%.1f", 1); igSameLine(0, 0); igSetNextItemWidth(75); igSetCursorPosX(win_size.x - 300); _ = ogDrag(f32, "Zoom", &camera.zoom, 0.01, 0.1, 4); // all controls need to be done by now igSetCursorScreenPos(screen_pos); _ = igInvisibleButton("##scene_view", win_size); const is_hovered = igIsItemHovered(ImGuiHoveredFlags_None); trans_mat = camera.transMat(); if (is_hovered) handleInput(); return true; } fn end() void { igEnd(); } fn handleInput() void { // scrolling via drag with alt or super key down if (igIsMouseDragging(ImGuiMouseButton_Left, 0) and (igGetIO().KeyAlt or igGetIO().KeySuper)) { var scroll_delta = ogGetMouseDragDelta(ImGuiMouseButton_Left, 0); camera.pos.x -= scroll_delta.x * 1 / camera.zoom; camera.pos.y -= scroll_delta.y * 1 / camera.zoom; igResetMouseDragDelta(ImGuiMouseButton_Left); return; } if (igGetIO().MouseWheel != 0) { camera.zoom += igGetIO().MouseWheel * 0.05; camera.clampZoom(); igGetIO().MouseWheel = 0; } } // rendering methods pub fn drawRect(center: math.Vec2, size: f32, color: math.Color) void { const half_size = size / 2; var tl = trans_mat.transformImVec2(.{ .x = center.x - half_size, .y = center.y - half_size }); var tr = trans_mat.transformImVec2(.{ .x = center.x + half_size, .y = center.y - half_size }); var br = trans_mat.transformImVec2(.{ .x = center.x + half_size, .y = center.y + half_size }); var bl = trans_mat.transformImVec2(.{ .x = center.x - half_size, .y = center.y + half_size }); ImDrawList_AddQuadFilled(igGetWindowDrawList(), tl.add(screen_pos), tr.add(screen_pos), br.add(screen_pos), bl.add(screen_pos), color.value); } pub fn drawHollowRect(center: math.Vec2, size: math.Vec2, thickness: f32, color: math.Color) void { const half_size = size.scale(0.5); var tl = trans_mat.transformImVec2(.{ .x = center.x - half_size.x, .y = center.y - half_size.y }); var tr = trans_mat.transformImVec2(.{ .x = center.x + half_size.x, .y = center.y - half_size.y }); var br = trans_mat.transformImVec2(.{ .x = center.x + half_size.x, .y = center.y + half_size.y }); var bl = trans_mat.transformImVec2(.{ .x = center.x - half_size.x, .y = center.y + half_size.y }); ImDrawList_AddQuad(igGetWindowDrawList(), tl.add(screen_pos), tr.add(screen_pos), br.add(screen_pos), bl.add(screen_pos), color.value, thickness); } pub fn drawText(text: [*c]const u8, top_left: ImVec2) void { const tl = trans_mat.transformImVec2(top_left); ImDrawList_AddTextVec2(igGetWindowDrawList(), tl.add(screen_pos), 0xffffffff, text, null); } pub fn drawTex(texture: upaya.Texture, pos: ImVec2) void { const tl = trans_mat.transformImVec2(pos); var br = pos; br.x += @intToFloat(f32, texture.width); br.y += @intToFloat(f32, texture.height); br = trans_mat.transformImVec2(br); ImDrawList_AddImage(igGetWindowDrawList(), texture.imTextureID(), tl.add(screen_pos), br.add(screen_pos), .{}, .{ .x = 1, .y = 1 }, 0xffffffff); } pub fn drawTexPortion(texture: upaya.Texture, pos: ImVec2, rect: math.Rect) void { const tl = trans_mat.transformImVec2(pos); var br = pos; br.x += rect.w; br.y += rect.h; br = trans_mat.transformImVec2(br); const inv_w = 1.0 / @intToFloat(f32, texture.width); const inv_h = 1.0 / @intToFloat(f32, texture.height); const uv0 = ImVec2{ .x = rect.x * inv_w, .y = rect.y * inv_h }; const uv1 = ImVec2{ .x = (rect.x + rect.w) * inv_w, .y = (rect.y + rect.h) * inv_h }; ImDrawList_AddImage(igGetWindowDrawList(), texture.imTextureID(), tl.add(screen_pos), br.add(screen_pos), uv0, uv1, 0xffffffff); }
examples/editor/windows/scene_view.zig
const std = @import("std"); usingnamespace @import("tigerbeetle.zig"); pub fn main() !void { // TODO We need to move to hex for struct ids as well, since these will usually be random. // Otherwise, we risk overflowing the JSON integer size limit. // TODO Move this file into tigerbeetle.zig as literal tests: // See std.json for examples of how to test jsonStringify methods. // That way, running "zig test tigerbeetle.zig" will test these automatically. // TODO Update demo.zig's send() method to use std.json.stringify. // TODO Update demo.zig to write to std out. // e.g. // var writer = std.io.getStdOut().writer(); // try std.json.stringify(transfer, .{}, writer); var command = Command.ack; var network = NetworkHeader{ .checksum_meta = 76567523, .checksum_data = 2345456373567, .id = 87236482354976, .command = Command.ack, .size = 76253, }; var account = Account{ .id = 1, .custom = 10, .flags = .{}, .unit = 710, // Let's use the ISO-4217 Code Number for ZAR .debit_reserved = 0, .debit_accepted = 0, .credit_reserved = 0, .credit_accepted = 0, .debit_reserved_limit = 100_000, .debit_accepted_limit = 1_000_000, .credit_reserved_limit = 0, .credit_accepted_limit = 0, }; var transfer = Transfer{ .id = 1000, .debit_account_id = 1, .credit_account_id = 2, .custom_1 = 0, .custom_2 = 0, .custom_3 = 0, .flags = .{ .accept = true, .auto_commit = true, }, .amount = 1000, .timeout = 0, }; try std.json.stringify(command, .{}, std.io.getStdErr().writer()); std.debug.print("\n\n", .{}); try std.json.stringify(network, .{}, std.io.getStdErr().writer()); std.debug.print("\n\n", .{}); try std.json.stringify(account, .{}, std.io.getStdErr().writer()); std.debug.print("\n\n", .{}); try std.json.stringify(transfer, .{}, std.io.getStdErr().writer()); std.debug.print("\n\n", .{}); }
src/format_test.zig
const std = @import("std"); const builtin = @import("builtin"); const liu = @import("liu"); // https://github.com/Pagedraw/pagedraw/blob/master/src/frontend/DraggingCanvas.cjsx // clear canvas // draw curves with cursor // create animation/start animation // undo/redo? // object tracking with binary search-ish thing // -> move objects // -> select objects const wasm = liu.wasm; pub const WasmCommand = void; pub usingnamespace wasm; const Vec2 = liu.Vec2; const Vec3 = liu.Vec3; const Point = struct { pos: Vec2, color: Vec3 }; const ext = struct { extern fn renderExt(triangles: wasm.Obj, colors: wasm.Obj) void; extern fn readPixel(x: u32, y: u32) wasm.Obj; extern fn setColorExt(r: f32, g: f32, b: f32) void; }; const Render = struct { const List = std.ArrayListUnmanaged; const Self = @This(); const LINE_SIZE: u32 = 12; dims: Vec2 = Vec2{ 0, 0 }, triangles: List(f32) = .{}, colors: List(f32) = .{}, temp_begin: ?usize = null, pub fn pixelPosition(self: *Self, pos: Vec2) @Vector(2, u32) { const dimX = self.dims[0]; const dimY = self.dims[1]; const posX = (pos[0] + 1) * dimX / 2; const posY = (pos[1] + 1) * dimY / 2; const x = @floatToInt(u32, posX); const y = @floatToInt(u32, posY); return @Vector(2, u32){ x, y }; } pub fn getPoint(self: *Self, posX: f32, posY: f32) Point { const dimX = self.dims[0]; const dimY = self.dims[1]; const pos = Vec2{ posX * 2 / dimX - 1, -(posY * 2 / dimY - 1) }; const color = current_color; return .{ .pos = pos, .color = color }; } pub fn render(self: *Self) void { const mark = wasm.watermark(); defer wasm.setWatermark(mark); const obj = wasm.out.slice(self.triangles.items); const obj2 = wasm.out.slice(self.colors.items); ext.renderExt(obj, obj2); } pub fn dropTempData(self: *Self) void { const temp_begin = if (self.temp_begin) |t| t else return; self.triangles.items.len = temp_begin; self.colors.items.len = temp_begin / 2 * 3; self.temp_begin = null; self.render(); } pub fn useTempData(self: *Self) void { std.debug.assert(self.temp_begin != null); self.temp_begin = null; } pub fn startTempStorage(self: *Self) void { std.debug.assert(self.temp_begin == null); self.temp_begin = self.triangles.items.len; } pub fn addTriangle(self: *Self, pts: [3]Point) !void { var pos: [6]f32 = undefined; pos[0..2].* = pts[0].pos; pos[2..4].* = pts[1].pos; pos[4..6].* = pts[2].pos; var color: [9]f32 = undefined; color[0..3].* = pts[0].color; color[3..6].* = pts[1].color; color[6..9].* = pts[2].color; try self.triangles.appendSlice(liu.Pages, &pos); try self.colors.appendSlice(liu.Pages, &color); self.render(); } pub fn temp(self: *Self) usize { if (self.temp_begin) |t| { return t; } unreachable; } pub fn pushVert(self: *Self, count: usize) !u32 { const len = self.triangles.items.len; try self.triangles.appendNTimes(liu.Pages, 0, count * 2); try self.colors.appendNTimes(liu.Pages, 0, count * 3); return len; } pub fn drawLine(self: *Self, vertex: u32, from: Point, to: Point) void { const pos = self.triangles.items[(vertex)..]; const color = self.colors.items[(vertex / 2 * 3)..]; const vector = to.pos - from.pos; const rot90: Vec2 = .{ -vector[1], vector[0] }; const tangent_len = @sqrt(rot90[0] * rot90[0] + rot90[1] * rot90[1]); const tangent = rot90 * @splat(2, 2 / tangent_len) / self.dims; // first triangle, drawn clockwise pos[0..2].* = from.pos + tangent; color[0..3].* = from.color; pos[2..4].* = to.pos + tangent; color[3..6].* = to.color; pos[4..6].* = from.pos - tangent; color[6..9].* = from.color; // second triangle, drawn clockwise pos[6..8].* = from.pos - tangent; color[9..12].* = from.color; pos[8..10].* = to.pos + tangent; color[12..15].* = to.color; pos[10..12].* = to.pos - tangent; color[15..18].* = to.color; self.render(); } }; const Tool = struct { const Self = @This(); const VTable = struct { reset: fn (self: *anyopaque) void, rightClick: fn (self: *anyopaque, pt: Point) anyerror!void, key: fn (self: *anyopaque, code: u32) anyerror!void, move: fn (self: *anyopaque, pt: Point) anyerror!void, click: fn (self: *anyopaque, pt: Point) anyerror!void, }; ptr: *anyopaque, vtable: *const VTable, pub fn init(obj: anytype) Self { const PtrT = @TypeOf(obj); const T = std.meta.Child(PtrT); return initWithVtable(T, obj, T); } pub fn initWithVtable(comptime T: type, obj: *T, comptime VtableType: type) Self { const info = std.meta.fieldInfo; const Impls = struct { fn rightClickMethod(o: *anyopaque, pt: Point) anyerror!void { const self = @ptrCast(*T, @alignCast(@alignOf(T), o)); if (@hasDecl(VtableType, "rightClick")) { return VtableType.rightClick(self, pt); } return VtableType.reset(self); } fn keyMethod(o: *anyopaque, code: u32) anyerror!void { if (!@hasDecl(VtableType, "key")) return; const self = @ptrCast(*T, @alignCast(@alignOf(T), o)); return VtableType.key(self, code); } }; const vtable = comptime VTable{ .reset = @ptrCast(info(VTable, .reset).field_type, VtableType.reset), .rightClick = Impls.rightClickMethod, .key = Impls.keyMethod, .move = @ptrCast(info(VTable, .move).field_type, VtableType.move), .click = @ptrCast(info(VTable, .click).field_type, VtableType.click), }; return Self{ .ptr = @ptrCast(*anyopaque, obj), .vtable = &vtable }; } pub fn reset(self: *Self) void { return self.vtable.reset(self.ptr); } pub fn rightClick(self: *Self, pt: Point) !void { return self.vtable.rightClick(self.ptr, pt); } pub fn key(self: *Self, code: u32) !void { return self.vtable.key(self.ptr, code); } pub fn move(self: *Self, pt: Point) !void { return self.vtable.move(self.ptr, pt); } pub fn click(self: *Self, pt: Point) anyerror!void { return self.vtable.click(self.ptr, pt); } }; const ToolKind = enum { click, line, triangle, draw }; var tool_click: ClickTool = .{}; var tool_triangle: TriangleTool = .{}; var tool_line: LineTool = .{}; var tool_draw: DrawTool = .{}; var tool: Tool = Tool.init(&tool_triangle); var tool_kind: ToolKind = .triangle; var render: Render = .{}; var current_color: Vec3 = Vec3{ 0.5, 0.5, 0.5 }; var obj_click: wasm.Obj = undefined; var obj_triangle: wasm.Obj = undefined; var obj_line: wasm.Obj = undefined; var obj_draw: wasm.Obj = undefined; const Math = struct { const EPSILON: f32 = 0.0000001; // Möller–Trumbore algorithm for triangle-ray intersection algorithm fn intersect(vert: u32, ray2: Vec2) bool { const pos = render.triangles.items[vert..]; const ray_origin = liu.vec2Append(ray2, 1); const ray = Vec3{ 0, 0, -1 }; const vert0 = liu.vec2Append(pos[0..2].*, 0); const vert1 = liu.vec2Append(pos[2..4].*, 0); const vert2 = liu.vec2Append(pos[4..6].*, 0); return liu.intersect(EPSILON, ray, ray_origin, .{ vert0, vert1, vert2 }); } }; const LineTool = struct { prev: ?Point = null, const Self = @This(); fn reset(self: *Self) void { render.dropTempData(); self.prev = null; } fn move(self: *Self, pt: Point) !void { const prev = if (self.prev) |prev| prev else return; const temp = render.temp(); render.drawLine(temp, prev, pt); return; } fn click(self: *Self, pt: Point) !void { if (self.prev) |_| { render.useTempData(); self.prev = null; return; } render.startTempStorage(); self.prev = pt; _ = try render.pushVert(6); } }; const TriangleTool = struct { first: ?Point = null, second: ?Point = null, const Self = @This(); fn reset(self: *Self) void { render.dropTempData(); self.first = null; self.second = null; } fn move(self: *Self, pt: Point) !void { const first = if (self.first) |first| first else return; const temp = render.temp(); const second = if (self.second) |second| second else { render.drawLine(temp, first, pt); return; }; render.drawLine(temp + Render.LINE_SIZE, first, pt); render.drawLine(temp + 2 * Render.LINE_SIZE, second, pt); return; } fn click(self: *Self, pt: Point) !void { const first = if (self.first) |first| first else { render.startTempStorage(); self.first = pt; _ = try render.pushVert(6); return; }; const second = if (self.second) |second| second else { self.second = pt; _ = try render.pushVert(12); return; }; self.reset(); try render.addTriangle(.{ first, second, pt }); } }; const DrawTool = struct { const Self = @This(); previous: ?Point = null, fn reset(self: *Self) void { render.dropTempData(); self.previous = null; } fn move(self: *Self, pt: Point) !void { const previous = if (self.previous) |prev| prev else return; self.previous = pt; const vert = try render.pushVert(6); render.drawLine(vert, previous, pt); } fn click(self: *Self, pt: Point) !void { if (self.previous == null) { render.startTempStorage(); self.previous = pt; } else { render.useTempData(); self.previous = null; } } }; const ClickTool = struct { const Self = @This(); dummy: bool = false, fn reset(self: *Self) void { _ = self; } fn rightClick(self: *Self, pt: Point) !void { _ = self; const mark = liu.TempMark; defer liu.TempMark = mark; const pixPos = render.pixelPosition(pt.pos); const pixObj = ext.readPixel(pixPos[0], pixPos[1]); const bytes = try wasm.in.bytes(pixObj, liu.Temp); current_color[0] = @intToFloat(f32, bytes[0]) / 255; current_color[1] = @intToFloat(f32, bytes[1]) / 255; current_color[2] = @intToFloat(f32, bytes[2]) / 255; ext.setColorExt(current_color[0], current_color[1], current_color[2]); } fn move(self: *Self, pt: Point) !void { _ = self; _ = pt; } fn click(self: *Self, pt: Point) !void { _ = self; var i: u32 = render.triangles.items.len; std.debug.assert(i % 6 == 0); while (i > 0) { // iterate in reverse order // we assume that the `triangles` slice is in fact a slice of // 2d triangles i -= 6; const vert = i; if (Math.intersect(vert, pt.pos)) { const color = render.colors.items[(vert / 2 * 3)..]; color[0..3].* = pt.color; color[3..6].* = pt.color; color[6..9].* = pt.color; render.render(); break; } } } }; export fn setColor(r: f32, g: f32, b: f32) void { current_color = Vec3{ r, g, b }; } export fn setDims(width: f32, height: f32) void { render.dims = Vec2{ width, height }; } export fn toggleTool() wasm.Obj { tool.reset(); switch (tool_kind) { .click => { tool = Tool.init(&tool_triangle); tool_kind = .triangle; return obj_triangle; }, .triangle => { tool = Tool.init(&tool_line); tool_kind = .line; return obj_line; }, .line => { tool = Tool.init(&tool_draw); tool_kind = .draw; return obj_draw; }, .draw => { tool = Tool.init(&tool_click); tool_kind = .click; return obj_click; }, } } export fn onRightClick(posX: f32, posY: f32) void { const pt = render.getPoint(posX, posY); tool.rightClick(pt) catch @panic("onRightClick failed"); } export fn onKey(code: u32) void { tool.key(code) catch @panic("onKey failed"); } export fn onMove(posX: f32, posY: f32) void { const pt = render.getPoint(posX, posY); tool.move(pt) catch @panic("onMove failed"); } export fn onClick(posX: f32, posY: f32) void { const pt = render.getPoint(posX, posY); tool.click(pt) catch @panic("onClick failed"); } export fn init() void { wasm.initIfNecessary(); obj_line = wasm.make.string(.manual, "line"); obj_triangle = wasm.make.string(.manual, "triangle"); obj_click = wasm.make.string(.manual, "click"); obj_draw = wasm.make.string(.manual, "draw"); wasm.post(.info, "WASM initialized!", .{}); }
src/routes/painter/painter.zig
const kernel = @import("../../kernel.zig"); const TODO = kernel.TODO; const log = kernel.log.scoped(.Physical); const MemoryMap = @import("memory_map.zig"); var bitset_memory: [0x400_000 + (10 * kernel.arch.page_size)]u8 align(kernel.arch.page_size) = undefined; var bitset_byte_count: u64 = 0; pub var available_regions: []Region = undefined; pub var reserved_regions: []Region.Descriptor = undefined; var _reserved: [64]Region.Descriptor = undefined; var _available: [64]Region = undefined; pub var kernel_region: *Region.Descriptor = undefined; pub var device_tree_region: *Region.Descriptor = undefined; pub const Region = struct { descriptor: Region.Descriptor, allocated_page_count: u64, bitset: []u64, pub const Descriptor = struct { address: u64, page_count: u64, }; }; pub fn init() void { const memory_map = MemoryMap.get(); reserved_regions.ptr = &_reserved; reserved_regions.len = memory_map.reserved.len; kernel.copy(Region.Descriptor, reserved_regions, memory_map.reserved); const kernel_start = kernel.bounds.get_start(); const kernel_end = kernel.bounds.get_end(); const kernel_size = kernel_end - kernel_start; reserved_regions.len += 1; kernel_region = &reserved_regions[reserved_regions.len - 1]; kernel_region.address = kernel_start; kernel_region.page_count = kernel_size / kernel.arch.page_size; kernel.assert(@src(), kernel_size & (kernel.arch.page_size - 1) == 0); reserved_regions.len += 1; device_tree_region = &reserved_regions[reserved_regions.len - 1]; device_tree_region.address = kernel.arch.device_tree.base_address; device_tree_region.page_count = kernel.align_forward(kernel.arch.device_tree.header.size, kernel.arch.page_size) / kernel.arch.page_size; log.debug("Reserved regions", .{}); for (reserved_regions) |reserved, i| { log.debug("[{}] (0x{x}, {})", .{ i, reserved.address, reserved.page_count }); } available_regions.ptr = &_available; available_regions.len = memory_map.available.len; for (memory_map.available) |available, i| { available_regions[i].descriptor = available; } for (reserved_regions) |reserved| { const reserved_size = reserved.page_count * kernel.arch.page_size; for (available_regions) |*available, available_i| { const available_size = available.descriptor.page_count * kernel.arch.page_size; if (reserved.address >= available.descriptor.address and reserved.address < available.descriptor.address + available_size) { const start_matches = reserved.address == available.descriptor.address; const end_matches = reserved.address + reserved_size == available.descriptor.address + available_size; if (!start_matches and !end_matches) { kernel.assert(@src(), available_i == available_regions.len - 1); const first = available; available_regions.len += 1; const second = &available_regions[available_i + 1]; const original_size = available_size; second.descriptor.address = reserved.address + reserved_size; const original_end_address = first.descriptor.address + original_size; second.descriptor.page_count = (original_end_address - second.descriptor.address) / kernel.arch.page_size; first.descriptor.page_count -= second.descriptor.page_count + reserved.page_count; } else if (start_matches and end_matches) { kernel.assert(@src(), available_i == available_regions.len - 1); available_regions.len -= 1; } else if (start_matches) { available.descriptor.address = reserved.address + reserved_size; available.descriptor.page_count -= reserved.page_count; } else if (end_matches) { TODO(@src()); } else { @panic("unreachableeEEEEE"); } break; } // TODO: contemplate the case in which the reserved region is bigger than the available region } } log.debug("Available regions:", .{}); for (available_regions) |region, i| { log.debug("[{}] (0x{x}, {} -- 0x{x})", .{ i, region.descriptor.address, region.descriptor.page_count, region.descriptor.page_count * kernel.arch.page_size }); } for (available_regions) |*region| { // Align to u64 const bitset_len = (region.descriptor.page_count / @bitSizeOf(u64)) + @boolToInt(region.descriptor.page_count % @bitSizeOf(u64) != 0); const bytes_to_allocate = bitset_len * @sizeOf(u64); bitset_byte_count = kernel.align_forward(bitset_byte_count, kernel.arch.page_size); region.bitset.ptr = @ptrCast([*]u64, @alignCast(kernel.arch.page_size, &bitset_memory[bitset_byte_count])); region.bitset.len = bytes_to_allocate / @sizeOf(u64); bitset_byte_count += bytes_to_allocate; } } pub fn allocate1(page_count: u64) ?u64 { const take_hint = true; // TODO: don't allocate if they are different regions (this can cause issues?) for (available_regions) |*region| { if (region.descriptor.page_count - region.allocated_page_count >= page_count) { const supposed_bitset_size = region.descriptor.page_count / @bitSizeOf(u64); kernel.assert(@src(), region.bitset.len >= supposed_bitset_size); var region_allocated_page_count: u64 = 0; const start_index = if (take_hint) region.allocated_page_count / @bitSizeOf(u64) else 0; var first_address: u64 = 0; bitset_loop: for (region.bitset[start_index..]) |*bitset_elem| { comptime var bit: u64 = 0; inline while (bit < @bitSizeOf(u64)) : (bit += 1) { const bit_set = bitset_elem.* & (1 << bit) != 0; if (region_allocated_page_count == page_count) { break :bitset_loop; } else { if (!bit_set) { if (first_address == 0) { const offset = (bit + (start_index * @bitSizeOf(u64))) * kernel.arch.page_size; first_address = region.descriptor.address + offset; } bitset_elem.* = bitset_elem.* | (1 << bit); region_allocated_page_count += 1; } } } } if (region_allocated_page_count == page_count) { const result = first_address; region.allocated_page_count += region_allocated_page_count; kernel.assert(@src(), result != 0); return result; } log.debug("Asked page count: {}. Pages to deallocate: {}. Region page count: {}. Region already allocated: {}", .{ page_count, region_allocated_page_count, region.descriptor.page_count, region.allocated_page_count }); kernel.assert(@src(), region.allocated_page_count + page_count > region.descriptor.page_count); kernel.assert(@src(), first_address != 0); const original_allocated_page_count = region.allocated_page_count - region_allocated_page_count; var byte = original_allocated_page_count / @bitSizeOf(u64); var bit = original_allocated_page_count % @bitSizeOf(u64); kernel.assert(@src(), region_allocated_page_count > 0); if (bit > 0) { while (bit < @bitSizeOf(u64)) : (bit += 1) { region.bitset[byte] &= (~(@as(u64, 1) << @intCast(u6, bit))); region_allocated_page_count -= 1; } } if (region_allocated_page_count >= 64) { TODO(@src()); } if (region_allocated_page_count > 0) { TODO(@src()); } region.allocated_page_count = original_allocated_page_count; } } @panic("allocation failed, no memory"); }
src/kernel/arch/riscv64/physical.zig
const std = @import("std"); const zua = @import("zua.zig"); const Instruction = zua.opcodes.Instruction; const Allocator = std.mem.Allocator; // This is a placeholder implementation to be filled in // as needed pub const GCObject = struct {}; pub const Value = union(Value.Type) { none: void, nil: void, boolean: bool, light_userdata: *anyopaque, // TODO: what type should this be? number: f64, string: *GCObject, table: *GCObject, function: *GCObject, userdata: *GCObject, thread: *GCObject, pub const Type = enum { none, nil, boolean, light_userdata, number, string, table, function, userdata, thread, pub fn isCollectable(self: Type) bool { switch (self) { .string, .table, .function, .userdata, .thread => return true, else => return false, } } /// ID to be used when reading/writing Lua bytecode pub fn bytecodeId(self: Type) u8 { return switch (self) { .none => unreachable, // none is not serializable .nil => 0, .boolean => 1, .light_userdata => 2, .number => 3, .string => 4, .table => 5, .function => 6, .userdata => 7, .thread => 8, }; } }; pub fn getType(self: Value) Type { return @as(Type, self); } pub fn isCollectable(self: Value) bool { return self.getType().isCollectable(); } }; test "collectability" { const nil = Value.nil; var dummyObj = GCObject{}; const str = Value{ .string = &dummyObj }; try std.testing.expect(!nil.isCollectable()); try std.testing.expect(str.isCollectable()); } /// Called Proto in Lua (lobject.h) pub const Function = struct { name: []const u8, code: []const Instruction, constants: []const Constant, varargs: Function.VarArgs = .{}, max_stack_size: u8, num_params: u8 = 0, num_upvalues: u8 = 0, allocator: ?Allocator = null, pub const VarArgs = struct { has_arg: bool = false, is_var_arg: bool = false, needs_arg: bool = false, pub fn dump(self: *const Function.VarArgs) u8 { var dumped: u8 = 0; if (self.has_arg) dumped |= 1; if (self.is_var_arg) dumped |= 2; if (self.needs_arg) dumped |= 4; return dumped; } pub fn undump(dumped: u8) Function.VarArgs { return Function.VarArgs{ .has_arg = (dumped & 1) == 1, .is_var_arg = (dumped & 2) == 2, .needs_arg = (dumped & 4) == 4, }; } }; pub fn deinit(self: *Function) void { if (self.allocator == null) return; // we own all of the strings memory, so free each one for (self.constants) |constant| { switch (constant) { .string => |val| { self.allocator.?.free(val); }, else => {}, } } self.allocator.?.free(self.constants); self.allocator.?.free(self.code); } pub fn printCode(self: *Function) void { // TODO this is an (incomplete) direct port of the function PrintFunction in print.c // It could be cleaned up a lot. for (self.code) |instruction, i| { const op = instruction.op; var a: i32 = instruction.a; var b: i32 = @bitCast(Instruction.ABC, instruction).b; var c: i32 = @bitCast(Instruction.ABC, instruction).c; var bx: i32 = @bitCast(Instruction.ABx, instruction).bx; var sbx: i32 = @bitCast(Instruction.AsBx, instruction).getSignedBx(); std.debug.print("\t{d}\t", .{i + 1}); std.debug.print("{s: <9}\t", .{@tagName(op)}); switch (op.getOpMode()) { .iABC => { std.debug.print("{d}", .{a}); if (op.getBMode() != .NotUsed) { var b_for_display: i32 = if (zua.opcodes.rkIsConstant(@intCast(u9, b))) (-1 - @intCast(i32, zua.opcodes.rkGetConstantIndex(@intCast(u9, b)))) else b; std.debug.print(" {d}", .{b_for_display}); } if (op.getCMode() != .NotUsed) { var c_for_display: i32 = if (zua.opcodes.rkIsConstant(@intCast(u9, c))) (-1 - @intCast(i32, zua.opcodes.rkGetConstantIndex(@intCast(u9, c)))) else c; std.debug.print(" {d}", .{c_for_display}); } }, .iABx => { if (op.getBMode() == .ConstantOrRegisterConstant) { std.debug.print("{d} {d}", .{ a, -1 - bx }); } else { std.debug.print("{d} {d}", .{ a, bx }); } }, .iAsBx => { // TODO _ = sbx; }, } std.debug.print("\n", .{}); } } }; pub const Constant = union(Constant.Type) { string: []const u8, number: f64, boolean: bool, nil: void, pub const Type = enum { string, number, nil, boolean, }; pub const HashContext = struct { pub fn hash(self: @This(), constant: Constant) u64 { _ = self; switch (constant) { .boolean => |val| { const autoHashFn = std.hash_map.getAutoHashFn(@TypeOf(val), void); return autoHashFn({}, val); }, .number => |val| { const floatBits = @typeInfo(@TypeOf(val)).Float.bits; const hashType = std.meta.Int(.unsigned, floatBits); const autoHashFn = std.hash_map.getAutoHashFn(hashType, void); return autoHashFn({}, @bitCast(hashType, val)); }, .string => |val| { return std.hash_map.hashString(val); }, .nil => { return 0; }, } } pub fn eql(self: @This(), a: Constant, b: Constant) bool { _ = self; if (@as(Constant.Type, a) != @as(Constant.Type, b)) { return false; } return switch (a) { .string => std.mem.eql(u8, a.string, b.string), .number => a.number == b.number, .boolean => a.boolean == b.boolean, .nil => true, }; } }; pub const Map = std.HashMap(Constant, usize, Constant.HashContext, std.hash_map.default_max_load_percentage); }; /// Turns a 'source' string into a chunk id for display in errors, etc. /// The buffer must have at least enough capacity to hold [string "..."] /// TODO: this was in lobject.c in Lua, but it's a pretty weird place for it pub fn getChunkId(source: []const u8, buf: []u8) []u8 { const buf_end: usize = buf_end: { switch (source[0]) { '=' => { // remove first char, truncate to buf capacity if needed const source_for_display = source[1..std.math.min(buf.len + 1, source.len)]; std.mem.copy(u8, buf, source_for_display); break :buf_end source_for_display.len; }, '@' => { var source_for_display = source[1..]; // skip the @ const ellipsis = "..."; const max_truncated_len = buf.len - ellipsis.len; var buf_index: usize = 0; if (source_for_display.len > max_truncated_len) { const source_start_index = source_for_display.len - max_truncated_len; source_for_display = source_for_display[source_start_index..]; std.mem.copy(u8, buf, ellipsis); buf_index += ellipsis.len; } std.mem.copy(u8, buf[buf_index..], source_for_display); break :buf_end buf_index + source_for_display.len; }, else => { const prefix = "[string \""; const suffix = "\"]"; const ellipsis = "..."; const min_display_len = prefix.len + ellipsis.len + suffix.len; std.debug.assert(buf.len >= min_display_len); // truncate to first newline const first_newline_index = std.mem.indexOfAny(u8, source, "\r\n"); var source_for_display: []const u8 = if (first_newline_index != null) source[0..first_newline_index.?] else source; // trim to fit in buffer if necessary const max_source_len = buf.len - min_display_len; const needed_truncation = source_for_display.len > max_source_len; if (needed_truncation) { source_for_display.len = max_source_len; } var fbs = std.io.fixedBufferStream(buf); const writer = fbs.writer(); writer.writeAll(prefix) catch unreachable; writer.writeAll(source_for_display) catch unreachable; if (needed_truncation) { writer.writeAll(ellipsis) catch unreachable; } writer.writeAll(suffix) catch unreachable; break :buf_end fbs.getPos() catch unreachable; }, } }; return buf[0..buf_end]; } test "getChunkId" { var buf: [50]u8 = undefined; try std.testing.expectEqualStrings("something", getChunkId("=something", &buf)); try std.testing.expectEqualStrings( "something that is long enough to actually need tru", getChunkId("=something that is long enough to actually need truncation", &buf), ); try std.testing.expectEqualStrings("something", getChunkId("@something", &buf)); try std.testing.expectEqualStrings( ".../is/long/enough/to/actually/need/truncation.lua", getChunkId("@something/that/is/long/enough/to/actually/need/truncation.lua", &buf), ); try std.testing.expectEqualStrings("[string \"something\"]", getChunkId("something", &buf)); try std.testing.expectEqualStrings("[string \"some\"]", getChunkId("some\nthing", &buf)); try std.testing.expectEqualStrings("[string \"some\"]", getChunkId("some\rthing", &buf)); try std.testing.expectEqualStrings( "[string \"something that is long enough to act...\"]", getChunkId("something that is long enough to actually need truncation", &buf), ); var min_buf: [14]u8 = undefined; try std.testing.expectEqualStrings("[string \"...\"]", getChunkId("anything", &min_buf)); } pub const max_floating_point_byte = 0b1111 << (0b11111 - 1); pub const FloatingPointByteIntType = std.math.IntFittingRange(0, max_floating_point_byte); /// Converts an integer to a "floating point byte", represented as /// (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if /// eeeee != 0 and (xxx) otherwise. /// This conversion is lossy. /// Equivalent to luaO_int2fb in lobject.c pub fn intToFloatingPointByte(_x: FloatingPointByteIntType) u8 { std.debug.assert(_x <= max_floating_point_byte); var x = _x; var e: u8 = 0; while (x >= 16) { x = (x + 1) >> 1; e += 1; } if (x < 8) { return @intCast(u8, x); } else { return @intCast(u8, ((e + 1) << 3) | (x - 8)); } } /// Equivalent to luaO_fb2int in lobject.c pub fn floatingPointByteToInt(_x: u8) FloatingPointByteIntType { var x: FloatingPointByteIntType = _x; var e: u5 = @intCast(u5, x >> 3); if (e == 0) { return x; } else { return ((x & 7) + 8) << (e - 1); } } test "intToFloatingPointByte" { try std.testing.expectEqual(@as(u8, 0), intToFloatingPointByte(0)); try std.testing.expectEqual(@as(u8, 8), intToFloatingPointByte(8)); try std.testing.expectEqual(@as(u8, 9), intToFloatingPointByte(9)); try std.testing.expectEqual(@as(u8, 29), intToFloatingPointByte(51)); try std.testing.expectEqual(@as(u8, 64), intToFloatingPointByte(1000)); try std.testing.expectEqual(@as(u8, 64), intToFloatingPointByte(1001)); try std.testing.expectEqual(@as(u8, 65), intToFloatingPointByte(1025)); try std.testing.expectEqual(@as(u8, 255), intToFloatingPointByte(max_floating_point_byte)); try std.testing.expectEqual(@as(FloatingPointByteIntType, 52), floatingPointByteToInt(29)); try std.testing.expectEqual(@as(FloatingPointByteIntType, 1024), floatingPointByteToInt(64)); try std.testing.expectEqual(@as(FloatingPointByteIntType, 1152), floatingPointByteToInt(65)); try std.testing.expectEqual(@as(FloatingPointByteIntType, max_floating_point_byte), floatingPointByteToInt(255)); }
src/object.zig
const std = @import("std"); const debug = std.debug; const assert = debug.assert; const testing = std.testing; pub fn main() anyerror!void { std.debug.warn("main"); } fn duplicate(comptime T: type) type { return struct { const Self = @This(); list: []const T, pub fn init(list: []T) Self { return Self{ .list = list, }; } pub const Iterator = struct { list: []const T, item: ?T, index: usize, n: usize, count: usize, pub fn next(it: *Iterator) ?T { if (it.item == null) return null; if (it.count < it.n) { it.count = it.count+1; return it.item; } it.count = 1; it.index = it.index+1; if (it.index == it.list.len) { it.item = null; return null; } if (it.index < it.list.len) { it.item = it.list[it.index]; return it.item; } unreachable; } }; pub fn iterator(self: *Self, n: usize) Iterator { var item: ?T = null; if (self.list.len != 0 and n != 0) { item = self.list[0]; } return Iterator{ .item = item, .list = self.list, .index = 0, .count = 0, .n = n, }; } }; } test "duplicate.iterator" { var lst = []i32{1,2,3}; var kek: []i32 = lst[0..]; var list = duplicate(i32).init(kek); var iter0 = list.iterator(0); testing.expect(iter0.next() == null); testing.expect(iter0.next() == null); var iter1 = list.iterator(1); testing.expect(iter1.next().? == 1); testing.expect(iter1.next().? == 2); testing.expect(iter1.next().? == 3); testing.expect(iter1.next() == null); testing.expect(iter1.next() == null); var iter2 = list.iterator(2); testing.expect(iter2.next().? == 1); testing.expect(iter2.next().? == 1); testing.expect(iter2.next().? == 2); testing.expect(iter2.next().? == 2); testing.expect(iter2.next().? == 3); testing.expect(iter2.next().? == 3); testing.expect(iter2.next() == null); testing.expect(iter2.next() == null); } test "duplicate.null" { var iter = duplicate(i32).init([]i32{}).iterator(3); testing.expect(iter.next() == null); testing.expect(iter.next() == null); }
src/main.zig
const std = @import("std"); const PortIO = @import("port.zig"); // BIOS Data Area (BDA) const bda_base = 0x0400; // address IO ports for COM1-COM4 (`null` if not present) pub var ports: [4]?u16 = undefined; pub const IRQ_AVAIL = 1; // Data available pub const IRQ_EMPTY = 2; // Transmitter empty pub const IRQ_ERROR = 4; // Break/error pub const IRQ_STATUS = 8; // Status change pub fn init() void { for (@intToPtr(*const [4]u16, bda_base)) |addr, id| { if (addr == 0) { ports[id] = null; continue; } PortIO.out(u8, addr + 1, 0x00); // Disable all interrupts PortIO.out(u8, addr + 3, 0x80); // Enable DLAB PortIO.out(u8, addr + 0, 0x01); // Low byte divisor (115200 baud) PortIO.out(u8, addr + 1, 0x00); // High byte divisor PortIO.out(u8, addr + 3, 0x03); // 8 bits, 1 stop bit, no parity PortIO.out(u8, addr + 4, 0x03); // RTS/DSR set ports[id] = addr; } } pub fn get_irq(port: usize) SerialError!u8 { if (ports[port]) |addr| { return PortIO.in(u8, addr + 1); } else return error.NotPresent; } pub fn set_irq(port: usize, irq: u8) SerialError!void { if (ports[port]) |addr| { PortIO.out(u8, addr + 1, irq); } else return error.NotPresent; } pub fn read(port: usize) SerialError!u8 { if (ports[port]) |addr| { while (!(try is_data_available(port))) {} return PortIO.in(u8, addr); } else return error.NotPresent; } pub fn is_data_available(port: usize) SerialError!bool { if (ports[port]) |addr| { return PortIO.in(u8, addr + 5) & 0x01 != 0; } else return error.NotPresent; } pub fn is_transmit_empty(port: usize) SerialError!bool { if (ports[port]) |addr| { return PortIO.in(u8, addr + 5) & 0x20 != 0; } else return error.NotPresent; } pub fn write(port: usize, val: u8) SerialError!void { if (ports[port]) |addr| { while (!(try is_transmit_empty(port))) {} PortIO.out(u8, addr, val); } else return error.NotPresent; } pub const SerialError = error { NotPresent, }; fn write_to_all(ctx: void, bytes: []const u8) SerialError!usize { for (bytes) |c| { for (ports) |_, id| { if (c == '\n') write(id, '\r') catch continue; write(id, c) catch continue; } } return bytes.len; } pub const Writer = std.io.Writer(void, SerialError, write_to_all); pub fn writer() Writer { return .{ .context = {}}; }
src/io/serial.zig
usingnamespace @import("std").c.builtins; pub const M3Result = [*c]const u8; pub const IM3Environment = ?*opaque {}; pub const IM3Runtime = ?*opaque {}; pub const IM3Module = ?*opaque {}; pub const IM3Function = ?*opaque {}; pub const M3ErrorInfo = extern struct { result: M3Result, runtime: IM3Runtime, module: IM3Module, function: IM3Function, file: [*c]const u8, line: u32, message: [*c]const u8, }; pub const M3ValueType = extern enum(c_int) { none = 0, i32 = 1, i64 = 2, f32 = 3, f64 = 4, unknown = 5, }; pub const M3ImportInfo = extern struct { moduleUtf8: [*c]const u8, fieldUtf8: [*c]const u8, }; pub extern var m3Err_none: M3Result; pub extern var m3Err_typeListOverflow: M3Result; pub extern var m3Err_mallocFailed: M3Result; pub extern var m3Err_incompatibleWasmVersion: M3Result; pub extern var m3Err_wasmMalformed: M3Result; pub extern var m3Err_misorderedWasmSection: M3Result; pub extern var m3Err_wasmUnderrun: M3Result; pub extern var m3Err_wasmOverrun: M3Result; pub extern var m3Err_wasmMissingInitExpr: M3Result; pub extern var m3Err_lebOverflow: M3Result; pub extern var m3Err_missingUTF8: M3Result; pub extern var m3Err_wasmSectionUnderrun: M3Result; pub extern var m3Err_wasmSectionOverrun: M3Result; pub extern var m3Err_invalidTypeId: M3Result; pub extern var m3Err_tooManyMemorySections: M3Result; pub extern var m3Err_moduleAlreadyLinked: M3Result; pub extern var m3Err_functionLookupFailed: M3Result; pub extern var m3Err_functionImportMissing: M3Result; pub extern var m3Err_malformedFunctionSignature: M3Result; pub extern var m3Err_noCompiler: M3Result; pub extern var m3Err_unknownOpcode: M3Result; pub extern var m3Err_functionStackOverflow: M3Result; pub extern var m3Err_functionStackUnderrun: M3Result; pub extern var m3Err_mallocFailedCodePage: M3Result; pub extern var m3Err_settingImmutableGlobal: M3Result; pub extern var m3Err_optimizerFailed: M3Result; pub extern var m3Err_missingCompiledCode: M3Result; pub extern var m3Err_wasmMemoryOverflow: M3Result; pub extern var m3Err_globalMemoryNotAllocated: M3Result; pub extern var m3Err_globaIndexOutOfBounds: M3Result; pub extern var m3Err_argumentCountMismatch: M3Result; pub extern var m3Err_trapOutOfBoundsMemoryAccess: M3Result; pub extern var m3Err_trapDivisionByZero: M3Result; pub extern var m3Err_trapIntegerOverflow: M3Result; pub extern var m3Err_trapIntegerConversion: M3Result; pub extern var m3Err_trapIndirectCallTypeMismatch: M3Result; pub extern var m3Err_trapTableIndexOutOfRange: M3Result; pub extern var m3Err_trapTableElementIsNull: M3Result; pub extern var m3Err_trapExit: M3Result; pub extern var m3Err_trapAbort: M3Result; pub extern var m3Err_trapUnreachable: M3Result; pub extern var m3Err_trapStackOverflow: M3Result; pub extern fn m3_NewEnvironment() IM3Environment; pub extern fn m3_FreeEnvironment(i_environment: IM3Environment) void; pub extern fn m3_NewRuntime(io_environment: IM3Environment, i_stackSizeInBytes: u32, i_userdata: ?*c_void) IM3Runtime; pub extern fn m3_FreeRuntime(i_runtime: IM3Runtime) void; pub extern fn m3_GetMemory(i_runtime: IM3Runtime, o_memorySizeInBytes: [*c]u32, i_memoryIndex: u32) [*c]u8; pub extern fn m3_GetUserData(i_runtime: IM3Runtime) ?*c_void; pub extern fn m3_ParseModule(i_environment: IM3Environment, o_module: [*c]IM3Module, i_wasmBytes: [*c]const u8, i_numWasmBytes: u32) M3Result; pub extern fn m3_FreeModule(i_module: IM3Module) void; pub extern fn m3_LoadModule(io_runtime: IM3Runtime, io_module: IM3Module) M3Result; pub const M3RawCall = ?fn (IM3Runtime, [*c]u64, ?*c_void, ?*c_void) callconv(.C) ?*const c_void; pub extern fn m3_LinkRawFunction(io_module: IM3Module, i_moduleName: [*c]const u8, i_functionName: [*c]const u8, i_signature: [*c]const u8, i_function: M3RawCall) M3Result; pub extern fn m3_LinkRawFunctionEx(io_module: IM3Module, i_moduleName: [*c]const u8, i_functionName: [*c]const u8, i_signature: [*c]const u8, i_function: M3RawCall, i_userdata: ?*const c_void) M3Result; pub extern fn m3_Yield() M3Result; pub extern fn m3_FindFunction(o_function: [*c]IM3Function, i_runtime: IM3Runtime, i_functionName: [*c]const u8) M3Result; pub extern fn m3_GetArgCount(i_function: IM3Function) u32; pub extern fn m3_GetRetCount(i_function: IM3Function) u32; pub extern fn m3_GetArgType(i_function: IM3Function, index: u32) M3ValueType; pub extern fn m3_GetRetType(i_function: IM3Function, index: u32) M3ValueType; pub extern fn m3_CallV(i_function: IM3Function, ...) M3Result; pub extern fn m3_Call(i_function: IM3Function, i_argc: u32, i_argptrs: [*c]?*const c_void) M3Result; pub extern fn m3_CallArgV(i_function: IM3Function, i_argc: u32, i_argv: [*c][*c]const u8) M3Result; pub extern fn m3_GetResults(i_function: IM3Function, i_retc: u32, ret_ptrs: [*c]?*c_void) M3Result; pub extern fn m3_GetErrorInfo(i_runtime: IM3Runtime, info: [*c]M3ErrorInfo) void; pub extern fn m3_ResetErrorInfo(i_runtime: IM3Runtime) void; pub extern fn m3_PrintRuntimeInfo(i_runtime: IM3Runtime) void; pub extern fn m3_PrintM3Info() void; pub extern fn m3_PrintProfilerInfo() void; pub extern fn m3_LinkWASI(io_module: IM3Module) M3Result;
src/c.zig
const std = @import("std"); const with_trace = true; const assert = std.debug.assert; fn trace(comptime fmt: []const u8, args: anytype) void { if (with_trace) std.debug.print(fmt, args); } fn findpair(s: []const u8) ?usize { if (s.len < 2) return null; var i: usize = 0; while (i < s.len - 1) : (i += 1) { const prev = if (i > 0) s[i - 1] else 0; const pair0 = s[i]; const pair1 = s[i + 1]; const next = if (i + 2 < s.len) s[i + 2] else 0; if (pair0 == pair1 and pair0 != prev and pair1 != next) return i; } return null; } fn is_valid1(s: []const u8) bool { var hasbrelan = false; var tri = [3]u8{ 0, 0, 0 }; for (s) |c| { tri[0] = tri[1]; tri[1] = tri[2]; tri[2] = c; if (tri[0] + 1 == tri[1] and tri[1] + 1 == tri[2]) hasbrelan = true; } if (!hasbrelan) return false; var hasforbiden = false; for (s) |c| { if (c == 'o' or c == 'l' or c == 'i') hasforbiden = true; } if (hasforbiden) return false; const pair1 = findpair(s); if (pair1) |p1| { var n = p1 + 2; while (true) { const pair2 = findpair(s[n..]); if (pair2) |p2| { if (s[p1] != s[p2]) return true; n = p2 + 2; } else { return false; } } } else { return false; } } fn add_one(s: []u8) void { var carry: u8 = 1; var i: usize = 0; while (i < s.len) : (i += 1) { const pos = &s[(s.len - 1) - i]; const c = pos.* + carry; if (c > 'z') { carry = 1; pos.* = 'a'; } else { carry = 0; pos.* = c; } } } pub fn main() anyerror!void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const allocator = arena.allocator(); // const limit = 1 * 1024 * 1024 * 1024; // const text = try std.fs.cwd().readFileAlloc(allocator, "day9.txt", limit); var password: [8]u8 = undefined; std.mem.copy(u8, &password, "<PASSWORD>"); add_one(&password); while (!is_valid1(&password)) { add_one(&password); } add_one(&password); while (!is_valid1(&password)) { add_one(&password); } const out = std.io.getStdOut().writer(); try out.print("pass = {s}\n", password); // return error.SolutionNotFound; }
2015/day11.zig
const std = @import("std"); const fs = std.fs; const io = std.io; const mem = std.mem; const Allocator = mem.Allocator; const Target = std.Target; // TODO this is hard-coded until self-hosted gains this information canonically const available_libcs = [_][]const u8{ "aarch64_be-linux-gnu", "aarch64_be-linux-musl", "aarch64_be-windows-gnu", "aarch64-linux-gnu", "aarch64-linux-musl", "aarch64-windows-gnu", "armeb-linux-gnueabi", "armeb-linux-gnueabihf", "armeb-linux-musleabi", "armeb-linux-musleabihf", "armeb-windows-gnu", "arm-linux-gnueabi", "arm-linux-gnueabihf", "arm-linux-musleabi", "arm-linux-musleabihf", "arm-windows-gnu", "i386-linux-gnu", "i386-linux-musl", "i386-windows-gnu", "mips64el-linux-gnuabi64", "mips64el-linux-gnuabin32", "mips64el-linux-musl", "mips64-linux-gnuabi64", "mips64-linux-gnuabin32", "mips64-linux-musl", "mipsel-linux-gnu", "mipsel-linux-musl", "mips-linux-gnu", "mips-linux-musl", "powerpc64le-linux-gnu", "powerpc64le-linux-musl", "powerpc64-linux-gnu", "powerpc64-linux-musl", "powerpc-linux-gnu", "powerpc-linux-musl", "riscv64-linux-gnu", "riscv64-linux-musl", "s390x-linux-gnu", "s390x-linux-musl", "sparc-linux-gnu", "sparcv9-linux-gnu", "wasm32-freestanding-musl", "x86_64-linux-gnu (native)", "x86_64-linux-gnux32", "x86_64-linux-musl", "x86_64-windows-gnu", }; // TODO this is hard-coded until self-hosted gains this information canonically const available_glibcs = [_][]const u8{ "2.0", "2.1", "2.1.1", "2.1.2", "2.1.3", "2.2", "2.2.1", "2.2.2", "2.2.3", "2.2.4", "2.2.5", "2.2.6", "2.3", "2.3.2", "2.3.3", "2.3.4", "2.4", "2.5", "2.6", "2.7", "2.8", "2.9", "2.10", "2.11", "2.12", "2.13", "2.14", "2.15", "2.16", "2.17", "2.18", "2.19", "2.22", "2.23", "2.24", "2.25", "2.26", "2.27", "2.28", "2.29", "2.30", }; pub fn cmdTargets( allocator: *Allocator, args: []const []const u8, stdout: *io.OutStream(fs.File.WriteError), native_target: Target, ) !void { const BOS = io.BufferedOutStream(fs.File.WriteError); var bos = BOS.init(stdout); var jws = std.json.WriteStream(BOS.Stream, 6).init(&bos.stream); try jws.beginObject(); try jws.objectField("arch"); try jws.beginArray(); { inline for (@typeInfo(Target.Cpu.Arch).Enum.fields) |field| { try jws.arrayElem(); try jws.emitString(field.name); } } try jws.endArray(); try jws.objectField("os"); try jws.beginArray(); inline for (@typeInfo(Target.Os).Enum.fields) |field| { try jws.arrayElem(); try jws.emitString(field.name); } try jws.endArray(); try jws.objectField("abi"); try jws.beginArray(); inline for (@typeInfo(Target.Abi).Enum.fields) |field| { try jws.arrayElem(); try jws.emitString(field.name); } try jws.endArray(); try jws.objectField("libc"); try jws.beginArray(); for (available_libcs) |libc| { try jws.arrayElem(); try jws.emitString(libc); } try jws.endArray(); try jws.objectField("glibc"); try jws.beginArray(); for (available_glibcs) |glibc| { try jws.arrayElem(); try jws.emitString(glibc); } try jws.endArray(); try jws.objectField("cpus"); try jws.beginObject(); inline for (@typeInfo(Target.Cpu.Arch).Enum.fields) |field| { try jws.objectField(field.name); try jws.beginObject(); const arch = @field(Target.Cpu.Arch, field.name); for (arch.allCpuModels()) |model| { try jws.objectField(model.name); try jws.beginArray(); for (arch.allFeaturesList()) |feature, i| { if (model.features.isEnabled(@intCast(u8, i))) { try jws.arrayElem(); try jws.emitString(feature.name); } } try jws.endArray(); } try jws.endObject(); } try jws.endObject(); try jws.objectField("cpuFeatures"); try jws.beginObject(); inline for (@typeInfo(Target.Cpu.Arch).Enum.fields) |field| { try jws.objectField(field.name); try jws.beginArray(); const arch = @field(Target.Cpu.Arch, field.name); for (arch.allFeaturesList()) |feature| { try jws.arrayElem(); try jws.emitString(feature.name); } try jws.endArray(); } try jws.endObject(); try jws.objectField("native"); try jws.beginObject(); { const triple = try native_target.zigTriple(allocator); defer allocator.free(triple); try jws.objectField("triple"); try jws.emitString(triple); } { try jws.objectField("cpu"); try jws.beginObject(); try jws.objectField("arch"); try jws.emitString(@tagName(native_target.getArch())); try jws.objectField("name"); const cpu = native_target.getCpu(); try jws.emitString(cpu.model.name); { try jws.objectField("features"); try jws.beginArray(); for (native_target.getArch().allFeaturesList()) |feature, i_usize| { const index = @intCast(Target.Cpu.Feature.Set.Index, i_usize); if (cpu.features.isEnabled(index)) { try jws.arrayElem(); try jws.emitString(feature.name); } } try jws.endArray(); } try jws.endObject(); } try jws.objectField("os"); try jws.emitString(@tagName(native_target.getOs())); try jws.objectField("abi"); try jws.emitString(@tagName(native_target.getAbi())); // TODO implement native glibc version detection in self-hosted try jws.endObject(); try jws.endObject(); try bos.stream.writeByte('\n'); return bos.flush(); }
src-self-hosted/print_targets.zig
const std = @import("std"); const known = @import("known-folders"); const clap = @import("clap"); const palette = @import("pal/palette.zig"); const replaceWriter = @import("pal/replace_writer.zig").replaceWriter; const fmt = std.fmt; const fs = std.fs; const heap = std.heap; const io = std.io; const rand = std.rand; const cli_params = blk: { @setEvalBranchQuota(2000); break :blk [_]clap.Param(clap.Help){ clap.parseParam("-h, --help display this help and exit.") catch unreachable, clap.parseParam("-s, --set set the current palettes to <PALETTE> or a random palette from <PALETTE>...") catch unreachable, clap.parseParam("-p, --preview preview <PALETTE>...") catch unreachable, clap.parseParam("-c, --current set <PALETTE> to the current palette") catch unreachable, clap.parseParam("-b, --broadcast broadcast changes to all ptys.") catch unreachable, clap.parseParam("-r, --random select a random palette from all available palettes") catch unreachable, clap.parseParam("<PALETTE>...") catch unreachable, }; }; fn die(comptime fmt_str: []const u8, args: anytype) u8 { std.debug.print(fmt_str ++ "\n", args); return 1; } fn printHelp(msg: ?[]const u8, exe_arg: ?[]const u8, exit: u8) noreturn { const stderr = replaceWriter(io.getStdErr().writer(), "\t", " ").writer(); if (msg) |m| stderr.print("{s}\n\n", .{m}) catch {}; stderr.print("pal: {s} [options] [palettes]\n", .{exe_arg}) catch {}; clap.help(stderr, &cli_params) catch {}; std.os.exit(exit); } fn paletteLocal() !fs.Dir { return try fs.cwd().makeOpenPath("pal", .{}); } fn getPalette(set: *palette.PaletteSet, name: []const u8, dir: fs.Dir) !palette.Palette { const idx = std.mem.indexOf(u8, name, ":") orelse name.len; const base = name[0..idx]; if (set.get(name)) |p| { return p; } var p_file = try dir.openFile(base, .{}); defer p_file.close(); try set.add(base, p_file.reader()); return set.get(name) orelse error.InvalidPalette; } fn setPalette(pal: palette.Palette, broadcast: bool) !void { if (broadcast) { const pts = (try std.fs.openDirAbsolute("/dev/pts/", .{ .iterate = true })); var pts_iter = pts.iterate(); while (try pts_iter.next()) |p| { // verify this *looks* like a pty _ = fmt.parseInt(usize, p.name, 10) catch continue; var pty = try pts.openFile(p.name, .{ .read = false, .write = true }); try pty.writer().print("{x}", .{pal}); } } else { try io.getStdOut().writer().print("{x}", .{pal}); } } fn globalPaletteSet(allocator: *std.mem.Allocator, palette_dir: fs.Dir) !palette.PaletteSet { var set = palette.PaletteSet.init(allocator); var palette_iter = palette_dir.iterate(); while (try palette_iter.next()) |pal| { var file = try palette_dir.openFile(pal.name, .{}); defer file.close(); try set.add(pal.name, file.reader()); } return set; } fn fisherYates(comptime T: type, rng: *rand.Random, slice: []T) void { var i: usize = slice.len - 1; while (i > 0) : (i -= 1) { const j = rng.uintLessThan(usize, i + 1); std.mem.swap(T, &slice[i], &slice[j]); } } pub fn main() !u8 { var gpa = heap.GeneralPurposeAllocator(.{}){ .backing_allocator = heap.page_allocator, }; var gpa_alloc = &gpa.allocator; defer _ = gpa.deinit(); const stderr = replaceWriter(io.getStdErr().writer(), "\t", " ").writer(); var palette_set = palette.PaletteSet.init(gpa_alloc); defer palette_set.deinit(); const pal_dir = blk: { if (try known.open(gpa_alloc, .data, .{})) |dir| { break :blk dir.makeOpenPath("pal", .{}) catch try paletteLocal(); } else { break :blk try paletteLocal(); } }; const palette_dir = try pal_dir.makeOpenPath("palettes", .{ .iterate = true }); var diag: clap.Diagnostic = undefined; var args = clap.parse( clap.Help, &cli_params, .{ .allocator = gpa_alloc, .diagnostic = &diag }, ) catch |err| { diag.report(stderr, err) catch {}; try stderr.print("\n", .{}); printHelp("no palette supplied", null, 1); }; defer args.deinit(); if (args.flag("--help")) { printHelp("no palette supplied", args.exe_arg, 0); } var buf: [32]u8 = undefined; const current_palette: ?palette.Palette = blk: { if (args.flag("--current")) { var file = pal_dir.openFile("current", .{}) catch |e| { return die("cannot get current palette: {}", .{e}); }; defer file.close(); const cp_name = std.mem.trim(u8, buf[0..(try file.reader().read(&buf))], " \n\r\t"); break :blk getPalette(&palette_set, cp_name, palette_dir) catch |e| { return die("invalid palette \"{s}\" set as current palette: {}", .{ cp_name, e }); }; } else { break :blk null; } }; var global_set = try globalPaletteSet(gpa_alloc, palette_dir); defer global_set.deinit(); var rng = &rand.Xoroshiro128.init(@intCast(u64, std.time.milliTimestamp())).random; fisherYates([]const u8, rng, global_set.profiles.items); if (args.flag("--set")) { const desired_palette = blk: { if (current_palette) |p| { break :blk p; } else switch (args.positionals().len) { 0 => { if (args.flag("--random")) { var slice = global_set.profiles.items; var name = slice[rng.uintLessThan(usize, slice.len)]; break :blk global_set.palettes.getPtr(name).?.*; } else { printHelp("no palette supplied", args.exe_arg, 0); } }, else => |len| { const idx = if (len > 1) rng.uintLessThan(usize, len) else 0; break :blk getPalette(&palette_set, args.positionals()[idx], palette_dir) catch { return die("invalid palette: {s}", .{args.positionals()[idx]}); }; }, } }; try setPalette(desired_palette, args.flag("--broadcast")); var current_file: fs.File = pal_dir.createFile("current", .{}) catch |e| { return die("cannot access current palette file: {s}", .{e}); }; defer current_file.close(); try current_file.writer().print("{s}", .{desired_palette.name}); } else if (args.flag("--preview")) { const stdout = io.getStdOut().writer(); if (current_palette) |p| { try stdout.print("*{}\n", .{p}); if (args.positionals().len > 0) { try stdout.print("\n", .{}); } } if (args.positionals().len == 0 or args.flag("--random")) { //const n = std.fmt.parseInt(usize, count, 10) catch { // return die("expected natural number got '{s}'", .{count}); //}; const take = std.math.clamp(10, 0, global_set.profiles.items.len); for (global_set.profiles.items[0..take]) |name, i| { try stdout.print("{}\n", .{global_set.palettes.get(name).?}); if (i != take - 1) { try stdout.print("\n", .{}); } } } else { for (args.positionals()) |name, i| { var p = getPalette(&palette_set, name, palette_dir) catch { try stdout.print("invalid palette: {s}\n\n", .{name}); continue; }; try stdout.print("{}\n", .{p}); if (i != args.positionals().len - 1) { try stdout.print("\n", .{}); } } } } else { printHelp(null, args.exe_arg, 0); } return 0; } test "pal" { std.testing.refAllDecls(@This()); // _ = @import("pal/palette.zig"); // _ = @import("pal/parser.zig"); }
pal/pal.zig
pub fn main() !void { const file_name = std.fs.path.basename(@src().file); print("\n file: {}\n", .{file_name}); } // basic function that takes two arguments and returns a primitive values. // this function does not return an error, but may trigger a runtime integer // overflow error. fn add(a: i8, b: i8) i8 { if (a == 0) { return b; } return a + b; } // pub makes the function visible for zig @import. primitive argument // types are passed by value. parameters are immutable. // see: https://ziglang.org/documentation/master/#Pass-by-value-Parameters pub fn sub(a: i8, b: i8) i8 { return a - b; } // export makes the function visible outside the generated object file // for link time resolution and generates C ABI format. export fn mul(a: i8, b: i8) i8 { return a * b; } // inline forces a function to inlines at all call sites. when it cannot // be inlined an error is thrown at compile time. inline fn div(a: i8, b: i8) i8 { return @divExact(a, b); } // the return type prefixed with '!' means 'anyerror!i8'. anyerror is a super // type of all errors. see `Hello World` comments on error set types. // see: https://ziglang.org/documentation/master/#Hello-World // see: https://ziglang.org/documentation/master/#Error-Set-Type fn add3(a: i8) error{Overflow}!i8 { var x: i8 = 3; if (@addWithOverflow(i8, x, a, &x)) { return error.Overflow; } return x; } test "function add i8" { // 128 is runtime integer overflow for i8 expect(add(100, 27) == 127); } test "function sub i8" { expect(sub(127, 100) == 27); } test "function mul i8" { expect(mul(62, 2) == 124); } test "function div i8" { expect(div(124, 2) == 62); } // see: https://ziglang.org/documentation/master/#try // see: https://ziglang.org/documentation/master/#unreachable test "funciton add8 with return error" { const n1 = try add3(124); const n2 = add3(127) catch |err| { expect(err == error.Overflow); return; }; unreachable; } // imports const std = @import("std"); const print = std.debug.print; const expect = std.testing.expect;
05_functions.zig
const std = @import("std"); const testing = std.testing; const fmt = std.fmt; /// Takes a string such as "5d4h3h2s" and returns the number of seconds it represents. /// Available modifiers are: /// d: days /// h: hours /// m: minutes /// s: seconds pub fn seconds(human_string: []const u8) u64 { return humanStringToInt(human_string, 1); } /// Takes a string such as "5d4h3m2s" and returns the number of milliseconds it represents. /// Available modifiers are: /// d: days /// h: hours /// m: minutes /// s: seconds pub fn milliseconds(human_string: []const u8) u64 { return humanStringToInt(human_string, 1000); } fn humanStringToInt(human_string: []const u8, multiplier: u32) u64 { var current_number: u32 = 0; var total_time: u64 = 0; for (human_string) |s| { switch (s) { '0' => current_number *= 10, '1'...'9' => { const digit = fmt.charToDigit(s, 10) catch |err| { switch (err) { // pre-requisite already checked in the switch, fatal error if we error out on this error.InvalidCharacter => @panic("Somehow we have a bad digit between 1 and 9"), } }; current_number *= 10; current_number += digit; }, 's' => { total_time += multiplier * current_number; current_number = 0; }, 'm' => { total_time += 60 * multiplier * current_number; current_number = 0; }, 'h' => { total_time += 3600 * multiplier * current_number; current_number = 0; }, 'd' => { total_time += 86400 * multiplier * current_number; current_number = 0; }, else => continue, } } return total_time; } test "1h2m3s" { const time = comptime seconds("1h2m3s"); testing.expectEqual(time, 3723); } test "2h4m6s" { const time = comptime seconds("2h4m6s"); testing.expectEqual(time, (3600 * 2) + (4 * 60) + 6); } test "1h2m3s in milliseconds" { const format_string = "1h2m3s"; const time = comptime milliseconds(format_string); testing.expectEqual(time, comptime seconds(format_string) * 1000); } test "2h4m6s in milliseconds" { const format_string = "2h4m6s"; const time = comptime milliseconds(format_string); testing.expectEqual(time, comptime seconds(format_string) * 1000); } test "2h4m6s in milliseconds at runtime" { const format_string = "2h4m6s"; const time = milliseconds(format_string); testing.expectEqual(time, seconds(format_string) * 1000); } test "2h" { testing.expectEqual(comptime seconds("2h"), 7200); } test "2m5s" { testing.expectEqual(comptime seconds("2m5s"), 125); } test "2h5s" { testing.expectEqual(comptime seconds("2h5s"), 7205); } test "5d4h3m2s" { testing.expectEqual(seconds("5d4h3m2s"), 446582); } test "5d4h3m2s" { testing.expectEqual(milliseconds("5d4h3m2s"), 446582 * 1000); }
src/humantime.zig
const std = @import("std"); const clap = @import("clap"); const stderr = std.io.getStdErr().writer(); const Options = @This(); const config = @cImport(@cInclude("config.h")); benchmark: u32 = 0, filter: ?[]const u8 = null, init_search: ?[]const u8 = null, show_scores: bool = false, scrolloff: usize = 1, tty_filename: []const u8 = config.DEFAULT_TTY, num_lines: usize = config.DEFAULT_NUM_LINES, prompt: []const u8 = config.DEFAULT_PROMPT, workers: usize = config.DEFAULT_WORKERS, input_delimiter: u8 = '\n', show_info: bool = config.DEFAULT_SHOW_INFO != 0, input_file: ?[]const u8 = null, sort: bool = true, pub fn new() !Options { var options = Options{}; const params = comptime clap.parseParamsComptime( \\ -l, --lines <LINES> Specify how many lines of results to show (default 10) \\ -p, --prompt <PROMPT> Input prompt (default '> ') \\ -q, --query <QUERY> Use QUERY as the initial search string \\ -e, --show-matches <QUERY> Output the sorted matches of QUERY \\ -t, --tty <TTY> Specify file to use as TTY device (default /dev/tty) \\ -s, --show-scores Show the scores of each match \\ -0, --read-null Read input delimited by ASCII NUL characters \\ -j, --workers <NUM> Use NUM workers for searching. (default is # of CPUs) \\ -b, --benchmark <NUM> Run the match algorithm NUM times \\ -i, --show-info Show selection info line \\ -f, --file <FILE> Read choices from FILE insted of stdin \\ -n, --no-sort Do not sort matches \\ -h, --help Display this help and exit \\ -v, --version Output version information and exit ); const usage = struct { fn usage() !void { try stderr.writeAll("Usage: fzy [OPTION]...\n"); try clap.help(stderr, clap.Help, &params, .{ .description_on_new_line = false, .spacing_between_parameters = 0, }); } }.usage; const parsers = comptime .{ .LINES = clap.parsers.string, .PROMPT = clap.parsers.string, .QUERY = clap.parsers.string, .TTY = clap.parsers.string, .NUM = clap.parsers.int(u32, 10), .FILE = clap.parsers.string, }; var diag = clap.Diagnostic{}; var res = clap.parse(clap.Help, &params, parsers, .{ .diagnostic = &diag, }) catch |err| { diag.report(stderr, err) catch {}; return err; }; defer res.deinit(); if (res.args.help) { try usage(); std.process.exit(0); } if (res.args.lines) |l| { options.num_lines = blk: { if (std.fmt.parseUnsigned(usize, l, 10)) |lines| { if (lines >= 3) { break :blk lines; } } else |_| {} std.debug.print("Invalid format for --lines: {s}", .{l}); // usage(); std.process.exit(1); }; } if (res.args.prompt) |p| options.prompt = p; if (res.args.query) |q| options.init_search = q; if (res.args.@"show-matches") |e| options.filter = e; if (res.args.tty) |t| options.tty_filename = t; if (res.args.@"show-scores") options.show_scores = true; if (res.args.@"read-null") options.input_delimiter = 0; if (res.args.workers) |j| options.workers = j; if (res.args.@"show-info") options.show_info = true; if (res.args.benchmark) |b| options.benchmark = b; if (res.args.file) |f| { options.input_file = f; } if (res.args.@"no-sort") options.sort = false; return options; }
src/Options.zig
const std = @import("std"); usingnamespace @import("util.zig"); usingnamespace @import("fdt.zig"); pub const Error = error{ Truncated, BadMagic, UnsupportedVersion, BadStructure, Internal, }; pub const Event = union(enum) { BeginNode: []const u8, EndNode, Prop: Prop, End, }; pub const State = union(enum) { Event: Event, Error: Error, }; pub const Prop = struct { name: []const u8, value: []const u8, }; pub const Traverser = struct { const Self = @This(); state: State = .{ .Error = error.Internal }, frame: @Frame(traverse) = undefined, pub fn init(self: *Self, fdt: []const u8) Error!void { self.frame = async traverse(fdt, &self.state); switch (try self.current()) { .BeginNode => {}, else => return error.Internal, } } pub fn current(self: *Self) Error!Event { switch (self.state) { .Event => |ev| return ev, .Error => |err| return err, } } pub fn next(self: *Self) Error!Event { resume self.frame; return self.current(); } }; /// Try to carefully extract the total size of an FDT at this address. pub fn totalSize(fdt: *c_void) Error!u32 { const header_ptr = @ptrCast(*const FDTHeader, fdt); if (std.mem.bigToNative(u32, header_ptr.magic) != FDTMagic) { return error.BadMagic; } return std.mem.bigToNative(u32, header_ptr.totalsize); } pub fn traverse(fdt: []const u8, state: *State) void { if (fdt.len < @sizeOf(FDTHeader)) { state.* = .{ .Error = error.Truncated }; return; } const header = structBigToNative(FDTHeader, @ptrCast(*const FDTHeader, fdt.ptr).*); if (header.magic != FDTMagic) { state.* = .{ .Error = error.BadMagic }; return; } if (fdt.len < header.totalsize) { state.* = .{ .Error = error.Truncated }; return; } if (header.version != 17) { state.* = .{ .Error = error.UnsupportedVersion }; return; } var traverser = InternalTraverser{ .fdt = fdt, .header = header, .offset = header.off_dt_struct }; if (traverser.token() != .BeginNode) { state.* = .{ .Error = error.BadStructure }; return; } { const node_name = traverser.cstring(); traverser.alignTo(u32); state.* = .{ .Event = .{ .BeginNode = node_name } }; suspend {} } var depth: usize = 1; while (depth > 0) { switch (traverser.token()) { .BeginNode => { depth += 1; const node_name = traverser.cstring(); traverser.alignTo(u32); state.* = .{ .Event = .{ .BeginNode = node_name } }; suspend {} }, .EndNode => { depth -= 1; state.* = .{ .Event = .EndNode }; suspend {} }, .Prop => { const prop = traverser.object(FDTProp); const prop_name = traverser.cstringFromSectionOffset(prop.nameoff); const prop_value = traverser.buffer(prop.len); state.* = .{ .Event = .{ .Prop = .{ .name = prop_name, .value = prop_value, }, }, }; suspend {} traverser.alignTo(u32); }, .Nop => {}, .End => { state.* = .{ .Error = error.BadStructure }; return; }, } } if (traverser.token() != .End) { state.* = .{ .Error = error.BadStructure }; return; } if (traverser.offset != header.off_dt_struct + header.size_dt_struct) { state.* = .{ .Error = error.BadStructure }; return; } state.* = .{ .Event = .End }; } /// --- const InternalTraverser = struct { fdt: []const u8, header: FDTHeader, offset: usize, fn aligned(traverser: *@This(), comptime T: type) T { const size = @sizeOf(T); const value = @ptrCast(*const T, @alignCast(@alignOf(T), traverser.fdt[traverser.offset .. traverser.offset + size])).*; traverser.offset += size; return value; } fn buffer(traverser: *@This(), length: usize) []const u8 { const value = traverser.fdt[traverser.offset .. traverser.offset + length]; traverser.offset += length; return value; } fn token(traverser: *@This()) FDTToken { return @intToEnum(FDTToken, std.mem.bigToNative(u32, traverser.aligned(u32))); } fn object(traverser: *@This(), comptime T: type) T { return structBigToNative(T, traverser.aligned(T)); } fn cstring(traverser: *@This()) []const u8 { const length = std.mem.lenZ(@ptrCast([*c]const u8, traverser.fdt[traverser.offset..])); const value = traverser.fdt[traverser.offset .. traverser.offset + length]; traverser.offset += length + 1; return value; } fn cstringFromSectionOffset(traverser: @This(), offset: usize) []const u8 { const length = std.mem.lenZ(@ptrCast([*c]const u8, traverser.fdt[traverser.header.off_dt_strings + offset ..])); return traverser.fdt[traverser.header.off_dt_strings + offset ..][0..length]; } fn alignTo(traverser: *@This(), comptime T: type) void { traverser.offset += @sizeOf(T) - 1; traverser.offset &= ~@as(usize, @sizeOf(T) - 1); } };
src/traverser.zig
const std = @import("std"); const token = @import("../token.zig"); const ast = @import("../ast.zig"); const fieldNames = std.meta.fieldNames; const eq = std.mem.eq; const TokenError = token.TokenError; const Token = token.Token; const Kind = Token.Kind; const Ast = ast.Ast; const enums = std.enums; pub const Block = @import("./op.zig"); const @"Type" = @import("./type.zig").@"Type"; const Kw = @import("./kw.zig").Kw; pub const Op = enum(i32) { at, amp, dol, pound, caret, tilde, bslash, pipe, mul, div, exp, mod, add, bind, sub, comma, gt, lt, ques, semicolon, colon, newline, excl, assign, period, neg, add_eq, div_eq, sub_eq, @"or", @"and", mul_eq, ln_doc_cmt, abstractor, pointer, // :: ref, assoc, range, // range : ... range_xl, // range non-inclusive of start, : :.. range_xr, // range non-inclusive of end ..: range_xx, // non-inclusive range .. comment, addressed, access, faccess, use, maybe, not, ask, le, ge, farrow, barrow, bbarrow, bfarrow, eq_comp, ne, query, double_gt, double_lt, defn, open_lt, close_lt, pub const range_sym = ".."; pub const le_sym = "<="; pub const ge_sym = ">="; pub const farrow_sym = "->"; pub const barrow_sym = "<-"; pub const eq_compn_sym = "=="; pub const query_sym = "=?"; pub const nen_sym = "!="; pub const defn_sym = ":="; pub const commentn_sym = "--"; pub const sub_eq_sym = "-="; pub const div_eq_sym = "/="; pub const add_eq_sym = "+="; pub const mul_eq_sym = "*="; pub const gener_sym = "++"; pub const assoc_sym = "<>"; pub const double_gt_sym = ">>"; pub const double_lt_sym = "<<"; pub const line_doc_cmt = "-!"; pub const Self = @This(); pub fn toStr(oper: Op) []const u8 { return @tagName(oper); } pub fn code(self: Block) i32 { return @enumToInt(self); } pub fn isCharOp(inp: u8) ?Op { inline for (enums.values(Op)) |value| { if (value == inp) { return @intToEnum(Op, value); } } return null; } pub fn isOp(comptime inp: []const u8) ?Op { return switch (inp[0]) { ' ' => null, '-' => comptime switch (inp[1]) { '>' => .farrow, '-' => .comment, '=' => .sub_eq, else => .sub, }, '.' => comptime switch (inp[1]) { '.' => .range, '_', 'a'...'z', 'A'...'Z', '0'...'9' => .access, else => .period, }, '*' => switch (inp[1]) { '=' => .mul_eq, '_', 'a'...'z', 'A'...'Z', '0'...'9' => .pointer, else => .mul, }, '\n' => .newline, ',' => .comma, '%' => .mod, '+' => switch (inp[1]) { '=' => .add_eq, '+' => .assoc, else => .add, }, '?' => .ques, '<' => switch (inp[1]) { '<' => .double_lt, '=' => .le, '-' => .barrow, 'a'...'z', 'A'...'Z', '0'...'9', '_' => .open_lt, else => .lt, }, '>' => switch (inp[1]) { '>' => .double_gt, '=' => .ge, else => .gt, }, '=' => switch (inp[1]) { '=' => .eq, '?' => .query, else => .assign, }, '!' => switch (inp[1]) { '=' => .ne, else => .excl, }, ';' => .semicolon, ':' => switch (inp[1]) { '=' => .def, else => .colon, }, '&' => .amp, '|' => .pipe, '/' => switch (inp[1]) { '=' => .div_eq, '/' => .comment, else => null, }, '$' => .dol, '#' => .pound, '@' => .at, '^' => .caret, '\\' => .bslash, else => null, }; } };
src/lang/token/op.zig
const std = @import("std"); const colors = @import("../term/colors.zig"); const Color = colors.Color; const Token = @import("./token.zig").Token; const Fg = colors.Fg; const eq = std.mem.eql; const meta = std.meta; const mem = std.mem; const enums = std.enums; const fieldNames = meta.fieldNames; const Self = Token; pub fn kindColors(self: Token) type { return switch (comptime self.kind) { .unknown => |_| .{ .c1 = comptime Color.green.bold(.bright_fg), .c2 = Fg.green }, .eof => |_| .{ .c1 = comptime Color.red.bold(.bright_fg), .c2 = Fg.red }, .kw => |_| .{ .c1 = comptime Color.green.bold(.bright_fg), .c2 = Fg.green }, .op => |_| .{ .c1 = comptime Color.yellow.bold(.bright_fg), .c2 = Fg.yellow }, .type => |_| .{ .c1 = comptime Color.blue.bold(.bright_fg), .c2 = Fg.blue }, .block => |_| .{ .c1 = comptime Color.magenta.bold(.bright_fg), .c2 = Fg.magenta }, }; } pub fn toStr(self: Self, a: std.mem.Allocator, s: []const u8) ![]const u8 { const c1 = switch (self.kind) { .unknown => |_| comptime Color.red.bold(.bright_fg), .eof => |_| comptime Color.cyan.bold(.bright_fg), .kw => |_| comptime Color.blue.bold(.bright_fg), .op => |_| comptime Color.magenta.bold(.normal_fg), .type => |_| comptime Color.green.bold(.bright_fg), .block => |_| comptime Color.yellow.bold(.bright_fg), }; const c2 = switch (self.kind) { .unknown => |_| comptime Color.cyan.finish(.normal_fg), .eof => |_| comptime Color.red.finish(.normal_fg), .kw => |_| comptime Color.blue.finish(.normal_fg), .op => |_| comptime Color.magenta.finish(.normal_fg), .type => |_| comptime Color.green.finish(.normal_fg), .block => |_| comptime Color.yellow.finish(.normal_fg), }; const d = comptime Color.white.dim(.bright_fg); const w = switch (self.kind) { .op => comptime Color.white.finish(.bright_fg), .type => |ty| switch (ty) { .ident => comptime Color.green.bold(.bright_fg), .str => comptime Color.green.finish(.bright_fg), else => comptime Color.blue.finish(.bright_fg), }, else => comptime Color.white.bold(.bright_fg), }; const r = colors.reset(); const init_fmt = "{s}{s}(L{d:>3}, C{d:>3}) {s} {s:<8}{s}{s}\t{s:<12}{s}"; const common_args = .{ r, d, self.pos.line, self.pos.col, c1, @tagName(self.kind), r, c2, self.kind.toStr(), w }; return try std.fmt.allocPrint(a, init_fmt ++ "{s}\n", common_args ++ .{s}); } pub fn writeStr(self: Self, f: std.fs.File, a: std.mem.Allocator, s: []const u8) ![]const u8 { const c1 = switch (self.kind) { .unknown => |_| comptime Color.red.bold(.bright_fg), .eof => |_| comptime Color.cyan.bold(.bright_fg), .kw => |_| comptime Color.blue.bold(.bright_fg), .op => |_| comptime Color.magenta.bold(.normal_fg), .type => |_| comptime Color.green.bold(.bright_fg), .block => |_| comptime Color.yellow.bold(.bright_fg), }; const c2 = switch (self.kind) { .unknown => |_| comptime Color.cyan.finish(.normal_fg), .eof => |_| comptime Color.red.finish(.normal_fg), .kw => |_| comptime Color.blue.finish(.normal_fg), .op => |_| comptime Color.magenta.finish(.normal_fg), .type => |_| comptime Color.green.finish(.normal_fg), .block => |_| comptime Color.yellow.finish(.normal_fg), }; const d = comptime Color.white.dim(.bright_fg); const w = switch (self.kind) { .op => comptime Color.white.finish(.bright_fg), .type => |ty| switch (ty) { .ident => comptime Color.green.bold(.bright_fg), .str => comptime Color.green.finish(.bright_fg), else => comptime Color.blue.finish(.bright_fg), }, else => comptime Color.white.bold(.bright_fg), }; const r = colors.reset(); const init_fmt = "{s}{s}(L{d:>3}, C{d:>3}) {s} {s:<8}{s}{s}\t{s:<12}{s}"; const common_args = .{ r, d, self.line, self.col, c1, @tagName(self.kind), r, c2, self.kind.toStr(), w }; const res = try std.fmt.allocPrint(a, init_fmt ++ "{s}\n", common_args ++ .{s}); _ = try f.write(res); return res; } pub fn writeInt(self: Self, f: std.fs.File, a: std.mem.Allocator, s: u8) !void { const init_fmt = "{d:>5}{d:>7} {s:<10}{s:<15}"; const common_args = .{ self.line, self.col, self.kind.toStr() }; const res = try std.fmt.allocPrint(a, init_fmt ++ "{d}\n", common_args ++ .{s}); _ = try f.write(res); return res; } pub fn writeStdOut(self: Self, a: std.mem.Allocator, s: []const u8) ![]const u8 { var stdout = std.io.getStdOut(); const r = try writeStr(self, stdout, a, s); return r; } pub fn write(self: Token, al: std.mem.Allocator) ![]const u8 { var tval = self.val; if (tval) |value| { return switch (value) { .str => |st| try toStr(self, al, st), .byte => |_| try toStr(self, al, ""), .float => |_| try toStr(self, al, ""), .intl => |_| try toStr(self, al, ""), }; } else { return switch (self.kind) { .op => |o| return switch (o) { .newline, .semicolon => try toStr(self, al, "::"), .sub => try toStr(self, al, "-"), .add => try toStr(self, al, "-"), .access => try toStr(self, al, "|"), else => try toStr(self, al, ""), }, .block => |b| switch (b.isBlockStart()) { .start => try toStr(self, al, "\x1b[0m\x1b[33m/- blk start -\\"), .end => try toStr(self, al, "\x1b[0m\x1b[33m\\- blk end -/"), .outside => try toStr(self, al, ""), }, .eof => try toStr(self, al, "EOF"), .unknown => try toStr(self, al, "UNK"), .kw => |_| try toStr(self, al, ""), .type => |ttype| { return switch (ttype) { .none => |_| try toStr(self, al, ""), .ident => |iden| try toStr(self, al, iden), .byte => |_| try toStr(self, al, ""), .seq => |_| try toStr(self, al, ""), .int => |_| try toStr(self, al, ""), .float => |_| try toStr(self, al, ""), .str => |st| try toStr(self, al, st), .bool => |st| try toStr(self, al, if (st) "true" else "false"), }; }, }; } }
src/lang/fmt.zig
const std = @import("std"); const kernel = @import("root"); const SinglyLinkedList = std.SinglyLinkedList; pub const PrintkSink = fn ([]const u8) void; pub const SinkNode: type = SinglyLinkedList(PrintkSink).Node; var printk_sinks = SinglyLinkedList(PrintkSink){ .first = null }; pub fn register_sink(sink: *SinkNode) void { printk_sinks.prepend(sink); } var printk_spinlock = kernel.lib.Spinlock.init(); fn do_printk(buffer: []const u8) void { var sink = printk_sinks.first; while (sink != null) : (sink = sink.?.next) { sink.?.data(buffer); } } var printk_buffer: [0x10000]u8 = undefined; var fbs = std.io.fixedBufferStream(&printk_buffer); var out_stream = fbs.writer(); pub fn printk(comptime fmt: []const u8, args: anytype) void { const lock = printk_spinlock.acquire(); defer lock.release(); fbs.reset(); std.fmt.format(out_stream, fmt, args) catch {}; do_printk(fbs.getWritten()); } pub const LogLevel = enum(u8) { Critical = 0, Error = 1, Warning = 2, Info = 3, Debug = 4, }; pub fn logger(comptime prefix: []const u8) type { return struct { pub const Level = LogLevel; const PREFIX = prefix; log_level: LogLevel = LogLevel.Info, pub fn log(self: @This(), comptime fmt: []const u8, args: anytype) void { self.log_raw(LogLevel.Info, fmt, args); } pub fn setLevel(self: *@This(), level: LogLevel) void { self.log_level = level; } fn log_raw(self: @This(), comptime level: LogLevel, comptime fmt: []const u8, args: anytype) void { if (comptime (@enumToInt(level) <= @enumToInt(self.log_level))) { printk("[" ++ @tagName(level) ++ "] " ++ PREFIX ++ ": " ++ fmt, args); } } pub fn info(self: @This(), comptime fmt: []const u8, args: anytype) void { self.log_raw(LogLevel.Info, fmt, args); } pub fn debug(self: @This(), comptime fmt: []const u8, args: anytype) void { self.log_raw(LogLevel.Debug, fmt, args); } pub fn err(self: @This(), comptime fmt: []const u8, args: anytype) void { self.log_raw(LogLevel.Error, fmt, args); } pub fn warning(self: @This(), comptime fmt: []const u8, args: anytype) void { self.log_raw(LogLevel.Warning, fmt, args); } pub fn critical(self: @This(), comptime fmt: []const u8, args: anytype) void { self.log_raw(LogLevel.Critical, fmt, args); } pub fn childOf(child_prefix: []const u8) type { return logger(PREFIX ++ "." ++ child_prefix); } }; }
kernel/logging.zig
const std = @import("std"); const mem = std.mem; const allocPrint = std.fmt.allocPrint; const Allocator = mem.Allocator; const Data = @import("Data.zig"); const ptk = @import("parser-toolkit"); pub const Stdlib = @import("Stdlib.zig"); const Inon = @This(); allocator: Allocator, functions: FuncList, context: Data, current_context: *Data, message: ?Message, const Message = struct { location: ptk.Location, message: []const u8, pub fn free(self: @This(), allocator: Allocator) void { allocator.free(self.message); } }; const Error = mem.Allocator.Error; pub const FuncFnType = fn (inon: *Inon, params: []Data) Error!Data; pub const FuncType = struct { name: []const u8, params: []const ?Data.Type, run: FuncFnType, }; pub const FuncList = std.StringArrayHashMapUnmanaged(FuncType); pub fn init(allocator: Allocator) Inon { return .{ .allocator = allocator, .message = null, .functions = .{}, .context = .{ .value = .{ .map = .{} }, .allocator = allocator }, .current_context = undefined, }; } pub fn deinit(inon: *Inon) void { if (inon.message) |message| message.free(inon.allocator); inon.functions.deinit(inon.allocator); inon.context.deinit(); } pub fn parse(inon: *Inon, src: []const u8) !Data { var result = try Parser.parse(src, inon); errdefer result.free(); return result; } pub fn serialize(inon: *Inon, data: *Data, writer: anytype) !void { _ = inon; try data.serialize(4, writer); } pub fn renderError(inon: *Inon, writer: anytype) !void { const loc = inon.message.?.location; const msg = inon.message.?.message; try writer.print( "{s}:{}:{} error: {s}\n", .{ loc.source, loc.line, loc.column, msg }, ); } const matchers = ptk.matchers; const Parser = struct { const Self = @This(); const TokenType = enum { number, string, identifier, fn_name, whitespace, comment, @"true", @"false", @"null", @"::", @"?:", @":", @"(", @")", @"[", @"]", @"{", @"}", @",", @"-", }; const Pattern = ptk.Pattern(TokenType); const Tokenizer = ptk.Tokenizer(TokenType, &[_]Pattern{ Pattern.create(.number, matchers.sequenceOf(.{ matchers.decimalNumber, matchers.literal("."), matchers.decimalNumber })), Pattern.create(.number, matchers.decimalNumber), Pattern.create(.string, stringMatcher), Pattern.create(.@"true", matchers.literal("true")), Pattern.create(.@"false", matchers.literal("false")), Pattern.create(.@"null", matchers.literal("null")), Pattern.create(.identifier, identifierMatcher), Pattern.create(.identifier, anyNameMatcher), Pattern.create(.whitespace, matchers.takeAnyOf(" \n\r\t")), Pattern.create(.comment, commentMatcher), Pattern.create(.@"::", matchers.literal("::")), Pattern.create(.@"?:", matchers.literal("?:")), Pattern.create(.@":", matchers.literal(":")), Pattern.create(.@"[", matchers.literal("[")), Pattern.create(.@"]", matchers.literal("]")), Pattern.create(.@"(", matchers.literal("(")), Pattern.create(.@")", matchers.literal(")")), Pattern.create(.@"{", matchers.literal("{")), Pattern.create(.@"}", matchers.literal("}")), Pattern.create(.@",", matchers.literal(",")), Pattern.create(.@"-", matchers.literal("-")), }); const ParserCore = ptk.ParserCore(Tokenizer, .{ .whitespace, .comment }); pub fn parse(expression: []const u8, inon: *Inon) ParseError!Data { var tokenizer = Tokenizer.init(expression); var parser = Parser{ .core = ParserCore.init(&tokenizer), .inon = inon, }; parser.inon.current_context = &parser.inon.context; return parser.acceptObjectNoCtx(&inon.context); } core: ParserCore, inon: *Inon, const ruleset = ptk.RuleSet(TokenType); const is_number = ruleset.is(.number); const is_identifier = ruleset.is(.identifier); const is_string = ruleset.is(.string); const is_true = ruleset.is(.@"true"); const is_false = ruleset.is(.@"false"); const is_null = ruleset.is(.@"null"); const is_dualcolon = ruleset.is(.@"::"); const is_optcolon = ruleset.is(.@"?:"); const is_colon = ruleset.is(.@":"); const is_lpar = ruleset.is(.@"("); const is_rpar = ruleset.is(.@")"); const is_lbrac = ruleset.is(.@"{"); const is_rbrac = ruleset.is(.@"}"); const is_comma = ruleset.is(.@","); const is_lsqr = ruleset.is(.@"["); const is_rsqr = ruleset.is(.@"]"); const is_minus = ruleset.is(.@"-"); const ParseError = mem.Allocator.Error || ParserCore.Error || error{ParsingFailed}; fn peek(self: *Self) !?Tokenizer.Token { return self.core.peek() catch |err| switch (err) { error.UnexpectedCharacter => { try self.emitError("found unknown character", .{}); return error.ParsingFailed; }, }; } fn emitError(self: *Self, comptime format: []const u8, args: anytype) !void { const state = self.core.saveState(); errdefer self.core.restoreState(state); self.inon.message = .{ .location = state.location, .message = try allocPrint(self.inon.allocator, format, args), }; } fn acceptAssignment(self: *Self) ParseError!Data { const state = self.core.saveState(); errdefer self.core.restoreState(state); _ = try self.core.accept(is_colon); return try acceptAtom(self); } fn acceptTopLevelExpr(self: *Self, context: *Data) ParseError!void { const state = self.core.saveState(); errdefer self.core.restoreState(state); const identifier = (self.core.accept(is_identifier) catch |err| switch (err) { error.UnexpectedToken => { const tok_type = @tagName((self.peek() catch unreachable).?.type); try self.emitError("expected identifier, found '{s}'", .{tok_type}); return error.ParsingFailed; }, else => |e| return e, }).text; var prev_data = context.findEx(identifier); const prev_exists = !prev_data.is(.nulled); const val = blk: { if (try self.peek()) |token| { if (is_dualcolon(token.type)) { _ = try self.core.accept(is_dualcolon); var cond = try acceptAtom(self); defer cond.deinit(); if (cond.is(.bool)) { var expr = try acceptAssignment(self); defer expr.deinit(); if (cond.get(.bool)) { if (prev_exists) prev_data.deinit(); break :blk try expr.copy(self.inon.allocator); } else { return; } } try self.emitError("expected condition of type 'bool'", .{}); return error.ParsingFailed; } else if (is_optcolon(token.type)) { _ = try self.core.accept(is_optcolon); var value = try self.acceptAtom(); if (prev_exists) { value.deinit(); return; } break :blk value; } else if (is_colon(token.type)) { if (prev_exists) prev_data.deinit(); break :blk try acceptAssignment(self); } else { try self.emitError("expected '::', '?:' or ':' after identifier", .{}); return error.ParsingFailed; } } else { try self.emitError("found stray identifier", .{}); return error.ParsingFailed; } }; try context.value.map.put(self.inon.allocator, identifier, val); } fn acceptObjectNoCtx(self: *Self, context: *Data) ParseError!Data { const state = self.core.saveState(); errdefer self.core.restoreState(state); while ((try self.peek()) != null) { try self.acceptTopLevelExpr(context); } return context.*; } fn acceptObject(self: *Self) ParseError!Data { const state = self.core.saveState(); errdefer self.core.restoreState(state); _ = try self.core.accept(is_lbrac); var data = Data{ .value = .{ .map = .{} }, .allocator = self.inon.allocator }; errdefer data.deinit(); const old_context = self.inon.current_context; self.inon.current_context = &data; defer self.inon.current_context = old_context; while (!is_rbrac((try self.peek()).?.type)) { try self.acceptTopLevelExpr(&data); } _ = try self.core.accept(is_rbrac); return data; } fn acceptAtom(self: *Self) ParseError!Data { const state = self.core.saveState(); errdefer self.core.restoreState(state); if (try self.peek()) |token| { if (is_number(token.type)) { return self.acceptAtomNumber(); } else if (is_minus(token.type)) { _ = try self.core.accept(is_minus); var num = try self.acceptAtomNumber(); num.value.num = -num.value.num; return num; } else if (is_identifier(token.type)) { return self.acceptAtomIdentifier(); } else if (is_string(token.type)) { return self.acceptAtomString(); } else if (is_lpar(token.type)) { return self.acceptFunctionCall(); } else if (is_lsqr(token.type)) { return self.acceptAtomList(); } else if (is_lbrac(token.type)) { return self.acceptObject(); } else if (is_true(token.type)) { _ = (try self.core.accept(is_true)); return Data{ .value = .{ .bool = true } }; } else if (is_false(token.type)) { _ = (try self.core.accept(is_false)); return Data{ .value = .{ .bool = false } }; } else if (is_null(token.type)) { _ = (try self.core.accept(is_null)); return Data{ .value = .{ .nulled = .{} } }; } else { try self.emitError("expected expression, literal or function call", .{}); return error.ParsingFailed; } } unreachable; } fn acceptAtomNumber(self: *Self) !Data { const state = self.core.saveState(); errdefer self.core.restoreState(state); const value = try self.core.accept(is_number); return Data{ .value = .{ .num = std.fmt.parseFloat(f64, value.text) catch unreachable, } }; } fn acceptAtomIdentifier(self: *Self) ParseError!Data { const state = self.core.saveState(); errdefer self.core.restoreState(state); const token = try self.core.accept(is_identifier); const data = self.inon.context.findEx(token.text); if (data.is(.nulled)) { try self.emitError("undeclared identifier '{s}' referenced", .{token.text}); return error.ParsingFailed; } return data.copy(self.inon.allocator); } fn acceptAtomString(self: *Self) ParseError!Data { const state = self.core.saveState(); errdefer self.core.restoreState(state); var token = (try self.core.accept(is_string)).text; var str = Data{ .value = .{ .str = .{} }, .allocator = self.inon.allocator, }; errdefer str.deinit(); var raw_string: bool = if (mem.startsWith(u8, token, "\\")) true else false; if (raw_string) { while (raw_string) { try str.value.str.appendSlice(str.allocator, token[2..]); try str.value.str.append(str.allocator, '\n'); if (try self.peek()) |tok| { if (is_string(tok.type)) { token = (try self.core.accept(is_string)).text; raw_string = mem.startsWith(u8, token, "\\"); } else break; } else break; } } else { var i: usize = 1; while (i < token.len - 1) : (i += 1) { const next_is_es = token[i] == '\\' and i + 1 < token.len; try str.value.str.append(str.allocator, if (next_is_es) blk: { i += 1; break :blk switch (token[i]) { 'r' => '\r', 't' => '\t', 'n' => '\n', '\"' => '\"', '\'' => '\'', '\\' => '\\', else => token[i], }; } else token[i]); } } return str; } fn acceptAtomList(self: *Self) ParseError!Data { const state = self.core.saveState(); errdefer self.core.restoreState(state); _ = try self.core.accept(is_lsqr); var data = Data{ .value = .{ .array = .{} }, .allocator = self.inon.allocator }; errdefer data.deinit(); while (try self.peek()) |tok| { if (is_rsqr(tok.type)) { break; } try data.value.array.append(data.allocator, try self.acceptAtom()); const token = (try self.peek()).?; if (!is_rsqr(token.type)) { if (is_comma(token.type)) { _ = try self.core.accept(is_comma); } else { try self.emitError("expected ',' or ']' with list", .{}); return error.ParsingFailed; } } } _ = try self.core.accept(is_rsqr); return data; } fn acceptFunctionCall(self: *Self) ParseError!Data { const state = self.core.saveState(); errdefer self.core.restoreState(state); _ = try self.core.accept(is_lpar); const fn_name = blk: { const text = (try self.core.accept(is_identifier)).text; if (mem.startsWith(u8, text, "'")) { break :blk text[1 .. text.len - 1]; } else { break :blk text; } }; var args = Data{ .value = .{ .array = .{} }, .allocator = self.inon.allocator }; defer args.deinit(); const func = if (self.inon.functions.get(fn_name)) |func| func else unreachable; const param_count = func.params.len; while (try self.peek()) |tok| { if (is_rpar(tok.type)) { break; } const arg = try self.acceptAtom(); try args.value.array.append(args.allocator, arg); } // Validate argument count const no_of_args = args.get(.array).items.len; if (no_of_args != param_count) { try self.emitError("function '{s}' takes {} args, found {}", .{ fn_name, param_count, no_of_args }); return error.ParsingFailed; } // Validate argument type for (func.params) |param, index| { if (param) |par| { const arg = args.get(.array).items[index]; if (!arg.is(par)) { try self.emitError( "function '{s}' expects argument {} be of type '{s}' while '{s}' is given", .{ fn_name, index, @tagName(par), @tagName(arg.value), }, ); return error.ParsingFailed; } } } _ = try self.core.accept(is_rpar); // Run the function and return the result return try func.run(self.inon, args.get(.array).items); } }; // Tokenizer helpers fn stringMatcher(str: []const u8) ?usize { const raw_string = mem.startsWith(u8, str, "\\"); if (!(mem.startsWith(u8, str, "\"") or raw_string)) return null; var i: usize = 1; while (i < str.len) : (i += 1) { switch (str[i]) { '\\' => i += 1, '\"' => if (!raw_string) { i += 1; break; }, '\n' => if (raw_string) break, else => {}, } } return i; } fn identifierMatcher(str: []const u8) ?usize { const first_char = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; const all_chars = first_char ++ "-0123456789"; for (str) |c, i| { if (std.mem.indexOfScalar(u8, if (i > 0) all_chars else first_char, c) == null) { return i; } } return str.len; } fn anyNameMatcher(str: []const u8) ?usize { if (!mem.startsWith(u8, str, "'")) return null; for (str) |c, i| { switch (c) { '!'...'~' => continue, else => return i + 1, } } return str.len; } fn commentMatcher(str: []const u8) ?usize { if (!(mem.startsWith(u8, str, "#"))) return null; var i: usize = 0; while (i < str.len) : (i += 1) { if (str[i] == '\n') break; } return i; }
src/main.zig
const sf = @import("../sfml_import.zig"); /// Template for a 2 dimensional vector pub fn Vector2(comptime T: type) type { return extern struct { const Self = @This(); /// The CSFML vector type equivalent const CsfmlEquivalent = switch (T) { c_uint => sf.c.sfVector2u, c_int => sf.c.sfVector2i, f32 => sf.c.sfVector2f, else => void, }; pub fn new(x: T, y: T) Self { return .{ .x = x, .y = y }; } /// Makes a CSFML vector with this vector (only if the corresponding type exists) /// This is mainly for the inner workings of this wrapper pub fn _toCSFML(self: Self) CsfmlEquivalent { if (CsfmlEquivalent == void) @compileError("This vector type doesn't have a CSFML equivalent."); return @bitCast(CsfmlEquivalent, self); } /// Creates a vector from a CSFML one (only if the corresponding type exists) /// This is mainly for the inner workings of this wrapper pub fn _fromCSFML(vec: CsfmlEquivalent) Self { if (CsfmlEquivalent == void) @compileError("This vector type doesn't have a CSFML equivalent."); return @bitCast(Self, vec); } /// Adds two vectors pub fn add(self: Self, other: Self) Self { return Self{ .x = self.x + other.x, .y = self.y + other.y }; } /// Substracts two vectors pub fn substract(self: Self, other: Self) Self { return Self{ .x = self.x - other.x, .y = self.y - other.y }; } /// Scales a vector pub fn scale(self: Self, scalar: T) Self { return Self{ .x = self.x * scalar, .y = self.y * scalar }; } /// x component of the vector x: T = 0, /// y component of the vector y: T = 0, }; } /// Template for a 3 dimensional vector pub fn Vector3(comptime T: type) type { return packed struct { const Self = @This(); pub fn new(x: T, y: T, z: T) Self { return .{ .x = x, .y = y, .z = z }; } /// Makes a CSFML vector with this vector (only if the corresponding type exists) /// This is mainly for the inner workings of this wrapper pub fn _toCSFML(self: Self) sf.c.sfVector3f { if (T != f32) @compileError("This vector type doesn't have a CSFML equivalent."); return @bitCast(sf.c.sfVector3f, self); } /// Creates a vector from a CSFML one (only if the corresponding type exists) /// This is mainly for the inner workings of this wrapper pub fn _fromCSFML(vec: sf.c.sfVector3f) Self { if (T != f32) @compileError("This vector type doesn't have a CSFML equivalent."); return @bitCast(Self, vec); } /// Adds two vectors pub fn add(self: Self, other: Self) Self { return Self{ .x = self.x + other.x, .y = self.y + other.y, .z = self.z + other.z }; } /// Substracts two vectors pub fn substract(self: Self, other: Self) Self { return Self{ .x = self.x - other.x, .y = self.y - other.y, .z = self.z - other.z }; } /// Scales a vector pub fn scale(self: Self, scalar: T) Self { return Self{ .x = self.x * scalar, .y = self.y * scalar, .z = self.z * scalar }; } /// x component of the vector x: T = 0, /// y component of the vector y: T = 0, /// z component of the vector z: T = 0, }; } /// Template for a 4 dimensional vector /// SFML doesn't really have this but as shaders use such vectors it can be here anyways pub fn Vector4(comptime T: type) type { return packed struct { const Self = @This(); pub fn new(x: T, y: T, z: T, w: T) Self { return .{ .x = x, .y = y, .z = z, .w = w }; } /// x component of the vector x: T = 0, /// y component of the vector y: T = 0, /// z component of the vector z: T = 0, /// w component of the vector w: T = 0, }; } test "vector: sane from/to CSFML vectors" { const tst = @import("std").testing; inline for ([_]type{ c_int, c_uint, f32 }) |T| { const VecT = Vector2(T); const vec = VecT{ .x = 1, .y = 3 }; const cvec = vec._toCSFML(); try tst.expectEqual(vec.x, cvec.x); try tst.expectEqual(vec.y, cvec.y); const vec2 = VecT._fromCSFML(cvec); try tst.expectEqual(vec, vec2); } { const vec = Vector3(f32){ .x = 1, .y = 3.5, .z = -12 }; const cvec = vec._toCSFML(); try tst.expectEqual(vec.x, cvec.x); try tst.expectEqual(vec.y, cvec.y); try tst.expectEqual(vec.z, cvec.z); const vec2 = Vector3(f32)._fromCSFML(cvec); try tst.expectEqual(vec, vec2); } }
src/sfml/system/vector.zig
const std = @import("std"); const expectEqual = std.testing.expectEqual; const expectEqualStrings = std.testing.expectEqualStrings; const Arena = std.heap.ArenaAllocator; const initCodebase = @import("init_codebase.zig").initCodebase; const MockFileSystem = @import("file_system.zig").FileSystem; const analyzeSemantics = @import("semantic_analyzer.zig").analyzeSemantics; const codegen = @import("codegen.zig").codegen; const printWasm = @import("wasm_printer.zig").printWasm; const ecs = @import("ecs.zig"); const ECS = ecs.ECS; const List = @import("list.zig").List; const components = @import("components.zig"); const query = @import("query.zig"); const literalOf = query.literalOf; const colors = @import("colors.zig"); const Errors = List(u8, .{ .initial_capacity = 1000 }); pub fn printErrors(codebase: *ECS) ![]u8 { const allocator = codebase.arena.allocator(); var errors = Errors.init(allocator); var iterator = codebase.query(.{components.Error}); while (iterator.next()) |entity| { const e = entity.get(components.Error); try errors.appendSlice(colors.RED); try errors.appendSlice("---- "); try errors.appendSlice(e.header); try errors.appendSlice(" ----------------------------------- "); const module = e.module; try errors.appendSlice(module.get(components.ModulePath).string); try errors.appendSlice(colors.RESET); try errors.appendSlice("\n\n"); try errors.appendSlice(e.body); try errors.appendSlice("\n\n"); const begin = e.span.begin; const end = e.span.end; var source = module.get(components.ModuleSource).string; var i: usize = 0; const context_start = std.math.max(begin.row, 2) - 2; const context_end = end.row + 3; while (i < context_start) : (i += 1) { while (source[0] != '\n') : (source = source[1..]) {} source = source[1..]; } var row = context_start; var column: usize = 0; const width = (try std.fmt.allocPrint(allocator, "{}", .{context_end})).len; while (row < context_end and source.len > 0) { if (column == 0) { const result = try std.fmt.allocPrint(allocator, "{:[1]}| ", .{ row + 1, width }); try errors.appendSlice(result); } if (row == begin.row and column == begin.column) { try errors.appendSlice(colors.RED); } if (row == end.row and column == end.column) { try errors.appendSlice(colors.RESET); } switch (source[0]) { '\n' => { row += 1; column = 0; }, else => { column += 1; }, } try errors.append(source[0]); source = source[1..]; } try errors.appendSlice("\n"); try errors.appendSlice(e.hint); } return errors.mutSlice(); }
src/error_printer.zig
const std = @import("std"); const assert = std.debug.assert; const mem = std.mem; const Allocator = mem.Allocator; const c = @import("vulkan.zig"); const maxInt = std.math.maxInt; const WIDTH = 800; const HEIGHT = 600; const MAX_FRAMES_IN_FLIGHT = 2; const enableValidationLayers = std.debug.runtime_safety; const validationLayers = [_][*:0]const u8{"VK_LAYER_LUNARG_standard_validation"}; const deviceExtensions = [_][*:0]const u8{c.VK_KHR_SWAPCHAIN_EXTENSION_NAME}; var currentFrame: usize = 0; var instance: c.VkInstance = undefined; var callback: c.VkDebugReportCallbackEXT = undefined; var surface: c.VkSurfaceKHR = undefined; var physicalDevice: c.VkPhysicalDevice = undefined; var global_device: c.VkDevice = undefined; var graphicsQueue: c.VkQueue = undefined; var presentQueue: c.VkQueue = undefined; var swapChainImages: []c.VkImage = undefined; var swapChain: c.VkSwapchainKHR = undefined; var swapChainImageFormat: c.VkFormat = undefined; var swapChainExtent: c.VkExtent2D = undefined; var swapChainImageViews: []c.VkImageView = undefined; var renderPass: c.VkRenderPass = undefined; var pipelineLayout: c.VkPipelineLayout = undefined; var graphicsPipeline: c.VkPipeline = undefined; var swapChainFramebuffers: []c.VkFramebuffer = undefined; var commandPool: c.VkCommandPool = undefined; var commandBuffers: []c.VkCommandBuffer = undefined; var imageAvailableSemaphores: [MAX_FRAMES_IN_FLIGHT]c.VkSemaphore = undefined; var renderFinishedSemaphores: [MAX_FRAMES_IN_FLIGHT]c.VkSemaphore = undefined; var inFlightFences: [MAX_FRAMES_IN_FLIGHT]c.VkFence = undefined; const QueueFamilyIndices = struct { graphicsFamily: ?u32, presentFamily: ?u32, fn init() QueueFamilyIndices { return QueueFamilyIndices{ .graphicsFamily = null, .presentFamily = null, }; } fn isComplete(self: QueueFamilyIndices) bool { return self.graphicsFamily != null and self.presentFamily != null; } }; const SwapChainSupportDetails = struct { capabilities: c.VkSurfaceCapabilitiesKHR, formats: std.ArrayList(c.VkSurfaceFormatKHR), presentModes: std.ArrayList(c.VkPresentModeKHR), fn init(allocator: *Allocator) SwapChainSupportDetails { var result = SwapChainSupportDetails{ .capabilities = undefined, .formats = std.ArrayList(c.VkSurfaceFormatKHR).init(allocator), .presentModes = std.ArrayList(c.VkPresentModeKHR).init(allocator), }; const slice = mem.sliceAsBytes(@as(*[1]c.VkSurfaceCapabilitiesKHR, &result.capabilities)[0..1]); std.mem.set(u8, slice, 0); return result; } fn deinit(self: *SwapChainSupportDetails) void { self.formats.deinit(); self.presentModes.deinit(); } }; pub fn main() !void { if (c.glfwInit() == 0) return error.GlfwInitFailed; defer c.glfwTerminate(); c.glfwWindowHint(c.GLFW_CLIENT_API, c.GLFW_NO_API); c.glfwWindowHint(c.GLFW_RESIZABLE, c.GLFW_FALSE); const window = c.glfwCreateWindow(WIDTH, HEIGHT, "Zig Vulkan Triangle", null, null) orelse return error.GlfwCreateWindowFailed; defer c.glfwDestroyWindow(window); const allocator = std.heap.c_allocator; try initVulkan(allocator, window); while (c.glfwWindowShouldClose(window) == 0) { c.glfwPollEvents(); try drawFrame(); } try checkSuccess(c.vkDeviceWaitIdle(global_device)); cleanup(); } fn cleanup() void { var i: usize = 0; while (i < MAX_FRAMES_IN_FLIGHT) : (i += 1) { c.vkDestroySemaphore(global_device, renderFinishedSemaphores[i], null); c.vkDestroySemaphore(global_device, imageAvailableSemaphores[i], null); c.vkDestroyFence(global_device, inFlightFences[i], null); } c.vkDestroyCommandPool(global_device, commandPool, null); for (swapChainFramebuffers) |framebuffer| { c.vkDestroyFramebuffer(global_device, framebuffer, null); } c.vkDestroyPipeline(global_device, graphicsPipeline, null); c.vkDestroyPipelineLayout(global_device, pipelineLayout, null); c.vkDestroyRenderPass(global_device, renderPass, null); for (swapChainImageViews) |imageView| { c.vkDestroyImageView(global_device, imageView, null); } c.vkDestroySwapchainKHR(global_device, swapChain, null); c.vkDestroyDevice(global_device, null); if (enableValidationLayers) { DestroyDebugReportCallbackEXT(null); } c.vkDestroySurfaceKHR(instance, surface, null); c.vkDestroyInstance(instance, null); } fn initVulkan(allocator: *Allocator, window: *c.GLFWwindow) !void { try createInstance(allocator); try setupDebugCallback(); try createSurface(window); try pickPhysicalDevice(allocator); try createLogicalDevice(allocator); try createSwapChain(allocator); try createImageViews(allocator); try createRenderPass(); try createGraphicsPipeline(allocator); try createFramebuffers(allocator); try createCommandPool(allocator); try createCommandBuffers(allocator); try createSyncObjects(); } fn createCommandBuffers(allocator: *Allocator) !void { commandBuffers = try allocator.alloc(c.VkCommandBuffer, swapChainFramebuffers.len); const allocInfo = c.VkCommandBufferAllocateInfo{ .sType = c.VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, .commandPool = commandPool, .level = c.VK_COMMAND_BUFFER_LEVEL_PRIMARY, .commandBufferCount = @intCast(u32, commandBuffers.len), .pNext = null, }; try checkSuccess(c.vkAllocateCommandBuffers(global_device, &allocInfo, commandBuffers.ptr)); for (commandBuffers) |command_buffer, i| { const beginInfo = c.VkCommandBufferBeginInfo{ .sType = c.VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, .flags = c.VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT, .pNext = null, .pInheritanceInfo = null, }; try checkSuccess(c.vkBeginCommandBuffer(commandBuffers[i], &beginInfo)); const clearColor = [1]c.VkClearValue{c.VkClearValue{ .color = c.VkClearColorValue{ .float32 = [_]f32{ 0.0, 0.0, 0.0, 1.0 } }, }}; const renderPassInfo = c.VkRenderPassBeginInfo{ .sType = c.VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, .renderPass = renderPass, .framebuffer = swapChainFramebuffers[i], .renderArea = c.VkRect2D{ .offset = c.VkOffset2D{ .x = 0, .y = 0 }, .extent = swapChainExtent, }, .clearValueCount = 1, .pClearValues = @as(*const [1]c.VkClearValue, &clearColor), .pNext = null, }; c.vkCmdBeginRenderPass(commandBuffers[i], &renderPassInfo, c.VK_SUBPASS_CONTENTS_INLINE); { c.vkCmdBindPipeline(commandBuffers[i], c.VK_PIPELINE_BIND_POINT_GRAPHICS, graphicsPipeline); c.vkCmdDraw(commandBuffers[i], 3, 1, 0, 0); } c.vkCmdEndRenderPass(commandBuffers[i]); try checkSuccess(c.vkEndCommandBuffer(commandBuffers[i])); } } fn createSyncObjects() !void { const semaphoreInfo = c.VkSemaphoreCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, .pNext = null, .flags = 0, }; const fenceInfo = c.VkFenceCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, .flags = c.VK_FENCE_CREATE_SIGNALED_BIT, .pNext = null, }; var i: usize = 0; while (i < MAX_FRAMES_IN_FLIGHT) : (i += 1) { try checkSuccess(c.vkCreateSemaphore(global_device, &semaphoreInfo, null, &imageAvailableSemaphores[i])); try checkSuccess(c.vkCreateSemaphore(global_device, &semaphoreInfo, null, &renderFinishedSemaphores[i])); try checkSuccess(c.vkCreateFence(global_device, &fenceInfo, null, &inFlightFences[i])); } } fn createCommandPool(allocator: *Allocator) !void { const queueFamilyIndices = try findQueueFamilies(allocator, physicalDevice); const poolInfo = c.VkCommandPoolCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, .queueFamilyIndex = queueFamilyIndices.graphicsFamily.?, .pNext = null, .flags = 0, }; try checkSuccess(c.vkCreateCommandPool(global_device, &poolInfo, null, &commandPool)); } fn createFramebuffers(allocator: *Allocator) !void { swapChainFramebuffers = try allocator.alloc(c.VkFramebuffer, swapChainImageViews.len); for (swapChainImageViews) |swap_chain_image_view, i| { const attachments = [_]c.VkImageView{swap_chain_image_view}; const framebufferInfo = c.VkFramebufferCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, .renderPass = renderPass, .attachmentCount = 1, .pAttachments = &attachments, .width = swapChainExtent.width, .height = swapChainExtent.height, .layers = 1, .pNext = null, .flags = 0, }; try checkSuccess(c.vkCreateFramebuffer(global_device, &framebufferInfo, null, &swapChainFramebuffers[i])); } } fn createShaderModule(code: []align(@alignOf(u32)) const u8) !c.VkShaderModule { const createInfo = c.VkShaderModuleCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO, .codeSize = code.len, .pCode = mem.bytesAsSlice(u32, code).ptr, .pNext = null, .flags = 0, }; var shaderModule: c.VkShaderModule = undefined; try checkSuccess(c.vkCreateShaderModule(global_device, &createInfo, null, &shaderModule)); return shaderModule; } fn createGraphicsPipeline(allocator: *Allocator) !void { const vertShaderCode align(4) = @embedFile("../shaders/vert.spv").*; const fragShaderCode align(4) = @embedFile("../shaders/frag.spv").*; const vertShaderModule = try createShaderModule(&vertShaderCode); const fragShaderModule = try createShaderModule(&fragShaderCode); const vertShaderStageInfo = c.VkPipelineShaderStageCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, .stage = c.VK_SHADER_STAGE_VERTEX_BIT, .module = vertShaderModule, .pName = "main", .pNext = null, .flags = 0, .pSpecializationInfo = null, }; const fragShaderStageInfo = c.VkPipelineShaderStageCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, .stage = c.VK_SHADER_STAGE_FRAGMENT_BIT, .module = fragShaderModule, .pName = "main", .pNext = null, .flags = 0, .pSpecializationInfo = null, }; const shaderStages = [_]c.VkPipelineShaderStageCreateInfo{ vertShaderStageInfo, fragShaderStageInfo }; const vertexInputInfo = c.VkPipelineVertexInputStateCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO, .vertexBindingDescriptionCount = 0, .vertexAttributeDescriptionCount = 0, .pVertexBindingDescriptions = null, .pVertexAttributeDescriptions = null, .pNext = null, .flags = 0, }; const inputAssembly = c.VkPipelineInputAssemblyStateCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO, .topology = c.VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, .primitiveRestartEnable = c.VK_FALSE, .pNext = null, .flags = 0, }; const viewport = [_]c.VkViewport{c.VkViewport{ .x = 0.0, .y = 0.0, .width = @intToFloat(f32, swapChainExtent.width), .height = @intToFloat(f32, swapChainExtent.height), .minDepth = 0.0, .maxDepth = 1.0, }}; const scissor = [_]c.VkRect2D{c.VkRect2D{ .offset = c.VkOffset2D{ .x = 0, .y = 0 }, .extent = swapChainExtent, }}; const viewportState = c.VkPipelineViewportStateCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO, .viewportCount = 1, .pViewports = &viewport, .scissorCount = 1, .pScissors = &scissor, .pNext = null, .flags = 0, }; const rasterizer = c.VkPipelineRasterizationStateCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, .depthClampEnable = c.VK_FALSE, .rasterizerDiscardEnable = c.VK_FALSE, .polygonMode = c.VK_POLYGON_MODE_FILL, .lineWidth = 1.0, .cullMode = @intCast(u32, @enumToInt(c.VK_CULL_MODE_BACK_BIT)), .frontFace = c.VK_FRONT_FACE_CLOCKWISE, .depthBiasEnable = c.VK_FALSE, .pNext = null, .flags = 0, .depthBiasConstantFactor = 0, .depthBiasClamp = 0, .depthBiasSlopeFactor = 0, }; const multisampling = c.VkPipelineMultisampleStateCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO, .sampleShadingEnable = c.VK_FALSE, .rasterizationSamples = c.VK_SAMPLE_COUNT_1_BIT, .pNext = null, .flags = 0, .minSampleShading = 0, .pSampleMask = null, .alphaToCoverageEnable = 0, .alphaToOneEnable = 0, }; const colorBlendAttachment = c.VkPipelineColorBlendAttachmentState{ .colorWriteMask = c.VK_COLOR_COMPONENT_R_BIT | c.VK_COLOR_COMPONENT_G_BIT | c.VK_COLOR_COMPONENT_B_BIT | c.VK_COLOR_COMPONENT_A_BIT, .blendEnable = c.VK_FALSE, .srcColorBlendFactor = c.VK_BLEND_FACTOR_ZERO, .dstColorBlendFactor = c.VK_BLEND_FACTOR_ZERO, .colorBlendOp = c.VK_BLEND_OP_ADD, .srcAlphaBlendFactor = c.VK_BLEND_FACTOR_ZERO, .dstAlphaBlendFactor = c.VK_BLEND_FACTOR_ZERO, .alphaBlendOp = c.VK_BLEND_OP_ADD, }; const colorBlending = c.VkPipelineColorBlendStateCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, .logicOpEnable = c.VK_FALSE, .logicOp = c.VK_LOGIC_OP_COPY, .attachmentCount = 1, .pAttachments = &colorBlendAttachment, .blendConstants = [_]f32{ 0, 0, 0, 0 }, .pNext = null, .flags = 0, }; const pipelineLayoutInfo = c.VkPipelineLayoutCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, .setLayoutCount = 0, .pushConstantRangeCount = 0, .pNext = null, .flags = 0, .pSetLayouts = null, .pPushConstantRanges = null, }; try checkSuccess(c.vkCreatePipelineLayout(global_device, &pipelineLayoutInfo, null, &pipelineLayout)); const pipelineInfo = [_]c.VkGraphicsPipelineCreateInfo{c.VkGraphicsPipelineCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, .stageCount = @intCast(u32, shaderStages.len), .pStages = &shaderStages, .pVertexInputState = &vertexInputInfo, .pInputAssemblyState = &inputAssembly, .pViewportState = &viewportState, .pRasterizationState = &rasterizer, .pMultisampleState = &multisampling, .pColorBlendState = &colorBlending, .layout = pipelineLayout, .renderPass = renderPass, .subpass = 0, .basePipelineHandle = null, .pNext = null, .flags = 0, .pTessellationState = null, .pDepthStencilState = null, .pDynamicState = null, .basePipelineIndex = 0, }}; try checkSuccess(c.vkCreateGraphicsPipelines( global_device, null, @intCast(u32, pipelineInfo.len), &pipelineInfo, null, @as(*[1]c.VkPipeline, &graphicsPipeline), )); c.vkDestroyShaderModule(global_device, fragShaderModule, null); c.vkDestroyShaderModule(global_device, vertShaderModule, null); } fn createRenderPass() !void { const colorAttachment = c.VkAttachmentDescription{ .format = swapChainImageFormat, .samples = c.VK_SAMPLE_COUNT_1_BIT, .loadOp = c.VK_ATTACHMENT_LOAD_OP_CLEAR, .storeOp = c.VK_ATTACHMENT_STORE_OP_STORE, .stencilLoadOp = c.VK_ATTACHMENT_LOAD_OP_DONT_CARE, .stencilStoreOp = c.VK_ATTACHMENT_STORE_OP_DONT_CARE, .initialLayout = c.VK_IMAGE_LAYOUT_UNDEFINED, .finalLayout = c.VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, .flags = 0, }; const colorAttachmentRef = [1]c.VkAttachmentReference{c.VkAttachmentReference{ .attachment = 0, .layout = c.VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, }}; const subpass = [_]c.VkSubpassDescription{c.VkSubpassDescription{ .pipelineBindPoint = c.VK_PIPELINE_BIND_POINT_GRAPHICS, .colorAttachmentCount = 1, .pColorAttachments = @as(*const [1]c.VkAttachmentReference, &colorAttachmentRef), .flags = 0, .inputAttachmentCount = 0, .pInputAttachments = null, .pResolveAttachments = null, .pDepthStencilAttachment = null, .preserveAttachmentCount = 0, .pPreserveAttachments = null, }}; const dependency = [_]c.VkSubpassDependency{c.VkSubpassDependency{ .srcSubpass = c.VK_SUBPASS_EXTERNAL, .dstSubpass = 0, .srcStageMask = c.VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, .srcAccessMask = 0, .dstStageMask = c.VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, .dstAccessMask = c.VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | c.VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, .dependencyFlags = 0, }}; const renderPassInfo = c.VkRenderPassCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO, .attachmentCount = 1, .pAttachments = @ptrCast(*const [1]c.VkAttachmentDescription, &colorAttachment), .subpassCount = 1, .pSubpasses = &subpass, .dependencyCount = 1, .pDependencies = &dependency, .pNext = null, .flags = 0, }; try checkSuccess(c.vkCreateRenderPass(global_device, &renderPassInfo, null, &renderPass)); } fn createImageViews(allocator: *Allocator) !void { swapChainImageViews = try allocator.alloc(c.VkImageView, swapChainImages.len); errdefer allocator.free(swapChainImageViews); for (swapChainImages) |swap_chain_image, i| { const createInfo = c.VkImageViewCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, .image = swap_chain_image, .viewType = c.VK_IMAGE_VIEW_TYPE_2D, .format = swapChainImageFormat, .components = c.VkComponentMapping{ .r = c.VK_COMPONENT_SWIZZLE_IDENTITY, .g = c.VK_COMPONENT_SWIZZLE_IDENTITY, .b = c.VK_COMPONENT_SWIZZLE_IDENTITY, .a = c.VK_COMPONENT_SWIZZLE_IDENTITY, }, .subresourceRange = c.VkImageSubresourceRange{ .aspectMask = c.VK_IMAGE_ASPECT_COLOR_BIT, .baseMipLevel = 0, .levelCount = 1, .baseArrayLayer = 0, .layerCount = 1, }, .pNext = null, .flags = 0, }; try checkSuccess(c.vkCreateImageView(global_device, &createInfo, null, &swapChainImageViews[i])); } } fn chooseSwapSurfaceFormat(availableFormats: []c.VkSurfaceFormatKHR) c.VkSurfaceFormatKHR { if (availableFormats.len == 1 and availableFormats[0].format == c.VK_FORMAT_UNDEFINED) { return c.VkSurfaceFormatKHR{ .format = c.VK_FORMAT_B8G8R8A8_UNORM, .colorSpace = c.VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, }; } for (availableFormats) |availableFormat| { if (availableFormat.format == c.VK_FORMAT_B8G8R8A8_UNORM and availableFormat.colorSpace == c.VK_COLOR_SPACE_SRGB_NONLINEAR_KHR) { return availableFormat; } } return availableFormats[0]; } fn chooseSwapPresentMode(availablePresentModes: []c.VkPresentModeKHR) c.VkPresentModeKHR { var bestMode: c.VkPresentModeKHR = c.VK_PRESENT_MODE_FIFO_KHR; for (availablePresentModes) |availablePresentMode| { if (availablePresentMode == c.VK_PRESENT_MODE_MAILBOX_KHR) { return availablePresentMode; } else if (availablePresentMode == c.VK_PRESENT_MODE_IMMEDIATE_KHR) { bestMode = availablePresentMode; } } return bestMode; } fn chooseSwapExtent(capabilities: c.VkSurfaceCapabilitiesKHR) c.VkExtent2D { if (capabilities.currentExtent.width != maxInt(u32)) { return capabilities.currentExtent; } else { var actualExtent = c.VkExtent2D{ .width = WIDTH, .height = HEIGHT, }; actualExtent.width = std.math.max(capabilities.minImageExtent.width, std.math.min(capabilities.maxImageExtent.width, actualExtent.width)); actualExtent.height = std.math.max(capabilities.minImageExtent.height, std.math.min(capabilities.maxImageExtent.height, actualExtent.height)); return actualExtent; } } fn createSwapChain(allocator: *Allocator) !void { var swapChainSupport = try querySwapChainSupport(allocator, physicalDevice); defer swapChainSupport.deinit(); const surfaceFormat = chooseSwapSurfaceFormat(swapChainSupport.formats.items); const presentMode = chooseSwapPresentMode(swapChainSupport.presentModes.items); const extent = chooseSwapExtent(swapChainSupport.capabilities); var imageCount: u32 = swapChainSupport.capabilities.minImageCount + 1; if (swapChainSupport.capabilities.maxImageCount > 0 and imageCount > swapChainSupport.capabilities.maxImageCount) { imageCount = swapChainSupport.capabilities.maxImageCount; } const indices = try findQueueFamilies(allocator, physicalDevice); const queueFamilyIndices = [_]u32{ indices.graphicsFamily.?, indices.presentFamily.? }; const different_families = indices.graphicsFamily.? != indices.presentFamily.?; var createInfo = c.VkSwapchainCreateInfoKHR{ .sType = c.VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR, .surface = surface, .minImageCount = imageCount, .imageFormat = surfaceFormat.format, .imageColorSpace = surfaceFormat.colorSpace, .imageExtent = extent, .imageArrayLayers = 1, .imageUsage = c.VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, .imageSharingMode = if (different_families) c.VK_SHARING_MODE_CONCURRENT else c.VK_SHARING_MODE_EXCLUSIVE, .queueFamilyIndexCount = if (different_families) @as(u32, 2) else @as(u32, 0), .pQueueFamilyIndices = if (different_families) &queueFamilyIndices else &([_]u32{ 0, 0 }), .preTransform = swapChainSupport.capabilities.currentTransform, .compositeAlpha = c.VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR, .presentMode = presentMode, .clipped = c.VK_TRUE, .oldSwapchain = null, .pNext = null, .flags = 0, }; try checkSuccess(c.vkCreateSwapchainKHR(global_device, &createInfo, null, &swapChain)); try checkSuccess(c.vkGetSwapchainImagesKHR(global_device, swapChain, &imageCount, null)); swapChainImages = try allocator.alloc(c.VkImage, imageCount); try checkSuccess(c.vkGetSwapchainImagesKHR(global_device, swapChain, &imageCount, swapChainImages.ptr)); swapChainImageFormat = surfaceFormat.format; swapChainExtent = extent; } fn createLogicalDevice(allocator: *Allocator) !void { const indices = try findQueueFamilies(allocator, physicalDevice); var queueCreateInfos = std.ArrayList(c.VkDeviceQueueCreateInfo).init(allocator); defer queueCreateInfos.deinit(); const all_queue_families = [_]u32{ indices.graphicsFamily.?, indices.presentFamily.? }; const uniqueQueueFamilies = if (indices.graphicsFamily.? == indices.presentFamily.?) all_queue_families[0..1] else all_queue_families[0..2]; var queuePriority: f32 = 1.0; for (uniqueQueueFamilies) |queueFamily| { const queueCreateInfo = c.VkDeviceQueueCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, .queueFamilyIndex = queueFamily, .queueCount = 1, .pQueuePriorities = &queuePriority, .pNext = null, .flags = 0, }; try queueCreateInfos.append(queueCreateInfo); } const deviceFeatures = c.VkPhysicalDeviceFeatures{ .robustBufferAccess = 0, .fullDrawIndexUint32 = 0, .imageCubeArray = 0, .independentBlend = 0, .geometryShader = 0, .tessellationShader = 0, .sampleRateShading = 0, .dualSrcBlend = 0, .logicOp = 0, .multiDrawIndirect = 0, .drawIndirectFirstInstance = 0, .depthClamp = 0, .depthBiasClamp = 0, .fillModeNonSolid = 0, .depthBounds = 0, .wideLines = 0, .largePoints = 0, .alphaToOne = 0, .multiViewport = 0, .samplerAnisotropy = 0, .textureCompressionETC2 = 0, .textureCompressionASTC_LDR = 0, .textureCompressionBC = 0, .occlusionQueryPrecise = 0, .pipelineStatisticsQuery = 0, .vertexPipelineStoresAndAtomics = 0, .fragmentStoresAndAtomics = 0, .shaderTessellationAndGeometryPointSize = 0, .shaderImageGatherExtended = 0, .shaderStorageImageExtendedFormats = 0, .shaderStorageImageMultisample = 0, .shaderStorageImageReadWithoutFormat = 0, .shaderStorageImageWriteWithoutFormat = 0, .shaderUniformBufferArrayDynamicIndexing = 0, .shaderSampledImageArrayDynamicIndexing = 0, .shaderStorageBufferArrayDynamicIndexing = 0, .shaderStorageImageArrayDynamicIndexing = 0, .shaderClipDistance = 0, .shaderCullDistance = 0, .shaderFloat64 = 0, .shaderInt64 = 0, .shaderInt16 = 0, .shaderResourceResidency = 0, .shaderResourceMinLod = 0, .sparseBinding = 0, .sparseResidencyBuffer = 0, .sparseResidencyImage2D = 0, .sparseResidencyImage3D = 0, .sparseResidency2Samples = 0, .sparseResidency4Samples = 0, .sparseResidency8Samples = 0, .sparseResidency16Samples = 0, .sparseResidencyAliased = 0, .variableMultisampleRate = 0, .inheritedQueries = 0, }; const createInfo = c.VkDeviceCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, .queueCreateInfoCount = @intCast(u32, queueCreateInfos.items.len), .pQueueCreateInfos = queueCreateInfos.items.ptr, .pEnabledFeatures = &deviceFeatures, .enabledExtensionCount = @intCast(u32, deviceExtensions.len), .ppEnabledExtensionNames = &deviceExtensions, .enabledLayerCount = if (enableValidationLayers) @intCast(u32, validationLayers.len) else 0, .ppEnabledLayerNames = if (enableValidationLayers) &validationLayers else null, .pNext = null, .flags = 0, }; try checkSuccess(c.vkCreateDevice(physicalDevice, &createInfo, null, &global_device)); c.vkGetDeviceQueue(global_device, indices.graphicsFamily.?, 0, &graphicsQueue); c.vkGetDeviceQueue(global_device, indices.presentFamily.?, 0, &presentQueue); } fn pickPhysicalDevice(allocator: *Allocator) !void { var deviceCount: u32 = 0; try checkSuccess(c.vkEnumeratePhysicalDevices(instance, &deviceCount, null)); if (deviceCount == 0) { return error.FailedToFindGPUsWithVulkanSupport; } const devices = try allocator.alloc(c.VkPhysicalDevice, deviceCount); defer allocator.free(devices); try checkSuccess(c.vkEnumeratePhysicalDevices(instance, &deviceCount, devices.ptr)); physicalDevice = for (devices) |device| { if (try isDeviceSuitable(allocator, device)) { break device; } } else return error.FailedToFindSuitableGPU; } fn findQueueFamilies(allocator: *Allocator, device: c.VkPhysicalDevice) !QueueFamilyIndices { var indices = QueueFamilyIndices.init(); var queueFamilyCount: u32 = 0; c.vkGetPhysicalDeviceQueueFamilyProperties(device, &queueFamilyCount, null); const queueFamilies = try allocator.alloc(c.VkQueueFamilyProperties, queueFamilyCount); defer allocator.free(queueFamilies); c.vkGetPhysicalDeviceQueueFamilyProperties(device, &queueFamilyCount, queueFamilies.ptr); var i: u32 = 0; for (queueFamilies) |queueFamily| { if (queueFamily.queueCount > 0 and queueFamily.queueFlags & c.VK_QUEUE_GRAPHICS_BIT != 0) { indices.graphicsFamily = i; } var presentSupport: c.VkBool32 = 0; try checkSuccess(c.vkGetPhysicalDeviceSurfaceSupportKHR(device, i, surface, &presentSupport)); if (queueFamily.queueCount > 0 and presentSupport != 0) { indices.presentFamily = i; } if (indices.isComplete()) { break; } i += 1; } return indices; } fn isDeviceSuitable(allocator: *Allocator, device: c.VkPhysicalDevice) !bool { const indices = try findQueueFamilies(allocator, device); const extensionsSupported = try checkDeviceExtensionSupport(allocator, device); var swapChainAdequate = false; if (extensionsSupported) { var swapChainSupport = try querySwapChainSupport(allocator, device); defer swapChainSupport.deinit(); swapChainAdequate = swapChainSupport.formats.items.len != 0 and swapChainSupport.presentModes.items.len != 0; } return indices.isComplete() and extensionsSupported and swapChainAdequate; } fn querySwapChainSupport(allocator: *Allocator, device: c.VkPhysicalDevice) !SwapChainSupportDetails { var details = SwapChainSupportDetails.init(allocator); try checkSuccess(c.vkGetPhysicalDeviceSurfaceCapabilitiesKHR(device, surface, &details.capabilities)); var formatCount: u32 = undefined; try checkSuccess(c.vkGetPhysicalDeviceSurfaceFormatsKHR(device, surface, &formatCount, null)); if (formatCount != 0) { try details.formats.resize(formatCount); try checkSuccess(c.vkGetPhysicalDeviceSurfaceFormatsKHR(device, surface, &formatCount, details.formats.items.ptr)); } var presentModeCount: u32 = undefined; try checkSuccess(c.vkGetPhysicalDeviceSurfacePresentModesKHR(device, surface, &presentModeCount, null)); if (presentModeCount != 0) { try details.presentModes.resize(presentModeCount); try checkSuccess(c.vkGetPhysicalDeviceSurfacePresentModesKHR(device, surface, &presentModeCount, details.presentModes.items.ptr)); } return details; } fn checkDeviceExtensionSupport(allocator: *Allocator, device: c.VkPhysicalDevice) !bool { var extensionCount: u32 = undefined; try checkSuccess(c.vkEnumerateDeviceExtensionProperties(device, null, &extensionCount, null)); const availableExtensions = try allocator.alloc(c.VkExtensionProperties, extensionCount); defer allocator.free(availableExtensions); try checkSuccess(c.vkEnumerateDeviceExtensionProperties(device, null, &extensionCount, availableExtensions.ptr)); const CStrHashMap = std.HashMap( [*:0]const u8, void, hash_cstr, eql_cstr, std.hash_map.DefaultMaxLoadPercentage, ); var requiredExtensions = CStrHashMap.init(allocator); defer requiredExtensions.deinit(); for (deviceExtensions) |device_ext| { _ = try requiredExtensions.put(device_ext, {}); } for (availableExtensions) |extension| { _ = requiredExtensions.remove(@ptrCast([*:0]const u8, &extension.extensionName)); } return requiredExtensions.count() == 0; } fn createSurface(window: *c.GLFWwindow) !void { if (c.glfwCreateWindowSurface(instance, window, null, &surface) != c.VK_SUCCESS) { return error.FailedToCreateWindowSurface; } } // TODO https://github.com/ziglang/zig/issues/661 // Doesn't work on Windows until the above is fixed, because // this function needs to be stdcallcc on Windows. fn debugCallback( flags: c.VkDebugReportFlagsEXT, objType: c.VkDebugReportObjectTypeEXT, obj: u64, location: usize, code: i32, layerPrefix: [*:0]const u8, msg: [*:0]const u8, userData: ?*c_void, ) callconv(.C) c.VkBool32 { std.debug.warn("validation layer: {s}\n", .{msg}); return c.VK_FALSE; } fn setupDebugCallback() error{FailedToSetUpDebugCallback}!void { if (!enableValidationLayers) return; var createInfo = c.VkDebugReportCallbackCreateInfoEXT{ .sType = c.VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT, .flags = c.VK_DEBUG_REPORT_ERROR_BIT_EXT | c.VK_DEBUG_REPORT_WARNING_BIT_EXT, .pfnCallback = debugCallback, .pNext = null, .pUserData = null, }; if (CreateDebugReportCallbackEXT(&createInfo, null, &callback) != c.VK_SUCCESS) { return error.FailedToSetUpDebugCallback; } } fn DestroyDebugReportCallbackEXT( pAllocator: ?*const c.VkAllocationCallbacks, ) void { const func = @ptrCast(c.PFN_vkDestroyDebugReportCallbackEXT, c.vkGetInstanceProcAddr( instance, "vkDestroyDebugReportCallbackEXT", )) orelse unreachable; func(instance, callback, pAllocator); } fn CreateDebugReportCallbackEXT( pCreateInfo: *const c.VkDebugReportCallbackCreateInfoEXT, pAllocator: ?*const c.VkAllocationCallbacks, pCallback: *c.VkDebugReportCallbackEXT, ) c.VkResult { const func = @ptrCast(c.PFN_vkCreateDebugReportCallbackEXT, c.vkGetInstanceProcAddr( instance, "vkCreateDebugReportCallbackEXT", )) orelse return c.VK_ERROR_EXTENSION_NOT_PRESENT; return func(instance, pCreateInfo, pAllocator, pCallback); } fn createInstance(allocator: *Allocator) !void { if (enableValidationLayers) { if (!(try checkValidationLayerSupport(allocator))) { return error.ValidationLayerRequestedButNotAvailable; } } const appInfo = c.VkApplicationInfo{ .sType = c.VK_STRUCTURE_TYPE_APPLICATION_INFO, .pApplicationName = "Hello Triangle", .applicationVersion = c.VK_MAKE_VERSION(1, 0, 0), .pEngineName = "No Engine", .engineVersion = c.VK_MAKE_VERSION(1, 0, 0), .apiVersion = c.VK_API_VERSION_1_0, .pNext = null, }; const extensions = try getRequiredExtensions(allocator); defer allocator.free(extensions); const createInfo = c.VkInstanceCreateInfo{ .sType = c.VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, .pApplicationInfo = &appInfo, .enabledExtensionCount = @intCast(u32, extensions.len), .ppEnabledExtensionNames = extensions.ptr, .enabledLayerCount = if (enableValidationLayers) @intCast(u32, validationLayers.len) else 0, .ppEnabledLayerNames = if (enableValidationLayers) &validationLayers else null, .pNext = null, .flags = 0, }; try checkSuccess(c.vkCreateInstance(&createInfo, null, &instance)); } /// caller must free returned memory fn getRequiredExtensions(allocator: *Allocator) ![][*]const u8 { var glfwExtensionCount: u32 = 0; var glfwExtensions: [*]const [*]const u8 = c.glfwGetRequiredInstanceExtensions(&glfwExtensionCount); var extensions = std.ArrayList([*]const u8).init(allocator); errdefer extensions.deinit(); try extensions.appendSlice(glfwExtensions[0..glfwExtensionCount]); if (enableValidationLayers) { try extensions.append(c.VK_EXT_DEBUG_REPORT_EXTENSION_NAME); } return extensions.toOwnedSlice(); } fn checkSuccess(result: c.VkResult) !void { switch (result) { c.VK_SUCCESS => {}, else => return error.Unexpected, } } fn checkValidationLayerSupport(allocator: *Allocator) !bool { var layerCount: u32 = undefined; try checkSuccess(c.vkEnumerateInstanceLayerProperties(&layerCount, null)); const availableLayers = try allocator.alloc(c.VkLayerProperties, layerCount); defer allocator.free(availableLayers); try checkSuccess(c.vkEnumerateInstanceLayerProperties(&layerCount, availableLayers.ptr)); for (validationLayers) |layerName| { var layerFound = false; for (availableLayers) |layerProperties| { if (std.cstr.cmp(layerName, @ptrCast([*:0]const u8, &layerProperties.layerName)) == 0) { layerFound = true; break; } } if (!layerFound) { return false; } } return true; } fn drawFrame() !void { try checkSuccess(c.vkWaitForFences(global_device, 1, @as(*[1]c.VkFence, &inFlightFences[currentFrame]), c.VK_TRUE, maxInt(u64))); try checkSuccess(c.vkResetFences(global_device, 1, @as(*[1]c.VkFence, &inFlightFences[currentFrame]))); var imageIndex: u32 = undefined; try checkSuccess(c.vkAcquireNextImageKHR(global_device, swapChain, maxInt(u64), imageAvailableSemaphores[currentFrame], null, &imageIndex)); var waitSemaphores = [_]c.VkSemaphore{imageAvailableSemaphores[currentFrame]}; var waitStages = [_]c.VkPipelineStageFlags{c.VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT}; const signalSemaphores = [_]c.VkSemaphore{renderFinishedSemaphores[currentFrame]}; var submitInfo = [_]c.VkSubmitInfo{c.VkSubmitInfo{ .sType = c.VK_STRUCTURE_TYPE_SUBMIT_INFO, .waitSemaphoreCount = 1, .pWaitSemaphores = &waitSemaphores, .pWaitDstStageMask = &waitStages, .commandBufferCount = 1, .pCommandBuffers = commandBuffers.ptr + imageIndex, .signalSemaphoreCount = 1, .pSignalSemaphores = &signalSemaphores, .pNext = null, }}; try checkSuccess(c.vkQueueSubmit(graphicsQueue, 1, &submitInfo, inFlightFences[currentFrame])); const swapChains = [_]c.VkSwapchainKHR{swapChain}; const presentInfo = c.VkPresentInfoKHR{ .sType = c.VK_STRUCTURE_TYPE_PRESENT_INFO_KHR, .waitSemaphoreCount = 1, .pWaitSemaphores = &signalSemaphores, .swapchainCount = 1, .pSwapchains = &swapChains, .pImageIndices = @ptrCast(*[1]u32, &imageIndex), .pNext = null, .pResults = null, }; try checkSuccess(c.vkQueuePresentKHR(presentQueue, &presentInfo)); currentFrame = (currentFrame + 1) % MAX_FRAMES_IN_FLIGHT; } fn hash_cstr(a: [*:0]const u8) u64 { // FNV 32-bit hash var h: u32 = 2166136261; var i: usize = 0; while (a[i] != 0) : (i += 1) { h ^= a[i]; h *%= 16777619; } return h; } fn eql_cstr(a: [*:0]const u8, b: [*:0]const u8) bool { return std.cstr.cmp(a, b) == 0; }
src/main.zig
const std = @import("std"); const Builder = @import("std").build.Builder; const Build = @import("std").build; const Builtin = @import("std").builtin; const Zig = @import("std").zig; const globalflags = [_][]const u8{"-std=c99"}; pub var strip = false; pub fn compileGLFWWin32(exe: *Build.LibExeObjStep, comptime engine_path: []const u8) void { const flags = [_][]const u8{"-O2"} ++ globalflags; exe.linkSystemLibrary("gdi32"); exe.linkSystemLibrary("opengl32"); exe.defineCMacro("_GLFW_WIN32"); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/wgl_context.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/win32_init.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/win32_joystick.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/win32_monitor.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/win32_thread.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/win32_time.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/win32_window.c", &flags); } pub fn compileGLFWLinux(exe: *Build.LibExeObjStep, comptime engine_path: []const u8) void { const flags = [_][]const u8{"-O2"} ++ globalflags; exe.linkSystemLibrary("X11"); exe.defineCMacro("_GLFW_X11"); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/glx_context.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/posix_thread.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/posix_time.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/x11_init.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/x11_window.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/x11_monitor.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/xkb_unicode.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/linux_joystick.c", &flags); } pub fn compileGLFWShared(exe: *Build.LibExeObjStep, comptime engine_path: []const u8) void { const flags = [_][]const u8{"-O2"} ++ globalflags; exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/init.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/context.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/input.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/monitor.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/window.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/vulkan.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/osmesa_context.c", &flags); exe.addCSourceFile(engine_path ++ "include/glfw-3.3.4/src/egl_context.c", &flags); } pub fn compileOneFile(exe: *Build.LibExeObjStep, comptime engine_path: []const u8) void { const flags = [_][]const u8{"-O3"} ++ globalflags; exe.addCSourceFile(engine_path ++ "include/onefile/GLAD/gl.c", &flags); exe.addCSourceFile(engine_path ++ "include/onefile/stb/image.c", &flags); exe.addCSourceFile(engine_path ++ "include/onefile/stb/rect_pack.c", &flags); exe.addCSourceFile(engine_path ++ "include/onefile/stb/truetype.c", &flags); exe.addCSourceFile(engine_path ++ "src/core/private.c", &flags); } pub fn include(exe: *Build.LibExeObjStep, comptime engine_path: []const u8) void { exe.addIncludeDir(engine_path ++ "include/glfw-3.3.4/include/"); exe.addIncludeDir(engine_path ++ "include/onefile/"); } pub fn setup(b: *Builder, target: Zig.CrossTarget, gamename: []const u8, gamepath: []const u8, comptime engine_path: []const u8) *Build.LibExeObjStep { const exe = b.addExecutable(gamename, gamepath); exe.addPackagePath("alka", engine_path ++ "src/alka.zig"); exe.strip = strip; exe.linkSystemLibrary("c"); include(exe, engine_path); compileOneFile(exe, engine_path); const target_os = target.getOsTag(); switch (target_os) { .windows => { exe.setTarget(target); exe.linkSystemLibrary("gdi32"); exe.linkSystemLibrary("opengl32"); exe.subsystem = .Console; compileGLFWWin32(exe, engine_path); }, .linux => { exe.setTarget(target); exe.linkSystemLibrary("X11"); compileGLFWLinux(exe, engine_path); }, else => {}, } compileGLFWShared(exe, engine_path); return exe; }
examples/example_shooter_game/libbuild.zig
test "import" { _ = @import("util.zig"); } pub const ERROR = @import("error.zig"); pub extern "advapi32" stdcallcc fn CryptAcquireContextA( phProv: *HCRYPTPROV, pszContainer: ?LPCSTR, pszProvider: ?LPCSTR, dwProvType: DWORD, dwFlags: DWORD, ) BOOL; pub extern "advapi32" stdcallcc fn CryptReleaseContext(hProv: HCRYPTPROV, dwFlags: DWORD) BOOL; pub extern "advapi32" stdcallcc fn CryptGenRandom(hProv: HCRYPTPROV, dwLen: DWORD, pbBuffer: [*]BYTE) BOOL; pub extern "kernel32" stdcallcc fn CloseHandle(hObject: HANDLE) BOOL; pub extern "kernel32" stdcallcc fn CreateDirectoryA( lpPathName: LPCSTR, lpSecurityAttributes: ?*SECURITY_ATTRIBUTES, ) BOOL; pub extern "kernel32" stdcallcc fn CreateFileA( lpFileName: LPCSTR, 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 CreateProcessA( lpApplicationName: ?LPCSTR, lpCommandLine: LPSTR, lpProcessAttributes: ?*SECURITY_ATTRIBUTES, lpThreadAttributes: ?*SECURITY_ATTRIBUTES, bInheritHandles: BOOL, dwCreationFlags: DWORD, lpEnvironment: ?*c_void, lpCurrentDirectory: ?LPCSTR, lpStartupInfo: *STARTUPINFOA, lpProcessInformation: *PROCESS_INFORMATION, ) BOOL; pub extern "kernel32" stdcallcc fn CreateSymbolicLinkA( lpSymlinkFileName: LPCSTR, lpTargetFileName: LPCSTR, dwFlags: DWORD, ) BOOLEAN; 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 DeleteFileA(lpFileName: LPCSTR) BOOL; pub extern "kernel32" stdcallcc fn ExitProcess(exit_code: UINT) noreturn; pub extern "kernel32" stdcallcc fn FindFirstFileA(lpFileName: LPCSTR, lpFindFileData: *WIN32_FIND_DATAA) HANDLE; pub extern "kernel32" stdcallcc fn FindClose(hFindFile: HANDLE) BOOL; pub extern "kernel32" stdcallcc fn FindNextFileA(hFindFile: HANDLE, lpFindFileData: *WIN32_FIND_DATAA) BOOL; pub extern "kernel32" stdcallcc fn FreeEnvironmentStringsA(penv: [*]u8) 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 GetCurrentDirectoryA(nBufferLength: WORD, lpBuffer: ?LPSTR) DWORD; pub extern "kernel32" stdcallcc fn GetEnvironmentStringsA() ?[*]u8; pub extern "kernel32" stdcallcc fn GetEnvironmentVariableA(lpName: LPCSTR, lpBuffer: LPSTR, 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 GetFileAttributesA(lpFileName: LPCSTR) DWORD; pub extern "kernel32" stdcallcc fn GetModuleFileNameA(hModule: ?HMODULE, lpFilename: LPSTR, nSize: DWORD) DWORD; 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 GetFinalPathNameByHandleA( hFile: HANDLE, lpszFilePath: LPSTR, cchFilePath: DWORD, dwFlags: DWORD, ) DWORD; pub extern "kernel32" stdcallcc fn GetProcessHeap() ?HANDLE; 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 HeapValidate(hHeap: HANDLE, dwFlags: DWORD, lpMem: *const c_void) BOOL; 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 MoveFileExA( lpExistingFileName: LPCSTR, lpNewFileName: LPCSTR, dwFlags: DWORD, ) 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 ReadFile( in_hFile: HANDLE, out_lpBuffer: *c_void, in_nNumberOfBytesToRead: DWORD, out_lpNumberOfBytesRead: *DWORD, in_out_lpOverlapped: ?*OVERLAPPED, ) BOOL; pub extern "kernel32" stdcallcc fn RemoveDirectoryA(lpPathName: LPCSTR) 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 c_void, in_nNumberOfBytesToWrite: DWORD, out_lpNumberOfBytesWritten: ?*DWORD, in_out_lpOverlapped: ?*OVERLAPPED, ) BOOL; //TODO: call unicode versions instead of relying on ANSI code page pub extern "kernel32" stdcallcc fn LoadLibraryA(lpLibFileName: LPCSTR) ?HMODULE; pub extern "kernel32" stdcallcc fn FreeLibrary(hModule: HMODULE) BOOL; pub extern "user32" stdcallcc fn MessageBoxA(hWnd: ?HANDLE, lpText: ?LPCTSTR, lpCaption: ?LPCTSTR, uType: UINT) c_int; pub extern "shlwapi" stdcallcc fn PathFileExistsA(pszPath: ?LPCTSTR) BOOL; pub const PROV_RSA_FULL = 1; pub const BOOL = c_int; pub const BOOLEAN = BYTE; pub const BYTE = u8; pub const CHAR = u8; pub const DWORD = u32; pub const FLOAT = f32; pub const HANDLE = *c_void; pub const HCRYPTPROV = ULONG_PTR; pub const HINSTANCE = *@OpaqueType(); pub const HMODULE = *@OpaqueType(); pub const INT = c_int; pub const LPBYTE = *BYTE; pub const LPCH = *CHAR; pub const LPCSTR = [*]const CHAR; pub const LPCTSTR = [*]const TCHAR; pub const LPCVOID = *const c_void; pub const LPDWORD = *DWORD; pub const LPSTR = [*]CHAR; pub const LPTSTR = if (UNICODE) LPWSTR else LPSTR; pub const LPVOID = *c_void; pub const LPWSTR = [*]WCHAR; pub const PVOID = *c_void; pub const PWSTR = [*]WCHAR; pub const SIZE_T = usize; pub const TCHAR = if (UNICODE) WCHAR else u8; pub const UINT = c_uint; pub const ULONG_PTR = usize; pub const UNICODE = false; pub const WCHAR = u16; pub const WORD = u16; pub const LARGE_INTEGER = i64; pub const TRUE = 1; pub const FALSE = 0; /// The standard input device. Initially, this is the console input buffer, CONIN$. pub const STD_INPUT_HANDLE = @maxValue(DWORD) - 10 + 1; /// The standard output device. Initially, this is the active console screen buffer, CONOUT$. pub const STD_OUTPUT_HANDLE = @maxValue(DWORD) - 11 + 1; /// The standard error device. Initially, this is the active console screen buffer, CONOUT$. pub const STD_ERROR_HANDLE = @maxValue(DWORD) - 12 + 1; pub const INVALID_HANDLE_VALUE = @intToPtr(HANDLE, @maxValue(usize)); pub const INVALID_FILE_ATTRIBUTES = DWORD(@maxValue(DWORD)); pub const OVERLAPPED = extern struct { Internal: ULONG_PTR, InternalHigh: ULONG_PTR, Pointer: PVOID, hEvent: HANDLE, }; pub const LPOVERLAPPED = *OVERLAPPED; pub const MAX_PATH = 260; // TODO issue #305 pub const FILE_INFO_BY_HANDLE_CLASS = u32; pub const FileBasicInfo = 0; pub const FileStandardInfo = 1; pub const FileNameInfo = 2; pub const FileRenameInfo = 3; pub const FileDispositionInfo = 4; pub const FileAllocationInfo = 5; pub const FileEndOfFileInfo = 6; pub const FileStreamInfo = 7; pub const FileCompressionInfo = 8; pub const FileAttributeTagInfo = 9; pub const FileIdBothDirectoryInfo = 10; pub const FileIdBothDirectoryRestartInfo = 11; pub const FileIoPriorityHintInfo = 12; pub const FileRemoteProtocolInfo = 13; pub const FileFullDirectoryInfo = 14; pub const FileFullDirectoryRestartInfo = 15; pub const FileStorageInfo = 16; pub const FileAlignmentInfo = 17; pub const FileIdInfo = 18; pub const FileIdExtdDirectoryInfo = 19; pub const FileIdExtdDirectoryRestartInfo = 20; pub const FILE_NAME_INFO = extern struct { FileNameLength: DWORD, FileName: [1]WCHAR, }; /// Return the normalized drive name. This is the default. pub const FILE_NAME_NORMALIZED = 0x0; /// Return the opened file name (not normalized). pub const FILE_NAME_OPENED = 0x8; /// Return the path with the drive letter. This is the default. pub const VOLUME_NAME_DOS = 0x0; /// Return the path with a volume GUID path instead of the drive name. pub const VOLUME_NAME_GUID = 0x1; /// Return the path with no drive information. pub const VOLUME_NAME_NONE = 0x4; /// Return the path with the volume device path. pub const VOLUME_NAME_NT = 0x2; pub const SECURITY_ATTRIBUTES = extern struct { nLength: DWORD, lpSecurityDescriptor: ?*c_void, bInheritHandle: BOOL, }; pub const PSECURITY_ATTRIBUTES = *SECURITY_ATTRIBUTES; pub const LPSECURITY_ATTRIBUTES = *SECURITY_ATTRIBUTES; pub const GENERIC_READ = 0x80000000; pub const GENERIC_WRITE = 0x40000000; pub const GENERIC_EXECUTE = 0x20000000; pub const GENERIC_ALL = 0x10000000; pub const FILE_SHARE_DELETE = 0x00000004; pub const FILE_SHARE_READ = 0x00000001; pub const FILE_SHARE_WRITE = 0x00000002; pub const CREATE_ALWAYS = 2; pub const CREATE_NEW = 1; pub const OPEN_ALWAYS = 4; pub const OPEN_EXISTING = 3; pub const TRUNCATE_EXISTING = 5; pub const FILE_ATTRIBUTE_ARCHIVE = 0x20; pub const FILE_ATTRIBUTE_COMPRESSED = 0x800; pub const FILE_ATTRIBUTE_DEVICE = 0x40; pub const FILE_ATTRIBUTE_DIRECTORY = 0x10; pub const FILE_ATTRIBUTE_ENCRYPTED = 0x4000; pub const FILE_ATTRIBUTE_HIDDEN = 0x2; pub const FILE_ATTRIBUTE_INTEGRITY_STREAM = 0x8000; pub const FILE_ATTRIBUTE_NORMAL = 0x80; pub const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x2000; pub const FILE_ATTRIBUTE_NO_SCRUB_DATA = 0x20000; pub const FILE_ATTRIBUTE_OFFLINE = 0x1000; pub const FILE_ATTRIBUTE_READONLY = 0x1; pub const FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS = 0x400000; pub const FILE_ATTRIBUTE_RECALL_ON_OPEN = 0x40000; pub const FILE_ATTRIBUTE_REPARSE_POINT = 0x400; pub const FILE_ATTRIBUTE_SPARSE_FILE = 0x200; pub const FILE_ATTRIBUTE_SYSTEM = 0x4; pub const FILE_ATTRIBUTE_TEMPORARY = 0x100; pub const FILE_ATTRIBUTE_VIRTUAL = 0x10000; pub const PROCESS_INFORMATION = extern struct { hProcess: HANDLE, hThread: HANDLE, dwProcessId: DWORD, dwThreadId: DWORD, }; pub const STARTUPINFOA = extern struct { cb: DWORD, lpReserved: ?LPSTR, lpDesktop: ?LPSTR, lpTitle: ?LPSTR, dwX: DWORD, dwY: DWORD, dwXSize: DWORD, dwYSize: DWORD, dwXCountChars: DWORD, dwYCountChars: DWORD, dwFillAttribute: DWORD, dwFlags: DWORD, wShowWindow: WORD, cbReserved2: WORD, lpReserved2: ?LPBYTE, hStdInput: ?HANDLE, hStdOutput: ?HANDLE, hStdError: ?HANDLE, }; pub const STARTF_FORCEONFEEDBACK = 0x00000040; pub const STARTF_FORCEOFFFEEDBACK = 0x00000080; pub const STARTF_PREVENTPINNING = 0x00002000; pub const STARTF_RUNFULLSCREEN = 0x00000020; pub const STARTF_TITLEISAPPID = 0x00001000; pub const STARTF_TITLEISLINKNAME = 0x00000800; pub const STARTF_UNTRUSTEDSOURCE = 0x00008000; pub const STARTF_USECOUNTCHARS = 0x00000008; pub const STARTF_USEFILLATTRIBUTE = 0x00000010; pub const STARTF_USEHOTKEY = 0x00000200; pub const STARTF_USEPOSITION = 0x00000004; pub const STARTF_USESHOWWINDOW = 0x00000001; pub const STARTF_USESIZE = 0x00000002; pub const STARTF_USESTDHANDLES = 0x00000100; pub const INFINITE = 4294967295; pub const WAIT_ABANDONED = 0x00000080; pub const WAIT_OBJECT_0 = 0x00000000; pub const WAIT_TIMEOUT = 0x00000102; pub const WAIT_FAILED = 0xFFFFFFFF; pub const HANDLE_FLAG_INHERIT = 0x00000001; pub const HANDLE_FLAG_PROTECT_FROM_CLOSE = 0x00000002; pub const MOVEFILE_COPY_ALLOWED = 2; pub const MOVEFILE_CREATE_HARDLINK = 16; pub const MOVEFILE_DELAY_UNTIL_REBOOT = 4; pub const MOVEFILE_FAIL_IF_NOT_TRACKABLE = 32; pub const MOVEFILE_REPLACE_EXISTING = 1; pub const MOVEFILE_WRITE_THROUGH = 8; pub const FILE_BEGIN = 0; pub const FILE_CURRENT = 1; pub const FILE_END = 2; pub const HEAP_CREATE_ENABLE_EXECUTE = 0x00040000; pub const HEAP_GENERATE_EXCEPTIONS = 0x00000004; pub const HEAP_NO_SERIALIZE = 0x00000001; pub const PTHREAD_START_ROUTINE = extern fn (LPVOID) DWORD; pub const LPTHREAD_START_ROUTINE = PTHREAD_START_ROUTINE; pub const WIN32_FIND_DATAA = extern struct { dwFileAttributes: DWORD, ftCreationTime: FILETIME, ftLastAccessTime: FILETIME, ftLastWriteTime: FILETIME, nFileSizeHigh: DWORD, nFileSizeLow: DWORD, dwReserved0: DWORD, dwReserved1: DWORD, cFileName: [260]CHAR, cAlternateFileName: [14]CHAR, }; pub const FILETIME = extern struct { dwLowDateTime: DWORD, dwHighDateTime: DWORD, };
std/os/windows/index.zig
const std = @import("std"); const allocators = @import("allocators.zig"); pub const c = @cImport({ @cDefine("Z_SOLO", {}); @cDefine("ZLIB_CONST", {}); @cInclude("zlib.h"); }); fn zlibAlloc(@"opaque": ?*anyopaque, items: c_uint, size: c_uint) callconv(.C) ?*anyopaque { var temp_alloc = @ptrCast(*allocators.TempAllocator, @alignCast(8, @"opaque")); var alloc = temp_alloc.allocator(); var buf = alloc.rawAlloc(items * size, 16, 16, 0) catch { return null; }; return buf.ptr; } fn zlibFree(_: ?*anyopaque, _: ?*anyopaque) callconv(.C) void { // all memory will be freed when the TempAllocator is reset at the end. } fn deflateBound(uncompressed_size: usize, encode_length: bool) usize { var compressed_size = uncompressed_size + ((uncompressed_size + 7) >> 3) + ((uncompressed_size + 63) >> 6) + 11; if (encode_length) { compressed_size += @sizeOf(u64); } return compressed_size; } pub fn deflate(temp_alloc: *allocators.TempAllocator, uncompressed: []const u8, encode_length: bool, level: i8) ![]u8 { var allocator = temp_alloc.allocator(); var result = try allocator.alloc(u8, deflateBound(uncompressed.len, encode_length)); errdefer allocator.free(result); var in = uncompressed; var out = result; if (encode_length) { out = out[@sizeOf(u64)..]; } var stream: c.z_stream = undefined; stream.zalloc = zlibAlloc; stream.zfree = zlibFree; stream.@"opaque" = temp_alloc; switch (c.deflateInit(&stream, level)) { c.Z_MEM_ERROR => return error.OutOfMemory, c.Z_STREAM_ERROR => return error.InvalidLevel, c.Z_OK => {}, else => return error.Unexpected, } stream.next_out = out.ptr; stream.avail_out = 0; stream.next_in = in.ptr; stream.avail_in = 0; const max_bytes: c_uint = std.math.maxInt(c_uint); var compressed_size: usize = 0; var status: c_int = c.Z_OK; while (status == c.Z_OK) { if (stream.avail_out == 0) { stream.avail_out = if (out.len > max_bytes) max_bytes else @intCast(c_uint, out.len); out = out[stream.avail_out..]; } if (stream.avail_in == 0) { stream.avail_in = if (in.len > max_bytes) max_bytes else @intCast(c_uint, in.len); in = in[stream.avail_in..]; } stream.total_out = 0; status = c.deflate(&stream, if (in.len > 0) c.Z_NO_FLUSH else c.Z_FINISH); compressed_size += stream.total_out; } if (status != c.Z_STREAM_END) { _ = c.deflateEnd(&stream); return error.Unexpected; } status = c.deflateEnd(&stream); if (status != c.Z_OK) { return error.Unexpected; } if (encode_length) { compressed_size += @sizeOf(u64); var size = std.mem.nativeToLittle(u64, uncompressed.len); // @Cleanup: is there a clearer/more idiomatic way to do this? @memcpy(result.ptr, @ptrCast([*]align(8) const u8, &size), @sizeOf(u64)); } if (result.len != compressed_size) { result.len = compressed_size; } return result; } pub fn getUncompressedLength(compressed: []const u8) usize { if (compressed.len < @sizeOf(u64)) { return 0; } var uncompressed_size: u64 = undefined; @memcpy(@ptrCast([*]align(8) u8, &uncompressed_size), compressed.ptr, @sizeOf(u64)); return std.mem.littleToNative(u64, uncompressed_size); } pub fn stripUncompressedLength(compressed: []const u8) []const u8 { if (compressed.len < @sizeOf(u64)) { return compressed[compressed.len..]; } else { return compressed[@sizeOf(u64)..]; } } pub fn inflate(temp_alloc: *allocators.TempAllocator, compressed: []const u8, uncompressed_length: usize) ![]u8 { var tmp = [1]u8{0}; // for detection of incomplete stream when uncompressed.len == 0 var uncompressed: []u8 = undefined; if (uncompressed_length == 0) { uncompressed = &tmp; } else { uncompressed = try temp_alloc.allocator().alloc(u8, uncompressed_length); } var in = compressed; var out = uncompressed; var stream: c.z_stream = undefined; stream.zalloc = zlibAlloc; stream.zfree = zlibFree; stream.@"opaque" = temp_alloc; stream.next_in = in.ptr; stream.avail_in = 0; switch (c.inflateInit(&stream)) { c.Z_MEM_ERROR => return error.OutOfMemory, c.Z_OK => {}, else => return error.Unexpected, } stream.next_out = out.ptr; stream.avail_out = 0; const max_bytes: c_uint = std.math.maxInt(c_uint); var actual_uncompressed_size: usize = 0; var status = c.Z_OK; while (status == c.Z_OK) { if (stream.avail_out == 0) { stream.avail_out = if (out.len > max_bytes) max_bytes else @intCast(c_uint, out.len); out = out[stream.avail_out..]; } if (stream.avail_in == 0) { stream.avail_in = if (in.len > max_bytes) max_bytes else @intCast(c_uint, in.len); in = in[stream.avail_in..]; } stream.total_out = 0; status = c.inflate(&stream, c.Z_NO_FLUSH); actual_uncompressed_size += stream.total_out; } if (uncompressed.len == 0) { if (actual_uncompressed_size > 0 and status == c.Z_BUF_ERROR) { _ = c.inflateEnd(&stream); return error.DataCorrupted; } actual_uncompressed_size = 0; } if (status == c.Z_NEED_DICT or status == c.Z_BUF_ERROR and (out.len + stream.avail_out > 0)) { _ = c.inflateEnd(&stream); return error.DataCorrupted; } else if (status == c.Z_MEM_ERROR) { _ = c.inflateEnd(&stream); return error.OutOfMemory; } else if (status != c.Z_STREAM_END) { _ = c.inflateEnd(&stream); return error.Unexpected; } status = c.inflateEnd(&stream); if (status != c.Z_OK) { return error.Unexpected; } return uncompressed[0..actual_uncompressed_size]; }
limp/zlib.zig
const std = @import("std"); const concepts = @import("../../lib.zig").concepts; const concept = "getty.ser.sbt"; pub fn @"getty.ser.sbt"(comptime sbt: anytype) void { const T = if (@TypeOf(sbt) == type) sbt else @TypeOf(sbt); const info = @typeInfo(T); comptime { if (info == .Struct and info.Struct.is_tuple) { inline for (std.meta.fields(T)) |field| { const sb = @field(sbt, field.name); if (@TypeOf(sb) != type) { concepts.err(concept, "found non-namespace Serialization Block"); } switch (@typeInfo(sb)) { .Struct => |sb_info| { if (sb_info.is_tuple) { concepts.err(concept, "found non-namespace Serialization Block"); } if (sb_info.fields.len != 0) { concepts.err(concept, "found field in Serialization Block"); } inline for (.{ "is", "serialize" }) |func| { if (!std.meta.trait.hasFunctions(sb, .{func})) { concepts.err(concept, "missing `" ++ func ++ "` function in Serialization Block"); } } }, else => concepts.err(concept, "found non-namespace Serialization Block"), } } } else { if (info != .Struct or info.Struct.is_tuple) { concepts.err(concept, "found non-namespace Serialization Block"); } if (info.Struct.fields.len != 0) { concepts.err(concept, "found field in Serialization Block"); } inline for (.{ "is", "serialize" }) |func| { if (!std.meta.trait.hasFunctions(T, .{func})) { concepts.err(concept, "missing `" ++ func ++ "` function in Serialization Block"); } } } } }
src/ser/concept/sbt.zig
const std = @import("std"); const mem = std.mem; const ascii = @import("../../ascii.zig"); const Context = @import("../../Context.zig"); const Self = @This(); context: *Context, pub fn new(ctx: *Context) Self { return Self{ .context = ctx }; } /// isPunct detects punctuation characters. Note some punctuation maybe considered symbols by Unicode. pub fn isPunct(self: Self, cp: u21) !bool { const close = try self.context.getClose(); const connector = try self.context.getConnector(); const dash = try self.context.getDash(); const final = try self.context.getFinal(); const initial = try self.context.getInitial(); const open = try self.context.getOpen(); const other_punct = try self.context.getOtherPunct(); return close.isClosePunctuation(cp) or connector.isConnectorPunctuation(cp) or dash.isDashPunctuation(cp) or final.isFinalPunctuation(cp) or initial.isInitialPunctuation(cp) or open.isOpenPunctuation(cp) or other_punct.isOtherPunctuation(cp); } /// isAsciiPunct detects ASCII only punctuation. pub fn isAsciiPunct(cp: u21) bool { return if (cp < 128) ascii.isPunct(@intCast(u8, cp)) else false; } const expect = std.testing.expect; test "Component isPunct" { var ctx = Context.init(std.testing.allocator); defer ctx.deinit(); var punct = new(&ctx); expect(try punct.isPunct('!')); expect(try punct.isPunct('?')); expect(try punct.isPunct(',')); expect(try punct.isPunct('.')); expect(try punct.isPunct(':')); expect(try punct.isPunct(';')); expect(try punct.isPunct('\'')); expect(try punct.isPunct('"')); expect(try punct.isPunct('¿')); expect(try punct.isPunct('¡')); expect(try punct.isPunct('-')); expect(try punct.isPunct('(')); expect(try punct.isPunct(')')); expect(try punct.isPunct('{')); expect(try punct.isPunct('}')); expect(try punct.isPunct('–')); // Punct? in Unicode. expect(try punct.isPunct('@')); expect(try punct.isPunct('#')); expect(try punct.isPunct('%')); expect(try punct.isPunct('&')); expect(try punct.isPunct('*')); expect(try punct.isPunct('_')); expect(try punct.isPunct('/')); expect(try punct.isPunct('\\')); expect(!try punct.isPunct('\u{0003}')); }
src/components/aggregate/Punct.zig
const std = @import("std"); const mem = std.mem; const LowerMap = @This(); allocator: *mem.Allocator, map: std.AutoHashMap(u21, u21), pub fn init(allocator: *mem.Allocator) !LowerMap { var instance = LowerMap{ .allocator = allocator, .map = std.AutoHashMap(u21, u21).init(allocator), }; try instance.map.put(0x0041, 0x0061); try instance.map.put(0x0042, 0x0062); try instance.map.put(0x0043, 0x0063); try instance.map.put(0x0044, 0x0064); try instance.map.put(0x0045, 0x0065); try instance.map.put(0x0046, 0x0066); try instance.map.put(0x0047, 0x0067); try instance.map.put(0x0048, 0x0068); try instance.map.put(0x0049, 0x0069); try instance.map.put(0x004A, 0x006A); try instance.map.put(0x004B, 0x006B); try instance.map.put(0x004C, 0x006C); try instance.map.put(0x004D, 0x006D); try instance.map.put(0x004E, 0x006E); try instance.map.put(0x004F, 0x006F); try instance.map.put(0x0050, 0x0070); try instance.map.put(0x0051, 0x0071); try instance.map.put(0x0052, 0x0072); try instance.map.put(0x0053, 0x0073); try instance.map.put(0x0054, 0x0074); try instance.map.put(0x0055, 0x0075); try instance.map.put(0x0056, 0x0076); try instance.map.put(0x0057, 0x0077); try instance.map.put(0x0058, 0x0078); try instance.map.put(0x0059, 0x0079); try instance.map.put(0x005A, 0x007A); try instance.map.put(0x00C0, 0x00E0); try instance.map.put(0x00C1, 0x00E1); try instance.map.put(0x00C2, 0x00E2); try instance.map.put(0x00C3, 0x00E3); try instance.map.put(0x00C4, 0x00E4); try instance.map.put(0x00C5, 0x00E5); try instance.map.put(0x00C6, 0x00E6); try instance.map.put(0x00C7, 0x00E7); try instance.map.put(0x00C8, 0x00E8); try instance.map.put(0x00C9, 0x00E9); try instance.map.put(0x00CA, 0x00EA); try instance.map.put(0x00CB, 0x00EB); try instance.map.put(0x00CC, 0x00EC); try instance.map.put(0x00CD, 0x00ED); try instance.map.put(0x00CE, 0x00EE); try instance.map.put(0x00CF, 0x00EF); try instance.map.put(0x00D0, 0x00F0); try instance.map.put(0x00D1, 0x00F1); try instance.map.put(0x00D2, 0x00F2); try instance.map.put(0x00D3, 0x00F3); try instance.map.put(0x00D4, 0x00F4); try instance.map.put(0x00D5, 0x00F5); try instance.map.put(0x00D6, 0x00F6); try instance.map.put(0x00D8, 0x00F8); try instance.map.put(0x00D9, 0x00F9); try instance.map.put(0x00DA, 0x00FA); try instance.map.put(0x00DB, 0x00FB); try instance.map.put(0x00DC, 0x00FC); try instance.map.put(0x00DD, 0x00FD); try instance.map.put(0x00DE, 0x00FE); try instance.map.put(0x0100, 0x0101); try instance.map.put(0x0102, 0x0103); try instance.map.put(0x0104, 0x0105); try instance.map.put(0x0106, 0x0107); try instance.map.put(0x0108, 0x0109); try instance.map.put(0x010A, 0x010B); try instance.map.put(0x010C, 0x010D); try instance.map.put(0x010E, 0x010F); try instance.map.put(0x0110, 0x0111); try instance.map.put(0x0112, 0x0113); try instance.map.put(0x0114, 0x0115); try instance.map.put(0x0116, 0x0117); try instance.map.put(0x0118, 0x0119); try instance.map.put(0x011A, 0x011B); try instance.map.put(0x011C, 0x011D); try instance.map.put(0x011E, 0x011F); try instance.map.put(0x0120, 0x0121); try instance.map.put(0x0122, 0x0123); try instance.map.put(0x0124, 0x0125); try instance.map.put(0x0126, 0x0127); try instance.map.put(0x0128, 0x0129); try instance.map.put(0x012A, 0x012B); try instance.map.put(0x012C, 0x012D); try instance.map.put(0x012E, 0x012F); try instance.map.put(0x0130, 0x0069); try instance.map.put(0x0132, 0x0133); try instance.map.put(0x0134, 0x0135); try instance.map.put(0x0136, 0x0137); try instance.map.put(0x0139, 0x013A); try instance.map.put(0x013B, 0x013C); try instance.map.put(0x013D, 0x013E); try instance.map.put(0x013F, 0x0140); try instance.map.put(0x0141, 0x0142); try instance.map.put(0x0143, 0x0144); try instance.map.put(0x0145, 0x0146); try instance.map.put(0x0147, 0x0148); try instance.map.put(0x014A, 0x014B); try instance.map.put(0x014C, 0x014D); try instance.map.put(0x014E, 0x014F); try instance.map.put(0x0150, 0x0151); try instance.map.put(0x0152, 0x0153); try instance.map.put(0x0154, 0x0155); try instance.map.put(0x0156, 0x0157); try instance.map.put(0x0158, 0x0159); try instance.map.put(0x015A, 0x015B); try instance.map.put(0x015C, 0x015D); try instance.map.put(0x015E, 0x015F); try instance.map.put(0x0160, 0x0161); try instance.map.put(0x0162, 0x0163); try instance.map.put(0x0164, 0x0165); try instance.map.put(0x0166, 0x0167); try instance.map.put(0x0168, 0x0169); try instance.map.put(0x016A, 0x016B); try instance.map.put(0x016C, 0x016D); try instance.map.put(0x016E, 0x016F); try instance.map.put(0x0170, 0x0171); try instance.map.put(0x0172, 0x0173); try instance.map.put(0x0174, 0x0175); try instance.map.put(0x0176, 0x0177); try instance.map.put(0x0178, 0x00FF); try instance.map.put(0x0179, 0x017A); try instance.map.put(0x017B, 0x017C); try instance.map.put(0x017D, 0x017E); try instance.map.put(0x0181, 0x0253); try instance.map.put(0x0182, 0x0183); try instance.map.put(0x0184, 0x0185); try instance.map.put(0x0186, 0x0254); try instance.map.put(0x0187, 0x0188); try instance.map.put(0x0189, 0x0256); try instance.map.put(0x018A, 0x0257); try instance.map.put(0x018B, 0x018C); try instance.map.put(0x018E, 0x01DD); try instance.map.put(0x018F, 0x0259); try instance.map.put(0x0190, 0x025B); try instance.map.put(0x0191, 0x0192); try instance.map.put(0x0193, 0x0260); try instance.map.put(0x0194, 0x0263); try instance.map.put(0x0196, 0x0269); try instance.map.put(0x0197, 0x0268); try instance.map.put(0x0198, 0x0199); try instance.map.put(0x019C, 0x026F); try instance.map.put(0x019D, 0x0272); try instance.map.put(0x019F, 0x0275); try instance.map.put(0x01A0, 0x01A1); try instance.map.put(0x01A2, 0x01A3); try instance.map.put(0x01A4, 0x01A5); try instance.map.put(0x01A6, 0x0280); try instance.map.put(0x01A7, 0x01A8); try instance.map.put(0x01A9, 0x0283); try instance.map.put(0x01AC, 0x01AD); try instance.map.put(0x01AE, 0x0288); try instance.map.put(0x01AF, 0x01B0); try instance.map.put(0x01B1, 0x028A); try instance.map.put(0x01B2, 0x028B); try instance.map.put(0x01B3, 0x01B4); try instance.map.put(0x01B5, 0x01B6); try instance.map.put(0x01B7, 0x0292); try instance.map.put(0x01B8, 0x01B9); try instance.map.put(0x01BC, 0x01BD); try instance.map.put(0x01C4, 0x01C6); try instance.map.put(0x01C5, 0x01C6); try instance.map.put(0x01C7, 0x01C9); try instance.map.put(0x01C8, 0x01C9); try instance.map.put(0x01CA, 0x01CC); try instance.map.put(0x01CB, 0x01CC); try instance.map.put(0x01CD, 0x01CE); try instance.map.put(0x01CF, 0x01D0); try instance.map.put(0x01D1, 0x01D2); try instance.map.put(0x01D3, 0x01D4); try instance.map.put(0x01D5, 0x01D6); try instance.map.put(0x01D7, 0x01D8); try instance.map.put(0x01D9, 0x01DA); try instance.map.put(0x01DB, 0x01DC); try instance.map.put(0x01DE, 0x01DF); try instance.map.put(0x01E0, 0x01E1); try instance.map.put(0x01E2, 0x01E3); try instance.map.put(0x01E4, 0x01E5); try instance.map.put(0x01E6, 0x01E7); try instance.map.put(0x01E8, 0x01E9); try instance.map.put(0x01EA, 0x01EB); try instance.map.put(0x01EC, 0x01ED); try instance.map.put(0x01EE, 0x01EF); try instance.map.put(0x01F1, 0x01F3); try instance.map.put(0x01F2, 0x01F3); try instance.map.put(0x01F4, 0x01F5); try instance.map.put(0x01F6, 0x0195); try instance.map.put(0x01F7, 0x01BF); try instance.map.put(0x01F8, 0x01F9); try instance.map.put(0x01FA, 0x01FB); try instance.map.put(0x01FC, 0x01FD); try instance.map.put(0x01FE, 0x01FF); try instance.map.put(0x0200, 0x0201); try instance.map.put(0x0202, 0x0203); try instance.map.put(0x0204, 0x0205); try instance.map.put(0x0206, 0x0207); try instance.map.put(0x0208, 0x0209); try instance.map.put(0x020A, 0x020B); try instance.map.put(0x020C, 0x020D); try instance.map.put(0x020E, 0x020F); try instance.map.put(0x0210, 0x0211); try instance.map.put(0x0212, 0x0213); try instance.map.put(0x0214, 0x0215); try instance.map.put(0x0216, 0x0217); try instance.map.put(0x0218, 0x0219); try instance.map.put(0x021A, 0x021B); try instance.map.put(0x021C, 0x021D); try instance.map.put(0x021E, 0x021F); try instance.map.put(0x0220, 0x019E); try instance.map.put(0x0222, 0x0223); try instance.map.put(0x0224, 0x0225); try instance.map.put(0x0226, 0x0227); try instance.map.put(0x0228, 0x0229); try instance.map.put(0x022A, 0x022B); try instance.map.put(0x022C, 0x022D); try instance.map.put(0x022E, 0x022F); try instance.map.put(0x0230, 0x0231); try instance.map.put(0x0232, 0x0233); try instance.map.put(0x023A, 0x2C65); try instance.map.put(0x023B, 0x023C); try instance.map.put(0x023D, 0x019A); try instance.map.put(0x023E, 0x2C66); try instance.map.put(0x0241, 0x0242); try instance.map.put(0x0243, 0x0180); try instance.map.put(0x0244, 0x0289); try instance.map.put(0x0245, 0x028C); try instance.map.put(0x0246, 0x0247); try instance.map.put(0x0248, 0x0249); try instance.map.put(0x024A, 0x024B); try instance.map.put(0x024C, 0x024D); try instance.map.put(0x024E, 0x024F); try instance.map.put(0x0370, 0x0371); try instance.map.put(0x0372, 0x0373); try instance.map.put(0x0376, 0x0377); try instance.map.put(0x037F, 0x03F3); try instance.map.put(0x0386, 0x03AC); try instance.map.put(0x0388, 0x03AD); try instance.map.put(0x0389, 0x03AE); try instance.map.put(0x038A, 0x03AF); try instance.map.put(0x038C, 0x03CC); try instance.map.put(0x038E, 0x03CD); try instance.map.put(0x038F, 0x03CE); try instance.map.put(0x0391, 0x03B1); try instance.map.put(0x0392, 0x03B2); try instance.map.put(0x0393, 0x03B3); try instance.map.put(0x0394, 0x03B4); try instance.map.put(0x0395, 0x03B5); try instance.map.put(0x0396, 0x03B6); try instance.map.put(0x0397, 0x03B7); try instance.map.put(0x0398, 0x03B8); try instance.map.put(0x0399, 0x03B9); try instance.map.put(0x039A, 0x03BA); try instance.map.put(0x039B, 0x03BB); try instance.map.put(0x039C, 0x03BC); try instance.map.put(0x039D, 0x03BD); try instance.map.put(0x039E, 0x03BE); try instance.map.put(0x039F, 0x03BF); try instance.map.put(0x03A0, 0x03C0); try instance.map.put(0x03A1, 0x03C1); try instance.map.put(0x03A3, 0x03C3); try instance.map.put(0x03A4, 0x03C4); try instance.map.put(0x03A5, 0x03C5); try instance.map.put(0x03A6, 0x03C6); try instance.map.put(0x03A7, 0x03C7); try instance.map.put(0x03A8, 0x03C8); try instance.map.put(0x03A9, 0x03C9); try instance.map.put(0x03AA, 0x03CA); try instance.map.put(0x03AB, 0x03CB); try instance.map.put(0x03CF, 0x03D7); try instance.map.put(0x03D8, 0x03D9); try instance.map.put(0x03DA, 0x03DB); try instance.map.put(0x03DC, 0x03DD); try instance.map.put(0x03DE, 0x03DF); try instance.map.put(0x03E0, 0x03E1); try instance.map.put(0x03E2, 0x03E3); try instance.map.put(0x03E4, 0x03E5); try instance.map.put(0x03E6, 0x03E7); try instance.map.put(0x03E8, 0x03E9); try instance.map.put(0x03EA, 0x03EB); try instance.map.put(0x03EC, 0x03ED); try instance.map.put(0x03EE, 0x03EF); try instance.map.put(0x03F4, 0x03B8); try instance.map.put(0x03F7, 0x03F8); try instance.map.put(0x03F9, 0x03F2); try instance.map.put(0x03FA, 0x03FB); try instance.map.put(0x03FD, 0x037B); try instance.map.put(0x03FE, 0x037C); try instance.map.put(0x03FF, 0x037D); try instance.map.put(0x0400, 0x0450); try instance.map.put(0x0401, 0x0451); try instance.map.put(0x0402, 0x0452); try instance.map.put(0x0403, 0x0453); try instance.map.put(0x0404, 0x0454); try instance.map.put(0x0405, 0x0455); try instance.map.put(0x0406, 0x0456); try instance.map.put(0x0407, 0x0457); try instance.map.put(0x0408, 0x0458); try instance.map.put(0x0409, 0x0459); try instance.map.put(0x040A, 0x045A); try instance.map.put(0x040B, 0x045B); try instance.map.put(0x040C, 0x045C); try instance.map.put(0x040D, 0x045D); try instance.map.put(0x040E, 0x045E); try instance.map.put(0x040F, 0x045F); try instance.map.put(0x0410, 0x0430); try instance.map.put(0x0411, 0x0431); try instance.map.put(0x0412, 0x0432); try instance.map.put(0x0413, 0x0433); try instance.map.put(0x0414, 0x0434); try instance.map.put(0x0415, 0x0435); try instance.map.put(0x0416, 0x0436); try instance.map.put(0x0417, 0x0437); try instance.map.put(0x0418, 0x0438); try instance.map.put(0x0419, 0x0439); try instance.map.put(0x041A, 0x043A); try instance.map.put(0x041B, 0x043B); try instance.map.put(0x041C, 0x043C); try instance.map.put(0x041D, 0x043D); try instance.map.put(0x041E, 0x043E); try instance.map.put(0x041F, 0x043F); try instance.map.put(0x0420, 0x0440); try instance.map.put(0x0421, 0x0441); try instance.map.put(0x0422, 0x0442); try instance.map.put(0x0423, 0x0443); try instance.map.put(0x0424, 0x0444); try instance.map.put(0x0425, 0x0445); try instance.map.put(0x0426, 0x0446); try instance.map.put(0x0427, 0x0447); try instance.map.put(0x0428, 0x0448); try instance.map.put(0x0429, 0x0449); try instance.map.put(0x042A, 0x044A); try instance.map.put(0x042B, 0x044B); try instance.map.put(0x042C, 0x044C); try instance.map.put(0x042D, 0x044D); try instance.map.put(0x042E, 0x044E); try instance.map.put(0x042F, 0x044F); try instance.map.put(0x0460, 0x0461); try instance.map.put(0x0462, 0x0463); try instance.map.put(0x0464, 0x0465); try instance.map.put(0x0466, 0x0467); try instance.map.put(0x0468, 0x0469); try instance.map.put(0x046A, 0x046B); try instance.map.put(0x046C, 0x046D); try instance.map.put(0x046E, 0x046F); try instance.map.put(0x0470, 0x0471); try instance.map.put(0x0472, 0x0473); try instance.map.put(0x0474, 0x0475); try instance.map.put(0x0476, 0x0477); try instance.map.put(0x0478, 0x0479); try instance.map.put(0x047A, 0x047B); try instance.map.put(0x047C, 0x047D); try instance.map.put(0x047E, 0x047F); try instance.map.put(0x0480, 0x0481); try instance.map.put(0x048A, 0x048B); try instance.map.put(0x048C, 0x048D); try instance.map.put(0x048E, 0x048F); try instance.map.put(0x0490, 0x0491); try instance.map.put(0x0492, 0x0493); try instance.map.put(0x0494, 0x0495); try instance.map.put(0x0496, 0x0497); try instance.map.put(0x0498, 0x0499); try instance.map.put(0x049A, 0x049B); try instance.map.put(0x049C, 0x049D); try instance.map.put(0x049E, 0x049F); try instance.map.put(0x04A0, 0x04A1); try instance.map.put(0x04A2, 0x04A3); try instance.map.put(0x04A4, 0x04A5); try instance.map.put(0x04A6, 0x04A7); try instance.map.put(0x04A8, 0x04A9); try instance.map.put(0x04AA, 0x04AB); try instance.map.put(0x04AC, 0x04AD); try instance.map.put(0x04AE, 0x04AF); try instance.map.put(0x04B0, 0x04B1); try instance.map.put(0x04B2, 0x04B3); try instance.map.put(0x04B4, 0x04B5); try instance.map.put(0x04B6, 0x04B7); try instance.map.put(0x04B8, 0x04B9); try instance.map.put(0x04BA, 0x04BB); try instance.map.put(0x04BC, 0x04BD); try instance.map.put(0x04BE, 0x04BF); try instance.map.put(0x04C0, 0x04CF); try instance.map.put(0x04C1, 0x04C2); try instance.map.put(0x04C3, 0x04C4); try instance.map.put(0x04C5, 0x04C6); try instance.map.put(0x04C7, 0x04C8); try instance.map.put(0x04C9, 0x04CA); try instance.map.put(0x04CB, 0x04CC); try instance.map.put(0x04CD, 0x04CE); try instance.map.put(0x04D0, 0x04D1); try instance.map.put(0x04D2, 0x04D3); try instance.map.put(0x04D4, 0x04D5); try instance.map.put(0x04D6, 0x04D7); try instance.map.put(0x04D8, 0x04D9); try instance.map.put(0x04DA, 0x04DB); try instance.map.put(0x04DC, 0x04DD); try instance.map.put(0x04DE, 0x04DF); try instance.map.put(0x04E0, 0x04E1); try instance.map.put(0x04E2, 0x04E3); try instance.map.put(0x04E4, 0x04E5); try instance.map.put(0x04E6, 0x04E7); try instance.map.put(0x04E8, 0x04E9); try instance.map.put(0x04EA, 0x04EB); try instance.map.put(0x04EC, 0x04ED); try instance.map.put(0x04EE, 0x04EF); try instance.map.put(0x04F0, 0x04F1); try instance.map.put(0x04F2, 0x04F3); try instance.map.put(0x04F4, 0x04F5); try instance.map.put(0x04F6, 0x04F7); try instance.map.put(0x04F8, 0x04F9); try instance.map.put(0x04FA, 0x04FB); try instance.map.put(0x04FC, 0x04FD); try instance.map.put(0x04FE, 0x04FF); try instance.map.put(0x0500, 0x0501); try instance.map.put(0x0502, 0x0503); try instance.map.put(0x0504, 0x0505); try instance.map.put(0x0506, 0x0507); try instance.map.put(0x0508, 0x0509); try instance.map.put(0x050A, 0x050B); try instance.map.put(0x050C, 0x050D); try instance.map.put(0x050E, 0x050F); try instance.map.put(0x0510, 0x0511); try instance.map.put(0x0512, 0x0513); try instance.map.put(0x0514, 0x0515); try instance.map.put(0x0516, 0x0517); try instance.map.put(0x0518, 0x0519); try instance.map.put(0x051A, 0x051B); try instance.map.put(0x051C, 0x051D); try instance.map.put(0x051E, 0x051F); try instance.map.put(0x0520, 0x0521); try instance.map.put(0x0522, 0x0523); try instance.map.put(0x0524, 0x0525); try instance.map.put(0x0526, 0x0527); try instance.map.put(0x0528, 0x0529); try instance.map.put(0x052A, 0x052B); try instance.map.put(0x052C, 0x052D); try instance.map.put(0x052E, 0x052F); try instance.map.put(0x0531, 0x0561); try instance.map.put(0x0532, 0x0562); try instance.map.put(0x0533, 0x0563); try instance.map.put(0x0534, 0x0564); try instance.map.put(0x0535, 0x0565); try instance.map.put(0x0536, 0x0566); try instance.map.put(0x0537, 0x0567); try instance.map.put(0x0538, 0x0568); try instance.map.put(0x0539, 0x0569); try instance.map.put(0x053A, 0x056A); try instance.map.put(0x053B, 0x056B); try instance.map.put(0x053C, 0x056C); try instance.map.put(0x053D, 0x056D); try instance.map.put(0x053E, 0x056E); try instance.map.put(0x053F, 0x056F); try instance.map.put(0x0540, 0x0570); try instance.map.put(0x0541, 0x0571); try instance.map.put(0x0542, 0x0572); try instance.map.put(0x0543, 0x0573); try instance.map.put(0x0544, 0x0574); try instance.map.put(0x0545, 0x0575); try instance.map.put(0x0546, 0x0576); try instance.map.put(0x0547, 0x0577); try instance.map.put(0x0548, 0x0578); try instance.map.put(0x0549, 0x0579); try instance.map.put(0x054A, 0x057A); try instance.map.put(0x054B, 0x057B); try instance.map.put(0x054C, 0x057C); try instance.map.put(0x054D, 0x057D); try instance.map.put(0x054E, 0x057E); try instance.map.put(0x054F, 0x057F); try instance.map.put(0x0550, 0x0580); try instance.map.put(0x0551, 0x0581); try instance.map.put(0x0552, 0x0582); try instance.map.put(0x0553, 0x0583); try instance.map.put(0x0554, 0x0584); try instance.map.put(0x0555, 0x0585); try instance.map.put(0x0556, 0x0586); try instance.map.put(0x10A0, 0x2D00); try instance.map.put(0x10A1, 0x2D01); try instance.map.put(0x10A2, 0x2D02); try instance.map.put(0x10A3, 0x2D03); try instance.map.put(0x10A4, 0x2D04); try instance.map.put(0x10A5, 0x2D05); try instance.map.put(0x10A6, 0x2D06); try instance.map.put(0x10A7, 0x2D07); try instance.map.put(0x10A8, 0x2D08); try instance.map.put(0x10A9, 0x2D09); try instance.map.put(0x10AA, 0x2D0A); try instance.map.put(0x10AB, 0x2D0B); try instance.map.put(0x10AC, 0x2D0C); try instance.map.put(0x10AD, 0x2D0D); try instance.map.put(0x10AE, 0x2D0E); try instance.map.put(0x10AF, 0x2D0F); try instance.map.put(0x10B0, 0x2D10); try instance.map.put(0x10B1, 0x2D11); try instance.map.put(0x10B2, 0x2D12); try instance.map.put(0x10B3, 0x2D13); try instance.map.put(0x10B4, 0x2D14); try instance.map.put(0x10B5, 0x2D15); try instance.map.put(0x10B6, 0x2D16); try instance.map.put(0x10B7, 0x2D17); try instance.map.put(0x10B8, 0x2D18); try instance.map.put(0x10B9, 0x2D19); try instance.map.put(0x10BA, 0x2D1A); try instance.map.put(0x10BB, 0x2D1B); try instance.map.put(0x10BC, 0x2D1C); try instance.map.put(0x10BD, 0x2D1D); try instance.map.put(0x10BE, 0x2D1E); try instance.map.put(0x10BF, 0x2D1F); try instance.map.put(0x10C0, 0x2D20); try instance.map.put(0x10C1, 0x2D21); try instance.map.put(0x10C2, 0x2D22); try instance.map.put(0x10C3, 0x2D23); try instance.map.put(0x10C4, 0x2D24); try instance.map.put(0x10C5, 0x2D25); try instance.map.put(0x10C7, 0x2D27); try instance.map.put(0x10CD, 0x2D2D); try instance.map.put(0x13A0, 0xAB70); try instance.map.put(0x13A1, 0xAB71); try instance.map.put(0x13A2, 0xAB72); try instance.map.put(0x13A3, 0xAB73); try instance.map.put(0x13A4, 0xAB74); try instance.map.put(0x13A5, 0xAB75); try instance.map.put(0x13A6, 0xAB76); try instance.map.put(0x13A7, 0xAB77); try instance.map.put(0x13A8, 0xAB78); try instance.map.put(0x13A9, 0xAB79); try instance.map.put(0x13AA, 0xAB7A); try instance.map.put(0x13AB, 0xAB7B); try instance.map.put(0x13AC, 0xAB7C); try instance.map.put(0x13AD, 0xAB7D); try instance.map.put(0x13AE, 0xAB7E); try instance.map.put(0x13AF, 0xAB7F); try instance.map.put(0x13B0, 0xAB80); try instance.map.put(0x13B1, 0xAB81); try instance.map.put(0x13B2, 0xAB82); try instance.map.put(0x13B3, 0xAB83); try instance.map.put(0x13B4, 0xAB84); try instance.map.put(0x13B5, 0xAB85); try instance.map.put(0x13B6, 0xAB86); try instance.map.put(0x13B7, 0xAB87); try instance.map.put(0x13B8, 0xAB88); try instance.map.put(0x13B9, 0xAB89); try instance.map.put(0x13BA, 0xAB8A); try instance.map.put(0x13BB, 0xAB8B); try instance.map.put(0x13BC, 0xAB8C); try instance.map.put(0x13BD, 0xAB8D); try instance.map.put(0x13BE, 0xAB8E); try instance.map.put(0x13BF, 0xAB8F); try instance.map.put(0x13C0, 0xAB90); try instance.map.put(0x13C1, 0xAB91); try instance.map.put(0x13C2, 0xAB92); try instance.map.put(0x13C3, 0xAB93); try instance.map.put(0x13C4, 0xAB94); try instance.map.put(0x13C5, 0xAB95); try instance.map.put(0x13C6, 0xAB96); try instance.map.put(0x13C7, 0xAB97); try instance.map.put(0x13C8, 0xAB98); try instance.map.put(0x13C9, 0xAB99); try instance.map.put(0x13CA, 0xAB9A); try instance.map.put(0x13CB, 0xAB9B); try instance.map.put(0x13CC, 0xAB9C); try instance.map.put(0x13CD, 0xAB9D); try instance.map.put(0x13CE, 0xAB9E); try instance.map.put(0x13CF, 0xAB9F); try instance.map.put(0x13D0, 0xABA0); try instance.map.put(0x13D1, 0xABA1); try instance.map.put(0x13D2, 0xABA2); try instance.map.put(0x13D3, 0xABA3); try instance.map.put(0x13D4, 0xABA4); try instance.map.put(0x13D5, 0xABA5); try instance.map.put(0x13D6, 0xABA6); try instance.map.put(0x13D7, 0xABA7); try instance.map.put(0x13D8, 0xABA8); try instance.map.put(0x13D9, 0xABA9); try instance.map.put(0x13DA, 0xABAA); try instance.map.put(0x13DB, 0xABAB); try instance.map.put(0x13DC, 0xABAC); try instance.map.put(0x13DD, 0xABAD); try instance.map.put(0x13DE, 0xABAE); try instance.map.put(0x13DF, 0xABAF); try instance.map.put(0x13E0, 0xABB0); try instance.map.put(0x13E1, 0xABB1); try instance.map.put(0x13E2, 0xABB2); try instance.map.put(0x13E3, 0xABB3); try instance.map.put(0x13E4, 0xABB4); try instance.map.put(0x13E5, 0xABB5); try instance.map.put(0x13E6, 0xABB6); try instance.map.put(0x13E7, 0xABB7); try instance.map.put(0x13E8, 0xABB8); try instance.map.put(0x13E9, 0xABB9); try instance.map.put(0x13EA, 0xABBA); try instance.map.put(0x13EB, 0xABBB); try instance.map.put(0x13EC, 0xABBC); try instance.map.put(0x13ED, 0xABBD); try instance.map.put(0x13EE, 0xABBE); try instance.map.put(0x13EF, 0xABBF); try instance.map.put(0x13F0, 0x13F8); try instance.map.put(0x13F1, 0x13F9); try instance.map.put(0x13F2, 0x13FA); try instance.map.put(0x13F3, 0x13FB); try instance.map.put(0x13F4, 0x13FC); try instance.map.put(0x13F5, 0x13FD); try instance.map.put(0x1C90, 0x10D0); try instance.map.put(0x1C91, 0x10D1); try instance.map.put(0x1C92, 0x10D2); try instance.map.put(0x1C93, 0x10D3); try instance.map.put(0x1C94, 0x10D4); try instance.map.put(0x1C95, 0x10D5); try instance.map.put(0x1C96, 0x10D6); try instance.map.put(0x1C97, 0x10D7); try instance.map.put(0x1C98, 0x10D8); try instance.map.put(0x1C99, 0x10D9); try instance.map.put(0x1C9A, 0x10DA); try instance.map.put(0x1C9B, 0x10DB); try instance.map.put(0x1C9C, 0x10DC); try instance.map.put(0x1C9D, 0x10DD); try instance.map.put(0x1C9E, 0x10DE); try instance.map.put(0x1C9F, 0x10DF); try instance.map.put(0x1CA0, 0x10E0); try instance.map.put(0x1CA1, 0x10E1); try instance.map.put(0x1CA2, 0x10E2); try instance.map.put(0x1CA3, 0x10E3); try instance.map.put(0x1CA4, 0x10E4); try instance.map.put(0x1CA5, 0x10E5); try instance.map.put(0x1CA6, 0x10E6); try instance.map.put(0x1CA7, 0x10E7); try instance.map.put(0x1CA8, 0x10E8); try instance.map.put(0x1CA9, 0x10E9); try instance.map.put(0x1CAA, 0x10EA); try instance.map.put(0x1CAB, 0x10EB); try instance.map.put(0x1CAC, 0x10EC); try instance.map.put(0x1CAD, 0x10ED); try instance.map.put(0x1CAE, 0x10EE); try instance.map.put(0x1CAF, 0x10EF); try instance.map.put(0x1CB0, 0x10F0); try instance.map.put(0x1CB1, 0x10F1); try instance.map.put(0x1CB2, 0x10F2); try instance.map.put(0x1CB3, 0x10F3); try instance.map.put(0x1CB4, 0x10F4); try instance.map.put(0x1CB5, 0x10F5); try instance.map.put(0x1CB6, 0x10F6); try instance.map.put(0x1CB7, 0x10F7); try instance.map.put(0x1CB8, 0x10F8); try instance.map.put(0x1CB9, 0x10F9); try instance.map.put(0x1CBA, 0x10FA); try instance.map.put(0x1CBD, 0x10FD); try instance.map.put(0x1CBE, 0x10FE); try instance.map.put(0x1CBF, 0x10FF); try instance.map.put(0x1E00, 0x1E01); try instance.map.put(0x1E02, 0x1E03); try instance.map.put(0x1E04, 0x1E05); try instance.map.put(0x1E06, 0x1E07); try instance.map.put(0x1E08, 0x1E09); try instance.map.put(0x1E0A, 0x1E0B); try instance.map.put(0x1E0C, 0x1E0D); try instance.map.put(0x1E0E, 0x1E0F); try instance.map.put(0x1E10, 0x1E11); try instance.map.put(0x1E12, 0x1E13); try instance.map.put(0x1E14, 0x1E15); try instance.map.put(0x1E16, 0x1E17); try instance.map.put(0x1E18, 0x1E19); try instance.map.put(0x1E1A, 0x1E1B); try instance.map.put(0x1E1C, 0x1E1D); try instance.map.put(0x1E1E, 0x1E1F); try instance.map.put(0x1E20, 0x1E21); try instance.map.put(0x1E22, 0x1E23); try instance.map.put(0x1E24, 0x1E25); try instance.map.put(0x1E26, 0x1E27); try instance.map.put(0x1E28, 0x1E29); try instance.map.put(0x1E2A, 0x1E2B); try instance.map.put(0x1E2C, 0x1E2D); try instance.map.put(0x1E2E, 0x1E2F); try instance.map.put(0x1E30, 0x1E31); try instance.map.put(0x1E32, 0x1E33); try instance.map.put(0x1E34, 0x1E35); try instance.map.put(0x1E36, 0x1E37); try instance.map.put(0x1E38, 0x1E39); try instance.map.put(0x1E3A, 0x1E3B); try instance.map.put(0x1E3C, 0x1E3D); try instance.map.put(0x1E3E, 0x1E3F); try instance.map.put(0x1E40, 0x1E41); try instance.map.put(0x1E42, 0x1E43); try instance.map.put(0x1E44, 0x1E45); try instance.map.put(0x1E46, 0x1E47); try instance.map.put(0x1E48, 0x1E49); try instance.map.put(0x1E4A, 0x1E4B); try instance.map.put(0x1E4C, 0x1E4D); try instance.map.put(0x1E4E, 0x1E4F); try instance.map.put(0x1E50, 0x1E51); try instance.map.put(0x1E52, 0x1E53); try instance.map.put(0x1E54, 0x1E55); try instance.map.put(0x1E56, 0x1E57); try instance.map.put(0x1E58, 0x1E59); try instance.map.put(0x1E5A, 0x1E5B); try instance.map.put(0x1E5C, 0x1E5D); try instance.map.put(0x1E5E, 0x1E5F); try instance.map.put(0x1E60, 0x1E61); try instance.map.put(0x1E62, 0x1E63); try instance.map.put(0x1E64, 0x1E65); try instance.map.put(0x1E66, 0x1E67); try instance.map.put(0x1E68, 0x1E69); try instance.map.put(0x1E6A, 0x1E6B); try instance.map.put(0x1E6C, 0x1E6D); try instance.map.put(0x1E6E, 0x1E6F); try instance.map.put(0x1E70, 0x1E71); try instance.map.put(0x1E72, 0x1E73); try instance.map.put(0x1E74, 0x1E75); try instance.map.put(0x1E76, 0x1E77); try instance.map.put(0x1E78, 0x1E79); try instance.map.put(0x1E7A, 0x1E7B); try instance.map.put(0x1E7C, 0x1E7D); try instance.map.put(0x1E7E, 0x1E7F); try instance.map.put(0x1E80, 0x1E81); try instance.map.put(0x1E82, 0x1E83); try instance.map.put(0x1E84, 0x1E85); try instance.map.put(0x1E86, 0x1E87); try instance.map.put(0x1E88, 0x1E89); try instance.map.put(0x1E8A, 0x1E8B); try instance.map.put(0x1E8C, 0x1E8D); try instance.map.put(0x1E8E, 0x1E8F); try instance.map.put(0x1E90, 0x1E91); try instance.map.put(0x1E92, 0x1E93); try instance.map.put(0x1E94, 0x1E95); try instance.map.put(0x1E9E, 0x00DF); try instance.map.put(0x1EA0, 0x1EA1); try instance.map.put(0x1EA2, 0x1EA3); try instance.map.put(0x1EA4, 0x1EA5); try instance.map.put(0x1EA6, 0x1EA7); try instance.map.put(0x1EA8, 0x1EA9); try instance.map.put(0x1EAA, 0x1EAB); try instance.map.put(0x1EAC, 0x1EAD); try instance.map.put(0x1EAE, 0x1EAF); try instance.map.put(0x1EB0, 0x1EB1); try instance.map.put(0x1EB2, 0x1EB3); try instance.map.put(0x1EB4, 0x1EB5); try instance.map.put(0x1EB6, 0x1EB7); try instance.map.put(0x1EB8, 0x1EB9); try instance.map.put(0x1EBA, 0x1EBB); try instance.map.put(0x1EBC, 0x1EBD); try instance.map.put(0x1EBE, 0x1EBF); try instance.map.put(0x1EC0, 0x1EC1); try instance.map.put(0x1EC2, 0x1EC3); try instance.map.put(0x1EC4, 0x1EC5); try instance.map.put(0x1EC6, 0x1EC7); try instance.map.put(0x1EC8, 0x1EC9); try instance.map.put(0x1ECA, 0x1ECB); try instance.map.put(0x1ECC, 0x1ECD); try instance.map.put(0x1ECE, 0x1ECF); try instance.map.put(0x1ED0, 0x1ED1); try instance.map.put(0x1ED2, 0x1ED3); try instance.map.put(0x1ED4, 0x1ED5); try instance.map.put(0x1ED6, 0x1ED7); try instance.map.put(0x1ED8, 0x1ED9); try instance.map.put(0x1EDA, 0x1EDB); try instance.map.put(0x1EDC, 0x1EDD); try instance.map.put(0x1EDE, 0x1EDF); try instance.map.put(0x1EE0, 0x1EE1); try instance.map.put(0x1EE2, 0x1EE3); try instance.map.put(0x1EE4, 0x1EE5); try instance.map.put(0x1EE6, 0x1EE7); try instance.map.put(0x1EE8, 0x1EE9); try instance.map.put(0x1EEA, 0x1EEB); try instance.map.put(0x1EEC, 0x1EED); try instance.map.put(0x1EEE, 0x1EEF); try instance.map.put(0x1EF0, 0x1EF1); try instance.map.put(0x1EF2, 0x1EF3); try instance.map.put(0x1EF4, 0x1EF5); try instance.map.put(0x1EF6, 0x1EF7); try instance.map.put(0x1EF8, 0x1EF9); try instance.map.put(0x1EFA, 0x1EFB); try instance.map.put(0x1EFC, 0x1EFD); try instance.map.put(0x1EFE, 0x1EFF); try instance.map.put(0x1F08, 0x1F00); try instance.map.put(0x1F09, 0x1F01); try instance.map.put(0x1F0A, 0x1F02); try instance.map.put(0x1F0B, 0x1F03); try instance.map.put(0x1F0C, 0x1F04); try instance.map.put(0x1F0D, 0x1F05); try instance.map.put(0x1F0E, 0x1F06); try instance.map.put(0x1F0F, 0x1F07); try instance.map.put(0x1F18, 0x1F10); try instance.map.put(0x1F19, 0x1F11); try instance.map.put(0x1F1A, 0x1F12); try instance.map.put(0x1F1B, 0x1F13); try instance.map.put(0x1F1C, 0x1F14); try instance.map.put(0x1F1D, 0x1F15); try instance.map.put(0x1F28, 0x1F20); try instance.map.put(0x1F29, 0x1F21); try instance.map.put(0x1F2A, 0x1F22); try instance.map.put(0x1F2B, 0x1F23); try instance.map.put(0x1F2C, 0x1F24); try instance.map.put(0x1F2D, 0x1F25); try instance.map.put(0x1F2E, 0x1F26); try instance.map.put(0x1F2F, 0x1F27); try instance.map.put(0x1F38, 0x1F30); try instance.map.put(0x1F39, 0x1F31); try instance.map.put(0x1F3A, 0x1F32); try instance.map.put(0x1F3B, 0x1F33); try instance.map.put(0x1F3C, 0x1F34); try instance.map.put(0x1F3D, 0x1F35); try instance.map.put(0x1F3E, 0x1F36); try instance.map.put(0x1F3F, 0x1F37); try instance.map.put(0x1F48, 0x1F40); try instance.map.put(0x1F49, 0x1F41); try instance.map.put(0x1F4A, 0x1F42); try instance.map.put(0x1F4B, 0x1F43); try instance.map.put(0x1F4C, 0x1F44); try instance.map.put(0x1F4D, 0x1F45); try instance.map.put(0x1F59, 0x1F51); try instance.map.put(0x1F5B, 0x1F53); try instance.map.put(0x1F5D, 0x1F55); try instance.map.put(0x1F5F, 0x1F57); try instance.map.put(0x1F68, 0x1F60); try instance.map.put(0x1F69, 0x1F61); try instance.map.put(0x1F6A, 0x1F62); try instance.map.put(0x1F6B, 0x1F63); try instance.map.put(0x1F6C, 0x1F64); try instance.map.put(0x1F6D, 0x1F65); try instance.map.put(0x1F6E, 0x1F66); try instance.map.put(0x1F6F, 0x1F67); try instance.map.put(0x1F88, 0x1F80); try instance.map.put(0x1F89, 0x1F81); try instance.map.put(0x1F8A, 0x1F82); try instance.map.put(0x1F8B, 0x1F83); try instance.map.put(0x1F8C, 0x1F84); try instance.map.put(0x1F8D, 0x1F85); try instance.map.put(0x1F8E, 0x1F86); try instance.map.put(0x1F8F, 0x1F87); try instance.map.put(0x1F98, 0x1F90); try instance.map.put(0x1F99, 0x1F91); try instance.map.put(0x1F9A, 0x1F92); try instance.map.put(0x1F9B, 0x1F93); try instance.map.put(0x1F9C, 0x1F94); try instance.map.put(0x1F9D, 0x1F95); try instance.map.put(0x1F9E, 0x1F96); try instance.map.put(0x1F9F, 0x1F97); try instance.map.put(0x1FA8, 0x1FA0); try instance.map.put(0x1FA9, 0x1FA1); try instance.map.put(0x1FAA, 0x1FA2); try instance.map.put(0x1FAB, 0x1FA3); try instance.map.put(0x1FAC, 0x1FA4); try instance.map.put(0x1FAD, 0x1FA5); try instance.map.put(0x1FAE, 0x1FA6); try instance.map.put(0x1FAF, 0x1FA7); try instance.map.put(0x1FB8, 0x1FB0); try instance.map.put(0x1FB9, 0x1FB1); try instance.map.put(0x1FBA, 0x1F70); try instance.map.put(0x1FBB, 0x1F71); try instance.map.put(0x1FBC, 0x1FB3); try instance.map.put(0x1FC8, 0x1F72); try instance.map.put(0x1FC9, 0x1F73); try instance.map.put(0x1FCA, 0x1F74); try instance.map.put(0x1FCB, 0x1F75); try instance.map.put(0x1FCC, 0x1FC3); try instance.map.put(0x1FD8, 0x1FD0); try instance.map.put(0x1FD9, 0x1FD1); try instance.map.put(0x1FDA, 0x1F76); try instance.map.put(0x1FDB, 0x1F77); try instance.map.put(0x1FE8, 0x1FE0); try instance.map.put(0x1FE9, 0x1FE1); try instance.map.put(0x1FEA, 0x1F7A); try instance.map.put(0x1FEB, 0x1F7B); try instance.map.put(0x1FEC, 0x1FE5); try instance.map.put(0x1FF8, 0x1F78); try instance.map.put(0x1FF9, 0x1F79); try instance.map.put(0x1FFA, 0x1F7C); try instance.map.put(0x1FFB, 0x1F7D); try instance.map.put(0x1FFC, 0x1FF3); try instance.map.put(0x2126, 0x03C9); try instance.map.put(0x212A, 0x006B); try instance.map.put(0x212B, 0x00E5); try instance.map.put(0x2132, 0x214E); try instance.map.put(0x2160, 0x2170); try instance.map.put(0x2161, 0x2171); try instance.map.put(0x2162, 0x2172); try instance.map.put(0x2163, 0x2173); try instance.map.put(0x2164, 0x2174); try instance.map.put(0x2165, 0x2175); try instance.map.put(0x2166, 0x2176); try instance.map.put(0x2167, 0x2177); try instance.map.put(0x2168, 0x2178); try instance.map.put(0x2169, 0x2179); try instance.map.put(0x216A, 0x217A); try instance.map.put(0x216B, 0x217B); try instance.map.put(0x216C, 0x217C); try instance.map.put(0x216D, 0x217D); try instance.map.put(0x216E, 0x217E); try instance.map.put(0x216F, 0x217F); try instance.map.put(0x2183, 0x2184); try instance.map.put(0x24B6, 0x24D0); try instance.map.put(0x24B7, 0x24D1); try instance.map.put(0x24B8, 0x24D2); try instance.map.put(0x24B9, 0x24D3); try instance.map.put(0x24BA, 0x24D4); try instance.map.put(0x24BB, 0x24D5); try instance.map.put(0x24BC, 0x24D6); try instance.map.put(0x24BD, 0x24D7); try instance.map.put(0x24BE, 0x24D8); try instance.map.put(0x24BF, 0x24D9); try instance.map.put(0x24C0, 0x24DA); try instance.map.put(0x24C1, 0x24DB); try instance.map.put(0x24C2, 0x24DC); try instance.map.put(0x24C3, 0x24DD); try instance.map.put(0x24C4, 0x24DE); try instance.map.put(0x24C5, 0x24DF); try instance.map.put(0x24C6, 0x24E0); try instance.map.put(0x24C7, 0x24E1); try instance.map.put(0x24C8, 0x24E2); try instance.map.put(0x24C9, 0x24E3); try instance.map.put(0x24CA, 0x24E4); try instance.map.put(0x24CB, 0x24E5); try instance.map.put(0x24CC, 0x24E6); try instance.map.put(0x24CD, 0x24E7); try instance.map.put(0x24CE, 0x24E8); try instance.map.put(0x24CF, 0x24E9); try instance.map.put(0x2C00, 0x2C30); try instance.map.put(0x2C01, 0x2C31); try instance.map.put(0x2C02, 0x2C32); try instance.map.put(0x2C03, 0x2C33); try instance.map.put(0x2C04, 0x2C34); try instance.map.put(0x2C05, 0x2C35); try instance.map.put(0x2C06, 0x2C36); try instance.map.put(0x2C07, 0x2C37); try instance.map.put(0x2C08, 0x2C38); try instance.map.put(0x2C09, 0x2C39); try instance.map.put(0x2C0A, 0x2C3A); try instance.map.put(0x2C0B, 0x2C3B); try instance.map.put(0x2C0C, 0x2C3C); try instance.map.put(0x2C0D, 0x2C3D); try instance.map.put(0x2C0E, 0x2C3E); try instance.map.put(0x2C0F, 0x2C3F); try instance.map.put(0x2C10, 0x2C40); try instance.map.put(0x2C11, 0x2C41); try instance.map.put(0x2C12, 0x2C42); try instance.map.put(0x2C13, 0x2C43); try instance.map.put(0x2C14, 0x2C44); try instance.map.put(0x2C15, 0x2C45); try instance.map.put(0x2C16, 0x2C46); try instance.map.put(0x2C17, 0x2C47); try instance.map.put(0x2C18, 0x2C48); try instance.map.put(0x2C19, 0x2C49); try instance.map.put(0x2C1A, 0x2C4A); try instance.map.put(0x2C1B, 0x2C4B); try instance.map.put(0x2C1C, 0x2C4C); try instance.map.put(0x2C1D, 0x2C4D); try instance.map.put(0x2C1E, 0x2C4E); try instance.map.put(0x2C1F, 0x2C4F); try instance.map.put(0x2C20, 0x2C50); try instance.map.put(0x2C21, 0x2C51); try instance.map.put(0x2C22, 0x2C52); try instance.map.put(0x2C23, 0x2C53); try instance.map.put(0x2C24, 0x2C54); try instance.map.put(0x2C25, 0x2C55); try instance.map.put(0x2C26, 0x2C56); try instance.map.put(0x2C27, 0x2C57); try instance.map.put(0x2C28, 0x2C58); try instance.map.put(0x2C29, 0x2C59); try instance.map.put(0x2C2A, 0x2C5A); try instance.map.put(0x2C2B, 0x2C5B); try instance.map.put(0x2C2C, 0x2C5C); try instance.map.put(0x2C2D, 0x2C5D); try instance.map.put(0x2C2E, 0x2C5E); try instance.map.put(0x2C60, 0x2C61); try instance.map.put(0x2C62, 0x026B); try instance.map.put(0x2C63, 0x1D7D); try instance.map.put(0x2C64, 0x027D); try instance.map.put(0x2C67, 0x2C68); try instance.map.put(0x2C69, 0x2C6A); try instance.map.put(0x2C6B, 0x2C6C); try instance.map.put(0x2C6D, 0x0251); try instance.map.put(0x2C6E, 0x0271); try instance.map.put(0x2C6F, 0x0250); try instance.map.put(0x2C70, 0x0252); try instance.map.put(0x2C72, 0x2C73); try instance.map.put(0x2C75, 0x2C76); try instance.map.put(0x2C7E, 0x023F); try instance.map.put(0x2C7F, 0x0240); try instance.map.put(0x2C80, 0x2C81); try instance.map.put(0x2C82, 0x2C83); try instance.map.put(0x2C84, 0x2C85); try instance.map.put(0x2C86, 0x2C87); try instance.map.put(0x2C88, 0x2C89); try instance.map.put(0x2C8A, 0x2C8B); try instance.map.put(0x2C8C, 0x2C8D); try instance.map.put(0x2C8E, 0x2C8F); try instance.map.put(0x2C90, 0x2C91); try instance.map.put(0x2C92, 0x2C93); try instance.map.put(0x2C94, 0x2C95); try instance.map.put(0x2C96, 0x2C97); try instance.map.put(0x2C98, 0x2C99); try instance.map.put(0x2C9A, 0x2C9B); try instance.map.put(0x2C9C, 0x2C9D); try instance.map.put(0x2C9E, 0x2C9F); try instance.map.put(0x2CA0, 0x2CA1); try instance.map.put(0x2CA2, 0x2CA3); try instance.map.put(0x2CA4, 0x2CA5); try instance.map.put(0x2CA6, 0x2CA7); try instance.map.put(0x2CA8, 0x2CA9); try instance.map.put(0x2CAA, 0x2CAB); try instance.map.put(0x2CAC, 0x2CAD); try instance.map.put(0x2CAE, 0x2CAF); try instance.map.put(0x2CB0, 0x2CB1); try instance.map.put(0x2CB2, 0x2CB3); try instance.map.put(0x2CB4, 0x2CB5); try instance.map.put(0x2CB6, 0x2CB7); try instance.map.put(0x2CB8, 0x2CB9); try instance.map.put(0x2CBA, 0x2CBB); try instance.map.put(0x2CBC, 0x2CBD); try instance.map.put(0x2CBE, 0x2CBF); try instance.map.put(0x2CC0, 0x2CC1); try instance.map.put(0x2CC2, 0x2CC3); try instance.map.put(0x2CC4, 0x2CC5); try instance.map.put(0x2CC6, 0x2CC7); try instance.map.put(0x2CC8, 0x2CC9); try instance.map.put(0x2CCA, 0x2CCB); try instance.map.put(0x2CCC, 0x2CCD); try instance.map.put(0x2CCE, 0x2CCF); try instance.map.put(0x2CD0, 0x2CD1); try instance.map.put(0x2CD2, 0x2CD3); try instance.map.put(0x2CD4, 0x2CD5); try instance.map.put(0x2CD6, 0x2CD7); try instance.map.put(0x2CD8, 0x2CD9); try instance.map.put(0x2CDA, 0x2CDB); try instance.map.put(0x2CDC, 0x2CDD); try instance.map.put(0x2CDE, 0x2CDF); try instance.map.put(0x2CE0, 0x2CE1); try instance.map.put(0x2CE2, 0x2CE3); try instance.map.put(0x2CEB, 0x2CEC); try instance.map.put(0x2CED, 0x2CEE); try instance.map.put(0x2CF2, 0x2CF3); try instance.map.put(0xA640, 0xA641); try instance.map.put(0xA642, 0xA643); try instance.map.put(0xA644, 0xA645); try instance.map.put(0xA646, 0xA647); try instance.map.put(0xA648, 0xA649); try instance.map.put(0xA64A, 0xA64B); try instance.map.put(0xA64C, 0xA64D); try instance.map.put(0xA64E, 0xA64F); try instance.map.put(0xA650, 0xA651); try instance.map.put(0xA652, 0xA653); try instance.map.put(0xA654, 0xA655); try instance.map.put(0xA656, 0xA657); try instance.map.put(0xA658, 0xA659); try instance.map.put(0xA65A, 0xA65B); try instance.map.put(0xA65C, 0xA65D); try instance.map.put(0xA65E, 0xA65F); try instance.map.put(0xA660, 0xA661); try instance.map.put(0xA662, 0xA663); try instance.map.put(0xA664, 0xA665); try instance.map.put(0xA666, 0xA667); try instance.map.put(0xA668, 0xA669); try instance.map.put(0xA66A, 0xA66B); try instance.map.put(0xA66C, 0xA66D); try instance.map.put(0xA680, 0xA681); try instance.map.put(0xA682, 0xA683); try instance.map.put(0xA684, 0xA685); try instance.map.put(0xA686, 0xA687); try instance.map.put(0xA688, 0xA689); try instance.map.put(0xA68A, 0xA68B); try instance.map.put(0xA68C, 0xA68D); try instance.map.put(0xA68E, 0xA68F); try instance.map.put(0xA690, 0xA691); try instance.map.put(0xA692, 0xA693); try instance.map.put(0xA694, 0xA695); try instance.map.put(0xA696, 0xA697); try instance.map.put(0xA698, 0xA699); try instance.map.put(0xA69A, 0xA69B); try instance.map.put(0xA722, 0xA723); try instance.map.put(0xA724, 0xA725); try instance.map.put(0xA726, 0xA727); try instance.map.put(0xA728, 0xA729); try instance.map.put(0xA72A, 0xA72B); try instance.map.put(0xA72C, 0xA72D); try instance.map.put(0xA72E, 0xA72F); try instance.map.put(0xA732, 0xA733); try instance.map.put(0xA734, 0xA735); try instance.map.put(0xA736, 0xA737); try instance.map.put(0xA738, 0xA739); try instance.map.put(0xA73A, 0xA73B); try instance.map.put(0xA73C, 0xA73D); try instance.map.put(0xA73E, 0xA73F); try instance.map.put(0xA740, 0xA741); try instance.map.put(0xA742, 0xA743); try instance.map.put(0xA744, 0xA745); try instance.map.put(0xA746, 0xA747); try instance.map.put(0xA748, 0xA749); try instance.map.put(0xA74A, 0xA74B); try instance.map.put(0xA74C, 0xA74D); try instance.map.put(0xA74E, 0xA74F); try instance.map.put(0xA750, 0xA751); try instance.map.put(0xA752, 0xA753); try instance.map.put(0xA754, 0xA755); try instance.map.put(0xA756, 0xA757); try instance.map.put(0xA758, 0xA759); try instance.map.put(0xA75A, 0xA75B); try instance.map.put(0xA75C, 0xA75D); try instance.map.put(0xA75E, 0xA75F); try instance.map.put(0xA760, 0xA761); try instance.map.put(0xA762, 0xA763); try instance.map.put(0xA764, 0xA765); try instance.map.put(0xA766, 0xA767); try instance.map.put(0xA768, 0xA769); try instance.map.put(0xA76A, 0xA76B); try instance.map.put(0xA76C, 0xA76D); try instance.map.put(0xA76E, 0xA76F); try instance.map.put(0xA779, 0xA77A); try instance.map.put(0xA77B, 0xA77C); try instance.map.put(0xA77D, 0x1D79); try instance.map.put(0xA77E, 0xA77F); try instance.map.put(0xA780, 0xA781); try instance.map.put(0xA782, 0xA783); try instance.map.put(0xA784, 0xA785); try instance.map.put(0xA786, 0xA787); try instance.map.put(0xA78B, 0xA78C); try instance.map.put(0xA78D, 0x0265); try instance.map.put(0xA790, 0xA791); try instance.map.put(0xA792, 0xA793); try instance.map.put(0xA796, 0xA797); try instance.map.put(0xA798, 0xA799); try instance.map.put(0xA79A, 0xA79B); try instance.map.put(0xA79C, 0xA79D); try instance.map.put(0xA79E, 0xA79F); try instance.map.put(0xA7A0, 0xA7A1); try instance.map.put(0xA7A2, 0xA7A3); try instance.map.put(0xA7A4, 0xA7A5); try instance.map.put(0xA7A6, 0xA7A7); try instance.map.put(0xA7A8, 0xA7A9); try instance.map.put(0xA7AA, 0x0266); try instance.map.put(0xA7AB, 0x025C); try instance.map.put(0xA7AC, 0x0261); try instance.map.put(0xA7AD, 0x026C); try instance.map.put(0xA7AE, 0x026A); try instance.map.put(0xA7B0, 0x029E); try instance.map.put(0xA7B1, 0x0287); try instance.map.put(0xA7B2, 0x029D); try instance.map.put(0xA7B3, 0xAB53); try instance.map.put(0xA7B4, 0xA7B5); try instance.map.put(0xA7B6, 0xA7B7); try instance.map.put(0xA7B8, 0xA7B9); try instance.map.put(0xA7BA, 0xA7BB); try instance.map.put(0xA7BC, 0xA7BD); try instance.map.put(0xA7BE, 0xA7BF); try instance.map.put(0xA7C2, 0xA7C3); try instance.map.put(0xA7C4, 0xA794); try instance.map.put(0xA7C5, 0x0282); try instance.map.put(0xA7C6, 0x1D8E); try instance.map.put(0xA7C7, 0xA7C8); try instance.map.put(0xA7C9, 0xA7CA); try instance.map.put(0xA7F5, 0xA7F6); try instance.map.put(0xFF21, 0xFF41); try instance.map.put(0xFF22, 0xFF42); try instance.map.put(0xFF23, 0xFF43); try instance.map.put(0xFF24, 0xFF44); try instance.map.put(0xFF25, 0xFF45); try instance.map.put(0xFF26, 0xFF46); try instance.map.put(0xFF27, 0xFF47); try instance.map.put(0xFF28, 0xFF48); try instance.map.put(0xFF29, 0xFF49); try instance.map.put(0xFF2A, 0xFF4A); try instance.map.put(0xFF2B, 0xFF4B); try instance.map.put(0xFF2C, 0xFF4C); try instance.map.put(0xFF2D, 0xFF4D); try instance.map.put(0xFF2E, 0xFF4E); try instance.map.put(0xFF2F, 0xFF4F); try instance.map.put(0xFF30, 0xFF50); try instance.map.put(0xFF31, 0xFF51); try instance.map.put(0xFF32, 0xFF52); try instance.map.put(0xFF33, 0xFF53); try instance.map.put(0xFF34, 0xFF54); try instance.map.put(0xFF35, 0xFF55); try instance.map.put(0xFF36, 0xFF56); try instance.map.put(0xFF37, 0xFF57); try instance.map.put(0xFF38, 0xFF58); try instance.map.put(0xFF39, 0xFF59); try instance.map.put(0xFF3A, 0xFF5A); try instance.map.put(0x10400, 0x10428); try instance.map.put(0x10401, 0x10429); try instance.map.put(0x10402, 0x1042A); try instance.map.put(0x10403, 0x1042B); try instance.map.put(0x10404, 0x1042C); try instance.map.put(0x10405, 0x1042D); try instance.map.put(0x10406, 0x1042E); try instance.map.put(0x10407, 0x1042F); try instance.map.put(0x10408, 0x10430); try instance.map.put(0x10409, 0x10431); try instance.map.put(0x1040A, 0x10432); try instance.map.put(0x1040B, 0x10433); try instance.map.put(0x1040C, 0x10434); try instance.map.put(0x1040D, 0x10435); try instance.map.put(0x1040E, 0x10436); try instance.map.put(0x1040F, 0x10437); try instance.map.put(0x10410, 0x10438); try instance.map.put(0x10411, 0x10439); try instance.map.put(0x10412, 0x1043A); try instance.map.put(0x10413, 0x1043B); try instance.map.put(0x10414, 0x1043C); try instance.map.put(0x10415, 0x1043D); try instance.map.put(0x10416, 0x1043E); try instance.map.put(0x10417, 0x1043F); try instance.map.put(0x10418, 0x10440); try instance.map.put(0x10419, 0x10441); try instance.map.put(0x1041A, 0x10442); try instance.map.put(0x1041B, 0x10443); try instance.map.put(0x1041C, 0x10444); try instance.map.put(0x1041D, 0x10445); try instance.map.put(0x1041E, 0x10446); try instance.map.put(0x1041F, 0x10447); try instance.map.put(0x10420, 0x10448); try instance.map.put(0x10421, 0x10449); try instance.map.put(0x10422, 0x1044A); try instance.map.put(0x10423, 0x1044B); try instance.map.put(0x10424, 0x1044C); try instance.map.put(0x10425, 0x1044D); try instance.map.put(0x10426, 0x1044E); try instance.map.put(0x10427, 0x1044F); try instance.map.put(0x104B0, 0x104D8); try instance.map.put(0x104B1, 0x104D9); try instance.map.put(0x104B2, 0x104DA); try instance.map.put(0x104B3, 0x104DB); try instance.map.put(0x104B4, 0x104DC); try instance.map.put(0x104B5, 0x104DD); try instance.map.put(0x104B6, 0x104DE); try instance.map.put(0x104B7, 0x104DF); try instance.map.put(0x104B8, 0x104E0); try instance.map.put(0x104B9, 0x104E1); try instance.map.put(0x104BA, 0x104E2); try instance.map.put(0x104BB, 0x104E3); try instance.map.put(0x104BC, 0x104E4); try instance.map.put(0x104BD, 0x104E5); try instance.map.put(0x104BE, 0x104E6); try instance.map.put(0x104BF, 0x104E7); try instance.map.put(0x104C0, 0x104E8); try instance.map.put(0x104C1, 0x104E9); try instance.map.put(0x104C2, 0x104EA); try instance.map.put(0x104C3, 0x104EB); try instance.map.put(0x104C4, 0x104EC); try instance.map.put(0x104C5, 0x104ED); try instance.map.put(0x104C6, 0x104EE); try instance.map.put(0x104C7, 0x104EF); try instance.map.put(0x104C8, 0x104F0); try instance.map.put(0x104C9, 0x104F1); try instance.map.put(0x104CA, 0x104F2); try instance.map.put(0x104CB, 0x104F3); try instance.map.put(0x104CC, 0x104F4); try instance.map.put(0x104CD, 0x104F5); try instance.map.put(0x104CE, 0x104F6); try instance.map.put(0x104CF, 0x104F7); try instance.map.put(0x104D0, 0x104F8); try instance.map.put(0x104D1, 0x104F9); try instance.map.put(0x104D2, 0x104FA); try instance.map.put(0x104D3, 0x104FB); try instance.map.put(0x10C80, 0x10CC0); try instance.map.put(0x10C81, 0x10CC1); try instance.map.put(0x10C82, 0x10CC2); try instance.map.put(0x10C83, 0x10CC3); try instance.map.put(0x10C84, 0x10CC4); try instance.map.put(0x10C85, 0x10CC5); try instance.map.put(0x10C86, 0x10CC6); try instance.map.put(0x10C87, 0x10CC7); try instance.map.put(0x10C88, 0x10CC8); try instance.map.put(0x10C89, 0x10CC9); try instance.map.put(0x10C8A, 0x10CCA); try instance.map.put(0x10C8B, 0x10CCB); try instance.map.put(0x10C8C, 0x10CCC); try instance.map.put(0x10C8D, 0x10CCD); try instance.map.put(0x10C8E, 0x10CCE); try instance.map.put(0x10C8F, 0x10CCF); try instance.map.put(0x10C90, 0x10CD0); try instance.map.put(0x10C91, 0x10CD1); try instance.map.put(0x10C92, 0x10CD2); try instance.map.put(0x10C93, 0x10CD3); try instance.map.put(0x10C94, 0x10CD4); try instance.map.put(0x10C95, 0x10CD5); try instance.map.put(0x10C96, 0x10CD6); try instance.map.put(0x10C97, 0x10CD7); try instance.map.put(0x10C98, 0x10CD8); try instance.map.put(0x10C99, 0x10CD9); try instance.map.put(0x10C9A, 0x10CDA); try instance.map.put(0x10C9B, 0x10CDB); try instance.map.put(0x10C9C, 0x10CDC); try instance.map.put(0x10C9D, 0x10CDD); try instance.map.put(0x10C9E, 0x10CDE); try instance.map.put(0x10C9F, 0x10CDF); try instance.map.put(0x10CA0, 0x10CE0); try instance.map.put(0x10CA1, 0x10CE1); try instance.map.put(0x10CA2, 0x10CE2); try instance.map.put(0x10CA3, 0x10CE3); try instance.map.put(0x10CA4, 0x10CE4); try instance.map.put(0x10CA5, 0x10CE5); try instance.map.put(0x10CA6, 0x10CE6); try instance.map.put(0x10CA7, 0x10CE7); try instance.map.put(0x10CA8, 0x10CE8); try instance.map.put(0x10CA9, 0x10CE9); try instance.map.put(0x10CAA, 0x10CEA); try instance.map.put(0x10CAB, 0x10CEB); try instance.map.put(0x10CAC, 0x10CEC); try instance.map.put(0x10CAD, 0x10CED); try instance.map.put(0x10CAE, 0x10CEE); try instance.map.put(0x10CAF, 0x10CEF); try instance.map.put(0x10CB0, 0x10CF0); try instance.map.put(0x10CB1, 0x10CF1); try instance.map.put(0x10CB2, 0x10CF2); try instance.map.put(0x118A0, 0x118C0); try instance.map.put(0x118A1, 0x118C1); try instance.map.put(0x118A2, 0x118C2); try instance.map.put(0x118A3, 0x118C3); try instance.map.put(0x118A4, 0x118C4); try instance.map.put(0x118A5, 0x118C5); try instance.map.put(0x118A6, 0x118C6); try instance.map.put(0x118A7, 0x118C7); try instance.map.put(0x118A8, 0x118C8); try instance.map.put(0x118A9, 0x118C9); try instance.map.put(0x118AA, 0x118CA); try instance.map.put(0x118AB, 0x118CB); try instance.map.put(0x118AC, 0x118CC); try instance.map.put(0x118AD, 0x118CD); try instance.map.put(0x118AE, 0x118CE); try instance.map.put(0x118AF, 0x118CF); try instance.map.put(0x118B0, 0x118D0); try instance.map.put(0x118B1, 0x118D1); try instance.map.put(0x118B2, 0x118D2); try instance.map.put(0x118B3, 0x118D3); try instance.map.put(0x118B4, 0x118D4); try instance.map.put(0x118B5, 0x118D5); try instance.map.put(0x118B6, 0x118D6); try instance.map.put(0x118B7, 0x118D7); try instance.map.put(0x118B8, 0x118D8); try instance.map.put(0x118B9, 0x118D9); try instance.map.put(0x118BA, 0x118DA); try instance.map.put(0x118BB, 0x118DB); try instance.map.put(0x118BC, 0x118DC); try instance.map.put(0x118BD, 0x118DD); try instance.map.put(0x118BE, 0x118DE); try instance.map.put(0x118BF, 0x118DF); try instance.map.put(0x16E40, 0x16E60); try instance.map.put(0x16E41, 0x16E61); try instance.map.put(0x16E42, 0x16E62); try instance.map.put(0x16E43, 0x16E63); try instance.map.put(0x16E44, 0x16E64); try instance.map.put(0x16E45, 0x16E65); try instance.map.put(0x16E46, 0x16E66); try instance.map.put(0x16E47, 0x16E67); try instance.map.put(0x16E48, 0x16E68); try instance.map.put(0x16E49, 0x16E69); try instance.map.put(0x16E4A, 0x16E6A); try instance.map.put(0x16E4B, 0x16E6B); try instance.map.put(0x16E4C, 0x16E6C); try instance.map.put(0x16E4D, 0x16E6D); try instance.map.put(0x16E4E, 0x16E6E); try instance.map.put(0x16E4F, 0x16E6F); try instance.map.put(0x16E50, 0x16E70); try instance.map.put(0x16E51, 0x16E71); try instance.map.put(0x16E52, 0x16E72); try instance.map.put(0x16E53, 0x16E73); try instance.map.put(0x16E54, 0x16E74); try instance.map.put(0x16E55, 0x16E75); try instance.map.put(0x16E56, 0x16E76); try instance.map.put(0x16E57, 0x16E77); try instance.map.put(0x16E58, 0x16E78); try instance.map.put(0x16E59, 0x16E79); try instance.map.put(0x16E5A, 0x16E7A); try instance.map.put(0x16E5B, 0x16E7B); try instance.map.put(0x16E5C, 0x16E7C); try instance.map.put(0x16E5D, 0x16E7D); try instance.map.put(0x16E5E, 0x16E7E); try instance.map.put(0x16E5F, 0x16E7F); try instance.map.put(0x1E900, 0x1E922); try instance.map.put(0x1E901, 0x1E923); try instance.map.put(0x1E902, 0x1E924); try instance.map.put(0x1E903, 0x1E925); try instance.map.put(0x1E904, 0x1E926); try instance.map.put(0x1E905, 0x1E927); try instance.map.put(0x1E906, 0x1E928); try instance.map.put(0x1E907, 0x1E929); try instance.map.put(0x1E908, 0x1E92A); try instance.map.put(0x1E909, 0x1E92B); try instance.map.put(0x1E90A, 0x1E92C); try instance.map.put(0x1E90B, 0x1E92D); try instance.map.put(0x1E90C, 0x1E92E); try instance.map.put(0x1E90D, 0x1E92F); try instance.map.put(0x1E90E, 0x1E930); try instance.map.put(0x1E90F, 0x1E931); try instance.map.put(0x1E910, 0x1E932); try instance.map.put(0x1E911, 0x1E933); try instance.map.put(0x1E912, 0x1E934); try instance.map.put(0x1E913, 0x1E935); try instance.map.put(0x1E914, 0x1E936); try instance.map.put(0x1E915, 0x1E937); try instance.map.put(0x1E916, 0x1E938); try instance.map.put(0x1E917, 0x1E939); try instance.map.put(0x1E918, 0x1E93A); try instance.map.put(0x1E919, 0x1E93B); try instance.map.put(0x1E91A, 0x1E93C); try instance.map.put(0x1E91B, 0x1E93D); try instance.map.put(0x1E91C, 0x1E93E); try instance.map.put(0x1E91D, 0x1E93F); try instance.map.put(0x1E91E, 0x1E940); try instance.map.put(0x1E91F, 0x1E941); try instance.map.put(0x1E920, 0x1E942); try instance.map.put(0x1E921, 0x1E943); // Placeholder: 0. Method suffix, 1. Struct name return instance; } pub fn deinit(self: *LowerMap) void { self.map.deinit(); } /// toLower maps the code point to the desired case or returns the same code point if no mapping exists. pub fn toLower(self: LowerMap, cp: u21) u21 { return if (self.map.get(cp)) |mcp| mcp else cp; }
src/components/autogen/UnicodeData/LowerMap.zig
const std = @import("std"); const print = std.debug.print; pub fn main() anyerror!void { const allocator = std.heap.page_allocator; var file = try std.fs.cwd().openFile( "./inputs/day03.txt", .{ .read = true, }, ); try part1(allocator, file); try file.seekTo(0); try part2(allocator, file); } fn part1(allocator: *std.mem.Allocator, file: std.fs.File) anyerror!void { var buffer: [1024]u8 = undefined; var bytes = try file.read(&buffer); const Pos = struct { x: i32, y: i32 }; var houses = std.AutoHashMap(Pos, usize).init(allocator); defer houses.deinit(); var santa = Pos{ .x = 0, .y = 0 }; while (bytes > 0) { for (buffer[0..bytes]) |c| { switch (c) { '>' => santa.x += 1, '<' => santa.x -= 1, '^' => santa.y += 1, 'v' => santa.y -= 1, '\n' => break, else => @panic("Unexpected"), } var entry = try houses.getOrPutValue(santa, 0); entry.value_ptr.* += 1; } bytes = try file.read(&buffer); } print("Number of houses: {d}\n", .{houses.count()}); } fn part2(allocator: *std.mem.Allocator, file: std.fs.File) anyerror!void { var buffer: [1024]u8 = undefined; var bytes = try file.read(&buffer); const Pos = struct { x: i32, y: i32 }; var houses = std.AutoHashMap(Pos, usize).init(allocator); defer houses.deinit(); var santas = [2]Pos{ .{ .x = 0, .y = 0 }, .{ .x = 0, .y = 0 }, }; var current_santa: usize = 0; while (bytes > 0) { for (buffer[0..bytes]) |c| { switch (c) { '>' => santas[current_santa].x += 1, '<' => santas[current_santa].x -= 1, '^' => santas[current_santa].y += 1, 'v' => santas[current_santa].y -= 1, '\n' => break, else => @panic("Unexpected"), } var entry = try houses.getOrPutValue(santas[current_santa], 0); entry.value_ptr.* += 1; current_santa ^= 1; } bytes = try file.read(&buffer); } print("Number of houses with robot santa: {d}\n", .{houses.count()}); }
src/day03.zig
const std = @import("std"); const math = @import("std").math; const Mat2 = @import("mat2.zig").Mat2; const f_eq = @import("utils.zig").f_eq; pub const Vec2 = packed struct { x: f32, y: f32, pub fn create(x: f32, y: f32) Vec2 { return Vec2{ .x = x, .y = y }; } test "create" { const vecA = Vec2.create(1, 2); try std.testing.expect(f_eq(vecA.x, 1)); try std.testing.expect(f_eq(vecA.y, 2)); } /// Adds two vec2 pub fn add(a: Vec2, b: Vec2) Vec2 { return Vec2{ .x = a.x + b.x, .y = a.y + b.y, }; } test "add" { const vecA = Vec2.create(1, 2); const vecB = Vec2.create(3, 4); const out = vecA.add(vecB); const expected = Vec2.create(4, 6); try Vec2.expectEqual(out, expected); } /// substracts vec2 b from vec2 a pub fn substract(a: Vec2, b: Vec2) Vec2 { return Vec2{ .x = a.x - b.x, .y = a.y - b.y, }; } test "substract" { const a = Vec2.create(1, 2); const b = Vec2.create(3, 4); const out = a.sub(b); const expected = Vec2.create(-2, -2); try Vec2.expectEqual(out, expected); } /// Multiplies two vec2 pub fn multiply(a: Vec2, b: Vec2) Vec2 { return Vec2{ .x = a.x * b.x, .y = a.y * b.y, }; } test "multiply" { const a = Vec2.create(1, 2); const b = Vec2.create(3, 4); const out = a.mul(b); const expected = Vec2.create(3, 8); try Vec2.expectEqual(out, expected); } /// Divides two vec2 pub fn divide(a: Vec2, b: Vec2) Vec2 { return Vec2{ .x = a.x / b.x, .y = a.y / b.y, }; } test "divide" { const a = Vec2.create(1, 2); const b = Vec2.create(3, 4); const out = a.div(b); const expected = Vec2.create(0.3333333, 0.5); try Vec2.expectEqual(out, expected); } /// ceil the components pub fn ceil(a: Vec2) Vec2 { return Vec2{ .x = @ceil(a.x), .y = @ceil(a.y), }; } test "ceil" { const a = Vec2.create(math.e, math.pi); const out = a.ceil(); const expected = Vec2.create(3, 4); try Vec2.expectEqual(out, expected); } /// floor the components pub fn floor(a: Vec2) Vec2 { return Vec2{ .x = @floor(a.x), .y = @floor(a.y), }; } test "floor" { const a = Vec2.create(math.e, math.pi); const out = a.floor(); const expected = Vec2.create(2, 3); try Vec2.expectEqual(out, expected); } /// Returns the minimum of two vec2 pub fn min(a: Vec2, b: Vec2) Vec2 { return Vec2{ .x = math.min(a.x, b.x), .y = math.min(a.y, b.y), }; } test "min" { const a = Vec2.create(1, 4); const b = Vec2.create(3, 2); const out = a.min(b); const expected = Vec2.create(1, 2); try Vec2.expectEqual(out, expected); } /// Returns the maximum of two vec2 pub fn max(a: Vec2, b: Vec2) Vec2 { return Vec2{ .x = math.max(a.x, b.x), .y = math.max(a.y, b.y), }; } test "max" { const a = Vec2.create(1, 4); const b = Vec2.create(3, 2); const out = a.max(b); const expected = Vec2.create(3, 4); try Vec2.expectEqual(out, expected); } /// round the components of a vec pub fn round(a: Vec2) Vec2 { return Vec2{ .x = @round(a.x), .y = @round(a.y), }; } test "round" { const a = Vec2.create(math.e, math.pi); const out = a.round(); const expected = Vec2.create(3, 3); try Vec2.expectEqual(out, expected); } /// Scales a Vec2 by a scalar number pub fn scale(a: Vec2, b: f32) Vec2 { return Vec2{ .x = a.x * b, .y = a.y * b, }; } test "scale" { const a = Vec2.create(1, 2); const out = a.scale(2); const expected = Vec2.create(2, 4); try Vec2.expectEqual(out, expected); } /// Adds two vec2's after scaling the second operand by a scalar value pub fn scaleAndAdd(a: Vec2, b: Vec2, s: f32) Vec2 { return Vec2{ .x = a.x + (b.x * s), .y = a.y + (b.y * s), }; } test "scaleAndAdd" { const a = Vec2.create(1, 2); const b = Vec2.create(3, 4); const out = Vec2.scaleAndAdd(a, b, 0.5); const expected = Vec2.create(2.5, 4); try Vec2.expectEqual(out, expected); } /// Calculates the euclidian distance between two vec2 pub fn distance(a: Vec2, b: Vec2) f32 { return math.hypot(f32, b.x - a.x, b.y - a.y); } test "distance" { const a = Vec2.create(1, 2); const b = Vec2.create(3, 4); const out = a.distance(b); try std.testing.expectEqual(out, 2.828427); } /// Calculates the squared euclidian distance between two vec2's pub fn squaredDistance(a: Vec2, b: Vec2) f32 { const dx = b.x - a.x; const dy = b.y - a.y; return dx * dx + dy * dy; } test "squaredDistance" { const a = Vec2.create(1, 2); const b = Vec2.create(3, 4); const out = a.squaredDistance(b); try std.testing.expectEqual(out, 8); } /// Calculates the length of a vec2 pub fn length(a: Vec2) f32 { return math.hypot(f32, a.x, a.y); } test "length" { const a = Vec2.create(1, 2); const out = a.len(); try std.testing.expectEqual(out, 2.23606801); } /// Calculates the squared length of a vec2 pub fn squaredLength(a: Vec2) f32 { return a.x * a.x + a.y * a.y; } test "squaredLength" { const a = Vec2.create(1, 2); const out = a.squaredLength(); try std.testing.expectEqual(out, 5); } /// Negates the components of a vec2 pub fn negate(a: Vec2) Vec2 { return Vec2{ .x = -a.x, .y = -a.y, }; } test "negate" { const a = Vec2.create(1, 2); const out = a.negate(); const expected = Vec2.create(-1, -2); try Vec2.expectEqual(out, expected); } /// Inverse the components of a vec2 pub fn inverse(a: Vec2) Vec2 { return Vec2{ .x = 1 / a.x, .y = 1 / a.y, }; } ///Normalize a Vec2 pub fn normalize(v: Vec2) Vec2 { var l = v.x * v.x + v.y * v.y; if (l > 0) { l = 1 / @sqrt(l); } return Vec2{ .x = v.x * l, .y = v.y * l, }; } test "normalize" { const a = Vec2.create(5, 0); const out = a.normalize(); const expected = Vec2.create(1, 0); try Vec2.expectEqual(out, expected); } ///Calculates the dot product of two Vec2 pub fn dot(v: Vec2, other: Vec2) f32 { return v.x * other.x + v.y * other.y; } test "dot" { const a = Vec2.create(1, 2); const b = Vec2.create(3, 4); const out = Vec2.dot(a, b); try std.testing.expectEqual(out, 11); } /// Returns the cross product pub fn cross(v: Vec2, other: Vec2) f32 { return v.x * other.y - other.x * v.y; } test "cross" { const a = Vec2.create(1, 2); const b = Vec2.create(3, 4); const out = Vec2.cross(a, b); try std.testing.expectEqual(out, -2); } /// Performs a liniear interpolation between two Vec2 pub fn lerp(a: Vec2, b: Vec2, t: f32) Vec2 { return Vec2{ .x = a.x + t * (b.x - a.x), .y = a.y + t * (b.y - a.y), }; } test "lerp" { const a = Vec2.create(1, 2); const b = Vec2.create(3, 4); const out = Vec2.lerp(a, b, 0.5); const expected = Vec2.create(2, 3); try Vec2.expectEqual(out, expected); } /// Transforms the vec2 with a mat2 pub fn transformMat2(a: Vec2, m: Mat2) Vec2 { return Vec2{ .x = m.data[0][0] * a.x + m.data[1][0] * a.y, .y = m.data[0][1] * a.x + m.data[1][1] * a.y, }; } test "transformMat2" { const matA = Mat2.create(1, 2, 3, 4); const a = Vec2.create(1, 2); const out = a.transformMat2(matA); const expected = Vec2.create(7, 10); try Vec2.expectEqual(out, expected); } /// Rotate a 2D vector pub fn rotate(a: Vec2, origin: Vec2, rad: f32) Vec2 { const p0 = a.x - origin.x; const p1 = a.y - origin.y; const sin = @sin(rad); const cos = @cos(rad); return Vec2{ .x = p0 * cos - p1 * sin + origin.x, .y = p0 * sin + p1 * cos + origin.y, }; } test "rotate around world origin [0, 0, 0]" { const a = Vec2.create(0, 1); const b = Vec2.create(0, 0); const out = Vec2.rotate(a, b, math.pi); const expected = Vec2.create(0, -1); try Vec2.expectEqual(out, expected); } test "rotate around arbitrary origin" { const a = Vec2.create(6, -5); const b = Vec2.create(0, -5); const out = Vec2.rotate(a, b, math.pi); const expected = Vec2.create(-6, -5); try Vec2.expectEqual(out, expected); } /// Get the angle (rad) between two Vec2 pub fn angle(a: Vec2, b: Vec2) f32 { const x1 = a.x; const y1 = a.y; const x2 = b.x; const y2 = b.y; var len1 = x1 * x1 + y1 * y1; if (len1 > 0) len1 = 1 / @sqrt(len1); var len2 = x2 * x2 + y2 * y2; if (len2 > 0) len2 = 1 / @sqrt(len2); const cos = (x1 * x2 + y1 * y2) * len1 * len2; if (cos > 1) { return 0; } else if (cos < -1) { return math.pi; } else { return math.acos(cos); } } test "angle" { const a = Vec2.create(1, 0); const b = Vec2.create(1, 2); const out = Vec2.angle(a, b); try std.testing.expect(f_eq(out, 1.10714)); } pub fn equals(a: Vec2, b: Vec2) bool { return f_eq(a.x, b.x) and f_eq(a.y, b.y); } pub fn equalsExact(a: Vec2, b: Vec2) bool { return a.x == b.x and a.y == b.y; } pub const len = length; pub const sub = substract; pub const mul = multiply; pub const div = divide; pub const dist = distance; pub const sqrDist = squaredDistance; pub const sqrLen = squaredLength; pub fn format( value: @This(), comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype, ) !void { _ = options; _ = fmt; return std.fmt.format(writer, "Vec2({d:.3}, {d:.3})", .{ value.x, value.y }); } fn expectEqual(expected: Vec2, actual: Vec2) !void { if (!expected.equals(actual)) { std.debug.warn("Expected: {}, found {}", .{ expected, actual }); return error.NotEqual; } } };
src/vec2.zig
const std = @import("std"); const zs = @import("zstack.zig"); const Piece = zs.Piece; /// We implement this specifically and don't use std.rand, since we want to be able to recreate /// an exact piece sequence from a single seed. The implementation is small and it is easier to /// just rely on a small one we write. /// /// http://burtleburtle.net/bob/rand/smallprng.html pub const Prng = struct { a: u32, b: u32, c: u32, d: u32, pub fn init(s: u32) Prng { var r: Prng = undefined; r.seed(s); return r; } pub fn seed(r: *Prng, s: u32) void { r.a = 0xF1EA5EED; r.b = s; r.c = s; r.d = s; var i: usize = 0; while (i < 20) : (i += 1) { _ = r.next(); } } pub fn next(r: *Prng) u32 { const e = r.a -% std.math.rotl(u32, r.b, u32(27)); r.a = r.b ^ std.math.rotl(u32, r.c, u32(17)); r.b = r.c +% r.d; r.c = r.d +% e; r.d = e +% r.a; return r.d; } pub fn nextRange(r: *Prng, lo: u32, hi: u32) u32 { std.debug.assert(lo <= hi); const range = hi - lo; const rem = std.math.maxInt(u32) % range; var x: u32 = undefined; while (true) { x = r.next(); if (x < std.math.maxInt(u32) - rem) { break; } } return lo + x % range; } pub fn shuffle(r: *Prng, comptime T: type, array: []T) void { if (array.len < 2) return; const len = @intCast(u32, array.len); var i: u32 = 0; while (i < len - 1) : (i += 1) { const j = r.nextRange(i, len); std.mem.swap(T, &array[j], &array[i]); } } }; /// A Randomizer produces an infinite sequence of pieces. The method with which these pieces /// are chosen differs between the randomizers, and they have different behavior during play. pub const Randomizer = union(enum) { pub const Id = enum { memoryless, nes, tgm1, tgm2, tgm3, bag7, bag7seamcheck, bag6, multibag2, multibag4, multibag9, }; Memoryless: MemorylessRandomizer, Nes: NesRandomizer, Bag: BagRandomizer, MultiBag: MultiBagRandomizer, Tgm4Bag: Tgm4BagRandomizer, Tgm35Bag: Tgm35BagRandomizer, pub fn init(id: Id, seed: u32) Randomizer { return switch (id) { .memoryless => Randomizer{ .Memoryless = MemorylessRandomizer.init(seed) }, .nes => Randomizer{ .Nes = NesRandomizer.init(seed) }, .tgm1 => Randomizer{ .Tgm4Bag = Tgm4BagRandomizer.init(seed, 4) }, .tgm2 => Randomizer{ .Tgm4Bag = Tgm4BagRandomizer.init(seed, 6) }, .tgm3 => Randomizer{ .Tgm35Bag = Tgm35BagRandomizer.init(seed) }, .bag7 => Randomizer{ .Bag = BagRandomizer.init(seed, 7, false) }, .bag7seamcheck => Randomizer{ .Bag = BagRandomizer.init(seed, 7, true) }, .bag6 => Randomizer{ .Bag = BagRandomizer.init(seed, 6, false) }, .multibag2 => Randomizer{ .MultiBag = MultiBagRandomizer.init(seed, 2) }, .multibag4 => Randomizer{ .MultiBag = MultiBagRandomizer.init(seed, 4) }, .multibag9 => Randomizer{ .MultiBag = MultiBagRandomizer.init(seed, 9) }, }; } /// Returns the underlying prng state used for a randomizer. Useful for reseeding an /// already existing randomizer. pub fn prng(self: *Randomizer) *Prng { // TODO: Could have a struct { prng, Randomizer } and pass the prng through to each // randomizer explicitly. Simplifies the seed process for each randomizer, although // complicates some other things. return switch (self.*) { .Memoryless => |*r| &r.prng, .Nes => |*r| &r.prng, .Bag => |*r| &r.prng, .MultiBag => |*r| &r.prng, .Tgm4Bag => |*r| &r.prng, .Tgm35Bag => |*r| &r.prng, }; } /// Returns the next piece in the sequence. pub fn next(self: *Randomizer) Piece.Id { return switch (self.*) { .Memoryless => |*r| r.next(), .Nes => |*r| r.next(), .Bag => |*r| r.next(), .MultiBag => |*r| r.next(), .Tgm4Bag => |*r| r.next(), .Tgm35Bag => |*r| r.next(), else => unreachable, }; } }; /// Returns a random piece without any knowledge of the past previous pieces. This is very /// susceptible to runs of the same piece and droughts, where an individual piece does not show /// up for a long period. pub const MemorylessRandomizer = struct { const Self = @This(); prng: Prng, pub fn init(s: u32) Self { return Self{ .prng = Prng.init(s) }; } pub fn next(self: *Self) Piece.Id { return Piece.Id.fromInt(self.prng.nextRange(0, Piece.Id.count)); } }; /// Keep a history of the last piece returned. Roll an 8-sided die. If the die lands on the last /// piece or an 8, then roll a a 7-sided die and return the piece, else return the new piece. pub const NesRandomizer = struct { const Self = @This(); prng: Prng, history: Piece.Id, pub fn init(s: u32) Self { return Self{ .prng = Prng.init(s), .history = .S, // be nicer }; } pub fn next(self: *Self) Piece.Id { const roll = self.prng.nextRange(0, Piece.Id.count + 1); const b = blk: { if (roll == Piece.Id.count or Piece.Id.fromInt(roll) == self.history) { break :blk Piece.Id.fromInt(self.prng.nextRange(0, Piece.Id.count)); } else { break :blk Piece.Id.fromInt(roll); } }; self.history = b; return b; } }; /// Put all pieces into a bag and shuffle. Take out pieces from the bag until we have pulled out /// some N, where N < 7 (number of total pieces). Once N pieces have been removed, put all pieces /// back into the bag and repeat. /// /// Optionally, check the seam that occurs between reshuffles. If piece that is removed after /// the bag has just been shuffled is the same as the last that was removed in the last bag, take /// another piece from the bag and put this piece back. pub const BagRandomizer = struct { const Self = @This(); prng: Prng, bag: [Piece.Id.count]Piece.Id, index: usize, length: usize, check_seam: bool, pub fn init(s: u32, length: usize, check_seam: bool) Self { std.debug.assert(length <= Piece.Id.count); var r = Self{ .prng = Prng.init(s), .bag = [_]Piece.Id{ Piece.Id.I, Piece.Id.J, Piece.Id.L, Piece.Id.O, Piece.Id.S, Piece.Id.T, Piece.Id.Z, }, .index = 0, .length = length, .check_seam = check_seam, }; while (true) { r.prng.shuffle(Piece.Id, r.bag[0..]); switch (r.bag[0]) { .S, .Z, .O => {}, else => break, } } return r; } pub fn next(self: *Self) Piece.Id { const b = self.bag[self.index]; self.index += 1; if (self.index == self.length) { self.index = 0; self.prng.shuffle(Piece.Id, self.bag[0..]); // Duplicate across bag seams, swap the head with a random piece in the bag. if (self.check_seam and b == self.bag[0]) { const i = self.prng.nextRange(1, self.bag.len); std.mem.swap(Piece.Id, &self.bag[0], &self.bag[i]); } } return b; } }; /// Similar to a Bag Randomizer but instead of our pool of pieces being 7 (1 of each), add /// multiple numbers of each piece into a larger bag. e.g. 2, 3 of each piece into the same bag. /// Shuffle the set of pieces and remove pieces until the bag is empty, then repeat. pub const MultiBagRandomizer = struct { const max_bag_count = 9; const Self = @This(); prng: Prng, bag: [max_bag_count * Piece.Id.count]Piece.Id, index: usize, bag_count: usize, pub fn init(s: u32, bag_count: usize) Self { std.debug.assert(bag_count <= max_bag_count); var r = Self{ .prng = Prng.init(s), .bag = [_]Piece.Id{ Piece.Id.I, Piece.Id.J, Piece.Id.L, Piece.Id.O, Piece.Id.S, Piece.Id.T, Piece.Id.Z, } ** max_bag_count, .index = 0, .bag_count = bag_count, }; while (true) { r.prng.shuffle(Piece.Id, r.bag[0 .. r.bag_count * Piece.Id.count]); switch (r.bag[0]) { .S, .Z, .O => {}, else => break, } } return r; } pub fn next(self: *Self) Piece.Id { const b = self.bag[self.index]; self.index += 1; if (self.index == self.bag_count * Piece.Id.count) { self.index = 0; self.prng.shuffle(Piece.Id, self.bag[0 .. self.bag_count * Piece.Id.count]); } return b; } }; /// An extension of the NES Randomizer. Keep a history of the last four pieces returned. Choose /// a random piece. If this is in the history, reroll and pick another random piece, rolling up /// to N times. If we exceed N rolls, return the piece, even if it is already in the history. pub const Tgm4BagRandomizer = struct { const Self = @This(); prng: Prng, index: usize, history: [4]Piece.Id, first_roll: bool, number_of_rolls: usize, pub fn init(s: u32, number_of_rolls: usize) Self { return Self{ .prng = Prng.init(s), .index = 0, .history = [_]Piece.Id{ Piece.Id.Z, Piece.Id.Z, Piece.Id.Z, Piece.Id.Z }, .first_roll = true, .number_of_rolls = number_of_rolls, }; } pub fn initTgm2(s: u32, number_of_rolls: usize) Self { return Self{ .prng = Prng.init(s), .index = 0, .history = [_]Piece.Id{ Piece.Id.Z, Piece.Id.S, Piece.Id.S, Piece.Id.Z }, .first_roll = true, .number_of_rolls = number_of_rolls, }; } pub fn next(self: *Self) Piece.Id { var b: Piece.Id = undefined; if (self.first_roll) { self.first_roll = false; b = ([_]Piece.Id{ Piece.Id.J, Piece.Id.I, Piece.Id.L, Piece.Id.T, })[self.prng.nextRange(0, 4)]; } else { var i: usize = 0; while (i < self.number_of_rolls) : (i += 1) { b = Piece.Id.fromInt(self.prng.nextRange(0, Piece.Id.count)); if (b != self.history[0] and b != self.history[1] and b != self.history[2] and b != self.history[3]) { break; } } } self.history[self.index] = b; self.index = (self.index + 1) & 3; return b; } }; /// Similar to the Tgm Randomizer with added drought prevention features. The number of rerolls /// is 6, the same as in TGM2. /// /// Instead of choosing a random piece and rerolling, queue of 35 pieces (5 of each) is used. When /// a piece is removed from the queue, the least recently seen is pushed to the back of the queue. /// /// Also implements a small bug found in the original TGM3 code which results in the queue not /// being updated correctly under certain conditions. pub const Tgm35BagRandomizer = struct { const Self = @This(); prng: Prng, index: usize, history: [4]Piece.Id, bag: [35]Piece.Id, drought_order: [Piece.Id.count]Piece.Id, seen_count_bug: u32, first_roll: bool, pub fn init(s: u32) Self { return Self{ .prng = Prng.init(s), .index = 0, .history = [_]Piece.Id{ Piece.Id.S, Piece.Id.Z, Piece.Id.S, Piece.Id.Z }, .bag = [_]Piece.Id{ Piece.Id.I, Piece.Id.J, Piece.Id.L, Piece.Id.O, Piece.Id.S, Piece.Id.T, Piece.Id.Z, } ** 5, .drought_order = [_]Piece.Id{ Piece.Id.J, Piece.Id.I, Piece.Id.Z, Piece.Id.L, Piece.Id.O, Piece.Id.T, Piece.Id.S, }, .seen_count_bug = 0, .first_roll = true, }; } pub fn next(self: *Self) Piece.Id { var b: Piece.Id = undefined; if (self.first_roll) { self.first_roll = false; b = ([_]Piece.Id{ Piece.Id.J, Piece.Id.I, Piece.Id.L, Piece.Id.T, })[self.prng.nextRange(0, 4)]; } else { var roll: usize = 0; var i: usize = 0; while (roll < 6) : (roll += 1) { i = self.prng.nextRange(0, 35); b = self.bag[i]; if (b != self.history[0] and b != self.history[1] and b != self.history[2] and b != self.history[3]) { break; } if (roll < 5) { // Update bag to bias against current least-common piece self.bag[i] = self.drought_order[0]; } } self.seen_count_bug |= (u32(1) << @enumToInt(b)); // The bag is not updated in the case that every piece has been seen. // A reroll occurs on the piece and we choose the most droughted piece. const bug = roll > 0 and b == self.drought_order[0] and self.seen_count_bug == ((1 << Piece.Id.count) - 1); if (!bug) { self.bag[i] = self.drought_order[0]; } // Put current drought piece to back of drought queue for (self.drought_order[0..]) |d, j| { if (b == d) { var k = j + 1; while (k < Piece.Id.count) : (k += 1) { self.drought_order[k - 1] = self.drought_order[k]; } self.drought_order[Piece.Id.count - 1] = b; break; } } } self.history[self.index] = b; self.index = (self.index + 1) & 3; return b; } };
src/randomizer.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const assert = std.debug.assert; const leb = std.leb; const mem = std.mem; const Module = @import("../Module.zig"); const Decl = Module.Decl; const ir = @import("../ir.zig"); const Inst = ir.Inst; const Type = @import("../type.zig").Type; const Value = @import("../value.zig").Value; const Compilation = @import("../Compilation.zig"); /// Wasm Value, created when generating an instruction const WValue = union(enum) { none: void, /// Index of the local variable local: u32, /// Instruction holding a constant `Value` constant: *Inst, /// Block label block_idx: u32, }; /// Hashmap to store generated `WValue` for each `Inst` pub const ValueTable = std.AutoHashMap(*Inst, WValue); /// Using a given `Type`, returns the corresponding wasm value type fn genValtype(ty: Type) ?u8 { return switch (ty.tag()) { .f32 => 0x7D, .f64 => 0x7C, .u32, .i32 => 0x7F, .u64, .i64 => 0x7E, else => null, }; } /// Code represents the `Code` section of wasm that /// belongs to a function pub const Context = struct { /// Reference to the function declaration the code /// section belongs to decl: *Decl, gpa: *mem.Allocator, /// Table to save `WValue`'s generated by an `Inst` values: ValueTable, /// `bytes` contains the wasm bytecode belonging to the 'code' section. code: ArrayList(u8), /// Contains the generated function type bytecode for the current function /// found in `decl` func_type_data: ArrayList(u8), /// The index the next local generated will have /// NOTE: arguments share the index with locals therefore the first variable /// will have the index that comes after the last argument's index local_index: u32 = 0, /// If codegen fails, an error messages will be allocated and saved in `err_msg` err_msg: *Module.ErrorMsg, const InnerError = error{ OutOfMemory, CodegenFail, }; /// Sets `err_msg` on `Context` and returns `error.CodegenFail` which is caught in link/Wasm.zig fn fail(self: *Context, src: usize, comptime fmt: []const u8, args: anytype) InnerError { self.err_msg = try Module.ErrorMsg.create(self.gpa, .{ .file_scope = self.decl.getFileScope(), .byte_offset = src, }, fmt, args); return error.CodegenFail; } /// Resolves the `WValue` for the given instruction `inst` /// When the given instruction has a `Value`, it returns a constant instead fn resolveInst(self: Context, inst: *Inst) WValue { if (!inst.ty.hasCodeGenBits()) return .none; if (inst.value()) |_| { return WValue{ .constant = inst }; } return self.values.get(inst).?; // Instruction does not dominate all uses! } /// Writes the bytecode depending on the given `WValue` in `val` fn emitWValue(self: *Context, val: WValue) InnerError!void { const writer = self.code.writer(); switch (val) { .none, .block_idx => {}, .local => |idx| { try writer.writeByte(0x20); // local.get try leb.writeULEB128(writer, idx); }, .constant => |inst| try self.emitConstant(inst.castTag(.constant).?), // creates a new constant onto the stack } } fn genFunctype(self: *Context) InnerError!void { const ty = self.decl.typed_value.most_recent.typed_value.ty; const writer = self.func_type_data.writer(); // functype magic try writer.writeByte(0x60); // param types try leb.writeULEB128(writer, @intCast(u32, ty.fnParamLen())); if (ty.fnParamLen() != 0) { const params = try self.gpa.alloc(Type, ty.fnParamLen()); defer self.gpa.free(params); ty.fnParamTypes(params); for (params) |param_type| { const val_type = genValtype(param_type) orelse return self.fail(self.decl.src(), "TODO: Wasm codegen - arg type value for type '{s}'", .{param_type.tag()}); try writer.writeByte(val_type); } } // return type const return_type = ty.fnReturnType(); switch (return_type.tag()) { .void, .noreturn => try leb.writeULEB128(writer, @as(u32, 0)), else => |ret_type| { try leb.writeULEB128(writer, @as(u32, 1)); const val_type = genValtype(return_type) orelse return self.fail(self.decl.src(), "TODO: Wasm codegen - return type value for type '{s}'", .{ret_type}); try writer.writeByte(val_type); }, } } /// Generates the wasm bytecode for the function declaration belonging to `Context` pub fn gen(self: *Context) InnerError!void { assert(self.code.items.len == 0); try self.genFunctype(); const writer = self.code.writer(); // Reserve space to write the size after generating the code try self.code.resize(5); // Write instructions // TODO: check for and handle death of instructions const tv = self.decl.typed_value.most_recent.typed_value; const mod_fn = tv.val.castTag(.function).?.data; var locals = std.ArrayList(u8).init(self.gpa); defer locals.deinit(); for (mod_fn.body.instructions) |inst| { if (inst.tag != .alloc) continue; const alloc: *Inst.NoOp = inst.castTag(.alloc).?; const elem_type = alloc.base.ty.elemType(); const wasm_type = genValtype(elem_type) orelse return self.fail(inst.src, "TODO: Wasm codegen - valtype for type '{s}'", .{elem_type.tag()}); try locals.append(wasm_type); } try leb.writeULEB128(writer, @intCast(u32, locals.items.len)); // emit the actual locals amount for (locals.items) |local| { try leb.writeULEB128(writer, @as(u32, 1)); try leb.writeULEB128(writer, local); // valtype } try self.genBody(mod_fn.body); try writer.writeByte(0x0B); // end // Fill in the size of the generated code to the reserved space at the // beginning of the buffer. const size = self.code.items.len - 5 + self.decl.fn_link.wasm.?.idx_refs.items.len * 5; leb.writeUnsignedFixed(5, self.code.items[0..5], @intCast(u32, size)); } fn genInst(self: *Context, inst: *Inst) InnerError!WValue { return switch (inst.tag) { .add => self.genAdd(inst.castTag(.add).?), .alloc => self.genAlloc(inst.castTag(.alloc).?), .arg => self.genArg(inst.castTag(.arg).?), .call => self.genCall(inst.castTag(.call).?), .constant => unreachable, .dbg_stmt => WValue.none, .load => self.genLoad(inst.castTag(.load).?), .ret => self.genRet(inst.castTag(.ret).?), .retvoid => WValue.none, .store => self.genStore(inst.castTag(.store).?), else => self.fail(inst.src, "TODO: Implement wasm inst: {s}", .{inst.tag}), }; } fn genBody(self: *Context, body: ir.Body) InnerError!void { for (body.instructions) |inst| { const result = try self.genInst(inst); try self.values.putNoClobber(inst, result); } } fn genRet(self: *Context, inst: *Inst.UnOp) InnerError!WValue { // TODO: Implement tail calls const operand = self.resolveInst(inst.operand); try self.emitWValue(operand); return WValue.none; } fn genCall(self: *Context, inst: *Inst.Call) InnerError!WValue { const func_inst = inst.func.castTag(.constant).?; const func = func_inst.val.castTag(.function).?.data; const target = func.owner_decl; const target_ty = target.typed_value.most_recent.typed_value.ty; for (inst.args) |arg| { const arg_val = self.resolveInst(arg); try self.emitWValue(arg_val); } try self.code.append(0x10); // call // The function index immediate argument will be filled in using this data // in link.Wasm.flush(). try self.decl.fn_link.wasm.?.idx_refs.append(self.gpa, .{ .offset = @intCast(u32, self.code.items.len), .decl = target, }); return WValue.none; } fn genAlloc(self: *Context, inst: *Inst.NoOp) InnerError!WValue { defer self.local_index += 1; return WValue{ .local = self.local_index }; } fn genStore(self: *Context, inst: *Inst.BinOp) InnerError!WValue { const writer = self.code.writer(); const lhs = self.resolveInst(inst.lhs); const rhs = self.resolveInst(inst.rhs); try self.emitWValue(rhs); try writer.writeByte(0x21); // local.set try leb.writeULEB128(writer, lhs.local); return WValue.none; } fn genLoad(self: *Context, inst: *Inst.UnOp) InnerError!WValue { const operand = self.resolveInst(inst.operand); try self.emitWValue(operand); return WValue.none; } fn genArg(self: *Context, inst: *Inst.Arg) InnerError!WValue { // arguments share the index with locals defer self.local_index += 1; return WValue{ .local = self.local_index }; } fn genAdd(self: *Context, inst: *Inst.BinOp) InnerError!WValue { const lhs = self.resolveInst(inst.lhs); const rhs = self.resolveInst(inst.rhs); try self.emitWValue(lhs); try self.emitWValue(rhs); const opcode: u8 = switch (inst.base.ty.tag()) { .u32, .i32 => 0x6A, //i32.add .u64, .i64 => 0x7C, //i64.add .f32 => 0x92, //f32.add .f64 => 0xA0, //f64.add else => return self.fail(inst.base.src, "TODO - Implement wasm genAdd for type '{s}'", .{inst.base.ty.tag()}), }; try self.code.append(opcode); return WValue.none; } fn emitConstant(self: *Context, inst: *Inst.Constant) InnerError!void { const writer = self.code.writer(); switch (inst.base.ty.tag()) { .u32 => { try writer.writeByte(0x41); // i32.const try leb.writeILEB128(writer, inst.val.toUnsignedInt()); }, .i32 => { try writer.writeByte(0x41); // i32.const try leb.writeILEB128(writer, inst.val.toSignedInt()); }, .u64 => { try writer.writeByte(0x42); // i64.const try leb.writeILEB128(writer, inst.val.toUnsignedInt()); }, .i64 => { try writer.writeByte(0x42); // i64.const try leb.writeILEB128(writer, inst.val.toSignedInt()); }, .f32 => { try writer.writeByte(0x43); // f32.const // TODO: enforce LE byte order try writer.writeAll(mem.asBytes(&inst.val.toFloat(f32))); }, .f64 => { try writer.writeByte(0x44); // f64.const // TODO: enforce LE byte order try writer.writeAll(mem.asBytes(&inst.val.toFloat(f64))); }, .void => {}, else => |ty| return self.fail(inst.base.src, "Wasm TODO: emitConstant for type {s}", .{ty}), } } };
src/codegen/wasm.zig
const std = @import("std"); const gdt = @import("gdt.zig"); const idt = @import("idt.zig"); const vmem = @import("vmem.zig"); const pmem = @import("pmem.zig"); const pit = @import("pit.zig"); const cmos = @import("cmos.zig"); const serial = @import("../../debug/serial.zig"); const Task = @import("../../task.zig").Task; const Allocator = std.mem.Allocator; pub extern fn getEflags() u32; pub extern fn getCS() u32; // CPU context // Valid wrt interruptions. // TODO: support SYSENTER. pub const Context = extern struct { registers: Registers, // General purpose registers. interrupt_n: u64, // Number of the interrupt. error_code: u64, // Associated error code (or 0). // CPU status: rip: u64, cs: u64, rflags: u64, rsp: u64, ss: u64, pub fn setReturnValue(self: *volatile Context, value: anytype) void { self.registers.rax = if (@TypeOf(value) == bool) @boolToInt(value) else @as(u64, value); } }; // Structure holding general purpose registers // Valid wrt to isrCommon. pub const Registers = extern struct { r11: u64, r10: u64, r9: u64, r8: u64, rcx: u64, rdx: u64, rsi: u64, rdi: u64, rax: u64, rbp: u64 }; pub const Date = packed struct { second: u8, minute: u8, hour: u8, day: u8, month: u8, year: u8, century: u8, }; pub fn preinitialize(allocator: *std.mem.Allocator) void { cli(); // Disable all interrupts. pmem.initialize(allocator); gdt.initialize(); idt.initialize(); // vmem.initialize(); // TODO: enable me when vmem setupPaging is ready, enableSystemCallExtensions(); // TODO: support for syscall require to load the kernel entrypoint in the LSTAR MSR. } pub fn initialize() void { pit.initialize(); sti(); // TODO: timer.initialize(); // rtc.initialize(); } pub fn initializeTask(task: *Task, entrypoint: usize, allocator: *Allocator) Allocator.Error!void { const dataOffset: usize = if (task.kernel) gdt.KERNEL_DATA else gdt.USER_DATA | 0b11; const codeOffset: usize = if (task.kernel) gdt.KERNEL_CODE else gdt.USER_CODE | 0b11; const kStackBottom = (if (task.kernel) task.kernel_stack.len - 17 else task.kernel_stack.len - 19) - 20; var stack = &task.kernel_stack; // 9 zero Registers: r11, r10, r9, r8, rdi, rsi, rdx, rcx, rax comptime var i = 0; inline while (i <= 8) : (i += 1) { stack.*[kStackBottom + i] = 0; } // Base stack pointer stack.*[kStackBottom + i + 0] = @ptrToInt(&stack.*[stack.len - 1]); // Int num stack.*[kStackBottom + i + 1] = 0; // Error code stack.*[kStackBottom + i + 2] = 0; // Reload data segment? stack.*[kStackBottom + i + 3] = entrypoint; // RIP stack.*[kStackBottom + i + 4] = codeOffset; // CS stack.*[kStackBottom + i + 5] = 0x202; // RFLAGS stack.*[kStackBottom + i + 6] = stack.*[kStackBottom + i]; // RSP stack.*[kStackBottom + i + 7] = 0; // SS // TODO(Ryan): handle when this is not a ktask and use virtual memory. task.stack_pointer = @ptrToInt(&stack.*[kStackBottom]); } pub fn liftoff(userspace_fun_ptr: *const fn () void, userspace_stack: *u64) void { // Get a new IP/SP and setup eflags. // Then sysret! asm volatile ( \\mov %[userspace_fun_ptr], %%rdi \\mov %[userspace_stack], %%rsi \\mov $0x0202, %%r11 \\sysretq : : [userspace_fun_ptr] "r" (userspace_fun_ptr), [userspace_stack] "r" (userspace_stack) ); } pub fn hlt() noreturn { while (true) { asm volatile ("hlt"); } } pub fn cli() void { asm volatile ("cli"); } pub fn sti() void { asm volatile ("sti"); } pub fn NMI_enable() void { out(0x70, @as(u8, in(u8, 0x70) & 0x7F)); } pub fn NMI_disable() void { out(0x70, @as(u8, in(u8, 0x70) | 0x80)); } pub fn hang() noreturn { cli(); hlt(); } pub fn readCR(comptime number: []const u8) usize { return asm volatile ("mov %%cr" ++ number ++ ", %[ret]" : [ret] "=r" (-> usize) ); } pub fn writeCR(comptime number: []const u8, value: usize) void { asm volatile ("mov %[value], %%cr" ++ number : : [value] "r" (value) ); } pub fn isProtectedMode() bool { const cr0 = readCR("0"); return (cr0 & 1) == 1; } pub fn isPagingEnabled() bool { return (readCR("0") & 0x80000000) == 0x80000000; } pub fn isPAEEnabled() bool { return (readCR("4") & (1 << 5)) == (1 << 5); } pub fn isPSEEnabled() bool { return (readCR("4") & 0x00000010) == 0x00000010; } pub fn isX87EmulationEnabled() bool { return (readCR("0") & 0b100) == 0b100; } pub fn isTSSSet() bool { return (readCR("0") & 0b1000) == 0b1000; } pub fn cpuid(leaf_id: u32, sub_id: u32) [4]u32 { var registers: [4]u32 = undefined; asm volatile ( \\cpuid \\movl %%eax, 0(%[leaf_ptr]) \\movl %%ebx, 4(%[leaf_ptr]) \\movl %%ecx, 8(%[leaf_ptr]) \\movl %%edx, 12(%[leaf_ptr]) : : [leaf_id] "{eax}" (leaf_id), [subid] "{ecx}" (sub_id), [leaf_ptr] "r" (&registers) : "eax", "ebx", "ecx", "edx" ); return registers; } pub fn readMSR(msr: u32) u64 { return asm volatile ( \\rdmsr \\shl $32, %%rdx \\or %%rdx, %%rax \\mov %%rax, %[result] : [result] "=r" (-> u64) : [msr] "{rcx}" (msr) ); } pub fn writeMSR(msr: u32, value: u64) void { asm volatile ("wrmsr" : : [msr] "{rcx}" (msr), [value] "{rax}" (value) ); } pub const EFER_MSR = 0xC0000080; pub fn isLongModeEnabled() bool { // if (!hasCPUID()) return false; // FIXME(Ryan): use another method. var registers: [4]u32 = cpuid(0x80000000, 0); if (registers[0] < 0x80000001) return false; var eferMSR: u64 = readMSR(EFER_MSR); return (eferMSR & (1 << 10)) != 0 and (eferMSR & (1 << 8)) != 0; // EFER.LMA & EFER.LME. } pub const STAR_MSR = 0xC0000081; pub fn enableSystemCallExtensions() void { serial.writeText("System call extensions will be enabled...\n"); var buf: [4096]u8 = undefined; var eferMSR = readMSR(EFER_MSR); writeMSR(EFER_MSR, eferMSR & 0x1); // Enable SCE bit. var starMSR = readMSR(STAR_MSR); writeMSR(STAR_MSR, 0x00180008); // GDT segment. serial.writeText("System call extensions enabled.\n"); } pub fn rdtsc() u64 { return asm volatile ( \\rdtsc \\shl $32, %%rax \\or %%rcx, %%rax \\mov %%rax, %[val] : [val] "=m" (-> u64) ); } pub fn ioWait() void { out(0x80, @as(u8, 0)); } pub fn out(port: u16, data: anytype) void { switch (@TypeOf(data)) { u8 => asm volatile ("outb %[data], %[port]" : : [port] "{dx}" (port), [data] "{al}" (data) ), u16 => asm volatile ("outw %[data], %[port]" : : [port] "{dx}" (port), [data] "{ax}" (data) ), u32 => asm volatile ("outl %[data], %[port]" : : [port] "{dx}" (port), [data] "{eax}" (data) ), else => @compileError("Invalid data type for out. Only u8, u16 or u32, found: " ++ @typeName(@TypeOf(data))), } } pub fn in(comptime Type: type, port: u16) Type { return switch (Type) { u8 => asm volatile ("inb %[port], %[result]" : [result] "={al}" (-> Type) : [port] "N{dx}" (port) ), u16 => asm volatile ("inw %[port], %[result]" : [result] "={ax}" (-> Type) : [port] "N{dx}" (port) ), u32 => asm volatile ("inl %[port], %[result]" : [result] "={eax}" (-> Type) : [port] "N{dx}" (port) ), else => @compileError("Invalid port type for in. Only u8, u16 or u32, found: " ++ @typeName(@TypeOf(port))), }; } pub fn getClockInterval() u64 { return pit.time_ns; } pub const get_date = cmos.read_date;
src/kernel/arch/x86/platform.zig
const std = @import("std"); const fun = @import("fun"); const debug = std.debug; const heap = std.heap; const io = std.io; const math = std.math; const mem = std.mem; const os = std.os; const scan = fun.scan.scan; pub fn main() !void { const stdin = &(try io.getStdIn()).inStream().stream; const stdout = &(try io.getStdOut()).outStream().stream; var ps = io.PeekStream(1, os.File.InStream.Error).init(stdin); var direct_allocator = heap.DirectAllocator.init(); const allocator = &direct_allocator.allocator; defer direct_allocator.deinit(); const points = try readPoints(allocator, &ps); defer allocator.free(points); var seconds: usize = 0; while (pointsWithNeighbor(points) < points.len) : (seconds += 1) { for (points) |*p| p.update(); } try printPoints(points, stdout); try stdout.print("{}\n", seconds); } fn readPoints(allocator: *mem.Allocator, ps: var) ![]Point { var points = std.ArrayList(Point).init(allocator); defer points.deinit(); while (readPoint(ps)) |point| { try points.append(point); } else |err| switch (err) { error.EndOfStream => {}, else => return err, } return points.toOwnedSlice(); } fn readPoint(ps: var) !Point { _ = try scan(ps, "position=<", struct {}); try skipSpaces(ps); const pos1 = try scan(ps, "{},", struct { x: isize, }); try skipSpaces(ps); const pos2 = try scan(ps, "{}> velocity=<", struct { y: isize, }); try skipSpaces(ps); const vel1 = try scan(ps, "{},", struct { x: isize, }); try skipSpaces(ps); const vel2 = try scan(ps, "{}>\n", struct { y: isize, }); return Point{ .pos_x = pos1.x, .pos_y = pos2.y, .vel_x = vel1.x, .vel_y = vel2.y, }; } fn skipSpaces(ps: var) !void { while (ps.stream.readByte()) |c| switch (c) { ' ' => {}, else => { ps.putBackByte(c); return; }, } else |err| switch (err) { error.EndOfStream => {}, else => return err, } } fn pointsWithNeighbor(points: []const Point) usize { var res: usize = 0; outer: for (points) |p1| { for (points) |p2| { const dist = p1.distance(p2); if (dist == 1 or dist == 2) { res += 1; continue :outer; } } } return res; } fn printPoints(points: []const Point, stream: var) !void { var min_x: isize = math.maxInt(isize); var min_y: isize = math.maxInt(isize); var max_x: isize = math.minInt(isize); var max_y: isize = math.minInt(isize); for (points) |p| { if (p.pos_x < min_x) min_x = p.pos_x; if (p.pos_y < min_y) min_y = p.pos_y; if (p.pos_x > max_x) max_x = p.pos_x; if (p.pos_y > max_y) max_y = p.pos_y; } var y = min_y; while (y <= max_y) : (y += 1) { var x = min_x; while (x <= max_x) : (x += 1) { const p = Point{ .pos_x = x, .pos_y = y, .vel_x = 0, .vel_y = 0 }; if (find(Point, points, p, Point.equal)) |p2| { try stream.print("#"); } else { try stream.print("."); } } try stream.print("\n"); } } pub const Point = struct { pos_x: isize, pos_y: isize, vel_x: isize, vel_y: isize, fn update(p: *Point) void { p.pos_x += p.vel_x; p.pos_y += p.vel_y; } fn equal(a: Point, b: Point) bool { return a.distance(b) == 0; } fn distance(a: Point, b: Point) usize { return math.absCast(a.pos_x - b.pos_x) + math.absCast(a.pos_y - b.pos_y); } }; fn find(comptime T: type, slice: []const T, item: T, comptime eql: fn (T, T) bool) ?*const T { for (slice) |*i| { if (eql(i.*, item)) return i; } return null; }
src/day10.zig
const implode = @import("./implode.zig"); const bs = @import("./bitstream.zig"); const hm = @import("./huffman.zig"); const lz = @import("./lz77.zig"); const bits_utils = @import("./bits.zig"); const hamlet = @embedFile("../fixtures/hamlet.txt"); const std = @import("std"); const allocator = std.testing.allocator; const assert = std.debug.assert; const expect = std.testing.expect; const math = std.math; const mem = std.mem; // // $ curl -O http://cd.textfiles.com/1stcanadian/utils/pkz110/pkz110.exe // $ unzip pkz110.exe PKZIP.EXE // $ dd if=hamlet.txt of=a bs=1 count=256 // $ dosbox -c "mount c ." -c "c:" -c "pkzip -ei a.zip a" -c exit // $ xxd -i -s 31 -l $(expr $(find A.ZIP -printf %s) - 100) A.ZIP // const hamlet_256 = [249]u8{ 0x0d, 0x02, 0x01, 0x12, 0x23, 0x14, 0x15, 0x36, 0x37, 0x68, 0x89, 0x9a, 0xdb, 0x3c, 0x05, 0x06, 0x12, 0x13, 0x44, 0xc5, 0xf6, 0x96, 0xf7, 0xdf, 0xef, 0xfe, 0xdd, 0x50, 0x21, 0x54, 0xb9, 0x6f, 0xd5, 0x96, 0x1d, 0x4b, 0x17, 0xe4, 0xd1, 0xba, 0x74, 0xcb, 0xba, 0x15, 0x5b, 0x56, 0xee, 0x59, 0x90, 0x45, 0x85, 0xbe, 0x7d, 0xbb, 0x16, 0xe4, 0x5b, 0xb3, 0x20, 0x91, 0x86, 0x6d, 0xcb, 0xb6, 0x2c, 0x5d, 0x96, 0x20, 0xc5, 0xe6, 0x05, 0x79, 0x35, 0x2d, 0x5b, 0xb6, 0x69, 0x9c, 0x37, 0xc8, 0xa9, 0x68, 0xc3, 0xae, 0x2d, 0x3b, 0x17, 0x6e, 0xd9, 0xb0, 0x72, 0xcb, 0xe8, 0xaf, 0xe0, 0x4d, 0x15, 0x6d, 0xda, 0xb9, 0x20, 0xcb, 0xbc, 0x37, 0xe4, 0x37, 0xfb, 0x56, 0x2e, 0x48, 0xba, 0x68, 0xcb, 0x82, 0xac, 0x3b, 0xb7, 0x8c, 0xff, 0x0c, 0xeb, 0x36, 0xef, 0x5b, 0xb7, 0x65, 0x8c, 0xe7, 0x1d, 0xea, 0xf5, 0xbe, 0xc2, 0xb7, 0x9b, 0xee, 0x5e, 0xd5, 0x6d, 0x9a, 0x74, 0x4d, 0x26, 0x59, 0xd3, 0x0d, 0x63, 0xbc, 0xe7, 0x74, 0x3f, 0x19, 0x63, 0xdd, 0xf6, 0xed, 0x1c, 0xa0, 0xfb, 0x0d, 0xf7, 0xfd, 0x6f, 0x38, 0xd9, 0x9a, 0xee, 0x9c, 0xfe, 0xa1, 0x3e, 0xef, 0x40, 0x6b, 0x36, 0xe9, 0xeb, 0x7c, 0x83, 0x74, 0xfb, 0x16, 0xe4, 0x98, 0xf1, 0xd1, 0x7e, 0xd4, 0xcb, 0x7f, 0xa3, 0x41, 0xde, 0x6c, 0xe6, 0xdb, 0xf5, 0xe2, 0x5f, 0xd9, 0x0a, 0x79, 0xcb, 0x4d, 0x13, 0x54, 0xa7, 0x61, 0x57, 0xf8, 0x2b, 0x5d, 0xb5, 0xef, 0xb9, 0x6f, 0xcb, 0xda, 0x49, 0xd6, 0x2e, 0x41, 0x82, 0xcc, 0xfa, 0xb6, 0x2e, 0xc8, 0xb6, 0x61, 0xf3, 0xe8, 0x3f, 0x1c, 0xe2, 0x9d, 0x06, 0xa9, 0x9f, 0x4d, 0x6b, 0xc7, 0xe8, 0x19, 0xfb, 0x9d, 0xea, 0x63, 0xbb, }; // Test exploding data without literal tree and large window. test "explode_hamlet_256" { var dst: [256]u8 = undefined; var src_used: usize = 0; try expect((try implode.hwexplode( &hamlet_256, hamlet_256.len, 256, false, //large_wnd false, //lit_tree false, //pk101_bug_compat &src_used, &dst, )) == implode.explode_stat_t.HWEXPLODE_OK); try expect(src_used == hamlet_256.len); try expect(mem.eql(u8, dst[0..256], hamlet[0..256])); } // // $ curl -O http://cd.textfiles.com/1stcanadian/utils/pkz110/pkz110.exe // $ unzip pkz110.exe PKZIP.EXE // $ dd if=hamlet.txt of=a bs=1 count=8192 // $ dosbox -c "mount c ." -c "c:" -c "pkzip -ei a.zip a" -c exit // $ xxd -i -s 31 -l $(expr $(find A.ZIP -printf %s) - 100) A.ZIP // const hamlet_8192 = [3830]u8{ 0x61, 0x0a, 0x7b, 0x07, 0x06, 0x1b, 0x06, 0xbb, 0x0c, 0x4b, 0x03, 0x09, 0x07, 0x0b, 0x09, 0x0b, 0x09, 0x07, 0x16, 0x07, 0x08, 0x06, 0x05, 0x06, 0x07, 0x06, 0x05, 0x36, 0x07, 0x16, 0x17, 0x0b, 0x0a, 0x06, 0x08, 0x0a, 0x0b, 0x05, 0x06, 0x15, 0x04, 0x06, 0x17, 0x05, 0x0a, 0x08, 0x05, 0x06, 0x15, 0x06, 0x0a, 0x25, 0x06, 0x08, 0x07, 0x18, 0x0a, 0x07, 0x0a, 0x08, 0x0b, 0x07, 0x0b, 0x04, 0x25, 0x04, 0x25, 0x04, 0x0a, 0x06, 0x04, 0x05, 0x14, 0x05, 0x09, 0x34, 0x07, 0x06, 0x17, 0x09, 0x1a, 0x2b, 0xfc, 0xfc, 0xfc, 0xfb, 0xfb, 0xfb, 0x0c, 0x0b, 0x2c, 0x0b, 0x2c, 0x0b, 0x3c, 0x0b, 0x2c, 0x2b, 0xac, 0x0c, 0x01, 0x22, 0x23, 0x14, 0x15, 0x36, 0x37, 0x68, 0x89, 0x9a, 0xdb, 0x3c, 0x05, 0x06, 0x12, 0x23, 0x14, 0xe5, 0xf6, 0x96, 0xf7, 0x01, 0x6c, 0x50, 0x08, 0x32, 0x45, 0xc5, 0x49, 0xdb, 0x1e, 0x42, 0x77, 0x63, 0xf9, 0x51, 0xe7, 0xe5, 0x3e, 0x9a, 0xf7, 0x56, 0xfd, 0x6f, 0xea, 0xbe, 0x27, 0xfc, 0xbd, 0xf6, 0xa3, 0x3c, 0xe5, 0xf3, 0x5e, 0xf2, 0x7f, 0x33, 0xdc, 0x8f, 0x7c, 0x9d, 0xe7, 0xf5, 0x94, 0x7f, 0xbb, 0xf2, 0x24, 0xdc, 0x6b, 0xe9, 0x7e, 0xb6, 0xbb, 0xa8, 0xb8, 0xa8, 0xb8, 0x55, 0xb9, 0xd6, 0x7f, 0x7b, 0x3d, 0x10, 0xbf, 0xb6, 0x6f, 0x7f, 0xa9, 0xdc, 0x7f, 0x5e, 0x6f, 0xbe, 0xf7, 0x39, 0xc2, 0xed, 0xc7, 0xcd, 0xf0, 0xc6, 0x57, 0xee, 0xed, 0xfe, 0xd7, 0xa1, 0xf3, 0x24, 0x1e, 0xd7, 0x72, 0xd7, 0x7f, 0x7b, 0x79, 0x96, 0x7b, 0xd5, 0xf9, 0xf5, 0xa2, 0xe2, 0xf2, 0xbe, 0x2e, 0x7f, 0xc7, 0xf9, 0xdb, 0x2f, 0x3d, 0xdb, 0xb2, 0xea, 0xbd, 0x54, 0x6f, 0xfc, 0xbe, 0x9d, 0xf5, 0xff, 0x2c, 0xff, 0xd8, 0x7f, 0xc3, 0xe8, 0xd5, 0xfa, 0x3f, 0xfe, 0x5a, 0x2a, 0xff, 0x39, 0xcd, 0x9e, 0x63, 0x2f, 0x2a, 0xde, 0xee, 0x75, 0xd9, 0xae, 0xc6, 0x72, 0xed, 0xc7, 0xfa, 0xe3, 0x2b, 0xcf, 0xb2, 0xee, 0x77, 0x84, 0x7b, 0xcb, 0xfb, 0x3f, 0xb4, 0x7d, 0xfe, 0xe5, 0x27, 0x1c, 0xdd, 0x2f, 0x85, 0xfb, 0x17, 0xe4, 0xae, 0x5e, 0x11, 0x18, 0x36, 0xe3, 0x8f, 0x57, 0xf9, 0x58, 0x7b, 0xbb, 0xa7, 0x56, 0xeb, 0xb5, 0x14, 0x15, 0xcf, 0x47, 0xfd, 0xd6, 0x9b, 0x97, 0x7b, 0x2b, 0x0b, 0x8c, 0x75, 0x1a, 0xba, 0x7f, 0x35, 0xee, 0x03, 0xed, 0x3d, 0x1a, 0xe7, 0x5c, 0xbf, 0x3d, 0xa6, 0x0b, 0x44, 0x5f, 0x54, 0x2c, 0xd1, 0x86, 0xfd, 0xfb, 0x71, 0x5e, 0xf4, 0xeb, 0xf2, 0xe3, 0xe3, 0xe3, 0xf3, 0xaa, 0x78, 0x97, 0xbc, 0xdd, 0xe0, 0xff, 0x3f, 0xa8, 0xfd, 0x70, 0x34, 0xdb, 0xb0, 0x07, 0xdc, 0xcb, 0x3f, 0xf7, 0xc6, 0x23, 0xd2, 0xf5, 0x69, 0x17, 0x15, 0x03, 0x35, 0x96, 0x4f, 0xf5, 0x06, 0xe8, 0x81, 0x44, 0x40, 0x7f, 0x9e, 0xbf, 0xf2, 0xe8, 0xed, 0x45, 0xa2, 0xaf, 0xdc, 0x8d, 0x04, 0x9d, 0xe5, 0x7c, 0xe2, 0xa5, 0xc6, 0x8d, 0x7d, 0x3e, 0x96, 0x2d, 0xdc, 0xb7, 0x6e, 0xa3, 0xfd, 0xa2, 0x62, 0xe0, 0x17, 0xf7, 0xd2, 0xbc, 0x75, 0x6a, 0x9a, 0xea, 0x75, 0x54, 0xb5, 0x96, 0x7f, 0x37, 0xb1, 0x76, 0x9e, 0x62, 0x55, 0xb2, 0x72, 0x2d, 0xe7, 0x1d, 0x8d, 0xbc, 0x14, 0xe4, 0x1d, 0xcf, 0x4b, 0x65, 0xdf, 0xa2, 0xc9, 0x17, 0xd8, 0xce, 0x7d, 0xde, 0x0f, 0x43, 0x3f, 0xd4, 0xfd, 0xd1, 0x7e, 0x6f, 0x8f, 0x70, 0x97, 0x85, 0xf7, 0x9f, 0x44, 0x8f, 0x9e, 0xfe, 0x23, 0x09, 0xa6, 0x83, 0xc9, 0x24, 0x33, 0x27, 0x2b, 0xd4, 0xa2, 0xe2, 0xfe, 0x23, 0x55, 0x27, 0x96, 0xea, 0x0e, 0x6b, 0xb4, 0xdf, 0xbe, 0x4b, 0x8b, 0xd5, 0x9d, 0x9d, 0x9b, 0xff, 0x73, 0x72, 0x27, 0xd1, 0x39, 0xdf, 0xfe, 0x73, 0x54, 0xe7, 0xa7, 0x4a, 0xf9, 0xdf, 0xa3, 0x7a, 0x5e, 0x6b, 0x05, 0xe5, 0x1d, 0x55, 0x9e, 0xed, 0x69, 0x78, 0xd4, 0x7f, 0xbd, 0x97, 0x7f, 0x1f, 0x8d, 0xbd, 0xae, 0xb7, 0xa3, 0xfd, 0xc4, 0x56, 0xca, 0x34, 0x1d, 0xe8, 0x8d, 0x15, 0x2b, 0xd6, 0x6f, 0xb7, 0xc6, 0x9d, 0xd6, 0xef, 0xa6, 0xfc, 0x56, 0x94, 0x41, 0xfb, 0x27, 0x75, 0xba, 0x21, 0xf6, 0x8e, 0x5a, 0x3f, 0x6a, 0x62, 0xeb, 0xed, 0xa5, 0xbe, 0x9d, 0xa8, 0x9a, 0xf1, 0x6e, 0x37, 0xcc, 0x1f, 0x65, 0x9c, 0xdc, 0x7f, 0x5b, 0x1f, 0xec, 0x83, 0x8f, 0x0d, 0x3a, 0xcb, 0x1d, 0xde, 0xa8, 0x7e, 0xd6, 0x5f, 0xda, 0x6e, 0xfa, 0x1c, 0xaa, 0x1b, 0xee, 0x0f, 0xaf, 0xe7, 0xd0, 0xab, 0x53, 0xef, 0xe7, 0xf0, 0x69, 0x6d, 0x45, 0x79, 0x7f, 0xab, 0x33, 0x8e, 0xfa, 0x0e, 0x43, 0xa3, 0x7e, 0x35, 0xef, 0x7c, 0xed, 0x3f, 0xe8, 0x8d, 0x5e, 0x91, 0x77, 0xf8, 0xf6, 0x92, 0xc7, 0x9d, 0x30, 0x71, 0x2f, 0x45, 0xc5, 0x66, 0x01, 0xb4, 0xc0, 0xe9, 0x68, 0x3f, 0x60, 0xf2, 0x65, 0xe5, 0xee, 0xa0, 0xed, 0x41, 0x51, 0x71, 0x1b, 0x37, 0xbf, 0xff, 0x20, 0xef, 0xbf, 0xa7, 0x54, 0x2d, 0x56, 0xe7, 0xfd, 0xf1, 0x2f, 0x9d, 0xcf, 0xa2, 0x57, 0x97, 0x11, 0x4b, 0xb8, 0xab, 0x23, 0xd4, 0xfe, 0xbc, 0xf3, 0xc4, 0xce, 0x64, 0x47, 0x6c, 0xfb, 0x5e, 0x96, 0xc9, 0xae, 0x88, 0x59, 0xf9, 0x20, 0x66, 0x37, 0xd9, 0xe9, 0x40, 0xea, 0x0c, 0xf4, 0x93, 0xf6, 0x73, 0x3f, 0xae, 0x79, 0xb5, 0xce, 0xd7, 0x5f, 0xd9, 0x5d, 0xc2, 0xb8, 0xa7, 0x61, 0xe4, 0xfd, 0x96, 0xdf, 0x77, 0x98, 0xc0, 0x9c, 0x5d, 0xfe, 0xf8, 0x97, 0x49, 0xd6, 0xed, 0x2e, 0xef, 0xd0, 0x5f, 0xcf, 0x2f, 0x48, 0x14, 0xa1, 0x31, 0xee, 0x54, 0x77, 0x38, 0xfb, 0x81, 0x08, 0x75, 0x8c, 0xf4, 0x10, 0xa6, 0x07, 0xef, 0xd3, 0xe0, 0xc6, 0x82, 0x61, 0xc6, 0x30, 0xd0, 0xc1, 0x12, 0x1e, 0x58, 0xed, 0xf5, 0x50, 0x72, 0x8d, 0x32, 0x90, 0x61, 0x98, 0x0c, 0x50, 0xa0, 0x07, 0x29, 0x33, 0xdc, 0xe9, 0x40, 0x87, 0x61, 0x95, 0xca, 0xf3, 0x09, 0xfe, 0xf0, 0x3e, 0xca, 0xcf, 0x96, 0x60, 0x55, 0x38, 0x50, 0xc2, 0x20, 0x0f, 0x3e, 0x0c, 0xef, 0x03, 0x31, 0x0c, 0x97, 0x01, 0x0b, 0xd2, 0xf6, 0x68, 0x64, 0xa3, 0x32, 0x6f, 0x8d, 0x4a, 0xb8, 0x67, 0xab, 0xdb, 0x14, 0x50, 0x02, 0xef, 0x70, 0x7b, 0xca, 0xcf, 0x82, 0xe5, 0x9f, 0x74, 0x6f, 0xeb, 0x7e, 0x04, 0x89, 0x80, 0x08, 0xe5, 0x15, 0xf0, 0x79, 0x73, 0xb0, 0xd7, 0xb6, 0xe2, 0x3d, 0x3a, 0xea, 0x8f, 0x13, 0x87, 0x83, 0xc4, 0x76, 0xfe, 0x0f, 0x13, 0xdb, 0xad, 0xcd, 0x69, 0x3e, 0xaf, 0xab, 0xd6, 0x99, 0xd9, 0xcf, 0x9e, 0xf8, 0x85, 0x8d, 0x8d, 0x1a, 0xa5, 0xdb, 0x6e, 0xb9, 0x45, 0x39, 0xc5, 0x42, 0x13, 0xe4, 0x3e, 0xd7, 0xb1, 0xda, 0xe3, 0xbc, 0x7a, 0xfd, 0xa8, 0x6f, 0xa7, 0xd5, 0x49, 0x1c, 0xbe, 0xf9, 0x58, 0x4f, 0x88, 0xce, 0xf7, 0x7d, 0x40, 0x1d, 0x2b, 0x83, 0x74, 0xf2, 0x65, 0xed, 0xe3, 0x69, 0xac, 0x6b, 0x36, 0xcb, 0xe8, 0x7c, 0xe6, 0x3a, 0x72, 0x9c, 0xef, 0x27, 0x75, 0xfb, 0xdd, 0x1e, 0xce, 0xd2, 0xdf, 0xb7, 0xfa, 0x27, 0x76, 0xb7, 0x70, 0x8a, 0x56, 0xc5, 0xf9, 0xfd, 0x31, 0xee, 0x7f, 0x6d, 0x7e, 0x7b, 0x3f, 0xa4, 0xed, 0xe2, 0x04, 0xa1, 0xf9, 0xdd, 0xa4, 0x28, 0x6f, 0x7f, 0x30, 0xce, 0x07, 0x77, 0x9e, 0xab, 0x15, 0x13, 0xa7, 0x3e, 0x47, 0x46, 0xe9, 0x76, 0xc6, 0xad, 0x41, 0x37, 0xff, 0xa7, 0x6c, 0xd7, 0xad, 0x64, 0xac, 0xf3, 0x51, 0x66, 0x9b, 0x9f, 0xd2, 0xed, 0xb4, 0x06, 0xbd, 0xd4, 0xce, 0xb8, 0x0d, 0xd6, 0x78, 0x6f, 0xdf, 0x18, 0x8c, 0x79, 0x7e, 0x18, 0xdd, 0x7e, 0xeb, 0x4d, 0x1e, 0xf7, 0x86, 0xf9, 0x7f, 0xb4, 0xcf, 0xdb, 0x72, 0x39, 0x2f, 0xa3, 0x6e, 0xa7, 0x27, 0xfe, 0xa5, 0x56, 0x95, 0x93, 0x4e, 0xb7, 0xfd, 0xf6, 0x46, 0x9d, 0x71, 0xaf, 0x15, 0x22, 0x2e, 0xc7, 0xa2, 0x26, 0x0e, 0xfa, 0x06, 0xce, 0xed, 0xd6, 0xdb, 0xe9, 0xc1, 0x1c, 0x53, 0x71, 0x1e, 0xbd, 0xfd, 0x3e, 0xe3, 0xdb, 0xad, 0xd5, 0xec, 0x8c, 0x51, 0xde, 0xd4, 0x71, 0xa7, 0x37, 0xee, 0x0c, 0xbb, 0x26, 0xc7, 0x53, 0x50, 0xff, 0x68, 0xd0, 0x1e, 0xa1, 0xfc, 0xc7, 0x7f, 0x9f, 0x75, 0xbf, 0xcf, 0xbe, 0xdb, 0x9d, 0xc1, 0x48, 0x60, 0xc8, 0x37, 0xb4, 0xde, 0xb8, 0x6f, 0xf7, 0xb6, 0xef, 0x2d, 0xc2, 0x73, 0x2c, 0x10, 0x8d, 0x48, 0x3a, 0x9f, 0x70, 0x50, 0xb9, 0xc4, 0x1f, 0xff, 0xa8, 0xba, 0xce, 0xe7, 0x5d, 0x7e, 0x0e, 0xc1, 0x63, 0x63, 0x84, 0x2e, 0x9a, 0x36, 0x7e, 0x35, 0x7e, 0xc7, 0xa9, 0xf7, 0xf8, 0xc3, 0xd9, 0x38, 0xea, 0xe6, 0x6b, 0x3c, 0xad, 0x5f, 0xd5, 0x2a, 0xdf, 0x65, 0xf4, 0x94, 0x16, 0x98, 0x32, 0x8a, 0xa9, 0x7f, 0x5c, 0x6e, 0x3e, 0xeb, 0xfa, 0xd4, 0x77, 0xa1, 0x47, 0xb0, 0x0a, 0xf7, 0xfb, 0x8f, 0xd5, 0x5e, 0x2d, 0xc7, 0x12, 0x9f, 0x6f, 0x2a, 0xf1, 0x3e, 0xd7, 0x89, 0xf5, 0xf3, 0x7f, 0xf2, 0xbd, 0xae, 0xf7, 0x41, 0xfb, 0xe6, 0x2b, 0xaa, 0x19, 0x2f, 0xf4, 0xf6, 0x75, 0xbe, 0xbd, 0x32, 0xc7, 0xb4, 0x47, 0x6f, 0xef, 0x15, 0xf2, 0x09, 0x91, 0x25, 0x2c, 0x96, 0x02, 0x5d, 0x61, 0x2c, 0x40, 0x15, 0x15, 0x5b, 0x1a, 0x43, 0x65, 0x53, 0xb6, 0xe7, 0x68, 0x5c, 0x6b, 0x63, 0x87, 0x7f, 0x52, 0x9f, 0xed, 0xd0, 0x0f, 0xef, 0x7e, 0x71, 0xfc, 0x6d, 0xb2, 0x17, 0x29, 0xf5, 0x53, 0x61, 0x76, 0x29, 0xc9, 0xfb, 0x91, 0x2b, 0xbb, 0x66, 0x8c, 0x65, 0xec, 0x1d, 0xe2, 0x36, 0xaf, 0x4f, 0x71, 0xde, 0xef, 0x3d, 0xe1, 0x10, 0xd7, 0x35, 0x1e, 0xf7, 0x97, 0x21, 0xb6, 0x94, 0x3a, 0xec, 0x37, 0x78, 0xe7, 0xa3, 0x46, 0xbf, 0xf5, 0xb5, 0x6e, 0xeb, 0x7d, 0xd6, 0x50, 0x8f, 0xe8, 0xef, 0x1c, 0xfe, 0xa7, 0x81, 0x5c, 0xa8, 0x15, 0xc7, 0x6f, 0x28, 0x65, 0x8f, 0xc0, 0x99, 0x84, 0x38, 0xdc, 0x91, 0x51, 0x3c, 0x67, 0xa8, 0x13, 0x5a, 0xb9, 0x8d, 0xbd, 0x7c, 0x7f, 0x06, 0x29, 0x0d, 0x5a, 0xe3, 0xda, 0x7c, 0x9e, 0xe1, 0xfe, 0x5c, 0x92, 0x0b, 0xf3, 0xbf, 0x96, 0x56, 0x37, 0xff, 0x23, 0x44, 0x77, 0xcb, 0xd1, 0x5b, 0xc6, 0x2f, 0x99, 0xf4, 0x8c, 0xa8, 0x34, 0xfe, 0x3e, 0x23, 0x08, 0xee, 0xa8, 0xbe, 0xda, 0x26, 0x9b, 0x57, 0x49, 0xf3, 0xae, 0xe7, 0x9b, 0x35, 0x85, 0x3f, 0x3c, 0xc5, 0x58, 0x8c, 0xe2, 0xdf, 0xee, 0xf3, 0xba, 0x6b, 0xbf, 0x3c, 0x37, 0xf4, 0xe5, 0x3e, 0x47, 0xc2, 0x0a, 0x7c, 0x6e, 0x5e, 0x8b, 0x7b, 0xb7, 0x41, 0xd1, 0xe7, 0x0b, 0x39, 0xd7, 0xff, 0xe0, 0x33, 0x68, 0xaf, 0x57, 0x23, 0xc1, 0x44, 0x7e, 0xf9, 0x15, 0x09, 0xed, 0x85, 0x66, 0x88, 0x28, 0xb6, 0x72, 0x51, 0xa4, 0x56, 0x9e, 0xfa, 0x0f, 0xd9, 0x7c, 0x79, 0x6c, 0x0f, 0xe5, 0xad, 0x4e, 0xdf, 0x30, 0x2f, 0xe9, 0x07, 0x7d, 0xb3, 0x89, 0x5d, 0x97, 0x6b, 0xd3, 0xf4, 0xaf, 0xd2, 0x15, 0xfc, 0x3e, 0x4f, 0x6a, 0xf1, 0x7d, 0xaf, 0xff, 0xe3, 0xa2, 0xf2, 0xce, 0xf3, 0x96, 0xa4, 0xbe, 0x6b, 0xd5, 0xb0, 0x3f, 0xca, 0xbe, 0x79, 0x3a, 0x6b, 0xa4, 0x93, 0x9f, 0xad, 0xe1, 0xf5, 0x67, 0x95, 0x78, 0xcb, 0x5e, 0xea, 0x76, 0x45, 0x78, 0x4e, 0x53, 0x29, 0x65, 0x4a, 0xe9, 0x67, 0x69, 0x54, 0xf8, 0x05, 0x5f, 0x75, 0x9c, 0x6e, 0xd9, 0x52, 0x78, 0xc2, 0x0d, 0xb4, 0xd7, 0x85, 0x37, 0x31, 0xce, 0x43, 0xb0, 0x35, 0x7c, 0x80, 0xd6, 0x3d, 0x12, 0x1c, 0xbe, 0xfe, 0xca, 0xf9, 0xb8, 0xa5, 0xe6, 0x4b, 0xd5, 0xa1, 0xf4, 0xce, 0x0a, 0xf2, 0xcb, 0x9d, 0xd4, 0xd3, 0xd5, 0x3c, 0x4f, 0x57, 0x69, 0xfe, 0xee, 0xde, 0xae, 0x6e, 0xd0, 0xe2, 0x75, 0xdf, 0xc7, 0xd6, 0xe3, 0x3c, 0xe5, 0x8e, 0x47, 0x5d, 0xbd, 0xcb, 0xf7, 0x41, 0x75, 0xd3, 0x88, 0x3d, 0xdc, 0x12, 0x16, 0xf5, 0x72, 0x6e, 0xf5, 0x69, 0x42, 0x79, 0x84, 0xac, 0x77, 0xcd, 0x33, 0x8f, 0x67, 0xec, 0x54, 0x04, 0x79, 0x03, 0xe7, 0x2b, 0xa8, 0xef, 0x7c, 0x5d, 0xe1, 0xbb, 0x40, 0x0f, 0x2e, 0x98, 0xbf, 0x12, 0x01, 0xbc, 0xd6, 0x8e, 0x61, 0x2a, 0xb8, 0x63, 0x14, 0xad, 0xae, 0x64, 0x17, 0xca, 0xbf, 0x71, 0xeb, 0x1f, 0x31, 0xd5, 0x3f, 0xfd, 0x91, 0x22, 0xbe, 0xe1, 0xaf, 0x25, 0x2f, 0x62, 0xa8, 0x16, 0x43, 0x44, 0xd9, 0xcf, 0xf3, 0xc9, 0xe7, 0x3c, 0x87, 0x52, 0xba, 0x90, 0x6d, 0x07, 0xbf, 0xe2, 0xbc, 0xe6, 0xdb, 0x75, 0x1d, 0x4a, 0x0c, 0x1b, 0x4a, 0xca, 0xfb, 0xba, 0xd5, 0x6d, 0x57, 0xae, 0xb2, 0x57, 0x42, 0x4b, 0x86, 0xe6, 0x03, 0x5e, 0x44, 0x4e, 0x90, 0x3a, 0xa6, 0x85, 0xc4, 0x19, 0x89, 0x2c, 0xff, 0x08, 0xaf, 0x30, 0x15, 0xe0, 0x6a, 0xf5, 0x3f, 0x25, 0x68, 0xb1, 0x2e, 0x9d, 0xa7, 0x4a, 0xa1, 0x76, 0xd9, 0x9d, 0x17, 0x51, 0x1f, 0x31, 0xd0, 0xe4, 0x79, 0xd5, 0x33, 0x36, 0xe0, 0xb6, 0xc2, 0x18, 0xc5, 0x7e, 0x98, 0xe7, 0xbc, 0x3e, 0xe1, 0x56, 0xd9, 0x50, 0x02, 0xad, 0xcd, 0x99, 0x57, 0x1a, 0xd7, 0xbf, 0x06, 0xe7, 0xfc, 0xac, 0xe1, 0x74, 0x83, 0xe3, 0x9d, 0x85, 0x43, 0x72, 0x8d, 0x1b, 0x6f, 0xb2, 0xf8, 0x29, 0x2a, 0x5e, 0xac, 0x62, 0x30, 0xdc, 0xa2, 0xcf, 0xbf, 0xb5, 0x4b, 0xf9, 0xe3, 0xf3, 0xb8, 0xbe, 0xdd, 0x0f, 0x1e, 0xa7, 0xab, 0xcd, 0x4a, 0xe1, 0x54, 0xce, 0x5e, 0x63, 0xe6, 0xfa, 0xd4, 0x4b, 0x8b, 0xb1, 0xab, 0xea, 0xc4, 0x6a, 0x2a, 0xe5, 0x8c, 0xf6, 0x2d, 0xb9, 0xe5, 0x7c, 0x9f, 0x13, 0xd3, 0x6d, 0x64, 0x7b, 0x4e, 0x67, 0x9c, 0x18, 0xac, 0x10, 0xf7, 0x4c, 0xf9, 0x3a, 0x66, 0x5a, 0x56, 0x77, 0x86, 0x15, 0xfb, 0x3d, 0x90, 0xef, 0x96, 0x57, 0xff, 0xaf, 0x9a, 0x4b, 0x8b, 0xcc, 0xab, 0xd5, 0x3f, 0xdb, 0x45, 0xc7, 0xaa, 0xa6, 0xeb, 0x28, 0x37, 0x18, 0x2b, 0x2c, 0x7f, 0x13, 0xe5, 0x4e, 0xbd, 0xdc, 0xe1, 0x6e, 0x20, 0xfe, 0xb8, 0xa1, 0x84, 0xfc, 0x26, 0x50, 0xbf, 0x97, 0x5a, 0x9a, 0xb7, 0xb8, 0x35, 0xaf, 0x4c, 0xfe, 0x8b, 0xc2, 0x03, 0xd5, 0x05, 0x69, 0xc6, 0x28, 0x7b, 0x17, 0xa2, 0x0d, 0xc0, 0xbc, 0x4e, 0x6e, 0xae, 0xc0, 0xbc, 0x72, 0x9d, 0xb7, 0x61, 0x9b, 0xae, 0xeb, 0xb8, 0x77, 0x1b, 0xad, 0x3e, 0xb3, 0xb3, 0xd9, 0xeb, 0xb4, 0x74, 0x8c, 0xf8, 0x57, 0xbf, 0x19, 0x95, 0xed, 0x75, 0xb7, 0x66, 0x74, 0xb9, 0x6a, 0xd7, 0xcd, 0x5c, 0xba, 0xba, 0x94, 0xd7, 0x65, 0xdf, 0x54, 0x6a, 0x99, 0xec, 0x8f, 0xbf, 0x85, 0xad, 0xe0, 0x2f, 0x2b, 0x77, 0x51, 0xba, 0x21, 0xb1, 0x5c, 0xaf, 0x17, 0xd7, 0xa3, 0xb2, 0x72, 0x0c, 0xb3, 0xf2, 0x62, 0x19, 0xd8, 0x7f, 0x56, 0x92, 0x73, 0x79, 0x99, 0x70, 0x63, 0x76, 0xa8, 0x1f, 0x79, 0x7a, 0x50, 0xdf, 0xc8, 0x95, 0x9b, 0xc2, 0x2a, 0x5c, 0xf7, 0xa1, 0xed, 0x25, 0xb8, 0xbb, 0x7b, 0x7d, 0x94, 0x64, 0xc7, 0xab, 0xfa, 0xc7, 0xab, 0xfe, 0x5f, 0xdb, 0xf6, 0x32, 0x53, 0xd5, 0x8e, 0xf7, 0x8e, 0xd1, 0x8d, 0xe2, 0xef, 0x5c, 0xa6, 0xc9, 0x3f, 0x4f, 0xb5, 0xe1, 0x68, 0xe6, 0x93, 0xbd, 0xa4, 0xfd, 0xac, 0xf8, 0x01, 0x5f, 0x65, 0x1e, 0xf3, 0xec, 0x08, 0xc6, 0x3f, 0xb2, 0x38, 0x33, 0xaa, 0x56, 0x21, 0xe9, 0x6d, 0xce, 0x9b, 0xa6, 0x56, 0xb5, 0xc0, 0x2e, 0x4e, 0xca, 0xe1, 0x38, 0x8c, 0x1a, 0x3b, 0x11, 0x8a, 0x3d, 0x9d, 0xb2, 0x87, 0xc4, 0x07, 0x8e, 0x0b, 0x89, 0x3d, 0xee, 0x00, 0x3d, 0x90, 0x08, 0x58, 0xf8, 0x23, 0x22, 0xe9, 0x26, 0xf3, 0xc6, 0x77, 0xde, 0xd0, 0x2b, 0x36, 0x66, 0xf7, 0x5a, 0xcd, 0xd0, 0xa8, 0x2c, 0x73, 0x4f, 0xaa, 0x2e, 0x68, 0x99, 0x55, 0xa0, 0x4c, 0x62, 0xe3, 0x51, 0x2b, 0xfb, 0x2a, 0x6c, 0xc1, 0x07, 0xb4, 0x42, 0x5b, 0x74, 0x6a, 0x57, 0x75, 0xde, 0x70, 0xff, 0x79, 0x25, 0x58, 0xe8, 0x14, 0xa7, 0x69, 0xdd, 0x26, 0xac, 0xe1, 0xc3, 0x5b, 0x15, 0x31, 0x5a, 0xf4, 0xad, 0xae, 0x0d, 0xd7, 0xf0, 0xb3, 0x05, 0x23, 0x90, 0x88, 0xeb, 0x79, 0x94, 0x5c, 0x87, 0xef, 0x09, 0xab, 0xd4, 0xea, 0xe3, 0x87, 0xfb, 0x78, 0x88, 0x13, 0x75, 0x13, 0xe8, 0x0e, 0x93, 0x49, 0x4e, 0x86, 0xd5, 0x2b, 0xf6, 0xd2, 0x6d, 0x33, 0xe3, 0x67, 0xdb, 0x76, 0x6c, 0xda, 0x78, 0xdb, 0x9b, 0x9a, 0x9a, 0x4c, 0x56, 0x83, 0x9c, 0x1d, 0x8e, 0x52, 0xf5, 0x63, 0x5e, 0x6f, 0xfc, 0x3e, 0x9f, 0xe8, 0xb4, 0x1a, 0xed, 0x1d, 0xfd, 0xdd, 0x3d, 0x07, 0x87, 0x13, 0xbc, 0xba, 0x87, 0x00, 0x0c, 0x0c, 0x62, 0x8c, 0xf8, 0xba, 0xd0, 0xaf, 0xf0, 0x95, 0x79, 0x9d, 0xb7, 0x12, 0x51, 0x77, 0x21, 0x77, 0xf5, 0x2a, 0xa3, 0x3a, 0x01, 0xf6, 0x65, 0xaf, 0xde, 0x1a, 0xdc, 0x10, 0xad, 0xa8, 0x59, 0xb2, 0x5f, 0x7b, 0x2e, 0xa8, 0xe9, 0xb3, 0xf9, 0x2f, 0x5e, 0x72, 0x30, 0x6a, 0xfc, 0xb0, 0x97, 0x27, 0x4f, 0x08, 0x59, 0xec, 0x70, 0x90, 0x2f, 0x5e, 0x4e, 0x1a, 0xea, 0xc5, 0x53, 0x08, 0xda, 0x38, 0xc4, 0x57, 0xe3, 0x1a, 0xfa, 0xc5, 0xdf, 0xa6, 0x79, 0x25, 0xc4, 0x7f, 0x6a, 0x38, 0xf9, 0x94, 0x01, 0x27, 0xf7, 0x67, 0xab, 0xde, 0x3e, 0x69, 0x8e, 0x8a, 0xf3, 0xe0, 0x16, 0x3d, 0xd4, 0xa6, 0xcb, 0x11, 0x8d, 0xef, 0x3a, 0x85, 0x07, 0xbf, 0x11, 0x72, 0x9c, 0xda, 0x26, 0x7c, 0x32, 0xd5, 0x8f, 0x07, 0xdf, 0x06, 0x4d, 0x84, 0xf4, 0xc3, 0x85, 0x12, 0xf6, 0xce, 0x67, 0xb8, 0x43, 0x89, 0x7e, 0xc8, 0x50, 0x22, 0x9a, 0x04, 0x3f, 0x95, 0xd2, 0x84, 0xd9, 0x28, 0x5a, 0xc5, 0x8e, 0xe7, 0x3b, 0x12, 0x54, 0xc9, 0x15, 0x49, 0x29, 0x20, 0x0a, 0x9c, 0x33, 0x4c, 0x1a, 0xb6, 0x29, 0x0e, 0x25, 0xb9, 0x1c, 0x01, 0xfb, 0x72, 0xf3, 0xbc, 0xfd, 0x9e, 0x53, 0x22, 0xb4, 0xf4, 0x9c, 0x40, 0xd9, 0x15, 0xf2, 0x41, 0x20, 0xd8, 0xab, 0x23, 0x6d, 0xa7, 0x6c, 0x22, 0xf4, 0x73, 0x78, 0x59, 0x12, 0xe2, 0xa8, 0x65, 0x0a, 0xd5, 0x0e, 0x7a, 0xf7, 0xc3, 0xcb, 0x29, 0x96, 0x81, 0x4c, 0x55, 0xb7, 0xad, 0xa6, 0x1f, 0x75, 0xd7, 0x51, 0x1f, 0x78, 0xda, 0xb3, 0x7a, 0x05, 0xbe, 0x08, 0x5b, 0xc6, 0x74, 0xb7, 0xb7, 0xbb, 0xcf, 0x8b, 0x6a, 0x30, 0x09, 0xfe, 0x0b, 0x66, 0x43, 0xd9, 0xb6, 0x95, 0x26, 0xda, 0x11, 0xc0, 0xad, 0xa2, 0xf0, 0xf7, 0xb0, 0xaa, 0x94, 0x83, 0x3b, 0x53, 0xda, 0xf5, 0x29, 0x98, 0x4e, 0x00, 0xe7, 0xa7, 0x23, 0x57, 0x84, 0x68, 0x8d, 0x18, 0x61, 0xbd, 0x9c, 0x5e, 0x2c, 0x89, 0x0b, 0xbf, 0xf1, 0x00, 0x7a, 0xee, 0x6f, 0x8e, 0x5b, 0xce, 0x7a, 0x2b, 0xe3, 0x8b, 0xb9, 0x21, 0xa5, 0xec, 0x47, 0x51, 0x31, 0x83, 0x13, 0x56, 0x5c, 0x2b, 0xd4, 0x1b, 0x9b, 0xbd, 0xb6, 0x55, 0x15, 0x77, 0x7d, 0x8e, 0x01, 0xbd, 0x36, 0x4d, 0xcd, 0x06, 0x23, 0x33, 0xde, 0x16, 0x4e, 0xe3, 0x0f, 0x3a, 0x3d, 0x5e, 0x9f, 0xc2, 0xaa, 0xae, 0xd6, 0x5b, 0x93, 0x9e, 0x47, 0xf2, 0x13, 0x11, 0x16, 0xfe, 0xf8, 0xee, 0x27, 0x94, 0x99, 0x55, 0x9c, 0x12, 0xfd, 0xe5, 0xbc, 0xeb, 0x98, 0x46, 0x15, 0x38, 0x3f, 0x0d, 0xc7, 0x7c, 0xa7, 0xf6, 0x7c, 0x91, 0xab, 0x65, 0x2f, 0xf5, 0x16, 0xce, 0xf7, 0x6f, 0x55, 0x0f, 0x1a, 0xcf, 0x28, 0xbe, 0x11, 0x42, 0x9e, 0x69, 0xd2, 0x21, 0x34, 0x97, 0x4b, 0xff, 0xf1, 0x6e, 0xd5, 0x70, 0xab, 0x29, 0x48, 0x3e, 0xb7, 0x61, 0x85, 0xf0, 0x72, 0x3d, 0x27, 0x74, 0xad, 0x16, 0xab, 0x21, 0x5b, 0xfb, 0xc3, 0x66, 0xf1, 0x08, 0xe5, 0x5f, 0x2d, 0xf4, 0x48, 0x46, 0xa4, 0x78, 0x88, 0x9d, 0xad, 0x57, 0x63, 0x3e, 0x31, 0xac, 0xec, 0x94, 0xcc, 0xe2, 0xe9, 0xd9, 0x37, 0x1b, 0xb1, 0x09, 0x87, 0x7a, 0x66, 0x09, 0x46, 0x3f, 0x15, 0xb6, 0xf6, 0xc0, 0x88, 0xb8, 0xf4, 0xca, 0x68, 0xdb, 0x83, 0x7f, 0xe9, 0xc6, 0x11, 0xea, 0x5e, 0xba, 0x0e, 0x3f, 0x6f, 0x53, 0xbb, 0x28, 0xd9, 0xbd, 0x0e, 0xe4, 0x4f, 0x9f, 0xa5, 0x9e, 0xfc, 0x7b, 0x9b, 0x4b, 0xc2, 0x5e, 0x7c, 0x3f, 0xca, 0xf6, 0x5a, 0x16, 0x81, 0x86, 0x45, 0x75, 0x10, 0x03, 0x1d, 0xbb, 0xba, 0xe8, 0x4a, 0xd0, 0x5e, 0x94, 0xac, 0x1a, 0xc8, 0xad, 0xa0, 0x5b, 0x6a, 0xb3, 0xae, 0xaa, 0x66, 0xc3, 0x39, 0x47, 0x51, 0x35, 0x4d, 0x8f, 0xaa, 0xb1, 0x65, 0x44, 0x64, 0x9a, 0xab, 0x0a, 0x53, 0x3d, 0x54, 0xb7, 0x01, 0x74, 0xa5, 0xe1, 0xbe, 0xec, 0xd7, 0x29, 0x95, 0x5e, 0xe7, 0x26, 0x2a, 0x2a, 0x40, 0xaa, 0xc5, 0x69, 0x3d, 0xa0, 0x78, 0x1a, 0xaf, 0xfb, 0x57, 0xd4, 0x6c, 0xdd, 0x5e, 0x5f, 0x27, 0x57, 0x35, 0xca, 0xe2, 0x76, 0x7b, 0x42, 0xea, 0x90, 0x37, 0x58, 0xb0, 0x7b, 0x6e, 0xa8, 0xd7, 0xaa, 0x7a, 0x55, 0x0f, 0x8c, 0x0a, 0xc6, 0x5b, 0x54, 0x7c, 0x95, 0x4b, 0xa7, 0xbe, 0xb0, 0x7a, 0x08, 0xc7, 0xfb, 0x58, 0x8d, 0xac, 0x79, 0xb1, 0xf9, 0x4a, 0x88, 0x61, 0x9e, 0xb5, 0x72, 0x95, 0xe2, 0x37, 0x13, 0x2d, 0x9a, 0xc2, 0x38, 0xf2, 0xca, 0xe4, 0xe7, 0x59, 0x75, 0xb8, 0x0f, 0xf7, 0x9b, 0xd2, 0x77, 0xfd, 0x8a, 0x70, 0xd5, 0x75, 0xd3, 0x6d, 0x6e, 0xc1, 0x52, 0x71, 0x28, 0xbd, 0x28, 0xf0, 0xbe, 0xef, 0x04, 0x1d, 0x5b, 0x65, 0x7c, 0x37, 0x7d, 0xed, 0x62, 0xea, 0xcd, 0x97, 0xea, 0xa0, 0x2b, 0x6a, 0xea, 0xfd, 0xa0, 0x3a, 0x73, 0xf1, 0xf2, 0x87, 0x3b, 0x5c, 0x06, 0x38, 0xa8, 0x93, 0xe6, 0x10, 0xda, 0xaf, 0x63, 0x99, 0x9e, 0x4f, 0x13, 0xa7, 0x36, 0xb3, 0x55, 0xe7, 0xc1, 0xfe, 0xd1, 0x3c, 0x78, 0x25, 0xdd, 0x2a, 0xb8, 0x2e, 0xfc, 0x6d, 0xfb, 0x0d, 0x92, 0xe3, 0xd9, 0x29, 0xeb, 0x0a, 0x11, 0x2d, 0x9f, 0xcb, 0x20, 0x18, 0xb1, 0x32, 0xfe, 0x2e, 0xc8, 0x2e, 0x3a, 0x64, 0x1b, 0xdb, 0xfb, 0x38, 0x6f, 0x36, 0x71, 0x9c, 0x8c, 0x2d, 0x7f, 0x9c, 0xf8, 0x89, 0xda, 0x35, 0xf6, 0x9b, 0x8f, 0xe3, 0x17, 0xa0, 0x7b, 0x95, 0x1f, 0xaf, 0xac, 0xa8, 0x5d, 0x60, 0xb1, 0x08, 0xb1, 0x8c, 0x42, 0xc2, 0x97, 0xf3, 0x70, 0x1a, 0xf9, 0x91, 0xa3, 0x77, 0x65, 0x73, 0x63, 0x91, 0x65, 0x81, 0xa9, 0x39, 0x7f, 0x06, 0xb9, 0x87, 0x4f, 0xbd, 0x92, 0x52, 0x28, 0xb3, 0x96, 0xed, 0x76, 0xfb, 0x25, 0x9c, 0x3c, 0x01, 0xf1, 0x61, 0xab, 0x6d, 0xc2, 0x0f, 0x52, 0xfa, 0x2e, 0xcf, 0xc8, 0xa4, 0xf0, 0xfc, 0xfa, 0x2d, 0x4a, 0x2e, 0xf4, 0xe3, 0xd6, 0xef, 0x92, 0xf0, 0x6a, 0xe2, 0x35, 0x18, 0xf9, 0xc7, 0x22, 0x99, 0x26, 0x0d, 0x65, 0x61, 0x7f, 0xb1, 0x66, 0x4d, 0xa0, 0xc5, 0x81, 0xd9, 0x95, 0x84, 0xa3, 0x2b, 0x55, 0x95, 0xff, 0x2b, 0xc7, 0xd8, 0xac, 0x87, 0x1c, 0x8c, 0xb2, 0x9a, 0xdf, 0x77, 0x59, 0xd4, 0xf3, 0x55, 0x96, 0xfe, 0x92, 0xec, 0x57, 0x1f, 0xca, 0x6c, 0xb7, 0xdd, 0x68, 0x30, 0x72, 0xe5, 0x06, 0x68, 0x59, 0xef, 0xe7, 0xd4, 0x98, 0x19, 0x76, 0x49, 0x1f, 0x71, 0xbe, 0x91, 0x94, 0x8f, 0x60, 0x95, 0x5b, 0x8a, 0xd2, 0x67, 0x87, 0x5b, 0x3c, 0x46, 0x79, 0x3f, 0x67, 0x1d, 0x5c, 0x2a, 0xec, 0x6b, 0x53, 0xd7, 0x6e, 0x4d, 0xbd, 0x92, 0x15, 0xe0, 0xf7, 0xe4, 0x27, 0x8e, 0xdc, 0x3f, 0xde, 0x4a, 0xa0, 0xbb, 0x28, 0x8f, 0xdc, 0x5f, 0x7d, 0x6b, 0xd8, 0xd5, 0x22, 0x74, 0x01, 0xf0, 0xbb, 0xde, 0x57, 0x48, 0x9d, 0xda, 0x48, 0xf2, 0x0c, 0xcd, 0x47, 0xc8, 0xe6, 0x7b, 0xdb, 0x21, 0xe3, 0x63, 0x62, 0xd1, 0x5a, 0xc1, 0x26, 0x9d, 0x7c, 0xcb, 0x0e, 0x13, 0x63, 0x42, 0x27, 0xa5, 0xdb, 0x11, 0x51, 0xa2, 0xea, 0xaf, 0x52, 0xd6, 0x75, 0x07, 0x57, 0x94, 0xab, 0xc1, 0x08, 0xb1, 0xd5, 0xc3, 0x2e, 0x4a, 0xad, 0x23, 0xcd, 0x3b, 0xb7, 0x94, 0xef, 0xeb, 0x50, 0xdc, 0x17, 0x04, 0x73, 0x1e, 0x8e, 0x4d, 0x9a, 0x52, 0x88, 0xf6, 0x92, 0xe2, 0x92, 0x93, 0xfa, 0xab, 0xd0, 0x5f, 0xad, 0x7e, 0x30, 0x42, 0xc8, 0xfa, 0x7e, 0x1a, 0x37, 0x06, 0x5e, 0x1a, 0xbb, 0x03, 0xab, 0x87, 0x4e, 0x95, 0xc6, 0x2f, 0x06, 0xf5, 0xed, 0x02, 0xcd, 0x7a, 0xe2, 0x14, 0xdc, 0x0d, 0x99, 0x3d, 0x90, 0xbb, 0x98, 0x3f, 0xfe, 0x4b, 0xfb, 0xb5, 0x20, 0xea, 0x20, 0x86, 0x09, 0x4f, 0x7a, 0x0a, 0xae, 0x37, 0x72, 0xe8, 0xf0, 0x19, 0x5b, 0x0c, 0x67, 0x34, 0x9f, 0x0f, 0x46, 0xbf, 0x2c, 0xbc, 0xa9, 0xbd, 0xef, 0x65, 0xc1, 0x12, 0xb6, 0xb2, 0xd3, 0x7b, 0xb6, 0xa7, 0xd6, 0x6b, 0x75, 0xef, 0xaf, 0x43, 0xa9, 0xbd, 0x26, 0x5c, 0x90, 0x10, 0x8a, 0x12, 0xc5, 0x4c, 0x0c, 0xad, 0x1b, 0x89, 0x37, 0x9f, 0x05, 0xb6, 0x1b, 0x4e, 0xf4, 0x8c, 0x6d, 0x8f, 0x55, 0x5b, 0x7b, 0xc6, 0xad, 0x4f, 0x2b, 0x6f, 0x57, 0x88, 0xec, 0xe7, 0x4c, 0x00, 0x19, 0xec, 0x6c, 0xcd, 0xa9, 0xca, 0xf7, 0x42, 0x30, 0x5e, 0x90, 0x2a, 0xda, 0x4e, 0x6e, 0x70, 0xb1, 0x90, 0x71, 0xdd, 0xda, 0xc1, 0x0f, 0x87, 0x95, 0x87, 0xb5, 0x5a, 0x7e, 0x1a, 0x08, 0xf2, 0x97, 0xb0, 0x1e, 0x84, 0x12, 0x7d, 0x4a, 0xbe, 0x10, 0x46, 0xc7, 0xf4, 0x46, 0xea, 0x34, 0x5e, 0xb1, 0x19, 0x35, 0x0f, 0xea, 0xbc, 0xc1, 0x6c, 0xdb, 0xc1, 0x3a, 0x9f, 0xc2, 0xca, 0xe2, 0x0c, 0x1e, 0xe8, 0x1e, 0xd3, 0x1f, 0x88, 0x1d, 0x81, 0xaa, 0xbd, 0xb3, 0x01, 0xbb, 0x15, 0x4e, 0x42, 0xc8, 0xec, 0xc0, 0x81, 0x97, 0x23, 0x3b, 0x9f, 0xeb, 0x23, 0xc1, 0xb5, 0x7b, 0x5a, 0xcb, 0xa9, 0x26, 0x77, 0xf5, 0x5a, 0x3f, 0xdd, 0xc6, 0x8e, 0xd1, 0x88, 0x65, 0x45, 0xdb, 0x52, 0x9d, 0x4c, 0x19, 0xf1, 0x56, 0xf9, 0xe8, 0x5a, 0xfd, 0x58, 0xd1, 0x8c, 0x1d, 0xac, 0x48, 0x92, 0x72, 0xf8, 0x8b, 0x1b, 0x0b, 0xd2, 0xeb, 0x66, 0x17, 0x68, 0x35, 0x83, 0xf2, 0x23, 0x0f, 0x16, 0x5b, 0xbe, 0x57, 0x96, 0xdf, 0xb8, 0x8d, 0xb8, 0x62, 0x61, 0xd0, 0x7c, 0xf8, 0x16, 0x3b, 0x79, 0x35, 0x52, 0x2b, 0xa6, 0x46, 0xbb, 0x3e, 0x2c, 0x29, 0xe9, 0xff, 0x29, 0x94, 0x63, 0xa6, 0x77, 0x9b, 0xcb, 0x20, 0x6e, 0x30, 0x10, 0x4a, 0xb6, 0x5a, 0xf2, 0xe1, 0x84, 0x8a, 0x5e, 0xf8, 0x4e, 0x44, 0x5b, 0xf0, 0xdc, 0x48, 0xf2, 0x0e, 0xe8, 0xbd, 0xe2, 0xeb, 0x1e, 0xcd, 0xcd, 0x37, 0x27, 0xab, 0xc2, 0x52, 0xf7, 0x6d, 0xd1, 0xb1, 0xf1, 0x92, 0xc7, 0xa7, 0xab, 0x25, 0xd4, 0x62, 0xf0, 0x0c, 0x84, 0x99, 0x92, 0x97, 0xad, 0x7c, 0x43, 0xad, 0x1b, 0x8d, 0x5e, 0xbf, 0x51, 0x6a, 0xaf, 0x3e, 0x0a, 0xe6, 0xc3, 0xe8, 0x23, 0x07, 0x61, 0xb2, 0x95, 0x8e, 0x6c, 0x38, 0xe2, 0xa8, 0x02, 0xa5, 0x8f, 0x96, 0xef, 0x59, 0xac, 0x57, 0x08, 0x0d, 0x09, 0x06, 0xd5, 0x05, 0x8f, 0x9b, 0x0b, 0x95, 0x6c, 0xea, 0x4f, 0x2a, 0x55, 0x8e, 0xa1, 0x75, 0x01, 0x6e, 0xa4, 0xe4, 0xc5, 0xb8, 0x4c, 0xe6, 0xa4, 0x42, 0x66, 0x6d, 0x05, 0x64, 0x71, 0xe9, 0x72, 0x38, 0x57, 0x48, 0x65, 0xfe, 0x1d, 0x28, 0x6a, 0xc6, 0x3a, 0x9b, 0x24, 0xf4, 0xdf, 0x9b, 0xe4, 0x85, 0xd8, 0x1a, 0x19, 0xdd, 0x1f, 0x62, 0xf3, 0x79, 0xcd, 0xda, 0xc1, 0x46, 0xe5, 0xaa, 0x33, 0xba, 0x7e, 0x7a, 0xe5, 0xbd, 0x28, 0xf4, 0x0f, 0x12, 0xaa, 0xc2, 0x9a, 0xd2, 0x85, 0xb8, 0x0a, 0x67, 0xa6, 0x17, 0x5e, 0x0d, 0x99, 0x13, 0xd7, 0x0d, 0xcd, 0xdd, 0xe7, 0xad, 0x5e, 0x4d, 0x3a, 0xd0, 0xd2, 0xa8, 0xa2, 0xff, 0xdd, 0xad, 0x21, 0xe2, 0x62, 0x5f, 0xd1, 0x79, 0xbc, 0x32, 0xb3, 0xb2, 0x62, 0x9a, 0xba, 0xa9, 0xb9, 0x45, 0x5a, 0x6b, 0x17, 0x7d, 0xd0, 0xfa, 0x0d, 0x06, 0xec, 0x26, 0x9e, 0xf0, 0x7a, 0x7e, }; // Test exploding data with literal tree and large window. test "explode_hamlet_8192" { var dst: [8192]u8 = undefined; var src_used: usize = 0; try expect((try implode.hwexplode( &hamlet_8192, hamlet_8192.len, 8192, true, //large_wnd true, //lit_tree false, //pk101_bug_compat &src_used, &dst, )) == implode.explode_stat_t.HWEXPLODE_OK); try expect(src_used == hamlet_8192.len); try expect(mem.eql(u8, dst[0..8192], hamlet[0..8192])); } test "explode_too_short_src" { var dst: [8192]u8 = undefined; var src_used: usize = 0; var i: usize = 0; i = hamlet_256.len - 1; while (i < hamlet_256.len) : (i -%= 1) { try expect((try implode.hwexplode( &hamlet_256, i, 256, false, //large_wnd false, //lit_tree false, //pk101_bug_compat &src_used, &dst, )) == implode.explode_stat_t.HWEXPLODE_ERR); } i = hamlet_8192.len - 1; while (i < hamlet_8192.len) : (i -%= 1) { try expect((try implode.hwexplode( &hamlet_8192, i, 8192, true, //large_wnd true, //lit_tree false, //pk101_bug_compat &src_used, &dst, )) == implode.explode_stat_t.HWEXPLODE_ERR); } } test "explode_implicit_zeros" { var src: [2048]u8 = undefined; var dst: [5]u8 = undefined; var os: bs.ostream_t = undefined; var i: usize = 0; var src_sz: usize = 0; var src_used: usize = 0; bs.ostream_init(&os, &src, src.len); // (No lit tree.) // Length tree: all 64 symbols use 6 bits. _ = bs.ostream_write(&os, 64 - 1, 8); i = 0; while (i < 64) : (i += 1) { _ = bs.ostream_write(&os, (0 << 4) | (6 - 1), 8); } // Distance tree: all 64 symbols use 6 bits. _ = bs.ostream_write(&os, 64 - 1, 8); i = 0; while (i < 64) : (i += 1) { _ = bs.ostream_write(&os, (0 << 4) | (6 - 1), 8); } // Some literals. _ = bs.ostream_write(&os, ('1' << 1) | 1, 9); _ = bs.ostream_write(&os, ('2' << 1) | 1, 9); // A backref: dist 10, len 3 (using small window) _ = bs.ostream_write(&os, 0, 1); // Backref marker. _ = bs.ostream_write(&os, 10 - 1, 6); // Dist: 10. _ = bs.ostream_write(&os, bits_utils.lsb(~@as(u16, 0), 6), 6); // Huffman coded high dist bits. _ = bs.ostream_write(&os, bits_utils.reverse16(~@as(u16, 3 - 2), 6), 6); // Huff. len src_sz = bs.ostream_bytes_written(&os); // Check the expected output. try expect((try implode.hwexplode( &src, src_sz, dst.len, false, false, false, &src_used, &dst, )) == implode.explode_stat_t.HWEXPLODE_OK); try expect(dst[0] == '1'); try expect(dst[1] == '2'); try expect(dst[2] == 0x0); try expect(dst[3] == 0x0); try expect(dst[4] == 0x0); } test "explode_too_few_codeword_lens" { var src: [2048]u8 = undefined; var dst: [10]u8 = undefined; var os: bs.ostream_t = undefined; var i: usize = 0; var src_sz: usize = 0; var src_used: usize = 0; bs.ostream_init(&os, &src, src.len); // (No lit tree.) // Length tree: all 64 symbols use 6 bits. _ = bs.ostream_write(&os, 64 - 1, 8); i = 0; while (i < 64) : (i += 1) { _ = bs.ostream_write(&os, (0 << 4) | (6 - 1), 8); } // Distance tree: but only with 63 symbols use 6 bits. _ = bs.ostream_write(&os, 63 - 1, 8); i = 0; while (i < 63) : (i += 1) { _ = bs.ostream_write(&os, (0 << 4) | (6 - 1), 8); } src_sz = bs.ostream_bytes_written(&os); try expect((try implode.hwexplode( &src, src_sz, dst.len, false, false, false, &src_used, &dst, )) == implode.explode_stat_t.HWEXPLODE_ERR); } test "explode_too_many_codeword_lens" { var src: [2048]u8 = undefined; var dst: [10]u8 = undefined; var os: bs.ostream_t = undefined; var i: usize = 0; var src_sz: usize = 0; var src_used: usize = 0; bs.ostream_init(&os, &src, src.len); // (No lit tree.) // Length tree: all 64 symbols use 6 bits. _ = bs.ostream_write(&os, 64 - 1, 8); i = 0; while (i < 64) : (i += 1) { _ = bs.ostream_write(&os, (0 << 4) | (6 - 1), 8); } // Distance tree: but the run-lengths make for too many symbols. _ = bs.ostream_write(&os, 64 - 1, 8); i = 0; while (i < 63) : (i += 1) { _ = bs.ostream_write(&os, (3 << 4) | (6 - 1), 8); } src_sz = bs.ostream_bytes_written(&os); try expect((try implode.hwexplode( &src, src_sz, dst.len, false, false, false, &src_used, &dst, )) == implode.explode_stat_t.HWEXPLODE_ERR); } test "explode_bad_huffman_trees" { var src: [2048]u8 = undefined; var dst: [10]u8 = undefined; var os: bs.ostream_t = undefined; var i: usize = 0; var src_sz: usize = 0; var src_used: usize = 0; bs.ostream_init(&os, &src, src.len); // (No lit tree.) // Length tree: all 64 symbols use 6 bits. _ = bs.ostream_write(&os, 64 - 1, 8); i = 0; while (i < 64) : (i += 1) { _ = bs.ostream_write(&os, (0 << 4) | (6 - 1), 8); } // Distance tree: try to use 64 5-bit symbols. _ = bs.ostream_write(&os, 64 - 1, 8); i = 0; while (i < 64) : (i += 1) { _ = bs.ostream_write(&os, (0 << 4) | (5 - 1), 8); } src_sz = bs.ostream_bytes_written(&os); try expect((try implode.hwexplode( &src, src_sz, dst.len, false, false, false, &src_used, &dst, )) == implode.explode_stat_t.HWEXPLODE_ERR); bs.ostream_init(&os, &src, src.len); // (No lit tree.) // Length tree: all 64 symbols use 6 bits. _ = bs.ostream_write(&os, 64 - 1, 8); i = 0; while (i < 64) : (i += 1) { _ = bs.ostream_write(&os, (0 << 4) | (6 - 1), 8); } // Distance tree: try to use 64 7-bit symbols. _ = bs.ostream_write(&os, 64 - 1, 8); i = 0; while (i < 64) : (i += 1) { _ = bs.ostream_write(&os, (0 << 4) | (7 - 1), 8); } src_sz = bs.ostream_bytes_written(&os); try expect((try implode.hwexplode( &src, src_sz, dst.len, false, false, false, &src_used, &dst, )) == implode.explode_stat_t.HWEXPLODE_ERR); } test "explode_too_long_backref" { var src: [2048]u8 = undefined; var dst: [10]u8 = undefined; var os: bs.ostream_t = undefined; var i: usize = 0; var src_sz: usize = 0; var src_used: usize = 0; bs.ostream_init(&os, &src, src.len); // (No lit tree.) // Length tree: all 64 symbols use 6 bits. _ = bs.ostream_write(&os, 64 - 1, 8); i = 0; while (i < 64) : (i += 1) { _ = bs.ostream_write(&os, (0 << 4) | (6 - 1), 8); } // Distance tree: all 64 symbols use 6 bits. _ = bs.ostream_write(&os, 64 - 1, 8); i = 0; while (i < 64) : (i += 1) { _ = bs.ostream_write(&os, (0 << 4) | (6 - 1), 8); } // Some literals. _ = bs.ostream_write(&os, ('f' << 1) | 1, 9); _ = bs.ostream_write(&os, ('a' << 1) | 1, 9); _ = bs.ostream_write(&os, ('l' << 1) | 1, 9); _ = bs.ostream_write(&os, ('a' << 1) | 1, 9); // A backref: dist 2, len 6 (using small window) _ = bs.ostream_write(&os, 0, 1); // Backref marker. _ = bs.ostream_write(&os, 2 - 1, 6); // Dist: 2. _ = bs.ostream_write(&os, bits_utils.lsb(~@as(u16, 0), 6), 6); // Huffman coded high dist bits. _ = bs.ostream_write(&os, bits_utils.reverse16(~@as(u16, 6 - 2), 6), 6); // Huff. len src_sz = bs.ostream_bytes_written(&os); // Check the expected output. try expect((try implode.hwexplode( &src, src_sz, dst.len, false, false, false, &src_used, &dst, )) == implode.explode_stat_t.HWEXPLODE_OK); try expect(dst[0] == 'f'); try expect(dst[1] == 'a'); try expect(dst[2] == 'l'); try expect(dst[3] == 'a'); try expect(dst[4] == 'l'); try expect(dst[5] == 'a'); try expect(dst[6] == 'l'); try expect(dst[7] == 'a'); try expect(dst[8] == 'l'); try expect(dst[9] == 'a'); // Not enough room to output the backref. try expect((try implode.hwexplode( &src, src_sz, dst.len - 1, false, false, false, &src_used, &dst, )) == implode.explode_stat_t.HWEXPLODE_ERR); } test "explode_pkz_101_bug_compat" { var src: [2048]u8 = undefined; var dst: [2 + (3 + 63 + 255)]u8 = undefined; var os: bs.ostream_t = undefined; var i: usize = 0; var src_sz: usize = 0; var src_used: usize = 0; bs.ostream_init(&os, &src, src.len); // Length tree: all 64 symbols use 6 bits. _ = bs.ostream_write(&os, 64 - 1, 8); i = 0; while (i < 64) : (i += 1) { _ = bs.ostream_write(&os, (0 << 4) | (6 - 1), 8); } // Distance tree: all 64 symbols use 6 bits. _ = bs.ostream_write(&os, 64 - 1, 8); i = 0; while (i < 64) : (i += 1) { _ = bs.ostream_write(&os, (0 << 4) | (6 - 1), 8); } // Literals. _ = bs.ostream_write(&os, ('x' << 1) | 1, 9); _ = bs.ostream_write(&os, ('x' << 1) | 1, 9); // Backref with maximum length. // Because of pkz_101_bug_compat, the maximum length is one byte longer // than normal in non-lit_tree mode. It seems PKZip 1.01/1.02 don't // actually handle backrefs with this max length, but we should handle // it in case it ever occurs. _ = bs.ostream_write(&os, 0x0, 1); // Backref marker. _ = bs.ostream_write(&os, 2 - 1, 7); // Dist: 2 (large wnd => 7 bits). _ = bs.ostream_write(&os, bits_utils.lsb(~@as(u16, 0), 6), 6); // Huffman coded high dist bits. _ = bs.ostream_write(&os, 0x0, 6); // Huff. len (max) _ = bs.ostream_write(&os, 0xff, 8); // Extra len byte src_sz = bs.ostream_bytes_written(&os); try expect((try implode.hwexplode( &src, src_sz, dst.len, true, //large_wnd=true false, //lit_tree=false true, //pkz_101_bug_compat=true &src_used, &dst, )) == implode.explode_stat_t.HWEXPLODE_OK); try expect(src_used == src_sz); i = 0; while (i < dst.len) : (i += 1) { try expect(dst[i] == 'x'); } } fn roundtrip( src: [*]const u8, src_len: usize, large_wnd: bool, lit_tree: bool, ) !void { var compressed: [*]u8 = undefined; var uncompressed: [*]u8 = undefined; var compressed_cap: usize = 0; var compressed_size: usize = 0; var compressed_used: usize = 0; compressed_cap = src_len * 2 + 500; var compressed_mem = try allocator.alloc(u8, compressed_cap); compressed = compressed_mem.ptr; var uncompressed_mem = try allocator.alloc(u8, src_len); uncompressed = uncompressed_mem.ptr; try expect(implode.hwimplode( src, src_len, large_wnd, lit_tree, compressed, compressed_cap, &compressed_size, )); try expect((try implode.hwexplode( compressed, compressed_size, src_len, large_wnd, lit_tree, false, &compressed_used, uncompressed, )) == implode.explode_stat_t.HWEXPLODE_OK); try expect(compressed_used == compressed_size); try expect(mem.eql(u8, uncompressed[0..src_len], src[0..src_len])); allocator.free(compressed_mem); allocator.free(uncompressed_mem); } test "implode_roundtrip_empty" { const src: [1]u8 = undefined; // pointer to outside allowed memory, expecting no one reads it var dummy_pointer: [*]u8 = @intToPtr([*]u8, @ptrToInt(&src[0]) + 8); try roundtrip(dummy_pointer, 0, false, false); try roundtrip(dummy_pointer, 0, false, true); try roundtrip(dummy_pointer, 0, true, false); try roundtrip(dummy_pointer, 0, true, true); } test "implode_roundtrip_basic" { var src = "It was the best of times, it was the worst of times."; try roundtrip(src, src.len, false, false); try roundtrip(src, src.len, false, true); try roundtrip(src, src.len, true, false); try roundtrip(src, src.len, true, true); } test "implode_roundtrip_hamlet" { try roundtrip(hamlet, hamlet.len, false, false); try roundtrip(hamlet, hamlet.len, false, true); try roundtrip(hamlet, hamlet.len, true, false); try roundtrip(hamlet, hamlet.len, true, true); } test "implode_roundtrip_long_backref" { // Use 100 a's to hit case where an extra byte is used to encode the backref length. const src = [1]u8{'a'} ** 100; try roundtrip(&src, src.len, false, false); try roundtrip(&src, src.len, false, true); try roundtrip(&src, src.len, true, false); try roundtrip(&src, src.len, true, true); } test "implode_hamlet_size" { var compressed: [1024 * 512]u8 = undefined; var compressed_sz: usize = 0; var large_wnd: bool = undefined; var lit_tree: bool = undefined; // PKZIP 1.10 // pkzip -ex a.zip hamlet.txt // 88179 bytes (uses lit tree and large window) large_wnd = false; lit_tree = false; try expect(implode.hwimplode( hamlet, hamlet.len, large_wnd, lit_tree, &compressed, compressed.len, &compressed_sz, )); try expect(compressed_sz == 109248); large_wnd = false; lit_tree = true; try expect(implode.hwimplode( hamlet, hamlet.len, large_wnd, lit_tree, &compressed, compressed.len, &compressed_sz, )); try expect(compressed_sz == 90011); large_wnd = true; lit_tree = false; try expect(implode.hwimplode( hamlet, hamlet.len, large_wnd, lit_tree, &compressed, compressed.len, &compressed_sz, )); try expect(compressed_sz == 99224); large_wnd = true; lit_tree = true; try expect(implode.hwimplode( hamlet, hamlet.len, large_wnd, lit_tree, &compressed, compressed.len, &compressed_sz, )); try expect(compressed_sz == 85741); } test "implode_too_short_dst" { var dst: [8192]u8 = undefined; var large_wnd: bool = undefined; var lit_tree: bool = undefined; var comp_sz: usize = 0; var i: usize = 0; var tmp: usize = 0; large_wnd = false; lit_tree = false; try expect(implode.hwimplode(hamlet, 1024, large_wnd, lit_tree, &dst, dst.len, &comp_sz)); i = 0; while (i < comp_sz) : (i += 1) { try expect(!implode.hwimplode(hamlet, 1024, large_wnd, lit_tree, &dst, i, &tmp)); } large_wnd = false; lit_tree = true; try expect(implode.hwimplode(hamlet, 1024, large_wnd, lit_tree, &dst, dst.len, &comp_sz)); i = 0; while (i < comp_sz) : (i += 1) { try expect(!implode.hwimplode(hamlet, 1024, large_wnd, lit_tree, &dst, i, &tmp)); } }
src/implode_test.zig
const std = @import("std"); const lib = @import("lib.zig"); const meta = std.meta; const testing = std.testing; const Linker = lib.Linker; const Parser = lib.Parser; const Instruction = lib.Instruction; const HashMap = std.AutoArrayHashMapUnmanaged; const Allocator = std.mem.Allocator; const Interpreter = @This(); linker: Linker = .{}, module: u16 = 1, ip: u32 = 0, stack: Stack = .{}, indent: u16 = 0, should_indent: bool = false, last_is_newline: bool = true, const Stack = HashMap(u32, StackFrame); const StackFrame = struct { module: u16, ip: u32, indent: u16, }; const log = std.log.scoped(.vm); pub fn step(vm: *Interpreter, gpa: Allocator, comptime T: type, eval: T) !bool { const object = vm.linker.objects.items[vm.module - 1]; const opcode = object.program.items(.opcode); const data = object.program.items(.data); const index = vm.ip; vm.ip += 1; switch (opcode[index]) { .ret => return try vm.execRet(T, data[index].ret, eval), .jmp => try vm.execJmp(T, data[index].jmp, eval), .call => try vm.execCall(T, data[index].call, gpa, eval), .shell => vm.execShell(T, data[index].shell, object.text, eval), .write => try vm.execWrite(T, data[index].write, object.text, eval), } return true; } fn execRet(vm: *Interpreter, comptime T: type, data: Instruction.Data.Ret, eval: T) Child(T).Error!bool { const name = vm.linker.objects.items[vm.module - 1] .text[data.start .. data.start + data.len]; if (vm.stack.popOrNull()) |location| { const mod = vm.module; const ip = vm.ip; vm.ip = location.value.ip; vm.module = location.value.module; vm.indent -= location.value.indent; if (@hasDecl(Child(T), "ret")) try eval.ret( vm, name, ); log.debug("[mod {d} ip {x:0>8}] ret(mod {d}, ip {x:0>8}, indent {d}, identifier '{s}')", .{ mod, ip, vm.module, vm.ip, vm.indent, name, }); return true; } if (@hasDecl(Child(T), "terminate")) try eval.terminate(vm, name); log.debug("[mod {d} ip {x:0>8}] terminate(identifier '{s}')", .{ vm.module, vm.ip, name, }); return false; } fn execJmp(vm: *Interpreter, comptime T: type, data: Instruction.Data.Jmp, eval: T) Child(T).Error!void { const mod = vm.module; const ip = vm.ip; if (data.module != 0) { vm.module = data.module; } vm.ip = data.address; if (@hasDecl(Child(T), "jmp")) try eval.jmp(vm, data.address); if (@hasDecl(Child(T), "write")) try eval.write(vm, "\n", 0); log.debug("[mod {d} ip {x:0>8}] jmp(mod {d}, address {x:0>8})", .{ mod, ip, vm.module, vm.ip, }); vm.last_is_newline = true; } pub const CallError = error{ @"Cyclic reference detected", OutOfMemory, }; fn execCall( vm: *Interpreter, comptime T: type, data: Instruction.Data.Call, gpa: Allocator, eval: T, ) (CallError || Child(T).Error)!void { if (vm.stack.contains(vm.ip)) { return error.@"Cyclic reference detected"; } const mod = vm.module; const ip = vm.ip; try vm.stack.put(gpa, vm.ip, .{ .ip = vm.ip, .indent = data.indent, .module = vm.module, }); vm.indent += data.indent; vm.ip = data.address; if (data.module != 0) { vm.module = data.module; } if (@hasDecl(Child(T), "call")) try eval.call(vm); log.debug("[mod {d} ip {x:0>8}] call(mod {d}, ip {x:0>8})", .{ mod, ip - 1, vm.module, vm.ip, }); } fn execShell( vm: *Interpreter, comptime T: type, data: Instruction.Data.Shell, text: []const u8, eval: T, ) void { if (@hasDecl(Child(T), "shell")) try eval.shell(vm); _ = vm; _ = data; _ = text; @panic("TODO: implement shell"); } fn execWrite( vm: *Interpreter, comptime T: type, data: Instruction.Data.Write, text: []const u8, eval: T, ) Child(T).Error!void { if (vm.should_indent and vm.last_is_newline) { if (@hasDecl(Child(T), "indent")) try eval.indent(vm); log.debug("[mod {d} ip {x:0>8}] indent(len {d})", .{ vm.module, vm.ip, vm.indent, }); } else { vm.should_indent = true; } if (@hasDecl(Child(T), "write")) try eval.write( vm, text[data.start .. data.start + data.len], data.nl, ); log.debug("[mod {d} ip {x:0>8}] write(text {*}, index {x:0>8}, len {d}, nl {d}): {s}", .{ vm.module, vm.ip, text, data.start, data.len, data.nl, text[data.start .. data.start + data.len], }); vm.last_is_newline = data.nl != 0; } const Test = struct { stream: Stream, pub const Error = Stream.WriteError; pub const Stream = std.io.FixedBufferStream([]u8); pub fn write(self: *Test, vm: *Interpreter, text: []const u8, nl: u16) !void { _ = vm; const writer = self.stream.writer(); try writer.writeAll(text); try writer.writeByteNTimes('\n', nl); } pub fn indent(self: *Test, vm: *Interpreter) !void { _ = vm; const writer = self.stream.writer(); try writer.writeByteNTimes(' ', vm.indent); } pub fn expect(self: *Test, expected: []const u8) !void { try testing.expectEqualStrings(expected, self.stream.getWritten()); } }; pub fn deinit(vm: *Interpreter, gpa: Allocator) void { vm.linker.deinit(gpa); vm.stack.deinit(gpa); } fn Child(comptime T: type) type { switch (@typeInfo(T)) { .Pointer => |info| return info.child, else => return T, } } pub fn call(vm: *Interpreter, gpa: Allocator, symbol: []const u8, comptime T: type, eval: T) !void { if (vm.linker.procedures.get(symbol)) |sym| { vm.ip = sym.entry; vm.module = sym.module; vm.indent = 0; log.debug("calling {s} address {x:0>8} module {d}", .{ symbol, vm.ip, vm.module }); while (try vm.step(gpa, T, eval)) {} } else return error.@"Unknown procedure"; } pub fn callFile(vm: *Interpreter, gpa: Allocator, symbol: []const u8, comptime T: type, eval: T) !void { if (vm.linker.files.get(symbol)) |sym| { vm.ip = sym.entry; vm.module = sym.module; vm.indent = 0; log.debug("calling {s} address {x:0>8} module {d}", .{ symbol, vm.ip, vm.module }); while (try vm.step(gpa, T, eval)) {} } else return error.@"Unknown procedure"; } const TestTangleOutput = struct { name: []const u8, text: []const u8, }; fn testTangle(source: []const []const u8, output: []const TestTangleOutput) !void { var owned = true; var l: Linker = .{}; defer if (owned) l.deinit(testing.allocator); for (source) |src| { const obj = try Parser.parse(testing.allocator, "", src); try l.objects.append(testing.allocator, obj); } try l.link(testing.allocator); var vm: Interpreter = .{ .linker = l }; defer vm.deinit(testing.allocator); owned = false; errdefer for (l.objects.items) |obj, i| { log.debug("module {d}", .{i + 1}); for (obj.program.items(.opcode)) |op| { log.debug("{}", .{op}); } }; for (output) |out| { log.debug("evaluating {s}", .{out.name}); var buffer: [4096]u8 = undefined; var context: Test = .{ .stream = .{ .buffer = &buffer, .pos = 0 } }; try vm.call(testing.allocator, out.name, *Test, &context); try context.expect(out.text); } } test "run simple no calls" { try testTangle(&.{ \\begin \\ \\ lang: zig esc: none tag: #foo \\ ----------------------------- \\ \\ abc \\ \\end }, &.{ .{ .name = "foo", .text = "abc" }, }); } test "run multiple outputs no calls" { try testTangle(&.{ \\begin \\ \\ lang: zig esc: none tag: #foo \\ ----------------------------- \\ \\ abc \\ \\then \\ \\ lang: zig esc: none tag: #bar \\ ----------------------------- \\ \\ 123 \\ \\end }, &.{ .{ .name = "foo", .text = "abc" }, .{ .name = "bar", .text = "123" }, }); } test "run multiple outputs common call" { try testTangle(&.{ \\begin \\ \\ lang: zig esc: [[]] tag: #foo \\ ----------------------------- \\ \\ [[baz]] \\ \\then \\ \\ lang: zig esc: [[]] tag: #bar \\ ----------------------------- \\ \\ [[baz]][[baz]] \\ \\then \\ \\ lang: zig esc: none tag: #baz \\ ----------------------------- \\ \\ abc }, &.{ .{ .name = "baz", .text = "abc" }, .{ .name = "bar", .text = "abcabc" }, .{ .name = "foo", .text = "abc" }, }); } test "run multiple outputs multiple inputs" { try testTangle(&.{ \\begin \\ \\ lang: zig esc: [[]] tag: #foo \\ ----------------------------- \\ \\ [[baz]] \\ \\end , \\begin \\ \\ lang: zig esc: [[]] tag: #bar \\ ----------------------------- \\ \\ [[baz]][[baz]] \\ \\begin , \\end \\ \\ lang: zig esc: none tag: #baz \\ ----------------------------- \\ \\ abc \\ \\end }, &.{ .{ .name = "baz", .text = "abc" }, .{ .name = "bar", .text = "abcabc" }, .{ .name = "foo", .text = "abc" }, }); }
lib/Interpreter.zig
const std = @import("std"); pub fn import_module_start(comptime module: []const u8, comptime flags_ver: []const u8, comptime count: []const u8) []const u8 { return ( \\.set push \\.set noreorder \\.section .rodata.sceResident, "a" \\__stub_modulestr_ ++ module ++ ":\n" ++ \\.asciz " ++ module ++ "\"\n" ++ \\.align 2 \\.section .lib.stub, "a", @progbits \\.global __stub_module_ ++ module ++ "\n" ++ \\__stub_module_ ++ module ++ ":\n" ++ \\.word __stub_modulestr_ ++ module ++ "\n" ++ \\.word ++ flags_ver ++ "\n" ++ \\.hword 0x5 \\.hword ++ count ++ "\n" ++ \\.word __stub_idtable_ ++ module ++ "\n" ++ \\.word __stub_text_ ++ module ++ "\n" ++ \\.section .rodata.sceNid, "a" \\__stub_idtable_ ++ module ++ ":\n" ++ \\.section .sceStub.text, "ax", @progbits \\__stub_text_ ++ module ++ ":\n" ++ \\.set pop ); } pub fn import_function(comptime module: []const u8, comptime func_id: []const u8, comptime funcname: []const u8) []const u8 { return ( \\.set push \\.set noreorder \\.section .sceStub.text, "ax", @progbits \\.globl ++ funcname ++ "\n" ++ \\.type ++ funcname ++ ", @function\n" ++ \\.ent ++ funcname ++ ", 0\n" ++ funcname ++ ":\n" ++ \\jr $ra \\nop \\.end ++ funcname ++ "\n" ++ \\.size ++ funcname ++ ", .-" ++ funcname ++ "\n" ++ \\.section .rodata.sceNid, "a" \\.word ++ func_id ++ "\n" ++ \\.set pop ); } //INFO: https://people.eecs.berkeley.edu/~pattrsn/61CS99/lectures/lec24-args.pdf //Excellent source on >4 MIPS calls. //This is a generic wrapper for 5-7 func calls pub fn generic_abi_wrapper(comptime funcname: []const u8, comptime argc: u8) []const u8 { //Add new stack space... How to calculate: 4 bytes * (num args + ra) var stackAlloc: []const u8 = undefined; //Conversely free it var stackFree: []const u8 = undefined; //Load the registers depending on arg count var regLoad: []const u8 = undefined; if (argc == 5) { stackAlloc = "add $sp,$sp,-24\n"; stackFree = "add $sp,$sp,24\n"; regLoad = ( \\lw $t0,16($sp) //Store arg5 from stack to t0 ); } else if (argc == 6) { stackAlloc = "add $sp,$sp,-28\n"; stackFree = "add $sp,$sp,28\n"; regLoad = ( \\lw $t0,16($sp) //Store arg5 from stack to t0 \\lw $t1,20($sp) //Store arg6 from stack to t1 ); } else if (argc == 7) { stackAlloc = "add $sp,$sp,-32\n"; stackFree = "add $sp,$sp,32\n"; regLoad = ( \\lw $t0,16($sp) //Store arg5 from stack to t0 \\lw $t1,20($sp) //Store arg6 from stack to t1 \\lw $t2,24($sp) //Store arg7 from stack to t2 ); } else if (argc == 8) { stackAlloc = "add $sp,$sp,-36\n"; stackFree = "add $sp,$sp,36\n"; regLoad = ( \\lw $t0,16($sp) //Store arg5 from stack to t0 \\lw $t1,20($sp) //Store arg6 from stack to t1 \\lw $t2,24($sp) //Store arg7 from stack to t2 \\lw $t3,28($sp) //Store arg8 from stack to t3 ); } else if (argc == 9) { stackAlloc = "add $sp,$sp,-40\n"; stackFree = "add $sp,$sp,40\n"; regLoad = ( \\lw $t0,16($sp) //Store arg5 from stack to t0 \\lw $t1,20($sp) //Store arg6 from stack to t1 \\lw $t2,24($sp) //Store arg7 from stack to t2 \\lw $t3,28($sp) //Store arg8 from stack to t3 \\lw $t4,32($sp) //Store arg9 from stack to t4 TODO: CHECK THIS!!! ); } else { @compileError("Bad argc for generic ABI wrapper"); } return ( \\.section .text, "a" \\.global ++ funcname ++ "\n" ++ funcname ++ ":\n" ++ regLoad ++ "\n" ++ stackAlloc ++ //Preserve return \\sw $ra,0($sp) \\jal //Call the alias ++ funcname ++ "_stub\n" ++ "\n" ++ //Set correct return address \\lw $ra, 0($sp) ++ "\n" ++ stackFree ++ //Return \\jr $ra ); }
src/psp/nids/pspmacros.zig
const std = @import("std"); const Module = @import("../module.zig"); const Op = @import("../op.zig"); const Wat = @import("../wat.zig"); const PostProcess = @This(); import_funcs: []const ImportFunc, jumps: InstrJumps, pub const ImportFunc = struct { module: []const u8, field: []const u8, type_idx: Module.Index.FuncType, }; pub const InstrJumps = std.AutoHashMap(struct { func: u32, instr: u32 }, union { one: JumpTarget, many: [*]const JumpTarget, // len = args.len }); pub const JumpTarget = struct { has_value: bool, addr: u32, stack_unroll: u32, }; pub fn init(module: *Module) !PostProcess { var temp_arena = std.heap.ArenaAllocator.init(module.arena.child_allocator); defer temp_arena.deinit(); var import_funcs = std.ArrayList(ImportFunc).init(&module.arena.allocator); for (module.import) |import| { switch (import.kind) { .Function => |type_idx| { try import_funcs.append(.{ .module = import.module, .field = import.field, .type_idx = type_idx, }); }, else => @panic("TODO"), } } var stack_validator = StackValidator.init(&temp_arena.allocator); var jumps = InstrJumps.init(&module.arena.allocator); for (module.code) |code, f| { try stack_validator.process(import_funcs.items, module, f); // Fill in jump targets const jump_targeter = JumpTargeter{ .jumps = &jumps, .func_idx = f + import_funcs.items.len, .types = stack_validator.types }; for (code.body) |instr, instr_idx| { switch (instr.op) { .br, .br_if => { const block = stack_validator.blocks.upFrom(instr_idx, instr.arg.U32) orelse return error.JumpExceedsBlock; const block_instr = code.body[block.start_idx]; try jump_targeter.add(block.data, .{ .from = instr_idx, .target = if (block_instr.op == .loop) block.start_idx else block.end_idx, }); }, .br_table => { const targets = try module.arena.allocator.alloc(JumpTarget, instr.arg.Array.len); for (targets) |*target, t| { const block_level = instr.arg.Array.ptr[t]; const block = stack_validator.blocks.upFrom(instr_idx, block_level) orelse return error.JumpExceedsBlock; const block_instr = code.body[block.start_idx]; const target_idx = if (block_instr.op == .loop) block.start_idx else block.end_idx; target.addr = @intCast(u32, if (block_instr.op == .loop) block.start_idx else block.end_idx); target.has_value = block.data != .Empty; } try jump_targeter.addMany(instr_idx, targets); }, .@"else" => { const block = stack_validator.blocks.list.items[instr_idx].?; try jump_targeter.add(block.data, .{ .from = instr_idx, .target = block.end_idx, // When the "if" block has a value, it is left on the stack at // the "else", which needs to carry it forward // This is either off-by-one during stack analysis or jumping... :( .stack_adjust = @boolToInt(block.data != .Empty), }); }, .@"if" => { const block = stack_validator.blocks.list.items[instr_idx].?; try jump_targeter.add(block.data, .{ .from = instr_idx, .target = block.end_idx, }); }, else => {}, } } } return PostProcess{ .jumps = jumps, .import_funcs = import_funcs.toOwnedSlice(), }; } const JumpTargeter = struct { jumps: *InstrJumps, func_idx: usize, types: StackLedger(Module.Type.Value), fn add(self: JumpTargeter, block_type: Module.Type.Block, args: struct { from: usize, target: usize, stack_adjust: u32 = 0, }) !void { const target_depth = self.types.depthOf(args.target); try self.jumps.putNoClobber( .{ .func = @intCast(u32, self.func_idx), .instr = @intCast(u32, args.from) }, .{ .one = .{ .has_value = block_type != .Empty, .addr = @intCast(u32, args.target), .stack_unroll = self.types.depthOf(args.from) + args.stack_adjust - target_depth, }, }, ); } fn addMany(self: JumpTargeter, from_idx: usize, targets: []JumpTarget) !void { for (targets) |*target| { target.stack_unroll = self.types.depthOf(from_idx) - self.types.depthOf(target.addr); } try self.jumps.putNoClobber( .{ .func = @intCast(u32, self.func_idx), .instr = @intCast(u32, from_idx) }, .{ .many = targets.ptr }, ); } }; pub fn StackLedger(comptime T: type) type { return struct { const Self = @This(); const Node = struct { data: T, start_idx: usize, end_idx: usize, prev: ?*Node, }; top: ?*Node, list: std.ArrayList(?Node), pub fn init(allocator: *std.mem.Allocator) Self { return .{ .top = null, .list = std.ArrayList(?Node).init(allocator), }; } pub fn depthOf(self: Self, idx: usize) u32 { var iter = &(self.list.items[idx] orelse return 0); var result: u32 = 1; while (iter.prev) |prev| { result += 1; iter = prev; } return result; } pub fn format(self: Self, comptime fmt: []const u8, opts: std.fmt.FormatOptions, writer: anytype) !void { try writer.writeAll("StackLedger("); var iter = self.top; while (iter) |node| { try writer.print(", {}", .{node.data}); iter = node.prev; } try writer.writeAll(")"); } pub fn reset(self: *Self, size: usize) !void { self.top = null; self.list.shrinkRetainingCapacity(0); try self.list.ensureCapacity(size); } pub fn upFrom(self: Self, start_idx: usize, levels: usize) ?*const Node { var node = &(self.list.items[start_idx] orelse return null); if (levels == 0) { return &(self.list.items[node.start_idx].?); } var l = levels; while (l > 0) { l -= 1; node = node.prev orelse return null; } return node; } pub fn pushAt(self: *Self, idx: usize, data: T) void { std.debug.assert(idx == self.list.items.len); self.list.appendAssumeCapacity(Node{ .data = data, .start_idx = idx, .end_idx = undefined, .prev = self.top }); self.top = &self.list.items[idx].?; } pub fn seal(self: *Self, idx: usize) void { if (self.list.items.len == idx) { self.list.appendAssumeCapacity(if (self.top) |top| top.* else null); } } pub fn pop(self: *Self, idx: usize) !T { const top = self.top orelse return error.StackMismatch; self.top = top.prev; top.end_idx = idx; return top.data; } pub fn checkPops(self: *Self, idx: usize, datas: []const T) !void { var i: usize = datas.len; while (i > 0) { i -= 1; if (datas[i] != try self.pop(idx)) { return error.StackMismatch; } } } }; } const StackValidator = struct { types: StackLedger(Module.Type.Value), blocks: StackLedger(Module.Type.Block), pub fn init(allocator: *std.mem.Allocator) StackValidator { return .{ .types = StackLedger(Module.Type.Value).init(allocator), .blocks = StackLedger(Module.Type.Block).init(allocator), }; } pub fn process(self: *StackValidator, import_funcs: []const ImportFunc, module: *const Module, code_idx: usize) !void { const func = module.function[code_idx]; const func_type = module.@"type"[@enumToInt(func.type_idx)]; const code = module.code[code_idx]; try self.blocks.reset(code.body.len); for (code.body) |instr, instr_idx| { defer self.blocks.seal(instr_idx); switch (instr.op) { // Block operations .block, .loop, .@"if" => { const result_type = instr.arg.Type; self.blocks.pushAt(instr_idx, switch (result_type) { .Void => .Empty, .I32 => .I32, .I64 => .I64, .F32 => .F32, .F64 => .F64, }); }, .@"else" => { const block_idx = (self.blocks.top orelse return error.StackMismatch).start_idx; const top = try self.blocks.pop(instr_idx); if (code.body[block_idx].op != .@"if") { return error.MismatchElseWithoutIf; } self.blocks.pushAt(instr_idx, top); }, .end => _ = try self.blocks.pop(instr_idx), // TODO: catch invalid br/br_table/br_if else => {}, } } if (self.blocks.top != null) { return error.BlockMismatch; } try self.types.reset(code.body.len); var terminating_block_idx: ?usize = null; for (code.body) |instr, instr_idx| { defer self.types.seal(instr_idx); if (terminating_block_idx) |block_idx| { if (instr.op == .end) { terminating_block_idx = null; const unroll_amount = self.types.depthOf(instr_idx - 1) - self.types.depthOf(block_idx); var i: usize = 0; while (i < unroll_amount) : (i += 1) { _ = self.types.pop(instr_idx) catch unreachable; } } // TODO: do I need to detect valid instruction continue; } switch (instr.op) { .@"return", .br, .br_table, .@"unreachable" => { if (instr.op == .br_table) { try self.types.checkPops(instr_idx, &.{Module.Type.Value.I32}); } terminating_block_idx = if (self.blocks.list.items[instr_idx]) |block| block.start_idx else std.math.maxInt(usize); }, .@"else" => { const if_block = self.blocks.list.items[instr_idx - 1].?; if (if_block.data != .Empty) { _ = try self.types.pop(instr_idx); } }, .end => { const block = self.blocks.list.items[instr_idx - 1].?; const extra = @boolToInt(block.data != .Empty); if (self.types.depthOf(block.start_idx) != self.types.depthOf(instr_idx - 1) - extra) { return error.StackMismatch; } }, .call => { // TODO: validate these indexes const func_idx = instr.arg.U32; if (func_idx < import_funcs.len) { // import const call_func = import_funcs[func_idx]; const call_type = module.@"type"[@enumToInt(call_func.type_idx)]; try self.types.checkPops(instr_idx, call_type.param_types); if (call_type.return_type) |typ| { self.types.pushAt(instr_idx, typ); } } else { const call_func = module.function[func_idx - import_funcs.len]; const call_type = module.@"type"[@enumToInt(call_func.type_idx)]; try self.types.checkPops(instr_idx, call_type.param_types); if (call_type.return_type) |typ| { self.types.pushAt(instr_idx, typ); } } }, .call_indirect => { const call_type = module.@"type"[instr.arg.U32]; try self.types.checkPops(instr_idx, call_type.param_types); if (call_type.return_type) |typ| { self.types.pushAt(instr_idx, typ); } }, .local_set => try self.types.checkPops(instr_idx, &.{try localType(instr.arg.U32, func_type.param_types, code.locals)}), .local_get => self.types.pushAt(instr_idx, try localType(instr.arg.U32, func_type.param_types, code.locals)), .local_tee => { const typ = try localType(instr.arg.U32, func_type.param_types, code.locals); try self.types.checkPops(instr_idx, &.{typ}); self.types.pushAt(instr_idx, typ); }, .global_set => { const idx = instr.arg.U32; if (idx >= module.global.len) return error.GlobalIndexOutOfBounds; try self.types.checkPops(instr_idx, &.{module.global[idx].@"type".content_type}); }, .global_get => { const idx = instr.arg.U32; if (idx >= module.global.len) return error.GlobalIndexOutOfBounds; self.types.pushAt(instr_idx, module.global[idx].@"type".content_type); }, .select => { try self.types.checkPops(instr_idx, &.{.I32}); const top1 = try self.types.pop(instr_idx); const top2 = try self.types.pop(instr_idx); if (top1 != top2) { return error.StackMismatch; } self.types.pushAt(instr_idx, top1); }, // Drops *any* value, no check needed .drop => _ = try self.types.pop(instr_idx), else => { const op_meta = Op.Meta.of(instr.op); for (op_meta.pop) |pop| { try self.types.checkPops(instr_idx, &.{asValue(pop)}); } if (op_meta.push) |push| { self.types.pushAt(instr_idx, asValue(push)); } }, } } if (terminating_block_idx == null) { if (func_type.return_type) |return_type| { try self.types.checkPops(code.body.len, &.{return_type}); } if (self.types.top != null) { return error.StackMismatch; } } } fn asValue(change: Op.Stack.Change) Module.Type.Value { return switch (change) { .I32 => .I32, .I64 => .I64, .F32 => .F32, .F64 => .F64, .Poly => unreachable, }; } fn localType(local_idx: u32, params: []const Module.Type.Value, locals: []const Module.Type.Value) !Module.Type.Value { if (local_idx >= params.len + locals.len) return error.LocalIndexOutOfBounds; if (local_idx < params.len) { return params[local_idx]; } else { return locals[local_idx - params.len]; } } }; test "smoke" { var fbs = std.io.fixedBufferStream( \\(module \\ (func (result i32) \\ i32.const 40 \\ i32.const 2 \\ i32.add)) ); var module = try Wat.parseNoValidate(std.testing.allocator, fbs.reader()); defer module.deinit(); _ = try PostProcess.init(&module); } test "add nothing" { var fbs = std.io.fixedBufferStream( \\(module \\ (func (result i32) \\ i32.add)) ); var module = try Wat.parseNoValidate(std.testing.allocator, fbs.reader()); defer module.deinit(); try std.testing.expectError(error.StackMismatch, PostProcess.init(&module)); } test "add wrong types" { var fbs = std.io.fixedBufferStream( \\(module \\ (func (result i32) \\ i32.const 40 \\ i64.const 2 \\ i32.add)) ); var module = try Wat.parseNoValidate(std.testing.allocator, fbs.reader()); defer module.deinit(); try std.testing.expectError(error.StackMismatch, PostProcess.init(&module)); } test "return nothing" { var fbs = std.io.fixedBufferStream( \\(module \\ (func (result i32))) ); var module = try Wat.parseNoValidate(std.testing.allocator, fbs.reader()); defer module.deinit(); try std.testing.expectError(error.StackMismatch, PostProcess.init(&module)); } test "return wrong type" { var fbs = std.io.fixedBufferStream( \\(module \\ (func (result i32) \\ i64.const 40)) ); var module = try Wat.parseNoValidate(std.testing.allocator, fbs.reader()); defer module.deinit(); try std.testing.expectError(error.StackMismatch, PostProcess.init(&module)); } test "jump locations" { var fbs = std.io.fixedBufferStream( \\(module \\ (func \\ block ;; 0 \\ loop ;; 1 \\ br 0 ;; 2 \\ br 1 ;; 3 \\ end ;; 4 \\ end ;; 5 \\ )) ); var module = try Wat.parseNoValidate(std.testing.allocator, fbs.reader()); defer module.deinit(); const process = try PostProcess.init(&module); const br_0 = process.jumps.get(.{ .func = 0, .instr = 2 }) orelse return error.JumpNotFound; try std.testing.expectEqual(@as(usize, 1), br_0.one.addr); const br_1 = process.jumps.get(.{ .func = 0, .instr = 3 }) orelse return error.JumpNotFound; try std.testing.expectEqual(@as(usize, 5), br_1.one.addr); } test "if/else locations" { var fbs = std.io.fixedBufferStream( \\(module \\ (func (result i32) \\ i32.const 0 ;; 0 \\ if (result i32) ;; 1 \\ i32.const 1 ;; 2 \\ else ;; 3 \\ i32.const 0 ;; 4 \\ end ;; 5 \\ )) ); var module = try Wat.parseNoValidate(std.testing.allocator, fbs.reader()); defer module.deinit(); const process = try PostProcess.init(&module); const jump_if = process.jumps.get(.{ .func = 0, .instr = 1 }) orelse return error.JumpNotFound; try std.testing.expectEqual(@as(usize, 3), jump_if.one.addr); try std.testing.expectEqual(@as(usize, 0), jump_if.one.stack_unroll); const jump_else = process.jumps.get(.{ .func = 0, .instr = 3 }) orelse return error.JumpNotFound; try std.testing.expectEqual(@as(usize, 5), jump_else.one.addr); try std.testing.expectEqual(@as(usize, 0), jump_else.one.stack_unroll); } test "invalid global idx" { var fbs = std.io.fixedBufferStream( \\(module \\ (global $x i32 (i32.const -5)) \\ (func (result i32) \\ global.get 1)) ); var module = try Wat.parseNoValidate(std.testing.allocator, fbs.reader()); defer module.deinit(); try std.testing.expectError(error.GlobalIndexOutOfBounds, PostProcess.init(&module)); } test "valid global idx" { var fbs = std.io.fixedBufferStream( \\(module \\ (global $x i32 (i32.const -5)) \\ (func (result i32) \\ global.get 0)) ); var module = try Wat.parseNoValidate(std.testing.allocator, fbs.reader()); defer module.deinit(); _ = try PostProcess.init(&module); } test "invalid local idx" { var fbs = std.io.fixedBufferStream( \\(module \\ (func (result i32) \\ local.get 0)) ); var module = try Wat.parseNoValidate(std.testing.allocator, fbs.reader()); defer module.deinit(); try std.testing.expectError(error.LocalIndexOutOfBounds, PostProcess.init(&module)); } test "valid local idx" { var fbs = std.io.fixedBufferStream( \\(module \\ (func (param i32) (result i32) \\ local.get 0)) ); var module = try Wat.parseNoValidate(std.testing.allocator, fbs.reader()); defer module.deinit(); _ = try PostProcess.init(&module); } test "valid br flushing the stack" { var fbs = std.io.fixedBufferStream( \\(module \\ (func \\ block ;; 0 \\ i32.const 1 ;; 1 \\ br 0 ;; 2 \\ i32.const 2 ;; 3 \\ end)) ;; 4 ); var module = try Wat.parseNoValidate(std.testing.allocator, fbs.reader()); defer module.deinit(); _ = try PostProcess.init(&module); } test "valid return flushing the stack" { var fbs = std.io.fixedBufferStream( \\(module \\ (func \\ i32.const 1 ;; 0 \\ return ;; 1 \\ i32.const 2)) ;; 2 ); var module = try Wat.parseNoValidate(std.testing.allocator, fbs.reader()); defer module.deinit(); _ = try PostProcess.init(&module); } test "return a value from block" { var fbs = std.io.fixedBufferStream( \\(module \\ (func (result i32) \\ block ;; 0 \\ i32.const 1 ;; 1 \\ return ;; 2 \\ end ;; 3 \\ i32.const 42)) ;; 4 ); var module = try Wat.parseNoValidate(std.testing.allocator, fbs.reader()); defer module.deinit(); _ = try PostProcess.init(&module); }
src/module/post_process.zig
const std = @import("std"); const Dependency = @import("Dependency.zig"); const Lockfile = @import("Lockfile.zig"); const Self = @This(); const Allocator = std.mem.Allocator; const DepQueue = std.TailQueue(struct { from: *Node, dep: *Dependency, }); arena: std.heap.ArenaAllocator, node_pool: std.ArrayList(*Node), root: Node, const Node = struct { entry: *const Lockfile.Entry, depth: u32, edges: std.ArrayListUnmanaged(*Edge), }; const Edge = struct { from: *Node, to: *Node, dep: *const Dependency, }; pub fn generate( gpa: *Allocator, lockfile: *Lockfile, deps: std.ArrayList(Dependency), ) !*Self { var ret = try gpa.create(Self); ret.* = Self{ .arena = std.heap.ArenaAllocator.init(gpa), .node_pool = std.ArrayList(*Node).init(gpa), .root = .{ .entry = undefined, .depth = 0, .edges = std.ArrayListUnmanaged(*Edge){}, }, }; errdefer ret.destroy(); var queue = DepQueue{}; defer while (queue.popFirst()) |node| gpa.destroy(node); var init_deps = try ret.arena.allocator.dupe(Dependency, deps.items); for (init_deps) |*dep| { var node = try gpa.create(DepQueue.Node); node.data = .{ .from = &ret.root, .dep = dep, }; queue.append(node); } while (queue.popFirst()) |q_node| { defer gpa.destroy(q_node); const entry = try q_node.data.dep.resolve(&ret.arena, lockfile); const node = for (ret.node_pool.items) |node| { if (node.entry == entry) { node.depth = std.math.max(node.depth, q_node.data.from.depth + 1); break node; } } else blk: { const ptr = try ret.arena.allocator.create(Node); ptr.* = Node{ .entry = entry, .depth = q_node.data.from.depth + 1, .edges = std.ArrayListUnmanaged(*Edge){}, }; try ret.node_pool.append(ptr); const dependencies = try entry.getDeps(&ret.arena); for (dependencies) |*dep| { var new_node = try gpa.create(DepQueue.Node); new_node.data = .{ .from = ptr, .dep = dep }; queue.append(new_node); } break :blk ptr; }; var edge = try ret.arena.allocator.create(Edge); edge.* = Edge{ .from = q_node.data.from, .to = node, .dep = q_node.data.dep, }; try q_node.data.from.edges.append(gpa, edge); try ret.validate(); } return ret; } fn validate(self: Self) !void { for (self.node_pool.items) |node| { for (node.edges.items) |edge| { if (node.depth >= edge.to.depth) return error.CircularDependency; } } } pub fn destroy(self: *Self) void { const gpa = self.arena.child_allocator; self.root.edges.deinit(gpa); for (self.node_pool.items) |node| node.edges.deinit(gpa); self.node_pool.deinit(); self.arena.deinit(); gpa.destroy(self); } pub fn assemblePkgs(self: *Self, seed: std.build.Pkg) ![]std.build.Pkg { var ret = try self.arena.allocator.alloc(std.build.Pkg, self.root.edges.items.len + 1); ret[0] = seed; for (ret[1..]) |*pkg, i| { pkg.* = try recursiveBuildPkg(&self.arena, self.root.edges.items[i]); } return ret; } fn recursiveBuildPkg(arena: *std.heap.ArenaAllocator, edge: *Edge) anyerror!std.build.Pkg { var ret = std.build.Pkg{ .name = edge.dep.alias, .path = try edge.to.entry.getRootPath(arena), .dependencies = null, }; if (edge.to.edges.items.len > 0) { var pkgs = try arena.allocator.alloc(std.build.Pkg, edge.to.edges.items.len); for (pkgs) |*pkg, i| { pkg.* = try recursiveBuildPkg(arena, edge.to.edges.items[i]); } ret.dependencies = pkgs; } return ret; } fn escape(allocator: *Allocator, str: []const u8) ![]const u8 { return for (str) |c| { if (!std.ascii.isAlNum(c) and c != '_') { var buf = try allocator.alloc(u8, str.len + 3); std.mem.copy(u8, buf, "@\""); std.mem.copy(u8, buf[2..], str); buf[buf.len - 1] = '"'; break buf; } } else try allocator.dupe(u8, str); } pub fn printZig(self: *Self, writer: anytype) !void { try writer.print( \\const std = @import("std"); \\pub const pkgs = struct {{ \\ , .{}); for (self.root.edges.items) |edge| { const alias = try escape(self.arena.child_allocator, edge.dep.alias); defer self.arena.child_allocator.free(alias); try writer.print(" pub const {s} = std.build.Pkg{{\n", .{alias}); try self.recursivePrintZig(0, edge, writer); try writer.print( \\ }}; \\ \\ , .{}); } try writer.print( \\ pub fn addAllTo(artifact: *std.build.LibExeObjStep) void {{ \\ @setEvalBranchQuota(1_000_000); \\ inline for (std.meta.declarations(pkgs)) |decl| {{ \\ if (decl.is_pub and decl.data == .Var) {{ \\ artifact.addPackage(@field(pkgs, decl.name)); \\ }} \\ }} \\ }} \\}}; \\ \\ , .{}); // basedirs try writer.print( \\pub const base_dirs = struct {{ \\ , .{}); for (self.root.edges.items) |edge| { const alias = try escape(self.arena.child_allocator, edge.dep.alias); defer self.arena.child_allocator.free(alias); try writer.print(" pub const {s} = \"{s}\";\n", .{ alias, try edge.to.entry.getEscapedPackageDir(&self.arena), }); } try writer.print( \\}}; \\ , .{}); } fn indent(depth: usize, writer: anytype) !void { try writer.writeByteNTimes(' ', 4 * (depth + 1)); } fn recursivePrintZig( self: *Self, depth: usize, edge: *const Edge, writer: anytype, ) anyerror!void { if (depth != 0) { try indent(depth, writer); try writer.print("std.build.Pkg{{\n", .{}); } try indent(depth + 1, writer); try writer.print(".name = \"{s}\",\n", .{edge.dep.alias}); try indent(depth + 1, writer); try writer.print(".path = \"{s}\",\n", .{ try edge.to.entry.getEscapedRootPath(&self.arena), }); if (edge.to.edges.items.len > 0) { try indent(depth + 1, writer); try writer.print(".dependencies = &[_]std.build.Pkg{{\n", .{}); for (edge.to.edges.items) |e| { try self.recursivePrintZig(depth + 2, e, writer); } try indent(depth + 1, writer); try writer.print("}},\n", .{}); } if (depth != 0) { try indent(depth, writer); try writer.print("}},\n", .{}); } }
src/DependencyTree.zig
const std = @import("std"); const builtin = @import("builtin"); const TestEnum = enum { TestEnumValue }; const tag_name = @tagName(TestEnum.TestEnumValue); const ptr_tag_name: [*:0]const u8 = tag_name; test "@tagName() returns a string literal" { if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong try std.testing.expectEqual(*const [13:0]u8, @TypeOf(tag_name)); try std.testing.expectEqualStrings("TestEnumValue", tag_name); try std.testing.expectEqualStrings("TestEnumValue", ptr_tag_name[0..tag_name.len]); } const TestError = error{TestErrorCode}; const error_name = @errorName(TestError.TestErrorCode); const ptr_error_name: [*:0]const u8 = error_name; test "@errorName() returns a string literal" { if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong try std.testing.expectEqual(*const [13:0]u8, @TypeOf(error_name)); try std.testing.expectEqualStrings("TestErrorCode", error_name); try std.testing.expectEqualStrings("TestErrorCode", ptr_error_name[0..error_name.len]); } const TestType = struct {}; const type_name = @typeName(TestType); const ptr_type_name: [*:0]const u8 = type_name; test "@typeName() returns a string literal" { if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong try std.testing.expectEqual(*const [type_name.len:0]u8, @TypeOf(type_name)); try std.testing.expectEqualStrings("behavior.bugs.3779.TestType", type_name); try std.testing.expectEqualStrings("behavior.bugs.3779.TestType", ptr_type_name[0..type_name.len]); } const actual_contents = @embedFile("3779_file_to_embed.txt"); const ptr_actual_contents: [*:0]const u8 = actual_contents; const expected_contents = "hello zig\n"; test "@embedFile() returns a string literal" { try std.testing.expectEqual(*const [expected_contents.len:0]u8, @TypeOf(actual_contents)); try std.testing.expect(std.mem.eql(u8, expected_contents, actual_contents)); try std.testing.expectEqualStrings(expected_contents, actual_contents); try std.testing.expectEqualStrings(expected_contents, ptr_actual_contents[0..actual_contents.len]); } fn testFnForSrc() std.builtin.SourceLocation { return @src(); } test "@src() returns a struct containing 0-terminated string slices" { const src = testFnForSrc(); try std.testing.expectEqual([:0]const u8, @TypeOf(src.file)); try std.testing.expect(std.mem.endsWith(u8, src.file, "3779.zig")); try std.testing.expectEqual([:0]const u8, @TypeOf(src.fn_name)); try std.testing.expect(std.mem.endsWith(u8, src.fn_name, "testFnForSrc")); const ptr_src_file: [*:0]const u8 = src.file; _ = ptr_src_file; // unused const ptr_src_fn_name: [*:0]const u8 = src.fn_name; _ = ptr_src_fn_name; // unused }
test/behavior/bugs/3779.zig
export fn foo_array() void { comptime { var target = [_:0]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; const slice = target[0..3 :0]; _ = slice; } } export fn foo_ptr_array() void { comptime { var buf = [_:0]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; var target = &buf; const slice = target[0..3 :0]; _ = slice; } } export fn foo_vector_ConstPtrSpecialBaseArray() void { comptime { var buf = [_:0]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; var target: [*]u8 = &buf; const slice = target[0..3 :0]; _ = slice; } } export fn foo_vector_ConstPtrSpecialRef() void { comptime { var buf = [_:0]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; var target: [*]u8 = @ptrCast([*]u8, &buf); const slice = target[0..3 :0]; _ = slice; } } export fn foo_cvector_ConstPtrSpecialBaseArray() void { comptime { var buf = [_:0]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; var target: [*c]u8 = &buf; const slice = target[0..3 :0]; _ = slice; } } export fn foo_cvector_ConstPtrSpecialRef() void { comptime { var buf = [_:0]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; var target: [*c]u8 = @ptrCast([*c]u8, &buf); const slice = target[0..3 :0]; _ = slice; } } export fn foo_slice() void { comptime { var buf = [_:0]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; var target: []u8 = &buf; const slice = target[0..3 :0]; _ = slice; } } // comptime slice-sentinel does not match memory at target index (terminated) // // :4:29: error: slice-sentinel does not match memory at target index // :12:29: error: slice-sentinel does not match memory at target index // :20:29: error: slice-sentinel does not match memory at target index // :28:29: error: slice-sentinel does not match memory at target index // :36:29: error: slice-sentinel does not match memory at target index // :44:29: error: slice-sentinel does not match memory at target index // :52:29: error: slice-sentinel does not match memory at target index
test/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_terminated.zig
const std = @import("std"); const version = @import("version"); const zzz = @import("zzz"); const uri = @import("uri"); const api = @import("api.zig"); const utils = @import("utils.zig"); const Self = @This(); const Allocator = std.mem.Allocator; const mem = std.mem; const testing = std.testing; pub const SourceType = std.meta.TagType(Source); alias: []const u8, src: Source, pub const Source = union(enum) { pkg: struct { user: []const u8, name: []const u8, version: version.Range, repository: []const u8, }, github: struct { user: []const u8, repo: []const u8, ref: []const u8, root: ?[]const u8, }, url: struct { str: []const u8, root: ?[]const u8, }, local: struct { path: []const u8, root: ?[]const u8, }, pub fn format( source: Source, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype, ) @TypeOf(writer).Error!void { _ = fmt; _ = options; switch (source) { .pkg => |pkg| try writer.print("{s}/{s}/{s}: {}", .{ pkg.repository, pkg.user, pkg.name, pkg.version }), .github => |gh| try writer.print("github.com/{s}/{s}/{s}: {s}", .{ gh.user, gh.repo, gh.root, gh.ref }), .url => |url| try writer.print("{s}/{s}", .{ url.str, url.root }), .local => |local| try writer.print("{s}/{s}", .{ local.path, local.root }), } } }; /// There are four ways for a dependency to be declared in the project file: /// /// A package from some other index: /// ``` /// name: /// src: /// pkg: /// user: <user> /// name: <name> # optional /// version: <version string> /// repository: <repository> # optional /// ``` /// /// A github repo: /// ``` /// name: /// src: /// github: /// user: <user> /// repo: <repo> /// ref: <ref> /// root: <root file> /// ``` /// /// A raw url: /// ``` /// name: /// src: /// url: <url> /// root: <root file> /// integrity: /// <type>: <integrity str> /// ``` pub fn fromZNode(allocator: *Allocator, node: *zzz.ZNode) !Self { if (node.*.child == null) return error.NoChildren; // check if only one child node and that it has no children if (node.*.child.?.value == .String and node.*.child.?.child == null) { if (node.*.child.?.sibling != null) return error.Unknown; const key = try utils.zGetString(node); const info = try utils.parseUserRepo(key); const ver_str = try utils.zGetString(node.*.child.?); return Self{ .alias = info.repo, .src = .{ .pkg = .{ .user = info.user, .name = info.repo, .version = try version.Range.parse(allocator, ver_str), .repository = utils.default_repo, }, }, }; } // search for src node const alias = try utils.zGetString(node); const src_node = blk: { var it = utils.ZChildIterator.init(node); while (it.next()) |child| { switch (child.value) { .String => |str| if (mem.eql(u8, str, "src")) break :blk child, else => continue, } } else return error.SrcTagNotFound; }; const src: Source = blk: { const child = src_node.child orelse return error.SrcNeedsChild; const src_str = try utils.zGetString(child); const src_type = inline for (std.meta.fields(SourceType)) |field| { if (mem.eql(u8, src_str, field.name)) break @field(SourceType, field.name); } else return error.InvalidSrcTag; break :blk switch (src_type) { .pkg => .{ .pkg = .{ .user = (try utils.zFindString(child, "user")) orelse return error.MissingUser, .name = (try utils.zFindString(child, "name")) orelse alias, .version = try version.Range.parse(allocator, (try utils.zFindString(child, "version")) orelse return error.MissingVersion), .repository = (try utils.zFindString(child, "repository")) orelse utils.default_repo, }, }, .github => .{ .github = .{ .user = (try utils.zFindString(child, "user")) orelse return error.GithubMissingUser, .repo = (try utils.zFindString(child, "repo")) orelse return error.GithubMissingRepo, .ref = (try utils.zFindString(child, "ref")) orelse return error.GithubMissingRef, .root = try utils.zFindString(node, "root"), }, }, .url => .{ .url = .{ .str = try utils.zGetString(child.child orelse return error.UrlMissingStr), .root = try utils.zFindString(node, "root"), }, }, .local => .{ .local = .{ .path = try utils.zGetString(child.child orelse return error.UrlMissingStr), .root = try utils.zFindString(node, "root"), }, }, }; }; if (src == .url) { _ = uri.parse(src.url.str) catch |err| { switch (err) { error.InvalidFormat => { std.log.err( "Failed to parse '{s}' as a url ({}), did you forget to wrap your url in double quotes?", .{ src.url.str, err }, ); }, else => return err, } return error.Explained; }; } // TODO: integrity return Self{ .alias = alias, .src = src }; } /// for testing fn fromString(allocator: *Allocator, str: []const u8) !Self { var tree = zzz.ZTree(1, 1000){}; const root = try tree.appendText(str); return Self.fromZNode(allocator, root.*.child.?); } fn expectNullStrEqual(expected: ?[]const u8, actual: ?[]const u8) !void { if (expected) |e| if (actual) |a| { try testing.expectEqualStrings(e, a); return; }; try testing.expectEqual(expected, actual); } fn expectDepEqual(expected: Self, actual: Self) !void { try testing.expectEqualStrings(expected.alias, actual.alias); try testing.expectEqual(@as(SourceType, expected.src), @as(SourceType, actual.src)); return switch (expected.src) { .pkg => |pkg| { try testing.expectEqualStrings(pkg.user, actual.src.pkg.user); try testing.expectEqualStrings(pkg.name, actual.src.pkg.name); try testing.expectEqualStrings(pkg.repository, actual.src.pkg.repository); try testing.expectEqual(pkg.version, actual.src.pkg.version); }, .github => |gh| { try testing.expectEqualStrings(gh.user, actual.src.github.user); try testing.expectEqualStrings(gh.repo, actual.src.github.repo); try testing.expectEqualStrings(gh.ref, actual.src.github.ref); try expectNullStrEqual(gh.root, actual.src.github.root); }, .url => |url| { try testing.expectEqualStrings(url.str, actual.src.url.str); try expectNullStrEqual(url.root, actual.src.url.root); }, .local => |local| { try testing.expectEqualStrings(local.path, actual.src.local.path); try expectNullStrEqual(local.root, actual.src.local.root); }, }; } test "default repo pkg" { try expectDepEqual(Self{ .alias = "something", .src = .{ .pkg = .{ .user = "matt", .name = "something", .version = try version.Range.parse(testing.allocator, "^0.1.0"), .repository = utils.default_repo, }, }, }, try fromString(testing.allocator, "matt/something: ^0.1.0")); } test "aliased, default repo pkg" { const actual = try fromString(testing.allocator, \\something: \\ src: \\ pkg: \\ user: matt \\ name: blarg \\ version: ^0.1.0 ); const expected = Self{ .alias = "something", .src = .{ .pkg = .{ .user = "matt", .name = "blarg", .version = try version.Range.parse(testing.allocator, "^0.1.0"), .repository = utils.default_repo, }, }, }; try expectDepEqual(expected, actual); } test "error if pkg has any other keys" { // TODO //testing.expectError(error.SuperfluousNode, fromString( // \\something: // \\ src: // \\ pkg: // \\ name: blarg // \\ version: ^0.1.0 // \\ foo: something //)); } test "non-default repo pkg" { const actual = try fromString(testing.allocator, \\something: \\ src: \\ pkg: \\ user: matt \\ version: ^0.1.0 \\ repository: example.com ); const expected = Self{ .alias = "something", .src = .{ .pkg = .{ .user = "matt", .name = "something", .version = try version.Range.parse(testing.allocator, "^0.1.0"), .repository = "example.com", }, }, }; try expectDepEqual(expected, actual); } test "aliased, non-default repo pkg" { const actual = try fromString(testing.allocator, \\something: \\ src: \\ pkg: \\ user: matt \\ name: real_name \\ version: ^0.1.0 \\ repository: example.com ); const expected = Self{ .alias = "something", .src = .{ .pkg = .{ .user = "matt", .name = "real_name", .version = try version.Range.parse(testing.allocator, "^0.1.0"), .repository = "example.com", }, }, }; try expectDepEqual(expected, actual); } test "github default root" { const actual = try fromString(testing.allocator, \\foo: \\ src: \\ github: \\ user: test \\ repo: something \\ ref: main ); const expected = Self{ .alias = "foo", .src = .{ .github = .{ .user = "test", .repo = "something", .ref = "main", .root = null, }, }, }; try expectDepEqual(expected, actual); } test "github explicit root" { const actual = try fromString(testing.allocator, \\foo: \\ src: \\ github: \\ user: test \\ repo: something \\ ref: main \\ root: main.zig ); const expected = Self{ .alias = "foo", .src = .{ .github = .{ .user = "test", .repo = "something", .ref = "main", .root = "main.zig", }, }, }; try expectDepEqual(expected, actual); } test "raw default root" { const actual = try fromString(testing.allocator, \\foo: \\ src: \\ url: "https://astrolabe.pm" ); const expected = Self{ .alias = "foo", .src = .{ .url = .{ .str = "https://astrolabe.pm", .root = null, }, }, }; try expectDepEqual(expected, actual); } test "raw explicit root" { const actual = try fromString(testing.allocator, \\foo: \\ src: \\ url: "https://astrolabe.pm" \\ root: main.zig ); const expected = Self{ .alias = "foo", .src = .{ .url = .{ .str = "https://astrolabe.pm", .root = "main.zig", }, }, }; try expectDepEqual(expected, actual); } test "local with default root" { const actual = try fromString(testing.allocator, \\foo: \\ src: \\ local: "mypkgs/cool-project" ); const expected = Self{ .alias = "foo", .src = .{ .local = .{ .path = "mypkgs/cool-project", .root = null, }, }, }; try expectDepEqual(expected, actual); } test "local with explicit root" { const actual = try fromString(testing.allocator, \\foo: \\ src: \\ local: "mypkgs/cool-project" \\ root: main.zig ); const expected = Self{ .alias = "foo", .src = .{ .local = .{ .path = "mypkgs/cool-project", .root = "main.zig", }, }, }; try expectDepEqual(expected, actual); } test "pkg can't take a root" { // TODO } test "pkg can't take an integrity" { // TODO } test "github can't take an integrity " { // TODO } /// serializes dependency information back into zzz format pub fn addToZNode( self: Self, arena: *std.heap.ArenaAllocator, tree: *zzz.ZTree(1, 1000), parent: *zzz.ZNode, explicit: bool, ) !void { var alias = try tree.addNode(parent, .{ .String = self.alias }); switch (self.src) { .pkg => |pkg| if (!explicit and std.mem.eql(u8, self.alias, pkg.name) and std.mem.eql(u8, pkg.repository, utils.default_repo)) { var fifo = std.fifo.LinearFifo(u8, .{ .Dynamic = {} }).init(&arena.allocator); try fifo.writer().print("{s}/{s}", .{ pkg.user, pkg.name }); alias.value.String = fifo.readableSlice(0); const ver_str = try std.fmt.allocPrint(&arena.allocator, "{}", .{pkg.version}); _ = try tree.addNode(alias, .{ .String = ver_str }); } else { var src = try tree.addNode(alias, .{ .String = "src" }); var node = try tree.addNode(src, .{ .String = "pkg" }); try utils.zPutKeyString(tree, node, "user", pkg.user); if (explicit or !std.mem.eql(u8, pkg.name, self.alias)) { try utils.zPutKeyString(tree, node, "name", pkg.name); } const ver_str = try std.fmt.allocPrint(&arena.allocator, "{}", .{pkg.version}); try utils.zPutKeyString(tree, node, "version", ver_str); if (explicit or !std.mem.eql(u8, pkg.repository, utils.default_repo)) { try utils.zPutKeyString(tree, node, "repository", pkg.repository); } }, .github => |gh| { var src = try tree.addNode(alias, .{ .String = "src" }); var github = try tree.addNode(src, .{ .String = "github" }); try utils.zPutKeyString(tree, github, "user", gh.user); try utils.zPutKeyString(tree, github, "repo", gh.repo); try utils.zPutKeyString(tree, github, "ref", gh.ref); if (explicit or gh.root != null) { try utils.zPutKeyString(tree, alias, "root", gh.root orelse utils.default_root); } }, .url => |url| { var src = try tree.addNode(alias, .{ .String = "src" }); try utils.zPutKeyString(tree, src, "url", url.str); if (explicit or url.root != null) { try utils.zPutKeyString(tree, alias, "root", url.root orelse utils.default_root); } }, .local => |local| { var src = try tree.addNode(alias, .{ .String = "src" }); try utils.zPutKeyString(tree, src, "local", local.path); if (explicit or local.root != null) { try utils.zPutKeyString(tree, alias, "root", local.root orelse utils.default_root); } }, } } fn expectZzzEqual(expected: *zzz.ZNode, actual: *zzz.ZNode) !void { var expected_it: *zzz.ZNode = expected; var actual_it: *zzz.ZNode = actual; var expected_depth: isize = 0; var actual_depth: isize = 0; while (expected_it.next(&expected_depth)) |exp| : (expected_it = exp) { if (actual_it.next(&actual_depth)) |act| { defer actual_it = act; try testing.expectEqual(expected_depth, actual_depth); switch (exp.value) { .String => |str| try testing.expectEqualStrings(str, act.value.String), .Int => |int| try testing.expectEqual(int, act.value.Int), .Float => |float| try testing.expectEqual(float, act.value.Float), .Bool => |b| try testing.expectEqual(b, act.value.Bool), else => {}, } } else { try testing.expect(false); } } try testing.expectEqual( expected_it.next(&expected_depth), actual_it.next(&actual_depth), ); } fn serializeTest(from: []const u8, to: []const u8, explicit: bool) !void { var arena = std.heap.ArenaAllocator.init(testing.allocator); defer arena.deinit(); const dep = try fromString(testing.allocator, from); var actual = zzz.ZTree(1, 1000){}; var actual_root = try actual.addNode(null, .{ .Null = {} }); try dep.addToZNode(&arena, &actual, actual_root, explicit); var expected = zzz.ZTree(1, 1000){}; const expected_root = try expected.appendText(to); try expectZzzEqual(expected_root, actual_root); } test "serialize pkg non-explicit" { const str = \\something: \\ src: \\ pkg: \\ user: test \\ version: ^0.0.0 \\ ; const expected = "test/something: ^0.0.0"; try serializeTest(str, expected, false); } test "serialize pkg explicit" { const str = \\something: \\ src: \\ pkg: \\ user: test \\ version: ^0.0.0 \\ ; const expected = \\something: \\ src: \\ pkg: \\ user: test \\ name: something \\ version: ^0.0.0 \\ repository: astrolabe.pm \\ ; try serializeTest(str, expected, true); } test "serialize github non-explicit" { const str = \\something: \\ src: \\ github: \\ user: test \\ repo: my_repo \\ ref: master \\ root: main.zig \\ ; try serializeTest(str, str, false); } test "serialize github non-explicit, default root" { const str = \\something: \\ src: \\ github: \\ user: test \\ repo: my_repo \\ ref: master \\ ; try serializeTest(str, str, false); } test "serialize github explicit, default root" { const str = \\something: \\ src: \\ github: \\ user: test \\ repo: my_repo \\ ref: master \\ root: src/main.zig \\ ; try serializeTest(str, str, true); } test "serialize github explicit" { const from = \\something: \\ src: \\ github: \\ user: test \\ repo: my_repo \\ ref: master \\ ; const to = \\something: \\ src: \\ github: \\ user: test \\ repo: my_repo \\ ref: master \\ root: src/main.zig \\ ; try serializeTest(from, to, true); } test "serialize url non-explicit" { const str = \\something: \\ src: \\ url: "https://github.com" \\ root: main.zig \\ ; try serializeTest(str, str, false); } test "serialize url explicit" { const from = \\something: \\ src: \\ url: "https://github.com" \\ ; const to = \\something: \\ src: \\ url: "https://github.com" \\ root: src/main.zig \\ ; try serializeTest(from, to, true); }
src/Dependency.zig
const std = @import("std"); const Step = std.build.Step; pub fn build(b: *std.build.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(); const exe = b.addExecutable("Aima", "src/main.zig"); // TODO: conditionally compile without linking libc ideally without // requiring a flag exe.linkLibC(); exe.setTarget(target); exe.setBuildMode(mode); const options = b.addOptions(); exe.addOptions("options", options); 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); const valgrind_exe = b.addExecutable("Valgrind-Aima", "src/main.zig"); valgrind_exe.linkLibC(); valgrind_exe.setTarget(target); valgrind_exe.setBuildMode(mode); valgrind_exe.install(); valgrind_exe.valgrind_support = true; valgrind_exe.addOptions("options", options); var valgrind_cmd = b.addSystemCommand(&.{ "valgrind", b.getInstallPath(.bin, "Valgrind-Aima"), "--leak-check=full", "--track-origins=yes", "--show-leak-kinds=all", "--num-callers=15", }); valgrind_cmd.step.dependOn(b.getInstallStep()); if (b.args) |args| { run_cmd.addArgs(args); } const valgrind_step = b.step("valgrind", "Test with valgrind"); options.addOption(bool, "valgrind", true); valgrind_step.dependOn(&valgrind_cmd.step); // valgrind_step.makeFn = struct { // options: , // fn make(self: *Step) !void { // _ = self; // @This().options.addOption(bool, "valgrind", true); // } // }.make; const exe_tests = b.addTest("src/main.zig"); exe_tests.setTarget(target); exe_tests.setBuildMode(mode); const digraph_tests = b.addTest("src/digraph.zig"); digraph_tests.setTarget(target); digraph_tests.setBuildMode(mode); const uninformed_tests = b.addTest("src/uninformed.zig"); uninformed_tests.setTarget(target); uninformed_tests.setBuildMode(mode); const graph_tests = b.addTest("src/graph.zig"); graph_tests.setTarget(target); graph_tests.setBuildMode(mode); const uninformed_tests = b.addTest("src/uninformed.zig"); uninformed_tests.setTarget(target); uninformed_tests.setBuildMode(mode); const test_step = b.step("test", "Run unit tests"); test_step.dependOn(&exe_tests.step); test_step.dependOn(&digraph_tests.step); test_step.dependOn(&graph_tests.step); test_step.dependOn(&uninformed_tests.step); }
build.zig
/// The function fiatP256AddcarryxU32 is an addition with carry. /// Postconditions: /// out1 = (arg1 + arg2 + arg3) mod 2^32 /// out2 = ⌊(arg1 + arg2 + arg3) / 2^32⌋ /// /// Input Bounds: /// arg1: [0x0 ~> 0x1] /// arg2: [0x0 ~> 0xffffffff] /// arg3: [0x0 ~> 0xffffffff] /// Output Bounds: /// out1: [0x0 ~> 0xffffffff] /// out2: [0x0 ~> 0x1] fn fiatP256AddcarryxU32(out1: *u32, out2: *u1, arg1: u1, arg2: u32, arg3: u32) callconv(.Inline) void { const x1: u64 = ((@intCast(u64, arg1) + @intCast(u64, arg2)) + @intCast(u64, arg3)); const x2: u32 = @intCast(u32, (x1 & @intCast(u64, 0xffffffff))); const x3: u1 = @intCast(u1, (x1 >> 32)); out1.* = x2; out2.* = x3; } /// The function fiatP256SubborrowxU32 is a subtraction with borrow. /// Postconditions: /// out1 = (-arg1 + arg2 + -arg3) mod 2^32 /// out2 = -⌊(-arg1 + arg2 + -arg3) / 2^32⌋ /// /// Input Bounds: /// arg1: [0x0 ~> 0x1] /// arg2: [0x0 ~> 0xffffffff] /// arg3: [0x0 ~> 0xffffffff] /// Output Bounds: /// out1: [0x0 ~> 0xffffffff] /// out2: [0x0 ~> 0x1] fn fiatP256SubborrowxU32(out1: *u32, out2: *u1, arg1: u1, arg2: u32, arg3: u32) callconv(.Inline) void { const x1: i64 = ((@intCast(i64, arg2) - @intCast(i64, arg1)) - @intCast(i64, arg3)); const x2: i1 = @intCast(i1, (x1 >> 32)); const x3: u32 = @intCast(u32, (x1 & @intCast(i64, 0xffffffff))); out1.* = x3; out2.* = @intCast(u1, (@intCast(i2, 0x0) - @intCast(i2, x2))); } /// The function fiatP256MulxU32 is a multiplication, returning the full double-width result. /// Postconditions: /// out1 = (arg1 * arg2) mod 2^32 /// out2 = ⌊arg1 * arg2 / 2^32⌋ /// /// Input Bounds: /// arg1: [0x0 ~> 0xffffffff] /// arg2: [0x0 ~> 0xffffffff] /// Output Bounds: /// out1: [0x0 ~> 0xffffffff] /// out2: [0x0 ~> 0xffffffff] fn fiatP256MulxU32(out1: *u32, out2: *u32, arg1: u32, arg2: u32) callconv(.Inline) void { const x1: u64 = (@intCast(u64, arg1) * @intCast(u64, arg2)); const x2: u32 = @intCast(u32, (x1 & @intCast(u64, 0xffffffff))); const x3: u32 = @intCast(u32, (x1 >> 32)); out1.* = x2; out2.* = x3; } /// The function fiatP256CmovznzU32 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 fiatP256CmovznzU32(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 fiatP256Mul 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 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] /// arg2: [[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]] pub fn fiatP256Mul(out1: *[8]u32, arg1: [8]u32, arg2: [8]u32) void { const x1: u32 = (arg1[1]); const x2: u32 = (arg1[2]); const x3: u32 = (arg1[3]); const x4: u32 = (arg1[4]); const x5: u32 = (arg1[5]); const x6: u32 = (arg1[6]); const x7: u32 = (arg1[7]); const x8: u32 = (arg1[0]); var x9: u32 = undefined; var x10: u32 = undefined; fiatP256MulxU32(&x9, &x10, x8, (arg2[7])); var x11: u32 = undefined; var x12: u32 = undefined; fiatP256MulxU32(&x11, &x12, x8, (arg2[6])); var x13: u32 = undefined; var x14: u32 = undefined; fiatP256MulxU32(&x13, &x14, x8, (arg2[5])); var x15: u32 = undefined; var x16: u32 = undefined; fiatP256MulxU32(&x15, &x16, x8, (arg2[4])); var x17: u32 = undefined; var x18: u32 = undefined; fiatP256MulxU32(&x17, &x18, x8, (arg2[3])); var x19: u32 = undefined; var x20: u32 = undefined; fiatP256MulxU32(&x19, &x20, x8, (arg2[2])); var x21: u32 = undefined; var x22: u32 = undefined; fiatP256MulxU32(&x21, &x22, x8, (arg2[1])); var x23: u32 = undefined; var x24: u32 = undefined; fiatP256MulxU32(&x23, &x24, x8, (arg2[0])); var x25: u32 = undefined; var x26: u1 = undefined; fiatP256AddcarryxU32(&x25, &x26, 0x0, x24, x21); var x27: u32 = undefined; var x28: u1 = undefined; fiatP256AddcarryxU32(&x27, &x28, x26, x22, x19); var x29: u32 = undefined; var x30: u1 = undefined; fiatP256AddcarryxU32(&x29, &x30, x28, x20, x17); var x31: u32 = undefined; var x32: u1 = undefined; fiatP256AddcarryxU32(&x31, &x32, x30, x18, x15); var x33: u32 = undefined; var x34: u1 = undefined; fiatP256AddcarryxU32(&x33, &x34, x32, x16, x13); var x35: u32 = undefined; var x36: u1 = undefined; fiatP256AddcarryxU32(&x35, &x36, x34, x14, x11); var x37: u32 = undefined; var x38: u1 = undefined; fiatP256AddcarryxU32(&x37, &x38, x36, x12, x9); const x39: u32 = (@intCast(u32, x38) + x10); var x40: u32 = undefined; var x41: u32 = undefined; fiatP256MulxU32(&x40, &x41, x23, 0xffffffff); var x42: u32 = undefined; var x43: u32 = undefined; fiatP256MulxU32(&x42, &x43, x23, 0xffffffff); var x44: u32 = undefined; var x45: u32 = undefined; fiatP256MulxU32(&x44, &x45, x23, 0xffffffff); var x46: u32 = undefined; var x47: u32 = undefined; fiatP256MulxU32(&x46, &x47, x23, 0xffffffff); var x48: u32 = undefined; var x49: u1 = undefined; fiatP256AddcarryxU32(&x48, &x49, 0x0, x47, x44); var x50: u32 = undefined; var x51: u1 = undefined; fiatP256AddcarryxU32(&x50, &x51, x49, x45, x42); const x52: u32 = (@intCast(u32, x51) + x43); var x53: u32 = undefined; var x54: u1 = undefined; fiatP256AddcarryxU32(&x53, &x54, 0x0, x23, x46); var x55: u32 = undefined; var x56: u1 = undefined; fiatP256AddcarryxU32(&x55, &x56, x54, x25, x48); var x57: u32 = undefined; var x58: u1 = undefined; fiatP256AddcarryxU32(&x57, &x58, x56, x27, x50); var x59: u32 = undefined; var x60: u1 = undefined; fiatP256AddcarryxU32(&x59, &x60, x58, x29, x52); var x61: u32 = undefined; var x62: u1 = undefined; fiatP256AddcarryxU32(&x61, &x62, x60, x31, @intCast(u32, 0x0)); var x63: u32 = undefined; var x64: u1 = undefined; fiatP256AddcarryxU32(&x63, &x64, x62, x33, @intCast(u32, 0x0)); var x65: u32 = undefined; var x66: u1 = undefined; fiatP256AddcarryxU32(&x65, &x66, x64, x35, x23); var x67: u32 = undefined; var x68: u1 = undefined; fiatP256AddcarryxU32(&x67, &x68, x66, x37, x40); var x69: u32 = undefined; var x70: u1 = undefined; fiatP256AddcarryxU32(&x69, &x70, x68, x39, x41); var x71: u32 = undefined; var x72: u32 = undefined; fiatP256MulxU32(&x71, &x72, x1, (arg2[7])); var x73: u32 = undefined; var x74: u32 = undefined; fiatP256MulxU32(&x73, &x74, x1, (arg2[6])); var x75: u32 = undefined; var x76: u32 = undefined; fiatP256MulxU32(&x75, &x76, x1, (arg2[5])); var x77: u32 = undefined; var x78: u32 = undefined; fiatP256MulxU32(&x77, &x78, x1, (arg2[4])); var x79: u32 = undefined; var x80: u32 = undefined; fiatP256MulxU32(&x79, &x80, x1, (arg2[3])); var x81: u32 = undefined; var x82: u32 = undefined; fiatP256MulxU32(&x81, &x82, x1, (arg2[2])); var x83: u32 = undefined; var x84: u32 = undefined; fiatP256MulxU32(&x83, &x84, x1, (arg2[1])); var x85: u32 = undefined; var x86: u32 = undefined; fiatP256MulxU32(&x85, &x86, x1, (arg2[0])); var x87: u32 = undefined; var x88: u1 = undefined; fiatP256AddcarryxU32(&x87, &x88, 0x0, x86, x83); var x89: u32 = undefined; var x90: u1 = undefined; fiatP256AddcarryxU32(&x89, &x90, x88, x84, x81); var x91: u32 = undefined; var x92: u1 = undefined; fiatP256AddcarryxU32(&x91, &x92, x90, x82, x79); var x93: u32 = undefined; var x94: u1 = undefined; fiatP256AddcarryxU32(&x93, &x94, x92, x80, x77); var x95: u32 = undefined; var x96: u1 = undefined; fiatP256AddcarryxU32(&x95, &x96, x94, x78, x75); var x97: u32 = undefined; var x98: u1 = undefined; fiatP256AddcarryxU32(&x97, &x98, x96, x76, x73); var x99: u32 = undefined; var x100: u1 = undefined; fiatP256AddcarryxU32(&x99, &x100, x98, x74, x71); const x101: u32 = (@intCast(u32, x100) + x72); var x102: u32 = undefined; var x103: u1 = undefined; fiatP256AddcarryxU32(&x102, &x103, 0x0, x55, x85); var x104: u32 = undefined; var x105: u1 = undefined; fiatP256AddcarryxU32(&x104, &x105, x103, x57, x87); var x106: u32 = undefined; var x107: u1 = undefined; fiatP256AddcarryxU32(&x106, &x107, x105, x59, x89); var x108: u32 = undefined; var x109: u1 = undefined; fiatP256AddcarryxU32(&x108, &x109, x107, x61, x91); var x110: u32 = undefined; var x111: u1 = undefined; fiatP256AddcarryxU32(&x110, &x111, x109, x63, x93); var x112: u32 = undefined; var x113: u1 = undefined; fiatP256AddcarryxU32(&x112, &x113, x111, x65, x95); var x114: u32 = undefined; var x115: u1 = undefined; fiatP256AddcarryxU32(&x114, &x115, x113, x67, x97); var x116: u32 = undefined; var x117: u1 = undefined; fiatP256AddcarryxU32(&x116, &x117, x115, x69, x99); var x118: u32 = undefined; var x119: u1 = undefined; fiatP256AddcarryxU32(&x118, &x119, x117, @intCast(u32, x70), x101); var x120: u32 = undefined; var x121: u32 = undefined; fiatP256MulxU32(&x120, &x121, x102, 0xffffffff); var x122: u32 = undefined; var x123: u32 = undefined; fiatP256MulxU32(&x122, &x123, x102, 0xffffffff); var x124: u32 = undefined; var x125: u32 = undefined; fiatP256MulxU32(&x124, &x125, x102, 0xffffffff); var x126: u32 = undefined; var x127: u32 = undefined; fiatP256MulxU32(&x126, &x127, x102, 0xffffffff); var x128: u32 = undefined; var x129: u1 = undefined; fiatP256AddcarryxU32(&x128, &x129, 0x0, x127, x124); var x130: u32 = undefined; var x131: u1 = undefined; fiatP256AddcarryxU32(&x130, &x131, x129, x125, x122); const x132: u32 = (@intCast(u32, x131) + x123); var x133: u32 = undefined; var x134: u1 = undefined; fiatP256AddcarryxU32(&x133, &x134, 0x0, x102, x126); var x135: u32 = undefined; var x136: u1 = undefined; fiatP256AddcarryxU32(&x135, &x136, x134, x104, x128); var x137: u32 = undefined; var x138: u1 = undefined; fiatP256AddcarryxU32(&x137, &x138, x136, x106, x130); var x139: u32 = undefined; var x140: u1 = undefined; fiatP256AddcarryxU32(&x139, &x140, x138, x108, x132); var x141: u32 = undefined; var x142: u1 = undefined; fiatP256AddcarryxU32(&x141, &x142, x140, x110, @intCast(u32, 0x0)); var x143: u32 = undefined; var x144: u1 = undefined; fiatP256AddcarryxU32(&x143, &x144, x142, x112, @intCast(u32, 0x0)); var x145: u32 = undefined; var x146: u1 = undefined; fiatP256AddcarryxU32(&x145, &x146, x144, x114, x102); var x147: u32 = undefined; var x148: u1 = undefined; fiatP256AddcarryxU32(&x147, &x148, x146, x116, x120); var x149: u32 = undefined; var x150: u1 = undefined; fiatP256AddcarryxU32(&x149, &x150, x148, x118, x121); const x151: u32 = (@intCast(u32, x150) + @intCast(u32, x119)); var x152: u32 = undefined; var x153: u32 = undefined; fiatP256MulxU32(&x152, &x153, x2, (arg2[7])); var x154: u32 = undefined; var x155: u32 = undefined; fiatP256MulxU32(&x154, &x155, x2, (arg2[6])); var x156: u32 = undefined; var x157: u32 = undefined; fiatP256MulxU32(&x156, &x157, x2, (arg2[5])); var x158: u32 = undefined; var x159: u32 = undefined; fiatP256MulxU32(&x158, &x159, x2, (arg2[4])); var x160: u32 = undefined; var x161: u32 = undefined; fiatP256MulxU32(&x160, &x161, x2, (arg2[3])); var x162: u32 = undefined; var x163: u32 = undefined; fiatP256MulxU32(&x162, &x163, x2, (arg2[2])); var x164: u32 = undefined; var x165: u32 = undefined; fiatP256MulxU32(&x164, &x165, x2, (arg2[1])); var x166: u32 = undefined; var x167: u32 = undefined; fiatP256MulxU32(&x166, &x167, x2, (arg2[0])); var x168: u32 = undefined; var x169: u1 = undefined; fiatP256AddcarryxU32(&x168, &x169, 0x0, x167, x164); var x170: u32 = undefined; var x171: u1 = undefined; fiatP256AddcarryxU32(&x170, &x171, x169, x165, x162); var x172: u32 = undefined; var x173: u1 = undefined; fiatP256AddcarryxU32(&x172, &x173, x171, x163, x160); var x174: u32 = undefined; var x175: u1 = undefined; fiatP256AddcarryxU32(&x174, &x175, x173, x161, x158); var x176: u32 = undefined; var x177: u1 = undefined; fiatP256AddcarryxU32(&x176, &x177, x175, x159, x156); var x178: u32 = undefined; var x179: u1 = undefined; fiatP256AddcarryxU32(&x178, &x179, x177, x157, x154); var x180: u32 = undefined; var x181: u1 = undefined; fiatP256AddcarryxU32(&x180, &x181, x179, x155, x152); const x182: u32 = (@intCast(u32, x181) + x153); var x183: u32 = undefined; var x184: u1 = undefined; fiatP256AddcarryxU32(&x183, &x184, 0x0, x135, x166); var x185: u32 = undefined; var x186: u1 = undefined; fiatP256AddcarryxU32(&x185, &x186, x184, x137, x168); var x187: u32 = undefined; var x188: u1 = undefined; fiatP256AddcarryxU32(&x187, &x188, x186, x139, x170); var x189: u32 = undefined; var x190: u1 = undefined; fiatP256AddcarryxU32(&x189, &x190, x188, x141, x172); var x191: u32 = undefined; var x192: u1 = undefined; fiatP256AddcarryxU32(&x191, &x192, x190, x143, x174); var x193: u32 = undefined; var x194: u1 = undefined; fiatP256AddcarryxU32(&x193, &x194, x192, x145, x176); var x195: u32 = undefined; var x196: u1 = undefined; fiatP256AddcarryxU32(&x195, &x196, x194, x147, x178); var x197: u32 = undefined; var x198: u1 = undefined; fiatP256AddcarryxU32(&x197, &x198, x196, x149, x180); var x199: u32 = undefined; var x200: u1 = undefined; fiatP256AddcarryxU32(&x199, &x200, x198, x151, x182); var x201: u32 = undefined; var x202: u32 = undefined; fiatP256MulxU32(&x201, &x202, x183, 0xffffffff); var x203: u32 = undefined; var x204: u32 = undefined; fiatP256MulxU32(&x203, &x204, x183, 0xffffffff); var x205: u32 = undefined; var x206: u32 = undefined; fiatP256MulxU32(&x205, &x206, x183, 0xffffffff); var x207: u32 = undefined; var x208: u32 = undefined; fiatP256MulxU32(&x207, &x208, x183, 0xffffffff); var x209: u32 = undefined; var x210: u1 = undefined; fiatP256AddcarryxU32(&x209, &x210, 0x0, x208, x205); var x211: u32 = undefined; var x212: u1 = undefined; fiatP256AddcarryxU32(&x211, &x212, x210, x206, x203); const x213: u32 = (@intCast(u32, x212) + x204); var x214: u32 = undefined; var x215: u1 = undefined; fiatP256AddcarryxU32(&x214, &x215, 0x0, x183, x207); var x216: u32 = undefined; var x217: u1 = undefined; fiatP256AddcarryxU32(&x216, &x217, x215, x185, x209); var x218: u32 = undefined; var x219: u1 = undefined; fiatP256AddcarryxU32(&x218, &x219, x217, x187, x211); var x220: u32 = undefined; var x221: u1 = undefined; fiatP256AddcarryxU32(&x220, &x221, x219, x189, x213); var x222: u32 = undefined; var x223: u1 = undefined; fiatP256AddcarryxU32(&x222, &x223, x221, x191, @intCast(u32, 0x0)); var x224: u32 = undefined; var x225: u1 = undefined; fiatP256AddcarryxU32(&x224, &x225, x223, x193, @intCast(u32, 0x0)); var x226: u32 = undefined; var x227: u1 = undefined; fiatP256AddcarryxU32(&x226, &x227, x225, x195, x183); var x228: u32 = undefined; var x229: u1 = undefined; fiatP256AddcarryxU32(&x228, &x229, x227, x197, x201); var x230: u32 = undefined; var x231: u1 = undefined; fiatP256AddcarryxU32(&x230, &x231, x229, x199, x202); const x232: u32 = (@intCast(u32, x231) + @intCast(u32, x200)); var x233: u32 = undefined; var x234: u32 = undefined; fiatP256MulxU32(&x233, &x234, x3, (arg2[7])); var x235: u32 = undefined; var x236: u32 = undefined; fiatP256MulxU32(&x235, &x236, x3, (arg2[6])); var x237: u32 = undefined; var x238: u32 = undefined; fiatP256MulxU32(&x237, &x238, x3, (arg2[5])); var x239: u32 = undefined; var x240: u32 = undefined; fiatP256MulxU32(&x239, &x240, x3, (arg2[4])); var x241: u32 = undefined; var x242: u32 = undefined; fiatP256MulxU32(&x241, &x242, x3, (arg2[3])); var x243: u32 = undefined; var x244: u32 = undefined; fiatP256MulxU32(&x243, &x244, x3, (arg2[2])); var x245: u32 = undefined; var x246: u32 = undefined; fiatP256MulxU32(&x245, &x246, x3, (arg2[1])); var x247: u32 = undefined; var x248: u32 = undefined; fiatP256MulxU32(&x247, &x248, x3, (arg2[0])); var x249: u32 = undefined; var x250: u1 = undefined; fiatP256AddcarryxU32(&x249, &x250, 0x0, x248, x245); var x251: u32 = undefined; var x252: u1 = undefined; fiatP256AddcarryxU32(&x251, &x252, x250, x246, x243); var x253: u32 = undefined; var x254: u1 = undefined; fiatP256AddcarryxU32(&x253, &x254, x252, x244, x241); var x255: u32 = undefined; var x256: u1 = undefined; fiatP256AddcarryxU32(&x255, &x256, x254, x242, x239); var x257: u32 = undefined; var x258: u1 = undefined; fiatP256AddcarryxU32(&x257, &x258, x256, x240, x237); var x259: u32 = undefined; var x260: u1 = undefined; fiatP256AddcarryxU32(&x259, &x260, x258, x238, x235); var x261: u32 = undefined; var x262: u1 = undefined; fiatP256AddcarryxU32(&x261, &x262, x260, x236, x233); const x263: u32 = (@intCast(u32, x262) + x234); var x264: u32 = undefined; var x265: u1 = undefined; fiatP256AddcarryxU32(&x264, &x265, 0x0, x216, x247); var x266: u32 = undefined; var x267: u1 = undefined; fiatP256AddcarryxU32(&x266, &x267, x265, x218, x249); var x268: u32 = undefined; var x269: u1 = undefined; fiatP256AddcarryxU32(&x268, &x269, x267, x220, x251); var x270: u32 = undefined; var x271: u1 = undefined; fiatP256AddcarryxU32(&x270, &x271, x269, x222, x253); var x272: u32 = undefined; var x273: u1 = undefined; fiatP256AddcarryxU32(&x272, &x273, x271, x224, x255); var x274: u32 = undefined; var x275: u1 = undefined; fiatP256AddcarryxU32(&x274, &x275, x273, x226, x257); var x276: u32 = undefined; var x277: u1 = undefined; fiatP256AddcarryxU32(&x276, &x277, x275, x228, x259); var x278: u32 = undefined; var x279: u1 = undefined; fiatP256AddcarryxU32(&x278, &x279, x277, x230, x261); var x280: u32 = undefined; var x281: u1 = undefined; fiatP256AddcarryxU32(&x280, &x281, x279, x232, x263); var x282: u32 = undefined; var x283: u32 = undefined; fiatP256MulxU32(&x282, &x283, x264, 0xffffffff); var x284: u32 = undefined; var x285: u32 = undefined; fiatP256MulxU32(&x284, &x285, x264, 0xffffffff); var x286: u32 = undefined; var x287: u32 = undefined; fiatP256MulxU32(&x286, &x287, x264, 0xffffffff); var x288: u32 = undefined; var x289: u32 = undefined; fiatP256MulxU32(&x288, &x289, x264, 0xffffffff); var x290: u32 = undefined; var x291: u1 = undefined; fiatP256AddcarryxU32(&x290, &x291, 0x0, x289, x286); var x292: u32 = undefined; var x293: u1 = undefined; fiatP256AddcarryxU32(&x292, &x293, x291, x287, x284); const x294: u32 = (@intCast(u32, x293) + x285); var x295: u32 = undefined; var x296: u1 = undefined; fiatP256AddcarryxU32(&x295, &x296, 0x0, x264, x288); var x297: u32 = undefined; var x298: u1 = undefined; fiatP256AddcarryxU32(&x297, &x298, x296, x266, x290); var x299: u32 = undefined; var x300: u1 = undefined; fiatP256AddcarryxU32(&x299, &x300, x298, x268, x292); var x301: u32 = undefined; var x302: u1 = undefined; fiatP256AddcarryxU32(&x301, &x302, x300, x270, x294); var x303: u32 = undefined; var x304: u1 = undefined; fiatP256AddcarryxU32(&x303, &x304, x302, x272, @intCast(u32, 0x0)); var x305: u32 = undefined; var x306: u1 = undefined; fiatP256AddcarryxU32(&x305, &x306, x304, x274, @intCast(u32, 0x0)); var x307: u32 = undefined; var x308: u1 = undefined; fiatP256AddcarryxU32(&x307, &x308, x306, x276, x264); var x309: u32 = undefined; var x310: u1 = undefined; fiatP256AddcarryxU32(&x309, &x310, x308, x278, x282); var x311: u32 = undefined; var x312: u1 = undefined; fiatP256AddcarryxU32(&x311, &x312, x310, x280, x283); const x313: u32 = (@intCast(u32, x312) + @intCast(u32, x281)); var x314: u32 = undefined; var x315: u32 = undefined; fiatP256MulxU32(&x314, &x315, x4, (arg2[7])); var x316: u32 = undefined; var x317: u32 = undefined; fiatP256MulxU32(&x316, &x317, x4, (arg2[6])); var x318: u32 = undefined; var x319: u32 = undefined; fiatP256MulxU32(&x318, &x319, x4, (arg2[5])); var x320: u32 = undefined; var x321: u32 = undefined; fiatP256MulxU32(&x320, &x321, x4, (arg2[4])); var x322: u32 = undefined; var x323: u32 = undefined; fiatP256MulxU32(&x322, &x323, x4, (arg2[3])); var x324: u32 = undefined; var x325: u32 = undefined; fiatP256MulxU32(&x324, &x325, x4, (arg2[2])); var x326: u32 = undefined; var x327: u32 = undefined; fiatP256MulxU32(&x326, &x327, x4, (arg2[1])); var x328: u32 = undefined; var x329: u32 = undefined; fiatP256MulxU32(&x328, &x329, x4, (arg2[0])); var x330: u32 = undefined; var x331: u1 = undefined; fiatP256AddcarryxU32(&x330, &x331, 0x0, x329, x326); var x332: u32 = undefined; var x333: u1 = undefined; fiatP256AddcarryxU32(&x332, &x333, x331, x327, x324); var x334: u32 = undefined; var x335: u1 = undefined; fiatP256AddcarryxU32(&x334, &x335, x333, x325, x322); var x336: u32 = undefined; var x337: u1 = undefined; fiatP256AddcarryxU32(&x336, &x337, x335, x323, x320); var x338: u32 = undefined; var x339: u1 = undefined; fiatP256AddcarryxU32(&x338, &x339, x337, x321, x318); var x340: u32 = undefined; var x341: u1 = undefined; fiatP256AddcarryxU32(&x340, &x341, x339, x319, x316); var x342: u32 = undefined; var x343: u1 = undefined; fiatP256AddcarryxU32(&x342, &x343, x341, x317, x314); const x344: u32 = (@intCast(u32, x343) + x315); var x345: u32 = undefined; var x346: u1 = undefined; fiatP256AddcarryxU32(&x345, &x346, 0x0, x297, x328); var x347: u32 = undefined; var x348: u1 = undefined; fiatP256AddcarryxU32(&x347, &x348, x346, x299, x330); var x349: u32 = undefined; var x350: u1 = undefined; fiatP256AddcarryxU32(&x349, &x350, x348, x301, x332); var x351: u32 = undefined; var x352: u1 = undefined; fiatP256AddcarryxU32(&x351, &x352, x350, x303, x334); var x353: u32 = undefined; var x354: u1 = undefined; fiatP256AddcarryxU32(&x353, &x354, x352, x305, x336); var x355: u32 = undefined; var x356: u1 = undefined; fiatP256AddcarryxU32(&x355, &x356, x354, x307, x338); var x357: u32 = undefined; var x358: u1 = undefined; fiatP256AddcarryxU32(&x357, &x358, x356, x309, x340); var x359: u32 = undefined; var x360: u1 = undefined; fiatP256AddcarryxU32(&x359, &x360, x358, x311, x342); var x361: u32 = undefined; var x362: u1 = undefined; fiatP256AddcarryxU32(&x361, &x362, x360, x313, x344); var x363: u32 = undefined; var x364: u32 = undefined; fiatP256MulxU32(&x363, &x364, x345, 0xffffffff); var x365: u32 = undefined; var x366: u32 = undefined; fiatP256MulxU32(&x365, &x366, x345, 0xffffffff); var x367: u32 = undefined; var x368: u32 = undefined; fiatP256MulxU32(&x367, &x368, x345, 0xffffffff); var x369: u32 = undefined; var x370: u32 = undefined; fiatP256MulxU32(&x369, &x370, x345, 0xffffffff); var x371: u32 = undefined; var x372: u1 = undefined; fiatP256AddcarryxU32(&x371, &x372, 0x0, x370, x367); var x373: u32 = undefined; var x374: u1 = undefined; fiatP256AddcarryxU32(&x373, &x374, x372, x368, x365); const x375: u32 = (@intCast(u32, x374) + x366); var x376: u32 = undefined; var x377: u1 = undefined; fiatP256AddcarryxU32(&x376, &x377, 0x0, x345, x369); var x378: u32 = undefined; var x379: u1 = undefined; fiatP256AddcarryxU32(&x378, &x379, x377, x347, x371); var x380: u32 = undefined; var x381: u1 = undefined; fiatP256AddcarryxU32(&x380, &x381, x379, x349, x373); var x382: u32 = undefined; var x383: u1 = undefined; fiatP256AddcarryxU32(&x382, &x383, x381, x351, x375); var x384: u32 = undefined; var x385: u1 = undefined; fiatP256AddcarryxU32(&x384, &x385, x383, x353, @intCast(u32, 0x0)); var x386: u32 = undefined; var x387: u1 = undefined; fiatP256AddcarryxU32(&x386, &x387, x385, x355, @intCast(u32, 0x0)); var x388: u32 = undefined; var x389: u1 = undefined; fiatP256AddcarryxU32(&x388, &x389, x387, x357, x345); var x390: u32 = undefined; var x391: u1 = undefined; fiatP256AddcarryxU32(&x390, &x391, x389, x359, x363); var x392: u32 = undefined; var x393: u1 = undefined; fiatP256AddcarryxU32(&x392, &x393, x391, x361, x364); const x394: u32 = (@intCast(u32, x393) + @intCast(u32, x362)); var x395: u32 = undefined; var x396: u32 = undefined; fiatP256MulxU32(&x395, &x396, x5, (arg2[7])); var x397: u32 = undefined; var x398: u32 = undefined; fiatP256MulxU32(&x397, &x398, x5, (arg2[6])); var x399: u32 = undefined; var x400: u32 = undefined; fiatP256MulxU32(&x399, &x400, x5, (arg2[5])); var x401: u32 = undefined; var x402: u32 = undefined; fiatP256MulxU32(&x401, &x402, x5, (arg2[4])); var x403: u32 = undefined; var x404: u32 = undefined; fiatP256MulxU32(&x403, &x404, x5, (arg2[3])); var x405: u32 = undefined; var x406: u32 = undefined; fiatP256MulxU32(&x405, &x406, x5, (arg2[2])); var x407: u32 = undefined; var x408: u32 = undefined; fiatP256MulxU32(&x407, &x408, x5, (arg2[1])); var x409: u32 = undefined; var x410: u32 = undefined; fiatP256MulxU32(&x409, &x410, x5, (arg2[0])); var x411: u32 = undefined; var x412: u1 = undefined; fiatP256AddcarryxU32(&x411, &x412, 0x0, x410, x407); var x413: u32 = undefined; var x414: u1 = undefined; fiatP256AddcarryxU32(&x413, &x414, x412, x408, x405); var x415: u32 = undefined; var x416: u1 = undefined; fiatP256AddcarryxU32(&x415, &x416, x414, x406, x403); var x417: u32 = undefined; var x418: u1 = undefined; fiatP256AddcarryxU32(&x417, &x418, x416, x404, x401); var x419: u32 = undefined; var x420: u1 = undefined; fiatP256AddcarryxU32(&x419, &x420, x418, x402, x399); var x421: u32 = undefined; var x422: u1 = undefined; fiatP256AddcarryxU32(&x421, &x422, x420, x400, x397); var x423: u32 = undefined; var x424: u1 = undefined; fiatP256AddcarryxU32(&x423, &x424, x422, x398, x395); const x425: u32 = (@intCast(u32, x424) + x396); var x426: u32 = undefined; var x427: u1 = undefined; fiatP256AddcarryxU32(&x426, &x427, 0x0, x378, x409); var x428: u32 = undefined; var x429: u1 = undefined; fiatP256AddcarryxU32(&x428, &x429, x427, x380, x411); var x430: u32 = undefined; var x431: u1 = undefined; fiatP256AddcarryxU32(&x430, &x431, x429, x382, x413); var x432: u32 = undefined; var x433: u1 = undefined; fiatP256AddcarryxU32(&x432, &x433, x431, x384, x415); var x434: u32 = undefined; var x435: u1 = undefined; fiatP256AddcarryxU32(&x434, &x435, x433, x386, x417); var x436: u32 = undefined; var x437: u1 = undefined; fiatP256AddcarryxU32(&x436, &x437, x435, x388, x419); var x438: u32 = undefined; var x439: u1 = undefined; fiatP256AddcarryxU32(&x438, &x439, x437, x390, x421); var x440: u32 = undefined; var x441: u1 = undefined; fiatP256AddcarryxU32(&x440, &x441, x439, x392, x423); var x442: u32 = undefined; var x443: u1 = undefined; fiatP256AddcarryxU32(&x442, &x443, x441, x394, x425); var x444: u32 = undefined; var x445: u32 = undefined; fiatP256MulxU32(&x444, &x445, x426, 0xffffffff); var x446: u32 = undefined; var x447: u32 = undefined; fiatP256MulxU32(&x446, &x447, x426, 0xffffffff); var x448: u32 = undefined; var x449: u32 = undefined; fiatP256MulxU32(&x448, &x449, x426, 0xffffffff); var x450: u32 = undefined; var x451: u32 = undefined; fiatP256MulxU32(&x450, &x451, x426, 0xffffffff); var x452: u32 = undefined; var x453: u1 = undefined; fiatP256AddcarryxU32(&x452, &x453, 0x0, x451, x448); var x454: u32 = undefined; var x455: u1 = undefined; fiatP256AddcarryxU32(&x454, &x455, x453, x449, x446); const x456: u32 = (@intCast(u32, x455) + x447); var x457: u32 = undefined; var x458: u1 = undefined; fiatP256AddcarryxU32(&x457, &x458, 0x0, x426, x450); var x459: u32 = undefined; var x460: u1 = undefined; fiatP256AddcarryxU32(&x459, &x460, x458, x428, x452); var x461: u32 = undefined; var x462: u1 = undefined; fiatP256AddcarryxU32(&x461, &x462, x460, x430, x454); var x463: u32 = undefined; var x464: u1 = undefined; fiatP256AddcarryxU32(&x463, &x464, x462, x432, x456); var x465: u32 = undefined; var x466: u1 = undefined; fiatP256AddcarryxU32(&x465, &x466, x464, x434, @intCast(u32, 0x0)); var x467: u32 = undefined; var x468: u1 = undefined; fiatP256AddcarryxU32(&x467, &x468, x466, x436, @intCast(u32, 0x0)); var x469: u32 = undefined; var x470: u1 = undefined; fiatP256AddcarryxU32(&x469, &x470, x468, x438, x426); var x471: u32 = undefined; var x472: u1 = undefined; fiatP256AddcarryxU32(&x471, &x472, x470, x440, x444); var x473: u32 = undefined; var x474: u1 = undefined; fiatP256AddcarryxU32(&x473, &x474, x472, x442, x445); const x475: u32 = (@intCast(u32, x474) + @intCast(u32, x443)); var x476: u32 = undefined; var x477: u32 = undefined; fiatP256MulxU32(&x476, &x477, x6, (arg2[7])); var x478: u32 = undefined; var x479: u32 = undefined; fiatP256MulxU32(&x478, &x479, x6, (arg2[6])); var x480: u32 = undefined; var x481: u32 = undefined; fiatP256MulxU32(&x480, &x481, x6, (arg2[5])); var x482: u32 = undefined; var x483: u32 = undefined; fiatP256MulxU32(&x482, &x483, x6, (arg2[4])); var x484: u32 = undefined; var x485: u32 = undefined; fiatP256MulxU32(&x484, &x485, x6, (arg2[3])); var x486: u32 = undefined; var x487: u32 = undefined; fiatP256MulxU32(&x486, &x487, x6, (arg2[2])); var x488: u32 = undefined; var x489: u32 = undefined; fiatP256MulxU32(&x488, &x489, x6, (arg2[1])); var x490: u32 = undefined; var x491: u32 = undefined; fiatP256MulxU32(&x490, &x491, x6, (arg2[0])); var x492: u32 = undefined; var x493: u1 = undefined; fiatP256AddcarryxU32(&x492, &x493, 0x0, x491, x488); var x494: u32 = undefined; var x495: u1 = undefined; fiatP256AddcarryxU32(&x494, &x495, x493, x489, x486); var x496: u32 = undefined; var x497: u1 = undefined; fiatP256AddcarryxU32(&x496, &x497, x495, x487, x484); var x498: u32 = undefined; var x499: u1 = undefined; fiatP256AddcarryxU32(&x498, &x499, x497, x485, x482); var x500: u32 = undefined; var x501: u1 = undefined; fiatP256AddcarryxU32(&x500, &x501, x499, x483, x480); var x502: u32 = undefined; var x503: u1 = undefined; fiatP256AddcarryxU32(&x502, &x503, x501, x481, x478); var x504: u32 = undefined; var x505: u1 = undefined; fiatP256AddcarryxU32(&x504, &x505, x503, x479, x476); const x506: u32 = (@intCast(u32, x505) + x477); var x507: u32 = undefined; var x508: u1 = undefined; fiatP256AddcarryxU32(&x507, &x508, 0x0, x459, x490); var x509: u32 = undefined; var x510: u1 = undefined; fiatP256AddcarryxU32(&x509, &x510, x508, x461, x492); var x511: u32 = undefined; var x512: u1 = undefined; fiatP256AddcarryxU32(&x511, &x512, x510, x463, x494); var x513: u32 = undefined; var x514: u1 = undefined; fiatP256AddcarryxU32(&x513, &x514, x512, x465, x496); var x515: u32 = undefined; var x516: u1 = undefined; fiatP256AddcarryxU32(&x515, &x516, x514, x467, x498); var x517: u32 = undefined; var x518: u1 = undefined; fiatP256AddcarryxU32(&x517, &x518, x516, x469, x500); var x519: u32 = undefined; var x520: u1 = undefined; fiatP256AddcarryxU32(&x519, &x520, x518, x471, x502); var x521: u32 = undefined; var x522: u1 = undefined; fiatP256AddcarryxU32(&x521, &x522, x520, x473, x504); var x523: u32 = undefined; var x524: u1 = undefined; fiatP256AddcarryxU32(&x523, &x524, x522, x475, x506); var x525: u32 = undefined; var x526: u32 = undefined; fiatP256MulxU32(&x525, &x526, x507, 0xffffffff); var x527: u32 = undefined; var x528: u32 = undefined; fiatP256MulxU32(&x527, &x528, x507, 0xffffffff); var x529: u32 = undefined; var x530: u32 = undefined; fiatP256MulxU32(&x529, &x530, x507, 0xffffffff); var x531: u32 = undefined; var x532: u32 = undefined; fiatP256MulxU32(&x531, &x532, x507, 0xffffffff); var x533: u32 = undefined; var x534: u1 = undefined; fiatP256AddcarryxU32(&x533, &x534, 0x0, x532, x529); var x535: u32 = undefined; var x536: u1 = undefined; fiatP256AddcarryxU32(&x535, &x536, x534, x530, x527); const x537: u32 = (@intCast(u32, x536) + x528); var x538: u32 = undefined; var x539: u1 = undefined; fiatP256AddcarryxU32(&x538, &x539, 0x0, x507, x531); var x540: u32 = undefined; var x541: u1 = undefined; fiatP256AddcarryxU32(&x540, &x541, x539, x509, x533); var x542: u32 = undefined; var x543: u1 = undefined; fiatP256AddcarryxU32(&x542, &x543, x541, x511, x535); var x544: u32 = undefined; var x545: u1 = undefined; fiatP256AddcarryxU32(&x544, &x545, x543, x513, x537); var x546: u32 = undefined; var x547: u1 = undefined; fiatP256AddcarryxU32(&x546, &x547, x545, x515, @intCast(u32, 0x0)); var x548: u32 = undefined; var x549: u1 = undefined; fiatP256AddcarryxU32(&x548, &x549, x547, x517, @intCast(u32, 0x0)); var x550: u32 = undefined; var x551: u1 = undefined; fiatP256AddcarryxU32(&x550, &x551, x549, x519, x507); var x552: u32 = undefined; var x553: u1 = undefined; fiatP256AddcarryxU32(&x552, &x553, x551, x521, x525); var x554: u32 = undefined; var x555: u1 = undefined; fiatP256AddcarryxU32(&x554, &x555, x553, x523, x526); const x556: u32 = (@intCast(u32, x555) + @intCast(u32, x524)); var x557: u32 = undefined; var x558: u32 = undefined; fiatP256MulxU32(&x557, &x558, x7, (arg2[7])); var x559: u32 = undefined; var x560: u32 = undefined; fiatP256MulxU32(&x559, &x560, x7, (arg2[6])); var x561: u32 = undefined; var x562: u32 = undefined; fiatP256MulxU32(&x561, &x562, x7, (arg2[5])); var x563: u32 = undefined; var x564: u32 = undefined; fiatP256MulxU32(&x563, &x564, x7, (arg2[4])); var x565: u32 = undefined; var x566: u32 = undefined; fiatP256MulxU32(&x565, &x566, x7, (arg2[3])); var x567: u32 = undefined; var x568: u32 = undefined; fiatP256MulxU32(&x567, &x568, x7, (arg2[2])); var x569: u32 = undefined; var x570: u32 = undefined; fiatP256MulxU32(&x569, &x570, x7, (arg2[1])); var x571: u32 = undefined; var x572: u32 = undefined; fiatP256MulxU32(&x571, &x572, x7, (arg2[0])); var x573: u32 = undefined; var x574: u1 = undefined; fiatP256AddcarryxU32(&x573, &x574, 0x0, x572, x569); var x575: u32 = undefined; var x576: u1 = undefined; fiatP256AddcarryxU32(&x575, &x576, x574, x570, x567); var x577: u32 = undefined; var x578: u1 = undefined; fiatP256AddcarryxU32(&x577, &x578, x576, x568, x565); var x579: u32 = undefined; var x580: u1 = undefined; fiatP256AddcarryxU32(&x579, &x580, x578, x566, x563); var x581: u32 = undefined; var x582: u1 = undefined; fiatP256AddcarryxU32(&x581, &x582, x580, x564, x561); var x583: u32 = undefined; var x584: u1 = undefined; fiatP256AddcarryxU32(&x583, &x584, x582, x562, x559); var x585: u32 = undefined; var x586: u1 = undefined; fiatP256AddcarryxU32(&x585, &x586, x584, x560, x557); const x587: u32 = (@intCast(u32, x586) + x558); var x588: u32 = undefined; var x589: u1 = undefined; fiatP256AddcarryxU32(&x588, &x589, 0x0, x540, x571); var x590: u32 = undefined; var x591: u1 = undefined; fiatP256AddcarryxU32(&x590, &x591, x589, x542, x573); var x592: u32 = undefined; var x593: u1 = undefined; fiatP256AddcarryxU32(&x592, &x593, x591, x544, x575); var x594: u32 = undefined; var x595: u1 = undefined; fiatP256AddcarryxU32(&x594, &x595, x593, x546, x577); var x596: u32 = undefined; var x597: u1 = undefined; fiatP256AddcarryxU32(&x596, &x597, x595, x548, x579); var x598: u32 = undefined; var x599: u1 = undefined; fiatP256AddcarryxU32(&x598, &x599, x597, x550, x581); var x600: u32 = undefined; var x601: u1 = undefined; fiatP256AddcarryxU32(&x600, &x601, x599, x552, x583); var x602: u32 = undefined; var x603: u1 = undefined; fiatP256AddcarryxU32(&x602, &x603, x601, x554, x585); var x604: u32 = undefined; var x605: u1 = undefined; fiatP256AddcarryxU32(&x604, &x605, x603, x556, x587); var x606: u32 = undefined; var x607: u32 = undefined; fiatP256MulxU32(&x606, &x607, x588, 0xffffffff); var x608: u32 = undefined; var x609: u32 = undefined; fiatP256MulxU32(&x608, &x609, x588, 0xffffffff); var x610: u32 = undefined; var x611: u32 = undefined; fiatP256MulxU32(&x610, &x611, x588, 0xffffffff); var x612: u32 = undefined; var x613: u32 = undefined; fiatP256MulxU32(&x612, &x613, x588, 0xffffffff); var x614: u32 = undefined; var x615: u1 = undefined; fiatP256AddcarryxU32(&x614, &x615, 0x0, x613, x610); var x616: u32 = undefined; var x617: u1 = undefined; fiatP256AddcarryxU32(&x616, &x617, x615, x611, x608); const x618: u32 = (@intCast(u32, x617) + x609); var x619: u32 = undefined; var x620: u1 = undefined; fiatP256AddcarryxU32(&x619, &x620, 0x0, x588, x612); var x621: u32 = undefined; var x622: u1 = undefined; fiatP256AddcarryxU32(&x621, &x622, x620, x590, x614); var x623: u32 = undefined; var x624: u1 = undefined; fiatP256AddcarryxU32(&x623, &x624, x622, x592, x616); var x625: u32 = undefined; var x626: u1 = undefined; fiatP256AddcarryxU32(&x625, &x626, x624, x594, x618); var x627: u32 = undefined; var x628: u1 = undefined; fiatP256AddcarryxU32(&x627, &x628, x626, x596, @intCast(u32, 0x0)); var x629: u32 = undefined; var x630: u1 = undefined; fiatP256AddcarryxU32(&x629, &x630, x628, x598, @intCast(u32, 0x0)); var x631: u32 = undefined; var x632: u1 = undefined; fiatP256AddcarryxU32(&x631, &x632, x630, x600, x588); var x633: u32 = undefined; var x634: u1 = undefined; fiatP256AddcarryxU32(&x633, &x634, x632, x602, x606); var x635: u32 = undefined; var x636: u1 = undefined; fiatP256AddcarryxU32(&x635, &x636, x634, x604, x607); const x637: u32 = (@intCast(u32, x636) + @intCast(u32, x605)); var x638: u32 = undefined; var x639: u1 = undefined; fiatP256SubborrowxU32(&x638, &x639, 0x0, x621, 0xffffffff); var x640: u32 = undefined; var x641: u1 = undefined; fiatP256SubborrowxU32(&x640, &x641, x639, x623, 0xffffffff); var x642: u32 = undefined; var x643: u1 = undefined; fiatP256SubborrowxU32(&x642, &x643, x641, x625, 0xffffffff); var x644: u32 = undefined; var x645: u1 = undefined; fiatP256SubborrowxU32(&x644, &x645, x643, x627, @intCast(u32, 0x0)); var x646: u32 = undefined; var x647: u1 = undefined; fiatP256SubborrowxU32(&x646, &x647, x645, x629, @intCast(u32, 0x0)); var x648: u32 = undefined; var x649: u1 = undefined; fiatP256SubborrowxU32(&x648, &x649, x647, x631, @intCast(u32, 0x0)); var x650: u32 = undefined; var x651: u1 = undefined; fiatP256SubborrowxU32(&x650, &x651, x649, x633, @intCast(u32, 0x1)); var x652: u32 = undefined; var x653: u1 = undefined; fiatP256SubborrowxU32(&x652, &x653, x651, x635, 0xffffffff); var x654: u32 = undefined; var x655: u1 = undefined; fiatP256SubborrowxU32(&x654, &x655, x653, x637, @intCast(u32, 0x0)); var x656: u32 = undefined; fiatP256CmovznzU32(&x656, x655, x638, x621); var x657: u32 = undefined; fiatP256CmovznzU32(&x657, x655, x640, x623); var x658: u32 = undefined; fiatP256CmovznzU32(&x658, x655, x642, x625); var x659: u32 = undefined; fiatP256CmovznzU32(&x659, x655, x644, x627); var x660: u32 = undefined; fiatP256CmovznzU32(&x660, x655, x646, x629); var x661: u32 = undefined; fiatP256CmovznzU32(&x661, x655, x648, x631); var x662: u32 = undefined; fiatP256CmovznzU32(&x662, x655, x650, x633); var x663: u32 = undefined; fiatP256CmovznzU32(&x663, x655, x652, x635); out1[0] = x656; out1[1] = x657; out1[2] = x658; out1[3] = x659; out1[4] = x660; out1[5] = x661; out1[6] = x662; out1[7] = x663; } /// The function fiatP256Square 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 ~> 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]] pub fn fiatP256Square(out1: *[8]u32, arg1: [8]u32) void { const x1: u32 = (arg1[1]); const x2: u32 = (arg1[2]); const x3: u32 = (arg1[3]); const x4: u32 = (arg1[4]); const x5: u32 = (arg1[5]); const x6: u32 = (arg1[6]); const x7: u32 = (arg1[7]); const x8: u32 = (arg1[0]); var x9: u32 = undefined; var x10: u32 = undefined; fiatP256MulxU32(&x9, &x10, x8, (arg1[7])); var x11: u32 = undefined; var x12: u32 = undefined; fiatP256MulxU32(&x11, &x12, x8, (arg1[6])); var x13: u32 = undefined; var x14: u32 = undefined; fiatP256MulxU32(&x13, &x14, x8, (arg1[5])); var x15: u32 = undefined; var x16: u32 = undefined; fiatP256MulxU32(&x15, &x16, x8, (arg1[4])); var x17: u32 = undefined; var x18: u32 = undefined; fiatP256MulxU32(&x17, &x18, x8, (arg1[3])); var x19: u32 = undefined; var x20: u32 = undefined; fiatP256MulxU32(&x19, &x20, x8, (arg1[2])); var x21: u32 = undefined; var x22: u32 = undefined; fiatP256MulxU32(&x21, &x22, x8, (arg1[1])); var x23: u32 = undefined; var x24: u32 = undefined; fiatP256MulxU32(&x23, &x24, x8, (arg1[0])); var x25: u32 = undefined; var x26: u1 = undefined; fiatP256AddcarryxU32(&x25, &x26, 0x0, x24, x21); var x27: u32 = undefined; var x28: u1 = undefined; fiatP256AddcarryxU32(&x27, &x28, x26, x22, x19); var x29: u32 = undefined; var x30: u1 = undefined; fiatP256AddcarryxU32(&x29, &x30, x28, x20, x17); var x31: u32 = undefined; var x32: u1 = undefined; fiatP256AddcarryxU32(&x31, &x32, x30, x18, x15); var x33: u32 = undefined; var x34: u1 = undefined; fiatP256AddcarryxU32(&x33, &x34, x32, x16, x13); var x35: u32 = undefined; var x36: u1 = undefined; fiatP256AddcarryxU32(&x35, &x36, x34, x14, x11); var x37: u32 = undefined; var x38: u1 = undefined; fiatP256AddcarryxU32(&x37, &x38, x36, x12, x9); const x39: u32 = (@intCast(u32, x38) + x10); var x40: u32 = undefined; var x41: u32 = undefined; fiatP256MulxU32(&x40, &x41, x23, 0xffffffff); var x42: u32 = undefined; var x43: u32 = undefined; fiatP256MulxU32(&x42, &x43, x23, 0xffffffff); var x44: u32 = undefined; var x45: u32 = undefined; fiatP256MulxU32(&x44, &x45, x23, 0xffffffff); var x46: u32 = undefined; var x47: u32 = undefined; fiatP256MulxU32(&x46, &x47, x23, 0xffffffff); var x48: u32 = undefined; var x49: u1 = undefined; fiatP256AddcarryxU32(&x48, &x49, 0x0, x47, x44); var x50: u32 = undefined; var x51: u1 = undefined; fiatP256AddcarryxU32(&x50, &x51, x49, x45, x42); const x52: u32 = (@intCast(u32, x51) + x43); var x53: u32 = undefined; var x54: u1 = undefined; fiatP256AddcarryxU32(&x53, &x54, 0x0, x23, x46); var x55: u32 = undefined; var x56: u1 = undefined; fiatP256AddcarryxU32(&x55, &x56, x54, x25, x48); var x57: u32 = undefined; var x58: u1 = undefined; fiatP256AddcarryxU32(&x57, &x58, x56, x27, x50); var x59: u32 = undefined; var x60: u1 = undefined; fiatP256AddcarryxU32(&x59, &x60, x58, x29, x52); var x61: u32 = undefined; var x62: u1 = undefined; fiatP256AddcarryxU32(&x61, &x62, x60, x31, @intCast(u32, 0x0)); var x63: u32 = undefined; var x64: u1 = undefined; fiatP256AddcarryxU32(&x63, &x64, x62, x33, @intCast(u32, 0x0)); var x65: u32 = undefined; var x66: u1 = undefined; fiatP256AddcarryxU32(&x65, &x66, x64, x35, x23); var x67: u32 = undefined; var x68: u1 = undefined; fiatP256AddcarryxU32(&x67, &x68, x66, x37, x40); var x69: u32 = undefined; var x70: u1 = undefined; fiatP256AddcarryxU32(&x69, &x70, x68, x39, x41); var x71: u32 = undefined; var x72: u32 = undefined; fiatP256MulxU32(&x71, &x72, x1, (arg1[7])); var x73: u32 = undefined; var x74: u32 = undefined; fiatP256MulxU32(&x73, &x74, x1, (arg1[6])); var x75: u32 = undefined; var x76: u32 = undefined; fiatP256MulxU32(&x75, &x76, x1, (arg1[5])); var x77: u32 = undefined; var x78: u32 = undefined; fiatP256MulxU32(&x77, &x78, x1, (arg1[4])); var x79: u32 = undefined; var x80: u32 = undefined; fiatP256MulxU32(&x79, &x80, x1, (arg1[3])); var x81: u32 = undefined; var x82: u32 = undefined; fiatP256MulxU32(&x81, &x82, x1, (arg1[2])); var x83: u32 = undefined; var x84: u32 = undefined; fiatP256MulxU32(&x83, &x84, x1, (arg1[1])); var x85: u32 = undefined; var x86: u32 = undefined; fiatP256MulxU32(&x85, &x86, x1, (arg1[0])); var x87: u32 = undefined; var x88: u1 = undefined; fiatP256AddcarryxU32(&x87, &x88, 0x0, x86, x83); var x89: u32 = undefined; var x90: u1 = undefined; fiatP256AddcarryxU32(&x89, &x90, x88, x84, x81); var x91: u32 = undefined; var x92: u1 = undefined; fiatP256AddcarryxU32(&x91, &x92, x90, x82, x79); var x93: u32 = undefined; var x94: u1 = undefined; fiatP256AddcarryxU32(&x93, &x94, x92, x80, x77); var x95: u32 = undefined; var x96: u1 = undefined; fiatP256AddcarryxU32(&x95, &x96, x94, x78, x75); var x97: u32 = undefined; var x98: u1 = undefined; fiatP256AddcarryxU32(&x97, &x98, x96, x76, x73); var x99: u32 = undefined; var x100: u1 = undefined; fiatP256AddcarryxU32(&x99, &x100, x98, x74, x71); const x101: u32 = (@intCast(u32, x100) + x72); var x102: u32 = undefined; var x103: u1 = undefined; fiatP256AddcarryxU32(&x102, &x103, 0x0, x55, x85); var x104: u32 = undefined; var x105: u1 = undefined; fiatP256AddcarryxU32(&x104, &x105, x103, x57, x87); var x106: u32 = undefined; var x107: u1 = undefined; fiatP256AddcarryxU32(&x106, &x107, x105, x59, x89); var x108: u32 = undefined; var x109: u1 = undefined; fiatP256AddcarryxU32(&x108, &x109, x107, x61, x91); var x110: u32 = undefined; var x111: u1 = undefined; fiatP256AddcarryxU32(&x110, &x111, x109, x63, x93); var x112: u32 = undefined; var x113: u1 = undefined; fiatP256AddcarryxU32(&x112, &x113, x111, x65, x95); var x114: u32 = undefined; var x115: u1 = undefined; fiatP256AddcarryxU32(&x114, &x115, x113, x67, x97); var x116: u32 = undefined; var x117: u1 = undefined; fiatP256AddcarryxU32(&x116, &x117, x115, x69, x99); var x118: u32 = undefined; var x119: u1 = undefined; fiatP256AddcarryxU32(&x118, &x119, x117, @intCast(u32, x70), x101); var x120: u32 = undefined; var x121: u32 = undefined; fiatP256MulxU32(&x120, &x121, x102, 0xffffffff); var x122: u32 = undefined; var x123: u32 = undefined; fiatP256MulxU32(&x122, &x123, x102, 0xffffffff); var x124: u32 = undefined; var x125: u32 = undefined; fiatP256MulxU32(&x124, &x125, x102, 0xffffffff); var x126: u32 = undefined; var x127: u32 = undefined; fiatP256MulxU32(&x126, &x127, x102, 0xffffffff); var x128: u32 = undefined; var x129: u1 = undefined; fiatP256AddcarryxU32(&x128, &x129, 0x0, x127, x124); var x130: u32 = undefined; var x131: u1 = undefined; fiatP256AddcarryxU32(&x130, &x131, x129, x125, x122); const x132: u32 = (@intCast(u32, x131) + x123); var x133: u32 = undefined; var x134: u1 = undefined; fiatP256AddcarryxU32(&x133, &x134, 0x0, x102, x126); var x135: u32 = undefined; var x136: u1 = undefined; fiatP256AddcarryxU32(&x135, &x136, x134, x104, x128); var x137: u32 = undefined; var x138: u1 = undefined; fiatP256AddcarryxU32(&x137, &x138, x136, x106, x130); var x139: u32 = undefined; var x140: u1 = undefined; fiatP256AddcarryxU32(&x139, &x140, x138, x108, x132); var x141: u32 = undefined; var x142: u1 = undefined; fiatP256AddcarryxU32(&x141, &x142, x140, x110, @intCast(u32, 0x0)); var x143: u32 = undefined; var x144: u1 = undefined; fiatP256AddcarryxU32(&x143, &x144, x142, x112, @intCast(u32, 0x0)); var x145: u32 = undefined; var x146: u1 = undefined; fiatP256AddcarryxU32(&x145, &x146, x144, x114, x102); var x147: u32 = undefined; var x148: u1 = undefined; fiatP256AddcarryxU32(&x147, &x148, x146, x116, x120); var x149: u32 = undefined; var x150: u1 = undefined; fiatP256AddcarryxU32(&x149, &x150, x148, x118, x121); const x151: u32 = (@intCast(u32, x150) + @intCast(u32, x119)); var x152: u32 = undefined; var x153: u32 = undefined; fiatP256MulxU32(&x152, &x153, x2, (arg1[7])); var x154: u32 = undefined; var x155: u32 = undefined; fiatP256MulxU32(&x154, &x155, x2, (arg1[6])); var x156: u32 = undefined; var x157: u32 = undefined; fiatP256MulxU32(&x156, &x157, x2, (arg1[5])); var x158: u32 = undefined; var x159: u32 = undefined; fiatP256MulxU32(&x158, &x159, x2, (arg1[4])); var x160: u32 = undefined; var x161: u32 = undefined; fiatP256MulxU32(&x160, &x161, x2, (arg1[3])); var x162: u32 = undefined; var x163: u32 = undefined; fiatP256MulxU32(&x162, &x163, x2, (arg1[2])); var x164: u32 = undefined; var x165: u32 = undefined; fiatP256MulxU32(&x164, &x165, x2, (arg1[1])); var x166: u32 = undefined; var x167: u32 = undefined; fiatP256MulxU32(&x166, &x167, x2, (arg1[0])); var x168: u32 = undefined; var x169: u1 = undefined; fiatP256AddcarryxU32(&x168, &x169, 0x0, x167, x164); var x170: u32 = undefined; var x171: u1 = undefined; fiatP256AddcarryxU32(&x170, &x171, x169, x165, x162); var x172: u32 = undefined; var x173: u1 = undefined; fiatP256AddcarryxU32(&x172, &x173, x171, x163, x160); var x174: u32 = undefined; var x175: u1 = undefined; fiatP256AddcarryxU32(&x174, &x175, x173, x161, x158); var x176: u32 = undefined; var x177: u1 = undefined; fiatP256AddcarryxU32(&x176, &x177, x175, x159, x156); var x178: u32 = undefined; var x179: u1 = undefined; fiatP256AddcarryxU32(&x178, &x179, x177, x157, x154); var x180: u32 = undefined; var x181: u1 = undefined; fiatP256AddcarryxU32(&x180, &x181, x179, x155, x152); const x182: u32 = (@intCast(u32, x181) + x153); var x183: u32 = undefined; var x184: u1 = undefined; fiatP256AddcarryxU32(&x183, &x184, 0x0, x135, x166); var x185: u32 = undefined; var x186: u1 = undefined; fiatP256AddcarryxU32(&x185, &x186, x184, x137, x168); var x187: u32 = undefined; var x188: u1 = undefined; fiatP256AddcarryxU32(&x187, &x188, x186, x139, x170); var x189: u32 = undefined; var x190: u1 = undefined; fiatP256AddcarryxU32(&x189, &x190, x188, x141, x172); var x191: u32 = undefined; var x192: u1 = undefined; fiatP256AddcarryxU32(&x191, &x192, x190, x143, x174); var x193: u32 = undefined; var x194: u1 = undefined; fiatP256AddcarryxU32(&x193, &x194, x192, x145, x176); var x195: u32 = undefined; var x196: u1 = undefined; fiatP256AddcarryxU32(&x195, &x196, x194, x147, x178); var x197: u32 = undefined; var x198: u1 = undefined; fiatP256AddcarryxU32(&x197, &x198, x196, x149, x180); var x199: u32 = undefined; var x200: u1 = undefined; fiatP256AddcarryxU32(&x199, &x200, x198, x151, x182); var x201: u32 = undefined; var x202: u32 = undefined; fiatP256MulxU32(&x201, &x202, x183, 0xffffffff); var x203: u32 = undefined; var x204: u32 = undefined; fiatP256MulxU32(&x203, &x204, x183, 0xffffffff); var x205: u32 = undefined; var x206: u32 = undefined; fiatP256MulxU32(&x205, &x206, x183, 0xffffffff); var x207: u32 = undefined; var x208: u32 = undefined; fiatP256MulxU32(&x207, &x208, x183, 0xffffffff); var x209: u32 = undefined; var x210: u1 = undefined; fiatP256AddcarryxU32(&x209, &x210, 0x0, x208, x205); var x211: u32 = undefined; var x212: u1 = undefined; fiatP256AddcarryxU32(&x211, &x212, x210, x206, x203); const x213: u32 = (@intCast(u32, x212) + x204); var x214: u32 = undefined; var x215: u1 = undefined; fiatP256AddcarryxU32(&x214, &x215, 0x0, x183, x207); var x216: u32 = undefined; var x217: u1 = undefined; fiatP256AddcarryxU32(&x216, &x217, x215, x185, x209); var x218: u32 = undefined; var x219: u1 = undefined; fiatP256AddcarryxU32(&x218, &x219, x217, x187, x211); var x220: u32 = undefined; var x221: u1 = undefined; fiatP256AddcarryxU32(&x220, &x221, x219, x189, x213); var x222: u32 = undefined; var x223: u1 = undefined; fiatP256AddcarryxU32(&x222, &x223, x221, x191, @intCast(u32, 0x0)); var x224: u32 = undefined; var x225: u1 = undefined; fiatP256AddcarryxU32(&x224, &x225, x223, x193, @intCast(u32, 0x0)); var x226: u32 = undefined; var x227: u1 = undefined; fiatP256AddcarryxU32(&x226, &x227, x225, x195, x183); var x228: u32 = undefined; var x229: u1 = undefined; fiatP256AddcarryxU32(&x228, &x229, x227, x197, x201); var x230: u32 = undefined; var x231: u1 = undefined; fiatP256AddcarryxU32(&x230, &x231, x229, x199, x202); const x232: u32 = (@intCast(u32, x231) + @intCast(u32, x200)); var x233: u32 = undefined; var x234: u32 = undefined; fiatP256MulxU32(&x233, &x234, x3, (arg1[7])); var x235: u32 = undefined; var x236: u32 = undefined; fiatP256MulxU32(&x235, &x236, x3, (arg1[6])); var x237: u32 = undefined; var x238: u32 = undefined; fiatP256MulxU32(&x237, &x238, x3, (arg1[5])); var x239: u32 = undefined; var x240: u32 = undefined; fiatP256MulxU32(&x239, &x240, x3, (arg1[4])); var x241: u32 = undefined; var x242: u32 = undefined; fiatP256MulxU32(&x241, &x242, x3, (arg1[3])); var x243: u32 = undefined; var x244: u32 = undefined; fiatP256MulxU32(&x243, &x244, x3, (arg1[2])); var x245: u32 = undefined; var x246: u32 = undefined; fiatP256MulxU32(&x245, &x246, x3, (arg1[1])); var x247: u32 = undefined; var x248: u32 = undefined; fiatP256MulxU32(&x247, &x248, x3, (arg1[0])); var x249: u32 = undefined; var x250: u1 = undefined; fiatP256AddcarryxU32(&x249, &x250, 0x0, x248, x245); var x251: u32 = undefined; var x252: u1 = undefined; fiatP256AddcarryxU32(&x251, &x252, x250, x246, x243); var x253: u32 = undefined; var x254: u1 = undefined; fiatP256AddcarryxU32(&x253, &x254, x252, x244, x241); var x255: u32 = undefined; var x256: u1 = undefined; fiatP256AddcarryxU32(&x255, &x256, x254, x242, x239); var x257: u32 = undefined; var x258: u1 = undefined; fiatP256AddcarryxU32(&x257, &x258, x256, x240, x237); var x259: u32 = undefined; var x260: u1 = undefined; fiatP256AddcarryxU32(&x259, &x260, x258, x238, x235); var x261: u32 = undefined; var x262: u1 = undefined; fiatP256AddcarryxU32(&x261, &x262, x260, x236, x233); const x263: u32 = (@intCast(u32, x262) + x234); var x264: u32 = undefined; var x265: u1 = undefined; fiatP256AddcarryxU32(&x264, &x265, 0x0, x216, x247); var x266: u32 = undefined; var x267: u1 = undefined; fiatP256AddcarryxU32(&x266, &x267, x265, x218, x249); var x268: u32 = undefined; var x269: u1 = undefined; fiatP256AddcarryxU32(&x268, &x269, x267, x220, x251); var x270: u32 = undefined; var x271: u1 = undefined; fiatP256AddcarryxU32(&x270, &x271, x269, x222, x253); var x272: u32 = undefined; var x273: u1 = undefined; fiatP256AddcarryxU32(&x272, &x273, x271, x224, x255); var x274: u32 = undefined; var x275: u1 = undefined; fiatP256AddcarryxU32(&x274, &x275, x273, x226, x257); var x276: u32 = undefined; var x277: u1 = undefined; fiatP256AddcarryxU32(&x276, &x277, x275, x228, x259); var x278: u32 = undefined; var x279: u1 = undefined; fiatP256AddcarryxU32(&x278, &x279, x277, x230, x261); var x280: u32 = undefined; var x281: u1 = undefined; fiatP256AddcarryxU32(&x280, &x281, x279, x232, x263); var x282: u32 = undefined; var x283: u32 = undefined; fiatP256MulxU32(&x282, &x283, x264, 0xffffffff); var x284: u32 = undefined; var x285: u32 = undefined; fiatP256MulxU32(&x284, &x285, x264, 0xffffffff); var x286: u32 = undefined; var x287: u32 = undefined; fiatP256MulxU32(&x286, &x287, x264, 0xffffffff); var x288: u32 = undefined; var x289: u32 = undefined; fiatP256MulxU32(&x288, &x289, x264, 0xffffffff); var x290: u32 = undefined; var x291: u1 = undefined; fiatP256AddcarryxU32(&x290, &x291, 0x0, x289, x286); var x292: u32 = undefined; var x293: u1 = undefined; fiatP256AddcarryxU32(&x292, &x293, x291, x287, x284); const x294: u32 = (@intCast(u32, x293) + x285); var x295: u32 = undefined; var x296: u1 = undefined; fiatP256AddcarryxU32(&x295, &x296, 0x0, x264, x288); var x297: u32 = undefined; var x298: u1 = undefined; fiatP256AddcarryxU32(&x297, &x298, x296, x266, x290); var x299: u32 = undefined; var x300: u1 = undefined; fiatP256AddcarryxU32(&x299, &x300, x298, x268, x292); var x301: u32 = undefined; var x302: u1 = undefined; fiatP256AddcarryxU32(&x301, &x302, x300, x270, x294); var x303: u32 = undefined; var x304: u1 = undefined; fiatP256AddcarryxU32(&x303, &x304, x302, x272, @intCast(u32, 0x0)); var x305: u32 = undefined; var x306: u1 = undefined; fiatP256AddcarryxU32(&x305, &x306, x304, x274, @intCast(u32, 0x0)); var x307: u32 = undefined; var x308: u1 = undefined; fiatP256AddcarryxU32(&x307, &x308, x306, x276, x264); var x309: u32 = undefined; var x310: u1 = undefined; fiatP256AddcarryxU32(&x309, &x310, x308, x278, x282); var x311: u32 = undefined; var x312: u1 = undefined; fiatP256AddcarryxU32(&x311, &x312, x310, x280, x283); const x313: u32 = (@intCast(u32, x312) + @intCast(u32, x281)); var x314: u32 = undefined; var x315: u32 = undefined; fiatP256MulxU32(&x314, &x315, x4, (arg1[7])); var x316: u32 = undefined; var x317: u32 = undefined; fiatP256MulxU32(&x316, &x317, x4, (arg1[6])); var x318: u32 = undefined; var x319: u32 = undefined; fiatP256MulxU32(&x318, &x319, x4, (arg1[5])); var x320: u32 = undefined; var x321: u32 = undefined; fiatP256MulxU32(&x320, &x321, x4, (arg1[4])); var x322: u32 = undefined; var x323: u32 = undefined; fiatP256MulxU32(&x322, &x323, x4, (arg1[3])); var x324: u32 = undefined; var x325: u32 = undefined; fiatP256MulxU32(&x324, &x325, x4, (arg1[2])); var x326: u32 = undefined; var x327: u32 = undefined; fiatP256MulxU32(&x326, &x327, x4, (arg1[1])); var x328: u32 = undefined; var x329: u32 = undefined; fiatP256MulxU32(&x328, &x329, x4, (arg1[0])); var x330: u32 = undefined; var x331: u1 = undefined; fiatP256AddcarryxU32(&x330, &x331, 0x0, x329, x326); var x332: u32 = undefined; var x333: u1 = undefined; fiatP256AddcarryxU32(&x332, &x333, x331, x327, x324); var x334: u32 = undefined; var x335: u1 = undefined; fiatP256AddcarryxU32(&x334, &x335, x333, x325, x322); var x336: u32 = undefined; var x337: u1 = undefined; fiatP256AddcarryxU32(&x336, &x337, x335, x323, x320); var x338: u32 = undefined; var x339: u1 = undefined; fiatP256AddcarryxU32(&x338, &x339, x337, x321, x318); var x340: u32 = undefined; var x341: u1 = undefined; fiatP256AddcarryxU32(&x340, &x341, x339, x319, x316); var x342: u32 = undefined; var x343: u1 = undefined; fiatP256AddcarryxU32(&x342, &x343, x341, x317, x314); const x344: u32 = (@intCast(u32, x343) + x315); var x345: u32 = undefined; var x346: u1 = undefined; fiatP256AddcarryxU32(&x345, &x346, 0x0, x297, x328); var x347: u32 = undefined; var x348: u1 = undefined; fiatP256AddcarryxU32(&x347, &x348, x346, x299, x330); var x349: u32 = undefined; var x350: u1 = undefined; fiatP256AddcarryxU32(&x349, &x350, x348, x301, x332); var x351: u32 = undefined; var x352: u1 = undefined; fiatP256AddcarryxU32(&x351, &x352, x350, x303, x334); var x353: u32 = undefined; var x354: u1 = undefined; fiatP256AddcarryxU32(&x353, &x354, x352, x305, x336); var x355: u32 = undefined; var x356: u1 = undefined; fiatP256AddcarryxU32(&x355, &x356, x354, x307, x338); var x357: u32 = undefined; var x358: u1 = undefined; fiatP256AddcarryxU32(&x357, &x358, x356, x309, x340); var x359: u32 = undefined; var x360: u1 = undefined; fiatP256AddcarryxU32(&x359, &x360, x358, x311, x342); var x361: u32 = undefined; var x362: u1 = undefined; fiatP256AddcarryxU32(&x361, &x362, x360, x313, x344); var x363: u32 = undefined; var x364: u32 = undefined; fiatP256MulxU32(&x363, &x364, x345, 0xffffffff); var x365: u32 = undefined; var x366: u32 = undefined; fiatP256MulxU32(&x365, &x366, x345, 0xffffffff); var x367: u32 = undefined; var x368: u32 = undefined; fiatP256MulxU32(&x367, &x368, x345, 0xffffffff); var x369: u32 = undefined; var x370: u32 = undefined; fiatP256MulxU32(&x369, &x370, x345, 0xffffffff); var x371: u32 = undefined; var x372: u1 = undefined; fiatP256AddcarryxU32(&x371, &x372, 0x0, x370, x367); var x373: u32 = undefined; var x374: u1 = undefined; fiatP256AddcarryxU32(&x373, &x374, x372, x368, x365); const x375: u32 = (@intCast(u32, x374) + x366); var x376: u32 = undefined; var x377: u1 = undefined; fiatP256AddcarryxU32(&x376, &x377, 0x0, x345, x369); var x378: u32 = undefined; var x379: u1 = undefined; fiatP256AddcarryxU32(&x378, &x379, x377, x347, x371); var x380: u32 = undefined; var x381: u1 = undefined; fiatP256AddcarryxU32(&x380, &x381, x379, x349, x373); var x382: u32 = undefined; var x383: u1 = undefined; fiatP256AddcarryxU32(&x382, &x383, x381, x351, x375); var x384: u32 = undefined; var x385: u1 = undefined; fiatP256AddcarryxU32(&x384, &x385, x383, x353, @intCast(u32, 0x0)); var x386: u32 = undefined; var x387: u1 = undefined; fiatP256AddcarryxU32(&x386, &x387, x385, x355, @intCast(u32, 0x0)); var x388: u32 = undefined; var x389: u1 = undefined; fiatP256AddcarryxU32(&x388, &x389, x387, x357, x345); var x390: u32 = undefined; var x391: u1 = undefined; fiatP256AddcarryxU32(&x390, &x391, x389, x359, x363); var x392: u32 = undefined; var x393: u1 = undefined; fiatP256AddcarryxU32(&x392, &x393, x391, x361, x364); const x394: u32 = (@intCast(u32, x393) + @intCast(u32, x362)); var x395: u32 = undefined; var x396: u32 = undefined; fiatP256MulxU32(&x395, &x396, x5, (arg1[7])); var x397: u32 = undefined; var x398: u32 = undefined; fiatP256MulxU32(&x397, &x398, x5, (arg1[6])); var x399: u32 = undefined; var x400: u32 = undefined; fiatP256MulxU32(&x399, &x400, x5, (arg1[5])); var x401: u32 = undefined; var x402: u32 = undefined; fiatP256MulxU32(&x401, &x402, x5, (arg1[4])); var x403: u32 = undefined; var x404: u32 = undefined; fiatP256MulxU32(&x403, &x404, x5, (arg1[3])); var x405: u32 = undefined; var x406: u32 = undefined; fiatP256MulxU32(&x405, &x406, x5, (arg1[2])); var x407: u32 = undefined; var x408: u32 = undefined; fiatP256MulxU32(&x407, &x408, x5, (arg1[1])); var x409: u32 = undefined; var x410: u32 = undefined; fiatP256MulxU32(&x409, &x410, x5, (arg1[0])); var x411: u32 = undefined; var x412: u1 = undefined; fiatP256AddcarryxU32(&x411, &x412, 0x0, x410, x407); var x413: u32 = undefined; var x414: u1 = undefined; fiatP256AddcarryxU32(&x413, &x414, x412, x408, x405); var x415: u32 = undefined; var x416: u1 = undefined; fiatP256AddcarryxU32(&x415, &x416, x414, x406, x403); var x417: u32 = undefined; var x418: u1 = undefined; fiatP256AddcarryxU32(&x417, &x418, x416, x404, x401); var x419: u32 = undefined; var x420: u1 = undefined; fiatP256AddcarryxU32(&x419, &x420, x418, x402, x399); var x421: u32 = undefined; var x422: u1 = undefined; fiatP256AddcarryxU32(&x421, &x422, x420, x400, x397); var x423: u32 = undefined; var x424: u1 = undefined; fiatP256AddcarryxU32(&x423, &x424, x422, x398, x395); const x425: u32 = (@intCast(u32, x424) + x396); var x426: u32 = undefined; var x427: u1 = undefined; fiatP256AddcarryxU32(&x426, &x427, 0x0, x378, x409); var x428: u32 = undefined; var x429: u1 = undefined; fiatP256AddcarryxU32(&x428, &x429, x427, x380, x411); var x430: u32 = undefined; var x431: u1 = undefined; fiatP256AddcarryxU32(&x430, &x431, x429, x382, x413); var x432: u32 = undefined; var x433: u1 = undefined; fiatP256AddcarryxU32(&x432, &x433, x431, x384, x415); var x434: u32 = undefined; var x435: u1 = undefined; fiatP256AddcarryxU32(&x434, &x435, x433, x386, x417); var x436: u32 = undefined; var x437: u1 = undefined; fiatP256AddcarryxU32(&x436, &x437, x435, x388, x419); var x438: u32 = undefined; var x439: u1 = undefined; fiatP256AddcarryxU32(&x438, &x439, x437, x390, x421); var x440: u32 = undefined; var x441: u1 = undefined; fiatP256AddcarryxU32(&x440, &x441, x439, x392, x423); var x442: u32 = undefined; var x443: u1 = undefined; fiatP256AddcarryxU32(&x442, &x443, x441, x394, x425); var x444: u32 = undefined; var x445: u32 = undefined; fiatP256MulxU32(&x444, &x445, x426, 0xffffffff); var x446: u32 = undefined; var x447: u32 = undefined; fiatP256MulxU32(&x446, &x447, x426, 0xffffffff); var x448: u32 = undefined; var x449: u32 = undefined; fiatP256MulxU32(&x448, &x449, x426, 0xffffffff); var x450: u32 = undefined; var x451: u32 = undefined; fiatP256MulxU32(&x450, &x451, x426, 0xffffffff); var x452: u32 = undefined; var x453: u1 = undefined; fiatP256AddcarryxU32(&x452, &x453, 0x0, x451, x448); var x454: u32 = undefined; var x455: u1 = undefined; fiatP256AddcarryxU32(&x454, &x455, x453, x449, x446); const x456: u32 = (@intCast(u32, x455) + x447); var x457: u32 = undefined; var x458: u1 = undefined; fiatP256AddcarryxU32(&x457, &x458, 0x0, x426, x450); var x459: u32 = undefined; var x460: u1 = undefined; fiatP256AddcarryxU32(&x459, &x460, x458, x428, x452); var x461: u32 = undefined; var x462: u1 = undefined; fiatP256AddcarryxU32(&x461, &x462, x460, x430, x454); var x463: u32 = undefined; var x464: u1 = undefined; fiatP256AddcarryxU32(&x463, &x464, x462, x432, x456); var x465: u32 = undefined; var x466: u1 = undefined; fiatP256AddcarryxU32(&x465, &x466, x464, x434, @intCast(u32, 0x0)); var x467: u32 = undefined; var x468: u1 = undefined; fiatP256AddcarryxU32(&x467, &x468, x466, x436, @intCast(u32, 0x0)); var x469: u32 = undefined; var x470: u1 = undefined; fiatP256AddcarryxU32(&x469, &x470, x468, x438, x426); var x471: u32 = undefined; var x472: u1 = undefined; fiatP256AddcarryxU32(&x471, &x472, x470, x440, x444); var x473: u32 = undefined; var x474: u1 = undefined; fiatP256AddcarryxU32(&x473, &x474, x472, x442, x445); const x475: u32 = (@intCast(u32, x474) + @intCast(u32, x443)); var x476: u32 = undefined; var x477: u32 = undefined; fiatP256MulxU32(&x476, &x477, x6, (arg1[7])); var x478: u32 = undefined; var x479: u32 = undefined; fiatP256MulxU32(&x478, &x479, x6, (arg1[6])); var x480: u32 = undefined; var x481: u32 = undefined; fiatP256MulxU32(&x480, &x481, x6, (arg1[5])); var x482: u32 = undefined; var x483: u32 = undefined; fiatP256MulxU32(&x482, &x483, x6, (arg1[4])); var x484: u32 = undefined; var x485: u32 = undefined; fiatP256MulxU32(&x484, &x485, x6, (arg1[3])); var x486: u32 = undefined; var x487: u32 = undefined; fiatP256MulxU32(&x486, &x487, x6, (arg1[2])); var x488: u32 = undefined; var x489: u32 = undefined; fiatP256MulxU32(&x488, &x489, x6, (arg1[1])); var x490: u32 = undefined; var x491: u32 = undefined; fiatP256MulxU32(&x490, &x491, x6, (arg1[0])); var x492: u32 = undefined; var x493: u1 = undefined; fiatP256AddcarryxU32(&x492, &x493, 0x0, x491, x488); var x494: u32 = undefined; var x495: u1 = undefined; fiatP256AddcarryxU32(&x494, &x495, x493, x489, x486); var x496: u32 = undefined; var x497: u1 = undefined; fiatP256AddcarryxU32(&x496, &x497, x495, x487, x484); var x498: u32 = undefined; var x499: u1 = undefined; fiatP256AddcarryxU32(&x498, &x499, x497, x485, x482); var x500: u32 = undefined; var x501: u1 = undefined; fiatP256AddcarryxU32(&x500, &x501, x499, x483, x480); var x502: u32 = undefined; var x503: u1 = undefined; fiatP256AddcarryxU32(&x502, &x503, x501, x481, x478); var x504: u32 = undefined; var x505: u1 = undefined; fiatP256AddcarryxU32(&x504, &x505, x503, x479, x476); const x506: u32 = (@intCast(u32, x505) + x477); var x507: u32 = undefined; var x508: u1 = undefined; fiatP256AddcarryxU32(&x507, &x508, 0x0, x459, x490); var x509: u32 = undefined; var x510: u1 = undefined; fiatP256AddcarryxU32(&x509, &x510, x508, x461, x492); var x511: u32 = undefined; var x512: u1 = undefined; fiatP256AddcarryxU32(&x511, &x512, x510, x463, x494); var x513: u32 = undefined; var x514: u1 = undefined; fiatP256AddcarryxU32(&x513, &x514, x512, x465, x496); var x515: u32 = undefined; var x516: u1 = undefined; fiatP256AddcarryxU32(&x515, &x516, x514, x467, x498); var x517: u32 = undefined; var x518: u1 = undefined; fiatP256AddcarryxU32(&x517, &x518, x516, x469, x500); var x519: u32 = undefined; var x520: u1 = undefined; fiatP256AddcarryxU32(&x519, &x520, x518, x471, x502); var x521: u32 = undefined; var x522: u1 = undefined; fiatP256AddcarryxU32(&x521, &x522, x520, x473, x504); var x523: u32 = undefined; var x524: u1 = undefined; fiatP256AddcarryxU32(&x523, &x524, x522, x475, x506); var x525: u32 = undefined; var x526: u32 = undefined; fiatP256MulxU32(&x525, &x526, x507, 0xffffffff); var x527: u32 = undefined; var x528: u32 = undefined; fiatP256MulxU32(&x527, &x528, x507, 0xffffffff); var x529: u32 = undefined; var x530: u32 = undefined; fiatP256MulxU32(&x529, &x530, x507, 0xffffffff); var x531: u32 = undefined; var x532: u32 = undefined; fiatP256MulxU32(&x531, &x532, x507, 0xffffffff); var x533: u32 = undefined; var x534: u1 = undefined; fiatP256AddcarryxU32(&x533, &x534, 0x0, x532, x529); var x535: u32 = undefined; var x536: u1 = undefined; fiatP256AddcarryxU32(&x535, &x536, x534, x530, x527); const x537: u32 = (@intCast(u32, x536) + x528); var x538: u32 = undefined; var x539: u1 = undefined; fiatP256AddcarryxU32(&x538, &x539, 0x0, x507, x531); var x540: u32 = undefined; var x541: u1 = undefined; fiatP256AddcarryxU32(&x540, &x541, x539, x509, x533); var x542: u32 = undefined; var x543: u1 = undefined; fiatP256AddcarryxU32(&x542, &x543, x541, x511, x535); var x544: u32 = undefined; var x545: u1 = undefined; fiatP256AddcarryxU32(&x544, &x545, x543, x513, x537); var x546: u32 = undefined; var x547: u1 = undefined; fiatP256AddcarryxU32(&x546, &x547, x545, x515, @intCast(u32, 0x0)); var x548: u32 = undefined; var x549: u1 = undefined; fiatP256AddcarryxU32(&x548, &x549, x547, x517, @intCast(u32, 0x0)); var x550: u32 = undefined; var x551: u1 = undefined; fiatP256AddcarryxU32(&x550, &x551, x549, x519, x507); var x552: u32 = undefined; var x553: u1 = undefined; fiatP256AddcarryxU32(&x552, &x553, x551, x521, x525); var x554: u32 = undefined; var x555: u1 = undefined; fiatP256AddcarryxU32(&x554, &x555, x553, x523, x526); const x556: u32 = (@intCast(u32, x555) + @intCast(u32, x524)); var x557: u32 = undefined; var x558: u32 = undefined; fiatP256MulxU32(&x557, &x558, x7, (arg1[7])); var x559: u32 = undefined; var x560: u32 = undefined; fiatP256MulxU32(&x559, &x560, x7, (arg1[6])); var x561: u32 = undefined; var x562: u32 = undefined; fiatP256MulxU32(&x561, &x562, x7, (arg1[5])); var x563: u32 = undefined; var x564: u32 = undefined; fiatP256MulxU32(&x563, &x564, x7, (arg1[4])); var x565: u32 = undefined; var x566: u32 = undefined; fiatP256MulxU32(&x565, &x566, x7, (arg1[3])); var x567: u32 = undefined; var x568: u32 = undefined; fiatP256MulxU32(&x567, &x568, x7, (arg1[2])); var x569: u32 = undefined; var x570: u32 = undefined; fiatP256MulxU32(&x569, &x570, x7, (arg1[1])); var x571: u32 = undefined; var x572: u32 = undefined; fiatP256MulxU32(&x571, &x572, x7, (arg1[0])); var x573: u32 = undefined; var x574: u1 = undefined; fiatP256AddcarryxU32(&x573, &x574, 0x0, x572, x569); var x575: u32 = undefined; var x576: u1 = undefined; fiatP256AddcarryxU32(&x575, &x576, x574, x570, x567); var x577: u32 = undefined; var x578: u1 = undefined; fiatP256AddcarryxU32(&x577, &x578, x576, x568, x565); var x579: u32 = undefined; var x580: u1 = undefined; fiatP256AddcarryxU32(&x579, &x580, x578, x566, x563); var x581: u32 = undefined; var x582: u1 = undefined; fiatP256AddcarryxU32(&x581, &x582, x580, x564, x561); var x583: u32 = undefined; var x584: u1 = undefined; fiatP256AddcarryxU32(&x583, &x584, x582, x562, x559); var x585: u32 = undefined; var x586: u1 = undefined; fiatP256AddcarryxU32(&x585, &x586, x584, x560, x557); const x587: u32 = (@intCast(u32, x586) + x558); var x588: u32 = undefined; var x589: u1 = undefined; fiatP256AddcarryxU32(&x588, &x589, 0x0, x540, x571); var x590: u32 = undefined; var x591: u1 = undefined; fiatP256AddcarryxU32(&x590, &x591, x589, x542, x573); var x592: u32 = undefined; var x593: u1 = undefined; fiatP256AddcarryxU32(&x592, &x593, x591, x544, x575); var x594: u32 = undefined; var x595: u1 = undefined; fiatP256AddcarryxU32(&x594, &x595, x593, x546, x577); var x596: u32 = undefined; var x597: u1 = undefined; fiatP256AddcarryxU32(&x596, &x597, x595, x548, x579); var x598: u32 = undefined; var x599: u1 = undefined; fiatP256AddcarryxU32(&x598, &x599, x597, x550, x581); var x600: u32 = undefined; var x601: u1 = undefined; fiatP256AddcarryxU32(&x600, &x601, x599, x552, x583); var x602: u32 = undefined; var x603: u1 = undefined; fiatP256AddcarryxU32(&x602, &x603, x601, x554, x585); var x604: u32 = undefined; var x605: u1 = undefined; fiatP256AddcarryxU32(&x604, &x605, x603, x556, x587); var x606: u32 = undefined; var x607: u32 = undefined; fiatP256MulxU32(&x606, &x607, x588, 0xffffffff); var x608: u32 = undefined; var x609: u32 = undefined; fiatP256MulxU32(&x608, &x609, x588, 0xffffffff); var x610: u32 = undefined; var x611: u32 = undefined; fiatP256MulxU32(&x610, &x611, x588, 0xffffffff); var x612: u32 = undefined; var x613: u32 = undefined; fiatP256MulxU32(&x612, &x613, x588, 0xffffffff); var x614: u32 = undefined; var x615: u1 = undefined; fiatP256AddcarryxU32(&x614, &x615, 0x0, x613, x610); var x616: u32 = undefined; var x617: u1 = undefined; fiatP256AddcarryxU32(&x616, &x617, x615, x611, x608); const x618: u32 = (@intCast(u32, x617) + x609); var x619: u32 = undefined; var x620: u1 = undefined; fiatP256AddcarryxU32(&x619, &x620, 0x0, x588, x612); var x621: u32 = undefined; var x622: u1 = undefined; fiatP256AddcarryxU32(&x621, &x622, x620, x590, x614); var x623: u32 = undefined; var x624: u1 = undefined; fiatP256AddcarryxU32(&x623, &x624, x622, x592, x616); var x625: u32 = undefined; var x626: u1 = undefined; fiatP256AddcarryxU32(&x625, &x626, x624, x594, x618); var x627: u32 = undefined; var x628: u1 = undefined; fiatP256AddcarryxU32(&x627, &x628, x626, x596, @intCast(u32, 0x0)); var x629: u32 = undefined; var x630: u1 = undefined; fiatP256AddcarryxU32(&x629, &x630, x628, x598, @intCast(u32, 0x0)); var x631: u32 = undefined; var x632: u1 = undefined; fiatP256AddcarryxU32(&x631, &x632, x630, x600, x588); var x633: u32 = undefined; var x634: u1 = undefined; fiatP256AddcarryxU32(&x633, &x634, x632, x602, x606); var x635: u32 = undefined; var x636: u1 = undefined; fiatP256AddcarryxU32(&x635, &x636, x634, x604, x607); const x637: u32 = (@intCast(u32, x636) + @intCast(u32, x605)); var x638: u32 = undefined; var x639: u1 = undefined; fiatP256SubborrowxU32(&x638, &x639, 0x0, x621, 0xffffffff); var x640: u32 = undefined; var x641: u1 = undefined; fiatP256SubborrowxU32(&x640, &x641, x639, x623, 0xffffffff); var x642: u32 = undefined; var x643: u1 = undefined; fiatP256SubborrowxU32(&x642, &x643, x641, x625, 0xffffffff); var x644: u32 = undefined; var x645: u1 = undefined; fiatP256SubborrowxU32(&x644, &x645, x643, x627, @intCast(u32, 0x0)); var x646: u32 = undefined; var x647: u1 = undefined; fiatP256SubborrowxU32(&x646, &x647, x645, x629, @intCast(u32, 0x0)); var x648: u32 = undefined; var x649: u1 = undefined; fiatP256SubborrowxU32(&x648, &x649, x647, x631, @intCast(u32, 0x0)); var x650: u32 = undefined; var x651: u1 = undefined; fiatP256SubborrowxU32(&x650, &x651, x649, x633, @intCast(u32, 0x1)); var x652: u32 = undefined; var x653: u1 = undefined; fiatP256SubborrowxU32(&x652, &x653, x651, x635, 0xffffffff); var x654: u32 = undefined; var x655: u1 = undefined; fiatP256SubborrowxU32(&x654, &x655, x653, x637, @intCast(u32, 0x0)); var x656: u32 = undefined; fiatP256CmovznzU32(&x656, x655, x638, x621); var x657: u32 = undefined; fiatP256CmovznzU32(&x657, x655, x640, x623); var x658: u32 = undefined; fiatP256CmovznzU32(&x658, x655, x642, x625); var x659: u32 = undefined; fiatP256CmovznzU32(&x659, x655, x644, x627); var x660: u32 = undefined; fiatP256CmovznzU32(&x660, x655, x646, x629); var x661: u32 = undefined; fiatP256CmovznzU32(&x661, x655, x648, x631); var x662: u32 = undefined; fiatP256CmovznzU32(&x662, x655, x650, x633); var x663: u32 = undefined; fiatP256CmovznzU32(&x663, x655, x652, x635); out1[0] = x656; out1[1] = x657; out1[2] = x658; out1[3] = x659; out1[4] = x660; out1[5] = x661; out1[6] = x662; out1[7] = x663; } /// The function fiatP256Add 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 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] /// arg2: [[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]] pub fn fiatP256Add(out1: *[8]u32, arg1: [8]u32, arg2: [8]u32) void { var x1: u32 = undefined; var x2: u1 = undefined; fiatP256AddcarryxU32(&x1, &x2, 0x0, (arg1[0]), (arg2[0])); var x3: u32 = undefined; var x4: u1 = undefined; fiatP256AddcarryxU32(&x3, &x4, x2, (arg1[1]), (arg2[1])); var x5: u32 = undefined; var x6: u1 = undefined; fiatP256AddcarryxU32(&x5, &x6, x4, (arg1[2]), (arg2[2])); var x7: u32 = undefined; var x8: u1 = undefined; fiatP256AddcarryxU32(&x7, &x8, x6, (arg1[3]), (arg2[3])); var x9: u32 = undefined; var x10: u1 = undefined; fiatP256AddcarryxU32(&x9, &x10, x8, (arg1[4]), (arg2[4])); var x11: u32 = undefined; var x12: u1 = undefined; fiatP256AddcarryxU32(&x11, &x12, x10, (arg1[5]), (arg2[5])); var x13: u32 = undefined; var x14: u1 = undefined; fiatP256AddcarryxU32(&x13, &x14, x12, (arg1[6]), (arg2[6])); var x15: u32 = undefined; var x16: u1 = undefined; fiatP256AddcarryxU32(&x15, &x16, x14, (arg1[7]), (arg2[7])); var x17: u32 = undefined; var x18: u1 = undefined; fiatP256SubborrowxU32(&x17, &x18, 0x0, x1, 0xffffffff); var x19: u32 = undefined; var x20: u1 = undefined; fiatP256SubborrowxU32(&x19, &x20, x18, x3, 0xffffffff); var x21: u32 = undefined; var x22: u1 = undefined; fiatP256SubborrowxU32(&x21, &x22, x20, x5, 0xffffffff); var x23: u32 = undefined; var x24: u1 = undefined; fiatP256SubborrowxU32(&x23, &x24, x22, x7, @intCast(u32, 0x0)); var x25: u32 = undefined; var x26: u1 = undefined; fiatP256SubborrowxU32(&x25, &x26, x24, x9, @intCast(u32, 0x0)); var x27: u32 = undefined; var x28: u1 = undefined; fiatP256SubborrowxU32(&x27, &x28, x26, x11, @intCast(u32, 0x0)); var x29: u32 = undefined; var x30: u1 = undefined; fiatP256SubborrowxU32(&x29, &x30, x28, x13, @intCast(u32, 0x1)); var x31: u32 = undefined; var x32: u1 = undefined; fiatP256SubborrowxU32(&x31, &x32, x30, x15, 0xffffffff); var x33: u32 = undefined; var x34: u1 = undefined; fiatP256SubborrowxU32(&x33, &x34, x32, @intCast(u32, x16), @intCast(u32, 0x0)); var x35: u32 = undefined; fiatP256CmovznzU32(&x35, x34, x17, x1); var x36: u32 = undefined; fiatP256CmovznzU32(&x36, x34, x19, x3); var x37: u32 = undefined; fiatP256CmovznzU32(&x37, x34, x21, x5); var x38: u32 = undefined; fiatP256CmovznzU32(&x38, x34, x23, x7); var x39: u32 = undefined; fiatP256CmovznzU32(&x39, x34, x25, x9); var x40: u32 = undefined; fiatP256CmovznzU32(&x40, x34, x27, x11); var x41: u32 = undefined; fiatP256CmovznzU32(&x41, x34, x29, x13); var x42: u32 = undefined; fiatP256CmovznzU32(&x42, x34, x31, x15); out1[0] = x35; out1[1] = x36; out1[2] = x37; out1[3] = x38; out1[4] = x39; out1[5] = x40; out1[6] = x41; out1[7] = x42; } /// The function fiatP256Sub 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 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] /// arg2: [[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]] pub fn fiatP256Sub(out1: *[8]u32, arg1: [8]u32, arg2: [8]u32) void { var x1: u32 = undefined; var x2: u1 = undefined; fiatP256SubborrowxU32(&x1, &x2, 0x0, (arg1[0]), (arg2[0])); var x3: u32 = undefined; var x4: u1 = undefined; fiatP256SubborrowxU32(&x3, &x4, x2, (arg1[1]), (arg2[1])); var x5: u32 = undefined; var x6: u1 = undefined; fiatP256SubborrowxU32(&x5, &x6, x4, (arg1[2]), (arg2[2])); var x7: u32 = undefined; var x8: u1 = undefined; fiatP256SubborrowxU32(&x7, &x8, x6, (arg1[3]), (arg2[3])); var x9: u32 = undefined; var x10: u1 = undefined; fiatP256SubborrowxU32(&x9, &x10, x8, (arg1[4]), (arg2[4])); var x11: u32 = undefined; var x12: u1 = undefined; fiatP256SubborrowxU32(&x11, &x12, x10, (arg1[5]), (arg2[5])); var x13: u32 = undefined; var x14: u1 = undefined; fiatP256SubborrowxU32(&x13, &x14, x12, (arg1[6]), (arg2[6])); var x15: u32 = undefined; var x16: u1 = undefined; fiatP256SubborrowxU32(&x15, &x16, x14, (arg1[7]), (arg2[7])); var x17: u32 = undefined; fiatP256CmovznzU32(&x17, x16, @intCast(u32, 0x0), 0xffffffff); var x18: u32 = undefined; var x19: u1 = undefined; fiatP256AddcarryxU32(&x18, &x19, 0x0, x1, x17); var x20: u32 = undefined; var x21: u1 = undefined; fiatP256AddcarryxU32(&x20, &x21, x19, x3, x17); var x22: u32 = undefined; var x23: u1 = undefined; fiatP256AddcarryxU32(&x22, &x23, x21, x5, x17); var x24: u32 = undefined; var x25: u1 = undefined; fiatP256AddcarryxU32(&x24, &x25, x23, x7, @intCast(u32, 0x0)); var x26: u32 = undefined; var x27: u1 = undefined; fiatP256AddcarryxU32(&x26, &x27, x25, x9, @intCast(u32, 0x0)); var x28: u32 = undefined; var x29: u1 = undefined; fiatP256AddcarryxU32(&x28, &x29, x27, x11, @intCast(u32, 0x0)); var x30: u32 = undefined; var x31: u1 = undefined; fiatP256AddcarryxU32(&x30, &x31, x29, x13, @intCast(u32, @intCast(u1, (x17 & @intCast(u32, 0x1))))); var x32: u32 = undefined; var x33: u1 = undefined; fiatP256AddcarryxU32(&x32, &x33, x31, x15, x17); out1[0] = x18; out1[1] = x20; out1[2] = x22; out1[3] = x24; out1[4] = x26; out1[5] = x28; out1[6] = x30; out1[7] = x32; } /// The function fiatP256Opp 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 ~> 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]] pub fn fiatP256Opp(out1: *[8]u32, arg1: [8]u32) void { var x1: u32 = undefined; var x2: u1 = undefined; fiatP256SubborrowxU32(&x1, &x2, 0x0, @intCast(u32, 0x0), (arg1[0])); var x3: u32 = undefined; var x4: u1 = undefined; fiatP256SubborrowxU32(&x3, &x4, x2, @intCast(u32, 0x0), (arg1[1])); var x5: u32 = undefined; var x6: u1 = undefined; fiatP256SubborrowxU32(&x5, &x6, x4, @intCast(u32, 0x0), (arg1[2])); var x7: u32 = undefined; var x8: u1 = undefined; fiatP256SubborrowxU32(&x7, &x8, x6, @intCast(u32, 0x0), (arg1[3])); var x9: u32 = undefined; var x10: u1 = undefined; fiatP256SubborrowxU32(&x9, &x10, x8, @intCast(u32, 0x0), (arg1[4])); var x11: u32 = undefined; var x12: u1 = undefined; fiatP256SubborrowxU32(&x11, &x12, x10, @intCast(u32, 0x0), (arg1[5])); var x13: u32 = undefined; var x14: u1 = undefined; fiatP256SubborrowxU32(&x13, &x14, x12, @intCast(u32, 0x0), (arg1[6])); var x15: u32 = undefined; var x16: u1 = undefined; fiatP256SubborrowxU32(&x15, &x16, x14, @intCast(u32, 0x0), (arg1[7])); var x17: u32 = undefined; fiatP256CmovznzU32(&x17, x16, @intCast(u32, 0x0), 0xffffffff); var x18: u32 = undefined; var x19: u1 = undefined; fiatP256AddcarryxU32(&x18, &x19, 0x0, x1, x17); var x20: u32 = undefined; var x21: u1 = undefined; fiatP256AddcarryxU32(&x20, &x21, x19, x3, x17); var x22: u32 = undefined; var x23: u1 = undefined; fiatP256AddcarryxU32(&x22, &x23, x21, x5, x17); var x24: u32 = undefined; var x25: u1 = undefined; fiatP256AddcarryxU32(&x24, &x25, x23, x7, @intCast(u32, 0x0)); var x26: u32 = undefined; var x27: u1 = undefined; fiatP256AddcarryxU32(&x26, &x27, x25, x9, @intCast(u32, 0x0)); var x28: u32 = undefined; var x29: u1 = undefined; fiatP256AddcarryxU32(&x28, &x29, x27, x11, @intCast(u32, 0x0)); var x30: u32 = undefined; var x31: u1 = undefined; fiatP256AddcarryxU32(&x30, &x31, x29, x13, @intCast(u32, @intCast(u1, (x17 & @intCast(u32, 0x1))))); var x32: u32 = undefined; var x33: u1 = undefined; fiatP256AddcarryxU32(&x32, &x33, x31, x15, x17); out1[0] = x18; out1[1] = x20; out1[2] = x22; out1[3] = x24; out1[4] = x26; out1[5] = x28; out1[6] = x30; out1[7] = x32; } /// The function fiatP256FromMontgomery translates a field element out of the Montgomery domain. /// Preconditions: /// 0 ≤ eval arg1 < m /// Postconditions: /// eval out1 mod m = (eval arg1 * ((2^32)⁻¹ mod m)^8) mod m /// 0 ≤ eval out1 < m /// /// Input Bounds: /// arg1: [[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]] pub fn fiatP256FromMontgomery(out1: *[8]u32, arg1: [8]u32) void { const x1: u32 = (arg1[0]); var x2: u32 = undefined; var x3: u32 = undefined; fiatP256MulxU32(&x2, &x3, x1, 0xffffffff); var x4: u32 = undefined; var x5: u32 = undefined; fiatP256MulxU32(&x4, &x5, x1, 0xffffffff); var x6: u32 = undefined; var x7: u32 = undefined; fiatP256MulxU32(&x6, &x7, x1, 0xffffffff); var x8: u32 = undefined; var x9: u32 = undefined; fiatP256MulxU32(&x8, &x9, x1, 0xffffffff); var x10: u32 = undefined; var x11: u1 = undefined; fiatP256AddcarryxU32(&x10, &x11, 0x0, x9, x6); var x12: u32 = undefined; var x13: u1 = undefined; fiatP256AddcarryxU32(&x12, &x13, x11, x7, x4); var x14: u32 = undefined; var x15: u1 = undefined; fiatP256AddcarryxU32(&x14, &x15, 0x0, x1, x8); var x16: u32 = undefined; var x17: u1 = undefined; fiatP256AddcarryxU32(&x16, &x17, x15, @intCast(u32, 0x0), x10); var x18: u32 = undefined; var x19: u1 = undefined; fiatP256AddcarryxU32(&x18, &x19, x17, @intCast(u32, 0x0), x12); var x20: u32 = undefined; var x21: u1 = undefined; fiatP256AddcarryxU32(&x20, &x21, x19, @intCast(u32, 0x0), (@intCast(u32, x13) + x5)); var x22: u32 = undefined; var x23: u1 = undefined; fiatP256AddcarryxU32(&x22, &x23, 0x0, x16, (arg1[1])); var x24: u32 = undefined; var x25: u1 = undefined; fiatP256AddcarryxU32(&x24, &x25, x23, x18, @intCast(u32, 0x0)); var x26: u32 = undefined; var x27: u1 = undefined; fiatP256AddcarryxU32(&x26, &x27, x25, x20, @intCast(u32, 0x0)); var x28: u32 = undefined; var x29: u32 = undefined; fiatP256MulxU32(&x28, &x29, x22, 0xffffffff); var x30: u32 = undefined; var x31: u32 = undefined; fiatP256MulxU32(&x30, &x31, x22, 0xffffffff); var x32: u32 = undefined; var x33: u32 = undefined; fiatP256MulxU32(&x32, &x33, x22, 0xffffffff); var x34: u32 = undefined; var x35: u32 = undefined; fiatP256MulxU32(&x34, &x35, x22, 0xffffffff); var x36: u32 = undefined; var x37: u1 = undefined; fiatP256AddcarryxU32(&x36, &x37, 0x0, x35, x32); var x38: u32 = undefined; var x39: u1 = undefined; fiatP256AddcarryxU32(&x38, &x39, x37, x33, x30); var x40: u32 = undefined; var x41: u1 = undefined; fiatP256AddcarryxU32(&x40, &x41, 0x0, x22, x34); var x42: u32 = undefined; var x43: u1 = undefined; fiatP256AddcarryxU32(&x42, &x43, x41, x24, x36); var x44: u32 = undefined; var x45: u1 = undefined; fiatP256AddcarryxU32(&x44, &x45, x43, x26, x38); var x46: u32 = undefined; var x47: u1 = undefined; fiatP256AddcarryxU32(&x46, &x47, x45, (@intCast(u32, x27) + @intCast(u32, x21)), (@intCast(u32, x39) + x31)); var x48: u32 = undefined; var x49: u1 = undefined; fiatP256AddcarryxU32(&x48, &x49, 0x0, x2, x22); var x50: u32 = undefined; var x51: u1 = undefined; fiatP256AddcarryxU32(&x50, &x51, x49, x3, x28); var x52: u32 = undefined; var x53: u1 = undefined; fiatP256AddcarryxU32(&x52, &x53, 0x0, x42, (arg1[2])); var x54: u32 = undefined; var x55: u1 = undefined; fiatP256AddcarryxU32(&x54, &x55, x53, x44, @intCast(u32, 0x0)); var x56: u32 = undefined; var x57: u1 = undefined; fiatP256AddcarryxU32(&x56, &x57, x55, x46, @intCast(u32, 0x0)); var x58: u32 = undefined; var x59: u32 = undefined; fiatP256MulxU32(&x58, &x59, x52, 0xffffffff); var x60: u32 = undefined; var x61: u32 = undefined; fiatP256MulxU32(&x60, &x61, x52, 0xffffffff); var x62: u32 = undefined; var x63: u32 = undefined; fiatP256MulxU32(&x62, &x63, x52, 0xffffffff); var x64: u32 = undefined; var x65: u32 = undefined; fiatP256MulxU32(&x64, &x65, x52, 0xffffffff); var x66: u32 = undefined; var x67: u1 = undefined; fiatP256AddcarryxU32(&x66, &x67, 0x0, x65, x62); var x68: u32 = undefined; var x69: u1 = undefined; fiatP256AddcarryxU32(&x68, &x69, x67, x63, x60); var x70: u32 = undefined; var x71: u1 = undefined; fiatP256AddcarryxU32(&x70, &x71, 0x0, x52, x64); var x72: u32 = undefined; var x73: u1 = undefined; fiatP256AddcarryxU32(&x72, &x73, x71, x54, x66); var x74: u32 = undefined; var x75: u1 = undefined; fiatP256AddcarryxU32(&x74, &x75, x73, x56, x68); var x76: u32 = undefined; var x77: u1 = undefined; fiatP256AddcarryxU32(&x76, &x77, x75, (@intCast(u32, x57) + @intCast(u32, x47)), (@intCast(u32, x69) + x61)); var x78: u32 = undefined; var x79: u1 = undefined; fiatP256AddcarryxU32(&x78, &x79, x77, x1, @intCast(u32, 0x0)); var x80: u32 = undefined; var x81: u1 = undefined; fiatP256AddcarryxU32(&x80, &x81, x79, x48, @intCast(u32, 0x0)); var x82: u32 = undefined; var x83: u1 = undefined; fiatP256AddcarryxU32(&x82, &x83, x81, x50, x52); var x84: u32 = undefined; var x85: u1 = undefined; fiatP256AddcarryxU32(&x84, &x85, x83, (@intCast(u32, x51) + x29), x58); var x86: u32 = undefined; var x87: u1 = undefined; fiatP256AddcarryxU32(&x86, &x87, 0x0, x72, (arg1[3])); var x88: u32 = undefined; var x89: u1 = undefined; fiatP256AddcarryxU32(&x88, &x89, x87, x74, @intCast(u32, 0x0)); var x90: u32 = undefined; var x91: u1 = undefined; fiatP256AddcarryxU32(&x90, &x91, x89, x76, @intCast(u32, 0x0)); var x92: u32 = undefined; var x93: u1 = undefined; fiatP256AddcarryxU32(&x92, &x93, x91, x78, @intCast(u32, 0x0)); var x94: u32 = undefined; var x95: u1 = undefined; fiatP256AddcarryxU32(&x94, &x95, x93, x80, @intCast(u32, 0x0)); var x96: u32 = undefined; var x97: u1 = undefined; fiatP256AddcarryxU32(&x96, &x97, x95, x82, @intCast(u32, 0x0)); var x98: u32 = undefined; var x99: u1 = undefined; fiatP256AddcarryxU32(&x98, &x99, x97, x84, @intCast(u32, 0x0)); var x100: u32 = undefined; var x101: u1 = undefined; fiatP256AddcarryxU32(&x100, &x101, x99, (@intCast(u32, x85) + x59), @intCast(u32, 0x0)); var x102: u32 = undefined; var x103: u32 = undefined; fiatP256MulxU32(&x102, &x103, x86, 0xffffffff); var x104: u32 = undefined; var x105: u32 = undefined; fiatP256MulxU32(&x104, &x105, x86, 0xffffffff); var x106: u32 = undefined; var x107: u32 = undefined; fiatP256MulxU32(&x106, &x107, x86, 0xffffffff); var x108: u32 = undefined; var x109: u32 = undefined; fiatP256MulxU32(&x108, &x109, x86, 0xffffffff); var x110: u32 = undefined; var x111: u1 = undefined; fiatP256AddcarryxU32(&x110, &x111, 0x0, x109, x106); var x112: u32 = undefined; var x113: u1 = undefined; fiatP256AddcarryxU32(&x112, &x113, x111, x107, x104); var x114: u32 = undefined; var x115: u1 = undefined; fiatP256AddcarryxU32(&x114, &x115, 0x0, x86, x108); var x116: u32 = undefined; var x117: u1 = undefined; fiatP256AddcarryxU32(&x116, &x117, x115, x88, x110); var x118: u32 = undefined; var x119: u1 = undefined; fiatP256AddcarryxU32(&x118, &x119, x117, x90, x112); var x120: u32 = undefined; var x121: u1 = undefined; fiatP256AddcarryxU32(&x120, &x121, x119, x92, (@intCast(u32, x113) + x105)); var x122: u32 = undefined; var x123: u1 = undefined; fiatP256AddcarryxU32(&x122, &x123, x121, x94, @intCast(u32, 0x0)); var x124: u32 = undefined; var x125: u1 = undefined; fiatP256AddcarryxU32(&x124, &x125, x123, x96, @intCast(u32, 0x0)); var x126: u32 = undefined; var x127: u1 = undefined; fiatP256AddcarryxU32(&x126, &x127, x125, x98, x86); var x128: u32 = undefined; var x129: u1 = undefined; fiatP256AddcarryxU32(&x128, &x129, x127, x100, x102); var x130: u32 = undefined; var x131: u1 = undefined; fiatP256AddcarryxU32(&x130, &x131, x129, @intCast(u32, x101), x103); var x132: u32 = undefined; var x133: u1 = undefined; fiatP256AddcarryxU32(&x132, &x133, 0x0, x116, (arg1[4])); var x134: u32 = undefined; var x135: u1 = undefined; fiatP256AddcarryxU32(&x134, &x135, x133, x118, @intCast(u32, 0x0)); var x136: u32 = undefined; var x137: u1 = undefined; fiatP256AddcarryxU32(&x136, &x137, x135, x120, @intCast(u32, 0x0)); var x138: u32 = undefined; var x139: u1 = undefined; fiatP256AddcarryxU32(&x138, &x139, x137, x122, @intCast(u32, 0x0)); var x140: u32 = undefined; var x141: u1 = undefined; fiatP256AddcarryxU32(&x140, &x141, x139, x124, @intCast(u32, 0x0)); var x142: u32 = undefined; var x143: u1 = undefined; fiatP256AddcarryxU32(&x142, &x143, x141, x126, @intCast(u32, 0x0)); var x144: u32 = undefined; var x145: u1 = undefined; fiatP256AddcarryxU32(&x144, &x145, x143, x128, @intCast(u32, 0x0)); var x146: u32 = undefined; var x147: u1 = undefined; fiatP256AddcarryxU32(&x146, &x147, x145, x130, @intCast(u32, 0x0)); var x148: u32 = undefined; var x149: u32 = undefined; fiatP256MulxU32(&x148, &x149, x132, 0xffffffff); var x150: u32 = undefined; var x151: u32 = undefined; fiatP256MulxU32(&x150, &x151, x132, 0xffffffff); var x152: u32 = undefined; var x153: u32 = undefined; fiatP256MulxU32(&x152, &x153, x132, 0xffffffff); var x154: u32 = undefined; var x155: u32 = undefined; fiatP256MulxU32(&x154, &x155, x132, 0xffffffff); var x156: u32 = undefined; var x157: u1 = undefined; fiatP256AddcarryxU32(&x156, &x157, 0x0, x155, x152); var x158: u32 = undefined; var x159: u1 = undefined; fiatP256AddcarryxU32(&x158, &x159, x157, x153, x150); var x160: u32 = undefined; var x161: u1 = undefined; fiatP256AddcarryxU32(&x160, &x161, 0x0, x132, x154); var x162: u32 = undefined; var x163: u1 = undefined; fiatP256AddcarryxU32(&x162, &x163, x161, x134, x156); var x164: u32 = undefined; var x165: u1 = undefined; fiatP256AddcarryxU32(&x164, &x165, x163, x136, x158); var x166: u32 = undefined; var x167: u1 = undefined; fiatP256AddcarryxU32(&x166, &x167, x165, x138, (@intCast(u32, x159) + x151)); var x168: u32 = undefined; var x169: u1 = undefined; fiatP256AddcarryxU32(&x168, &x169, x167, x140, @intCast(u32, 0x0)); var x170: u32 = undefined; var x171: u1 = undefined; fiatP256AddcarryxU32(&x170, &x171, x169, x142, @intCast(u32, 0x0)); var x172: u32 = undefined; var x173: u1 = undefined; fiatP256AddcarryxU32(&x172, &x173, x171, x144, x132); var x174: u32 = undefined; var x175: u1 = undefined; fiatP256AddcarryxU32(&x174, &x175, x173, x146, x148); var x176: u32 = undefined; var x177: u1 = undefined; fiatP256AddcarryxU32(&x176, &x177, x175, (@intCast(u32, x147) + @intCast(u32, x131)), x149); var x178: u32 = undefined; var x179: u1 = undefined; fiatP256AddcarryxU32(&x178, &x179, 0x0, x162, (arg1[5])); var x180: u32 = undefined; var x181: u1 = undefined; fiatP256AddcarryxU32(&x180, &x181, x179, x164, @intCast(u32, 0x0)); var x182: u32 = undefined; var x183: u1 = undefined; fiatP256AddcarryxU32(&x182, &x183, x181, x166, @intCast(u32, 0x0)); var x184: u32 = undefined; var x185: u1 = undefined; fiatP256AddcarryxU32(&x184, &x185, x183, x168, @intCast(u32, 0x0)); var x186: u32 = undefined; var x187: u1 = undefined; fiatP256AddcarryxU32(&x186, &x187, x185, x170, @intCast(u32, 0x0)); var x188: u32 = undefined; var x189: u1 = undefined; fiatP256AddcarryxU32(&x188, &x189, x187, x172, @intCast(u32, 0x0)); var x190: u32 = undefined; var x191: u1 = undefined; fiatP256AddcarryxU32(&x190, &x191, x189, x174, @intCast(u32, 0x0)); var x192: u32 = undefined; var x193: u1 = undefined; fiatP256AddcarryxU32(&x192, &x193, x191, x176, @intCast(u32, 0x0)); var x194: u32 = undefined; var x195: u32 = undefined; fiatP256MulxU32(&x194, &x195, x178, 0xffffffff); var x196: u32 = undefined; var x197: u32 = undefined; fiatP256MulxU32(&x196, &x197, x178, 0xffffffff); var x198: u32 = undefined; var x199: u32 = undefined; fiatP256MulxU32(&x198, &x199, x178, 0xffffffff); var x200: u32 = undefined; var x201: u32 = undefined; fiatP256MulxU32(&x200, &x201, x178, 0xffffffff); var x202: u32 = undefined; var x203: u1 = undefined; fiatP256AddcarryxU32(&x202, &x203, 0x0, x201, x198); var x204: u32 = undefined; var x205: u1 = undefined; fiatP256AddcarryxU32(&x204, &x205, x203, x199, x196); var x206: u32 = undefined; var x207: u1 = undefined; fiatP256AddcarryxU32(&x206, &x207, 0x0, x178, x200); var x208: u32 = undefined; var x209: u1 = undefined; fiatP256AddcarryxU32(&x208, &x209, x207, x180, x202); var x210: u32 = undefined; var x211: u1 = undefined; fiatP256AddcarryxU32(&x210, &x211, x209, x182, x204); var x212: u32 = undefined; var x213: u1 = undefined; fiatP256AddcarryxU32(&x212, &x213, x211, x184, (@intCast(u32, x205) + x197)); var x214: u32 = undefined; var x215: u1 = undefined; fiatP256AddcarryxU32(&x214, &x215, x213, x186, @intCast(u32, 0x0)); var x216: u32 = undefined; var x217: u1 = undefined; fiatP256AddcarryxU32(&x216, &x217, x215, x188, @intCast(u32, 0x0)); var x218: u32 = undefined; var x219: u1 = undefined; fiatP256AddcarryxU32(&x218, &x219, x217, x190, x178); var x220: u32 = undefined; var x221: u1 = undefined; fiatP256AddcarryxU32(&x220, &x221, x219, x192, x194); var x222: u32 = undefined; var x223: u1 = undefined; fiatP256AddcarryxU32(&x222, &x223, x221, (@intCast(u32, x193) + @intCast(u32, x177)), x195); var x224: u32 = undefined; var x225: u1 = undefined; fiatP256AddcarryxU32(&x224, &x225, 0x0, x208, (arg1[6])); var x226: u32 = undefined; var x227: u1 = undefined; fiatP256AddcarryxU32(&x226, &x227, x225, x210, @intCast(u32, 0x0)); var x228: u32 = undefined; var x229: u1 = undefined; fiatP256AddcarryxU32(&x228, &x229, x227, x212, @intCast(u32, 0x0)); var x230: u32 = undefined; var x231: u1 = undefined; fiatP256AddcarryxU32(&x230, &x231, x229, x214, @intCast(u32, 0x0)); var x232: u32 = undefined; var x233: u1 = undefined; fiatP256AddcarryxU32(&x232, &x233, x231, x216, @intCast(u32, 0x0)); var x234: u32 = undefined; var x235: u1 = undefined; fiatP256AddcarryxU32(&x234, &x235, x233, x218, @intCast(u32, 0x0)); var x236: u32 = undefined; var x237: u1 = undefined; fiatP256AddcarryxU32(&x236, &x237, x235, x220, @intCast(u32, 0x0)); var x238: u32 = undefined; var x239: u1 = undefined; fiatP256AddcarryxU32(&x238, &x239, x237, x222, @intCast(u32, 0x0)); var x240: u32 = undefined; var x241: u32 = undefined; fiatP256MulxU32(&x240, &x241, x224, 0xffffffff); var x242: u32 = undefined; var x243: u32 = undefined; fiatP256MulxU32(&x242, &x243, x224, 0xffffffff); var x244: u32 = undefined; var x245: u32 = undefined; fiatP256MulxU32(&x244, &x245, x224, 0xffffffff); var x246: u32 = undefined; var x247: u32 = undefined; fiatP256MulxU32(&x246, &x247, x224, 0xffffffff); var x248: u32 = undefined; var x249: u1 = undefined; fiatP256AddcarryxU32(&x248, &x249, 0x0, x247, x244); var x250: u32 = undefined; var x251: u1 = undefined; fiatP256AddcarryxU32(&x250, &x251, x249, x245, x242); var x252: u32 = undefined; var x253: u1 = undefined; fiatP256AddcarryxU32(&x252, &x253, 0x0, x224, x246); var x254: u32 = undefined; var x255: u1 = undefined; fiatP256AddcarryxU32(&x254, &x255, x253, x226, x248); var x256: u32 = undefined; var x257: u1 = undefined; fiatP256AddcarryxU32(&x256, &x257, x255, x228, x250); var x258: u32 = undefined; var x259: u1 = undefined; fiatP256AddcarryxU32(&x258, &x259, x257, x230, (@intCast(u32, x251) + x243)); var x260: u32 = undefined; var x261: u1 = undefined; fiatP256AddcarryxU32(&x260, &x261, x259, x232, @intCast(u32, 0x0)); var x262: u32 = undefined; var x263: u1 = undefined; fiatP256AddcarryxU32(&x262, &x263, x261, x234, @intCast(u32, 0x0)); var x264: u32 = undefined; var x265: u1 = undefined; fiatP256AddcarryxU32(&x264, &x265, x263, x236, x224); var x266: u32 = undefined; var x267: u1 = undefined; fiatP256AddcarryxU32(&x266, &x267, x265, x238, x240); var x268: u32 = undefined; var x269: u1 = undefined; fiatP256AddcarryxU32(&x268, &x269, x267, (@intCast(u32, x239) + @intCast(u32, x223)), x241); var x270: u32 = undefined; var x271: u1 = undefined; fiatP256AddcarryxU32(&x270, &x271, 0x0, x254, (arg1[7])); var x272: u32 = undefined; var x273: u1 = undefined; fiatP256AddcarryxU32(&x272, &x273, x271, x256, @intCast(u32, 0x0)); var x274: u32 = undefined; var x275: u1 = undefined; fiatP256AddcarryxU32(&x274, &x275, x273, x258, @intCast(u32, 0x0)); var x276: u32 = undefined; var x277: u1 = undefined; fiatP256AddcarryxU32(&x276, &x277, x275, x260, @intCast(u32, 0x0)); var x278: u32 = undefined; var x279: u1 = undefined; fiatP256AddcarryxU32(&x278, &x279, x277, x262, @intCast(u32, 0x0)); var x280: u32 = undefined; var x281: u1 = undefined; fiatP256AddcarryxU32(&x280, &x281, x279, x264, @intCast(u32, 0x0)); var x282: u32 = undefined; var x283: u1 = undefined; fiatP256AddcarryxU32(&x282, &x283, x281, x266, @intCast(u32, 0x0)); var x284: u32 = undefined; var x285: u1 = undefined; fiatP256AddcarryxU32(&x284, &x285, x283, x268, @intCast(u32, 0x0)); var x286: u32 = undefined; var x287: u32 = undefined; fiatP256MulxU32(&x286, &x287, x270, 0xffffffff); var x288: u32 = undefined; var x289: u32 = undefined; fiatP256MulxU32(&x288, &x289, x270, 0xffffffff); var x290: u32 = undefined; var x291: u32 = undefined; fiatP256MulxU32(&x290, &x291, x270, 0xffffffff); var x292: u32 = undefined; var x293: u32 = undefined; fiatP256MulxU32(&x292, &x293, x270, 0xffffffff); var x294: u32 = undefined; var x295: u1 = undefined; fiatP256AddcarryxU32(&x294, &x295, 0x0, x293, x290); var x296: u32 = undefined; var x297: u1 = undefined; fiatP256AddcarryxU32(&x296, &x297, x295, x291, x288); var x298: u32 = undefined; var x299: u1 = undefined; fiatP256AddcarryxU32(&x298, &x299, 0x0, x270, x292); var x300: u32 = undefined; var x301: u1 = undefined; fiatP256AddcarryxU32(&x300, &x301, x299, x272, x294); var x302: u32 = undefined; var x303: u1 = undefined; fiatP256AddcarryxU32(&x302, &x303, x301, x274, x296); var x304: u32 = undefined; var x305: u1 = undefined; fiatP256AddcarryxU32(&x304, &x305, x303, x276, (@intCast(u32, x297) + x289)); var x306: u32 = undefined; var x307: u1 = undefined; fiatP256AddcarryxU32(&x306, &x307, x305, x278, @intCast(u32, 0x0)); var x308: u32 = undefined; var x309: u1 = undefined; fiatP256AddcarryxU32(&x308, &x309, x307, x280, @intCast(u32, 0x0)); var x310: u32 = undefined; var x311: u1 = undefined; fiatP256AddcarryxU32(&x310, &x311, x309, x282, x270); var x312: u32 = undefined; var x313: u1 = undefined; fiatP256AddcarryxU32(&x312, &x313, x311, x284, x286); var x314: u32 = undefined; var x315: u1 = undefined; fiatP256AddcarryxU32(&x314, &x315, x313, (@intCast(u32, x285) + @intCast(u32, x269)), x287); var x316: u32 = undefined; var x317: u1 = undefined; fiatP256SubborrowxU32(&x316, &x317, 0x0, x300, 0xffffffff); var x318: u32 = undefined; var x319: u1 = undefined; fiatP256SubborrowxU32(&x318, &x319, x317, x302, 0xffffffff); var x320: u32 = undefined; var x321: u1 = undefined; fiatP256SubborrowxU32(&x320, &x321, x319, x304, 0xffffffff); var x322: u32 = undefined; var x323: u1 = undefined; fiatP256SubborrowxU32(&x322, &x323, x321, x306, @intCast(u32, 0x0)); var x324: u32 = undefined; var x325: u1 = undefined; fiatP256SubborrowxU32(&x324, &x325, x323, x308, @intCast(u32, 0x0)); var x326: u32 = undefined; var x327: u1 = undefined; fiatP256SubborrowxU32(&x326, &x327, x325, x310, @intCast(u32, 0x0)); var x328: u32 = undefined; var x329: u1 = undefined; fiatP256SubborrowxU32(&x328, &x329, x327, x312, @intCast(u32, 0x1)); var x330: u32 = undefined; var x331: u1 = undefined; fiatP256SubborrowxU32(&x330, &x331, x329, x314, 0xffffffff); var x332: u32 = undefined; var x333: u1 = undefined; fiatP256SubborrowxU32(&x332, &x333, x331, @intCast(u32, x315), @intCast(u32, 0x0)); var x334: u32 = undefined; fiatP256CmovznzU32(&x334, x333, x316, x300); var x335: u32 = undefined; fiatP256CmovznzU32(&x335, x333, x318, x302); var x336: u32 = undefined; fiatP256CmovznzU32(&x336, x333, x320, x304); var x337: u32 = undefined; fiatP256CmovznzU32(&x337, x333, x322, x306); var x338: u32 = undefined; fiatP256CmovznzU32(&x338, x333, x324, x308); var x339: u32 = undefined; fiatP256CmovznzU32(&x339, x333, x326, x310); var x340: u32 = undefined; fiatP256CmovznzU32(&x340, x333, x328, x312); var x341: u32 = undefined; fiatP256CmovznzU32(&x341, x333, x330, x314); out1[0] = x334; out1[1] = x335; out1[2] = x336; out1[3] = x337; out1[4] = x338; out1[5] = x339; out1[6] = x340; out1[7] = x341; } /// The function fiatP256ToMontgomery 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 ~> 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]] pub fn fiatP256ToMontgomery(out1: *[8]u32, arg1: [8]u32) void { const x1: u32 = (arg1[1]); const x2: u32 = (arg1[2]); const x3: u32 = (arg1[3]); const x4: u32 = (arg1[4]); const x5: u32 = (arg1[5]); const x6: u32 = (arg1[6]); const x7: u32 = (arg1[7]); const x8: u32 = (arg1[0]); var x9: u32 = undefined; var x10: u32 = undefined; fiatP256MulxU32(&x9, &x10, x8, 0x4); var x11: u32 = undefined; var x12: u32 = undefined; fiatP256MulxU32(&x11, &x12, x8, 0xfffffffd); var x13: u32 = undefined; var x14: u32 = undefined; fiatP256MulxU32(&x13, &x14, x8, 0xffffffff); var x15: u32 = undefined; var x16: u32 = undefined; fiatP256MulxU32(&x15, &x16, x8, 0xfffffffe); var x17: u32 = undefined; var x18: u32 = undefined; fiatP256MulxU32(&x17, &x18, x8, 0xfffffffb); var x19: u32 = undefined; var x20: u32 = undefined; fiatP256MulxU32(&x19, &x20, x8, 0xffffffff); var x21: u32 = undefined; var x22: u32 = undefined; fiatP256MulxU32(&x21, &x22, x8, 0x3); var x23: u32 = undefined; var x24: u1 = undefined; fiatP256AddcarryxU32(&x23, &x24, 0x0, x20, x17); var x25: u32 = undefined; var x26: u1 = undefined; fiatP256AddcarryxU32(&x25, &x26, x24, x18, x15); var x27: u32 = undefined; var x28: u1 = undefined; fiatP256AddcarryxU32(&x27, &x28, x26, x16, x13); var x29: u32 = undefined; var x30: u1 = undefined; fiatP256AddcarryxU32(&x29, &x30, x28, x14, x11); var x31: u32 = undefined; var x32: u1 = undefined; fiatP256AddcarryxU32(&x31, &x32, x30, x12, x9); var x33: u32 = undefined; var x34: u32 = undefined; fiatP256MulxU32(&x33, &x34, x21, 0xffffffff); var x35: u32 = undefined; var x36: u32 = undefined; fiatP256MulxU32(&x35, &x36, x21, 0xffffffff); var x37: u32 = undefined; var x38: u32 = undefined; fiatP256MulxU32(&x37, &x38, x21, 0xffffffff); var x39: u32 = undefined; var x40: u32 = undefined; fiatP256MulxU32(&x39, &x40, x21, 0xffffffff); var x41: u32 = undefined; var x42: u1 = undefined; fiatP256AddcarryxU32(&x41, &x42, 0x0, x40, x37); var x43: u32 = undefined; var x44: u1 = undefined; fiatP256AddcarryxU32(&x43, &x44, x42, x38, x35); var x45: u32 = undefined; var x46: u1 = undefined; fiatP256AddcarryxU32(&x45, &x46, 0x0, x21, x39); var x47: u32 = undefined; var x48: u1 = undefined; fiatP256AddcarryxU32(&x47, &x48, x46, x22, x41); var x49: u32 = undefined; var x50: u1 = undefined; fiatP256AddcarryxU32(&x49, &x50, x48, x19, x43); var x51: u32 = undefined; var x52: u1 = undefined; fiatP256AddcarryxU32(&x51, &x52, x50, x23, (@intCast(u32, x44) + x36)); var x53: u32 = undefined; var x54: u1 = undefined; fiatP256AddcarryxU32(&x53, &x54, x52, x25, @intCast(u32, 0x0)); var x55: u32 = undefined; var x56: u1 = undefined; fiatP256AddcarryxU32(&x55, &x56, x54, x27, @intCast(u32, 0x0)); var x57: u32 = undefined; var x58: u1 = undefined; fiatP256AddcarryxU32(&x57, &x58, x56, x29, x21); var x59: u32 = undefined; var x60: u1 = undefined; fiatP256AddcarryxU32(&x59, &x60, x58, x31, x33); var x61: u32 = undefined; var x62: u1 = undefined; fiatP256AddcarryxU32(&x61, &x62, x60, (@intCast(u32, x32) + x10), x34); var x63: u32 = undefined; var x64: u32 = undefined; fiatP256MulxU32(&x63, &x64, x1, 0x4); var x65: u32 = undefined; var x66: u32 = undefined; fiatP256MulxU32(&x65, &x66, x1, 0xfffffffd); var x67: u32 = undefined; var x68: u32 = undefined; fiatP256MulxU32(&x67, &x68, x1, 0xffffffff); var x69: u32 = undefined; var x70: u32 = undefined; fiatP256MulxU32(&x69, &x70, x1, 0xfffffffe); var x71: u32 = undefined; var x72: u32 = undefined; fiatP256MulxU32(&x71, &x72, x1, 0xfffffffb); var x73: u32 = undefined; var x74: u32 = undefined; fiatP256MulxU32(&x73, &x74, x1, 0xffffffff); var x75: u32 = undefined; var x76: u32 = undefined; fiatP256MulxU32(&x75, &x76, x1, 0x3); var x77: u32 = undefined; var x78: u1 = undefined; fiatP256AddcarryxU32(&x77, &x78, 0x0, x74, x71); var x79: u32 = undefined; var x80: u1 = undefined; fiatP256AddcarryxU32(&x79, &x80, x78, x72, x69); var x81: u32 = undefined; var x82: u1 = undefined; fiatP256AddcarryxU32(&x81, &x82, x80, x70, x67); var x83: u32 = undefined; var x84: u1 = undefined; fiatP256AddcarryxU32(&x83, &x84, x82, x68, x65); var x85: u32 = undefined; var x86: u1 = undefined; fiatP256AddcarryxU32(&x85, &x86, x84, x66, x63); var x87: u32 = undefined; var x88: u1 = undefined; fiatP256AddcarryxU32(&x87, &x88, 0x0, x47, x75); var x89: u32 = undefined; var x90: u1 = undefined; fiatP256AddcarryxU32(&x89, &x90, x88, x49, x76); var x91: u32 = undefined; var x92: u1 = undefined; fiatP256AddcarryxU32(&x91, &x92, x90, x51, x73); var x93: u32 = undefined; var x94: u1 = undefined; fiatP256AddcarryxU32(&x93, &x94, x92, x53, x77); var x95: u32 = undefined; var x96: u1 = undefined; fiatP256AddcarryxU32(&x95, &x96, x94, x55, x79); var x97: u32 = undefined; var x98: u1 = undefined; fiatP256AddcarryxU32(&x97, &x98, x96, x57, x81); var x99: u32 = undefined; var x100: u1 = undefined; fiatP256AddcarryxU32(&x99, &x100, x98, x59, x83); var x101: u32 = undefined; var x102: u1 = undefined; fiatP256AddcarryxU32(&x101, &x102, x100, x61, x85); var x103: u32 = undefined; var x104: u32 = undefined; fiatP256MulxU32(&x103, &x104, x87, 0xffffffff); var x105: u32 = undefined; var x106: u32 = undefined; fiatP256MulxU32(&x105, &x106, x87, 0xffffffff); var x107: u32 = undefined; var x108: u32 = undefined; fiatP256MulxU32(&x107, &x108, x87, 0xffffffff); var x109: u32 = undefined; var x110: u32 = undefined; fiatP256MulxU32(&x109, &x110, x87, 0xffffffff); var x111: u32 = undefined; var x112: u1 = undefined; fiatP256AddcarryxU32(&x111, &x112, 0x0, x110, x107); var x113: u32 = undefined; var x114: u1 = undefined; fiatP256AddcarryxU32(&x113, &x114, x112, x108, x105); var x115: u32 = undefined; var x116: u1 = undefined; fiatP256AddcarryxU32(&x115, &x116, 0x0, x87, x109); var x117: u32 = undefined; var x118: u1 = undefined; fiatP256AddcarryxU32(&x117, &x118, x116, x89, x111); var x119: u32 = undefined; var x120: u1 = undefined; fiatP256AddcarryxU32(&x119, &x120, x118, x91, x113); var x121: u32 = undefined; var x122: u1 = undefined; fiatP256AddcarryxU32(&x121, &x122, x120, x93, (@intCast(u32, x114) + x106)); var x123: u32 = undefined; var x124: u1 = undefined; fiatP256AddcarryxU32(&x123, &x124, x122, x95, @intCast(u32, 0x0)); var x125: u32 = undefined; var x126: u1 = undefined; fiatP256AddcarryxU32(&x125, &x126, x124, x97, @intCast(u32, 0x0)); var x127: u32 = undefined; var x128: u1 = undefined; fiatP256AddcarryxU32(&x127, &x128, x126, x99, x87); var x129: u32 = undefined; var x130: u1 = undefined; fiatP256AddcarryxU32(&x129, &x130, x128, x101, x103); var x131: u32 = undefined; var x132: u1 = undefined; fiatP256AddcarryxU32(&x131, &x132, x130, ((@intCast(u32, x102) + @intCast(u32, x62)) + (@intCast(u32, x86) + x64)), x104); var x133: u32 = undefined; var x134: u32 = undefined; fiatP256MulxU32(&x133, &x134, x2, 0x4); var x135: u32 = undefined; var x136: u32 = undefined; fiatP256MulxU32(&x135, &x136, x2, 0xfffffffd); var x137: u32 = undefined; var x138: u32 = undefined; fiatP256MulxU32(&x137, &x138, x2, 0xffffffff); var x139: u32 = undefined; var x140: u32 = undefined; fiatP256MulxU32(&x139, &x140, x2, 0xfffffffe); var x141: u32 = undefined; var x142: u32 = undefined; fiatP256MulxU32(&x141, &x142, x2, 0xfffffffb); var x143: u32 = undefined; var x144: u32 = undefined; fiatP256MulxU32(&x143, &x144, x2, 0xffffffff); var x145: u32 = undefined; var x146: u32 = undefined; fiatP256MulxU32(&x145, &x146, x2, 0x3); var x147: u32 = undefined; var x148: u1 = undefined; fiatP256AddcarryxU32(&x147, &x148, 0x0, x144, x141); var x149: u32 = undefined; var x150: u1 = undefined; fiatP256AddcarryxU32(&x149, &x150, x148, x142, x139); var x151: u32 = undefined; var x152: u1 = undefined; fiatP256AddcarryxU32(&x151, &x152, x150, x140, x137); var x153: u32 = undefined; var x154: u1 = undefined; fiatP256AddcarryxU32(&x153, &x154, x152, x138, x135); var x155: u32 = undefined; var x156: u1 = undefined; fiatP256AddcarryxU32(&x155, &x156, x154, x136, x133); var x157: u32 = undefined; var x158: u1 = undefined; fiatP256AddcarryxU32(&x157, &x158, 0x0, x117, x145); var x159: u32 = undefined; var x160: u1 = undefined; fiatP256AddcarryxU32(&x159, &x160, x158, x119, x146); var x161: u32 = undefined; var x162: u1 = undefined; fiatP256AddcarryxU32(&x161, &x162, x160, x121, x143); var x163: u32 = undefined; var x164: u1 = undefined; fiatP256AddcarryxU32(&x163, &x164, x162, x123, x147); var x165: u32 = undefined; var x166: u1 = undefined; fiatP256AddcarryxU32(&x165, &x166, x164, x125, x149); var x167: u32 = undefined; var x168: u1 = undefined; fiatP256AddcarryxU32(&x167, &x168, x166, x127, x151); var x169: u32 = undefined; var x170: u1 = undefined; fiatP256AddcarryxU32(&x169, &x170, x168, x129, x153); var x171: u32 = undefined; var x172: u1 = undefined; fiatP256AddcarryxU32(&x171, &x172, x170, x131, x155); var x173: u32 = undefined; var x174: u32 = undefined; fiatP256MulxU32(&x173, &x174, x157, 0xffffffff); var x175: u32 = undefined; var x176: u32 = undefined; fiatP256MulxU32(&x175, &x176, x157, 0xffffffff); var x177: u32 = undefined; var x178: u32 = undefined; fiatP256MulxU32(&x177, &x178, x157, 0xffffffff); var x179: u32 = undefined; var x180: u32 = undefined; fiatP256MulxU32(&x179, &x180, x157, 0xffffffff); var x181: u32 = undefined; var x182: u1 = undefined; fiatP256AddcarryxU32(&x181, &x182, 0x0, x180, x177); var x183: u32 = undefined; var x184: u1 = undefined; fiatP256AddcarryxU32(&x183, &x184, x182, x178, x175); var x185: u32 = undefined; var x186: u1 = undefined; fiatP256AddcarryxU32(&x185, &x186, 0x0, x157, x179); var x187: u32 = undefined; var x188: u1 = undefined; fiatP256AddcarryxU32(&x187, &x188, x186, x159, x181); var x189: u32 = undefined; var x190: u1 = undefined; fiatP256AddcarryxU32(&x189, &x190, x188, x161, x183); var x191: u32 = undefined; var x192: u1 = undefined; fiatP256AddcarryxU32(&x191, &x192, x190, x163, (@intCast(u32, x184) + x176)); var x193: u32 = undefined; var x194: u1 = undefined; fiatP256AddcarryxU32(&x193, &x194, x192, x165, @intCast(u32, 0x0)); var x195: u32 = undefined; var x196: u1 = undefined; fiatP256AddcarryxU32(&x195, &x196, x194, x167, @intCast(u32, 0x0)); var x197: u32 = undefined; var x198: u1 = undefined; fiatP256AddcarryxU32(&x197, &x198, x196, x169, x157); var x199: u32 = undefined; var x200: u1 = undefined; fiatP256AddcarryxU32(&x199, &x200, x198, x171, x173); var x201: u32 = undefined; var x202: u1 = undefined; fiatP256AddcarryxU32(&x201, &x202, x200, ((@intCast(u32, x172) + @intCast(u32, x132)) + (@intCast(u32, x156) + x134)), x174); var x203: u32 = undefined; var x204: u32 = undefined; fiatP256MulxU32(&x203, &x204, x3, 0x4); var x205: u32 = undefined; var x206: u32 = undefined; fiatP256MulxU32(&x205, &x206, x3, 0xfffffffd); var x207: u32 = undefined; var x208: u32 = undefined; fiatP256MulxU32(&x207, &x208, x3, 0xffffffff); var x209: u32 = undefined; var x210: u32 = undefined; fiatP256MulxU32(&x209, &x210, x3, 0xfffffffe); var x211: u32 = undefined; var x212: u32 = undefined; fiatP256MulxU32(&x211, &x212, x3, 0xfffffffb); var x213: u32 = undefined; var x214: u32 = undefined; fiatP256MulxU32(&x213, &x214, x3, 0xffffffff); var x215: u32 = undefined; var x216: u32 = undefined; fiatP256MulxU32(&x215, &x216, x3, 0x3); var x217: u32 = undefined; var x218: u1 = undefined; fiatP256AddcarryxU32(&x217, &x218, 0x0, x214, x211); var x219: u32 = undefined; var x220: u1 = undefined; fiatP256AddcarryxU32(&x219, &x220, x218, x212, x209); var x221: u32 = undefined; var x222: u1 = undefined; fiatP256AddcarryxU32(&x221, &x222, x220, x210, x207); var x223: u32 = undefined; var x224: u1 = undefined; fiatP256AddcarryxU32(&x223, &x224, x222, x208, x205); var x225: u32 = undefined; var x226: u1 = undefined; fiatP256AddcarryxU32(&x225, &x226, x224, x206, x203); var x227: u32 = undefined; var x228: u1 = undefined; fiatP256AddcarryxU32(&x227, &x228, 0x0, x187, x215); var x229: u32 = undefined; var x230: u1 = undefined; fiatP256AddcarryxU32(&x229, &x230, x228, x189, x216); var x231: u32 = undefined; var x232: u1 = undefined; fiatP256AddcarryxU32(&x231, &x232, x230, x191, x213); var x233: u32 = undefined; var x234: u1 = undefined; fiatP256AddcarryxU32(&x233, &x234, x232, x193, x217); var x235: u32 = undefined; var x236: u1 = undefined; fiatP256AddcarryxU32(&x235, &x236, x234, x195, x219); var x237: u32 = undefined; var x238: u1 = undefined; fiatP256AddcarryxU32(&x237, &x238, x236, x197, x221); var x239: u32 = undefined; var x240: u1 = undefined; fiatP256AddcarryxU32(&x239, &x240, x238, x199, x223); var x241: u32 = undefined; var x242: u1 = undefined; fiatP256AddcarryxU32(&x241, &x242, x240, x201, x225); var x243: u32 = undefined; var x244: u32 = undefined; fiatP256MulxU32(&x243, &x244, x227, 0xffffffff); var x245: u32 = undefined; var x246: u32 = undefined; fiatP256MulxU32(&x245, &x246, x227, 0xffffffff); var x247: u32 = undefined; var x248: u32 = undefined; fiatP256MulxU32(&x247, &x248, x227, 0xffffffff); var x249: u32 = undefined; var x250: u32 = undefined; fiatP256MulxU32(&x249, &x250, x227, 0xffffffff); var x251: u32 = undefined; var x252: u1 = undefined; fiatP256AddcarryxU32(&x251, &x252, 0x0, x250, x247); var x253: u32 = undefined; var x254: u1 = undefined; fiatP256AddcarryxU32(&x253, &x254, x252, x248, x245); var x255: u32 = undefined; var x256: u1 = undefined; fiatP256AddcarryxU32(&x255, &x256, 0x0, x227, x249); var x257: u32 = undefined; var x258: u1 = undefined; fiatP256AddcarryxU32(&x257, &x258, x256, x229, x251); var x259: u32 = undefined; var x260: u1 = undefined; fiatP256AddcarryxU32(&x259, &x260, x258, x231, x253); var x261: u32 = undefined; var x262: u1 = undefined; fiatP256AddcarryxU32(&x261, &x262, x260, x233, (@intCast(u32, x254) + x246)); var x263: u32 = undefined; var x264: u1 = undefined; fiatP256AddcarryxU32(&x263, &x264, x262, x235, @intCast(u32, 0x0)); var x265: u32 = undefined; var x266: u1 = undefined; fiatP256AddcarryxU32(&x265, &x266, x264, x237, @intCast(u32, 0x0)); var x267: u32 = undefined; var x268: u1 = undefined; fiatP256AddcarryxU32(&x267, &x268, x266, x239, x227); var x269: u32 = undefined; var x270: u1 = undefined; fiatP256AddcarryxU32(&x269, &x270, x268, x241, x243); var x271: u32 = undefined; var x272: u1 = undefined; fiatP256AddcarryxU32(&x271, &x272, x270, ((@intCast(u32, x242) + @intCast(u32, x202)) + (@intCast(u32, x226) + x204)), x244); var x273: u32 = undefined; var x274: u32 = undefined; fiatP256MulxU32(&x273, &x274, x4, 0x4); var x275: u32 = undefined; var x276: u32 = undefined; fiatP256MulxU32(&x275, &x276, x4, 0xfffffffd); var x277: u32 = undefined; var x278: u32 = undefined; fiatP256MulxU32(&x277, &x278, x4, 0xffffffff); var x279: u32 = undefined; var x280: u32 = undefined; fiatP256MulxU32(&x279, &x280, x4, 0xfffffffe); var x281: u32 = undefined; var x282: u32 = undefined; fiatP256MulxU32(&x281, &x282, x4, 0xfffffffb); var x283: u32 = undefined; var x284: u32 = undefined; fiatP256MulxU32(&x283, &x284, x4, 0xffffffff); var x285: u32 = undefined; var x286: u32 = undefined; fiatP256MulxU32(&x285, &x286, x4, 0x3); var x287: u32 = undefined; var x288: u1 = undefined; fiatP256AddcarryxU32(&x287, &x288, 0x0, x284, x281); var x289: u32 = undefined; var x290: u1 = undefined; fiatP256AddcarryxU32(&x289, &x290, x288, x282, x279); var x291: u32 = undefined; var x292: u1 = undefined; fiatP256AddcarryxU32(&x291, &x292, x290, x280, x277); var x293: u32 = undefined; var x294: u1 = undefined; fiatP256AddcarryxU32(&x293, &x294, x292, x278, x275); var x295: u32 = undefined; var x296: u1 = undefined; fiatP256AddcarryxU32(&x295, &x296, x294, x276, x273); var x297: u32 = undefined; var x298: u1 = undefined; fiatP256AddcarryxU32(&x297, &x298, 0x0, x257, x285); var x299: u32 = undefined; var x300: u1 = undefined; fiatP256AddcarryxU32(&x299, &x300, x298, x259, x286); var x301: u32 = undefined; var x302: u1 = undefined; fiatP256AddcarryxU32(&x301, &x302, x300, x261, x283); var x303: u32 = undefined; var x304: u1 = undefined; fiatP256AddcarryxU32(&x303, &x304, x302, x263, x287); var x305: u32 = undefined; var x306: u1 = undefined; fiatP256AddcarryxU32(&x305, &x306, x304, x265, x289); var x307: u32 = undefined; var x308: u1 = undefined; fiatP256AddcarryxU32(&x307, &x308, x306, x267, x291); var x309: u32 = undefined; var x310: u1 = undefined; fiatP256AddcarryxU32(&x309, &x310, x308, x269, x293); var x311: u32 = undefined; var x312: u1 = undefined; fiatP256AddcarryxU32(&x311, &x312, x310, x271, x295); var x313: u32 = undefined; var x314: u32 = undefined; fiatP256MulxU32(&x313, &x314, x297, 0xffffffff); var x315: u32 = undefined; var x316: u32 = undefined; fiatP256MulxU32(&x315, &x316, x297, 0xffffffff); var x317: u32 = undefined; var x318: u32 = undefined; fiatP256MulxU32(&x317, &x318, x297, 0xffffffff); var x319: u32 = undefined; var x320: u32 = undefined; fiatP256MulxU32(&x319, &x320, x297, 0xffffffff); var x321: u32 = undefined; var x322: u1 = undefined; fiatP256AddcarryxU32(&x321, &x322, 0x0, x320, x317); var x323: u32 = undefined; var x324: u1 = undefined; fiatP256AddcarryxU32(&x323, &x324, x322, x318, x315); var x325: u32 = undefined; var x326: u1 = undefined; fiatP256AddcarryxU32(&x325, &x326, 0x0, x297, x319); var x327: u32 = undefined; var x328: u1 = undefined; fiatP256AddcarryxU32(&x327, &x328, x326, x299, x321); var x329: u32 = undefined; var x330: u1 = undefined; fiatP256AddcarryxU32(&x329, &x330, x328, x301, x323); var x331: u32 = undefined; var x332: u1 = undefined; fiatP256AddcarryxU32(&x331, &x332, x330, x303, (@intCast(u32, x324) + x316)); var x333: u32 = undefined; var x334: u1 = undefined; fiatP256AddcarryxU32(&x333, &x334, x332, x305, @intCast(u32, 0x0)); var x335: u32 = undefined; var x336: u1 = undefined; fiatP256AddcarryxU32(&x335, &x336, x334, x307, @intCast(u32, 0x0)); var x337: u32 = undefined; var x338: u1 = undefined; fiatP256AddcarryxU32(&x337, &x338, x336, x309, x297); var x339: u32 = undefined; var x340: u1 = undefined; fiatP256AddcarryxU32(&x339, &x340, x338, x311, x313); var x341: u32 = undefined; var x342: u1 = undefined; fiatP256AddcarryxU32(&x341, &x342, x340, ((@intCast(u32, x312) + @intCast(u32, x272)) + (@intCast(u32, x296) + x274)), x314); var x343: u32 = undefined; var x344: u32 = undefined; fiatP256MulxU32(&x343, &x344, x5, 0x4); var x345: u32 = undefined; var x346: u32 = undefined; fiatP256MulxU32(&x345, &x346, x5, 0xfffffffd); var x347: u32 = undefined; var x348: u32 = undefined; fiatP256MulxU32(&x347, &x348, x5, 0xffffffff); var x349: u32 = undefined; var x350: u32 = undefined; fiatP256MulxU32(&x349, &x350, x5, 0xfffffffe); var x351: u32 = undefined; var x352: u32 = undefined; fiatP256MulxU32(&x351, &x352, x5, 0xfffffffb); var x353: u32 = undefined; var x354: u32 = undefined; fiatP256MulxU32(&x353, &x354, x5, 0xffffffff); var x355: u32 = undefined; var x356: u32 = undefined; fiatP256MulxU32(&x355, &x356, x5, 0x3); var x357: u32 = undefined; var x358: u1 = undefined; fiatP256AddcarryxU32(&x357, &x358, 0x0, x354, x351); var x359: u32 = undefined; var x360: u1 = undefined; fiatP256AddcarryxU32(&x359, &x360, x358, x352, x349); var x361: u32 = undefined; var x362: u1 = undefined; fiatP256AddcarryxU32(&x361, &x362, x360, x350, x347); var x363: u32 = undefined; var x364: u1 = undefined; fiatP256AddcarryxU32(&x363, &x364, x362, x348, x345); var x365: u32 = undefined; var x366: u1 = undefined; fiatP256AddcarryxU32(&x365, &x366, x364, x346, x343); var x367: u32 = undefined; var x368: u1 = undefined; fiatP256AddcarryxU32(&x367, &x368, 0x0, x327, x355); var x369: u32 = undefined; var x370: u1 = undefined; fiatP256AddcarryxU32(&x369, &x370, x368, x329, x356); var x371: u32 = undefined; var x372: u1 = undefined; fiatP256AddcarryxU32(&x371, &x372, x370, x331, x353); var x373: u32 = undefined; var x374: u1 = undefined; fiatP256AddcarryxU32(&x373, &x374, x372, x333, x357); var x375: u32 = undefined; var x376: u1 = undefined; fiatP256AddcarryxU32(&x375, &x376, x374, x335, x359); var x377: u32 = undefined; var x378: u1 = undefined; fiatP256AddcarryxU32(&x377, &x378, x376, x337, x361); var x379: u32 = undefined; var x380: u1 = undefined; fiatP256AddcarryxU32(&x379, &x380, x378, x339, x363); var x381: u32 = undefined; var x382: u1 = undefined; fiatP256AddcarryxU32(&x381, &x382, x380, x341, x365); var x383: u32 = undefined; var x384: u32 = undefined; fiatP256MulxU32(&x383, &x384, x367, 0xffffffff); var x385: u32 = undefined; var x386: u32 = undefined; fiatP256MulxU32(&x385, &x386, x367, 0xffffffff); var x387: u32 = undefined; var x388: u32 = undefined; fiatP256MulxU32(&x387, &x388, x367, 0xffffffff); var x389: u32 = undefined; var x390: u32 = undefined; fiatP256MulxU32(&x389, &x390, x367, 0xffffffff); var x391: u32 = undefined; var x392: u1 = undefined; fiatP256AddcarryxU32(&x391, &x392, 0x0, x390, x387); var x393: u32 = undefined; var x394: u1 = undefined; fiatP256AddcarryxU32(&x393, &x394, x392, x388, x385); var x395: u32 = undefined; var x396: u1 = undefined; fiatP256AddcarryxU32(&x395, &x396, 0x0, x367, x389); var x397: u32 = undefined; var x398: u1 = undefined; fiatP256AddcarryxU32(&x397, &x398, x396, x369, x391); var x399: u32 = undefined; var x400: u1 = undefined; fiatP256AddcarryxU32(&x399, &x400, x398, x371, x393); var x401: u32 = undefined; var x402: u1 = undefined; fiatP256AddcarryxU32(&x401, &x402, x400, x373, (@intCast(u32, x394) + x386)); var x403: u32 = undefined; var x404: u1 = undefined; fiatP256AddcarryxU32(&x403, &x404, x402, x375, @intCast(u32, 0x0)); var x405: u32 = undefined; var x406: u1 = undefined; fiatP256AddcarryxU32(&x405, &x406, x404, x377, @intCast(u32, 0x0)); var x407: u32 = undefined; var x408: u1 = undefined; fiatP256AddcarryxU32(&x407, &x408, x406, x379, x367); var x409: u32 = undefined; var x410: u1 = undefined; fiatP256AddcarryxU32(&x409, &x410, x408, x381, x383); var x411: u32 = undefined; var x412: u1 = undefined; fiatP256AddcarryxU32(&x411, &x412, x410, ((@intCast(u32, x382) + @intCast(u32, x342)) + (@intCast(u32, x366) + x344)), x384); var x413: u32 = undefined; var x414: u32 = undefined; fiatP256MulxU32(&x413, &x414, x6, 0x4); var x415: u32 = undefined; var x416: u32 = undefined; fiatP256MulxU32(&x415, &x416, x6, 0xfffffffd); var x417: u32 = undefined; var x418: u32 = undefined; fiatP256MulxU32(&x417, &x418, x6, 0xffffffff); var x419: u32 = undefined; var x420: u32 = undefined; fiatP256MulxU32(&x419, &x420, x6, 0xfffffffe); var x421: u32 = undefined; var x422: u32 = undefined; fiatP256MulxU32(&x421, &x422, x6, 0xfffffffb); var x423: u32 = undefined; var x424: u32 = undefined; fiatP256MulxU32(&x423, &x424, x6, 0xffffffff); var x425: u32 = undefined; var x426: u32 = undefined; fiatP256MulxU32(&x425, &x426, x6, 0x3); var x427: u32 = undefined; var x428: u1 = undefined; fiatP256AddcarryxU32(&x427, &x428, 0x0, x424, x421); var x429: u32 = undefined; var x430: u1 = undefined; fiatP256AddcarryxU32(&x429, &x430, x428, x422, x419); var x431: u32 = undefined; var x432: u1 = undefined; fiatP256AddcarryxU32(&x431, &x432, x430, x420, x417); var x433: u32 = undefined; var x434: u1 = undefined; fiatP256AddcarryxU32(&x433, &x434, x432, x418, x415); var x435: u32 = undefined; var x436: u1 = undefined; fiatP256AddcarryxU32(&x435, &x436, x434, x416, x413); var x437: u32 = undefined; var x438: u1 = undefined; fiatP256AddcarryxU32(&x437, &x438, 0x0, x397, x425); var x439: u32 = undefined; var x440: u1 = undefined; fiatP256AddcarryxU32(&x439, &x440, x438, x399, x426); var x441: u32 = undefined; var x442: u1 = undefined; fiatP256AddcarryxU32(&x441, &x442, x440, x401, x423); var x443: u32 = undefined; var x444: u1 = undefined; fiatP256AddcarryxU32(&x443, &x444, x442, x403, x427); var x445: u32 = undefined; var x446: u1 = undefined; fiatP256AddcarryxU32(&x445, &x446, x444, x405, x429); var x447: u32 = undefined; var x448: u1 = undefined; fiatP256AddcarryxU32(&x447, &x448, x446, x407, x431); var x449: u32 = undefined; var x450: u1 = undefined; fiatP256AddcarryxU32(&x449, &x450, x448, x409, x433); var x451: u32 = undefined; var x452: u1 = undefined; fiatP256AddcarryxU32(&x451, &x452, x450, x411, x435); var x453: u32 = undefined; var x454: u32 = undefined; fiatP256MulxU32(&x453, &x454, x437, 0xffffffff); var x455: u32 = undefined; var x456: u32 = undefined; fiatP256MulxU32(&x455, &x456, x437, 0xffffffff); var x457: u32 = undefined; var x458: u32 = undefined; fiatP256MulxU32(&x457, &x458, x437, 0xffffffff); var x459: u32 = undefined; var x460: u32 = undefined; fiatP256MulxU32(&x459, &x460, x437, 0xffffffff); var x461: u32 = undefined; var x462: u1 = undefined; fiatP256AddcarryxU32(&x461, &x462, 0x0, x460, x457); var x463: u32 = undefined; var x464: u1 = undefined; fiatP256AddcarryxU32(&x463, &x464, x462, x458, x455); var x465: u32 = undefined; var x466: u1 = undefined; fiatP256AddcarryxU32(&x465, &x466, 0x0, x437, x459); var x467: u32 = undefined; var x468: u1 = undefined; fiatP256AddcarryxU32(&x467, &x468, x466, x439, x461); var x469: u32 = undefined; var x470: u1 = undefined; fiatP256AddcarryxU32(&x469, &x470, x468, x441, x463); var x471: u32 = undefined; var x472: u1 = undefined; fiatP256AddcarryxU32(&x471, &x472, x470, x443, (@intCast(u32, x464) + x456)); var x473: u32 = undefined; var x474: u1 = undefined; fiatP256AddcarryxU32(&x473, &x474, x472, x445, @intCast(u32, 0x0)); var x475: u32 = undefined; var x476: u1 = undefined; fiatP256AddcarryxU32(&x475, &x476, x474, x447, @intCast(u32, 0x0)); var x477: u32 = undefined; var x478: u1 = undefined; fiatP256AddcarryxU32(&x477, &x478, x476, x449, x437); var x479: u32 = undefined; var x480: u1 = undefined; fiatP256AddcarryxU32(&x479, &x480, x478, x451, x453); var x481: u32 = undefined; var x482: u1 = undefined; fiatP256AddcarryxU32(&x481, &x482, x480, ((@intCast(u32, x452) + @intCast(u32, x412)) + (@intCast(u32, x436) + x414)), x454); var x483: u32 = undefined; var x484: u32 = undefined; fiatP256MulxU32(&x483, &x484, x7, 0x4); var x485: u32 = undefined; var x486: u32 = undefined; fiatP256MulxU32(&x485, &x486, x7, 0xfffffffd); var x487: u32 = undefined; var x488: u32 = undefined; fiatP256MulxU32(&x487, &x488, x7, 0xffffffff); var x489: u32 = undefined; var x490: u32 = undefined; fiatP256MulxU32(&x489, &x490, x7, 0xfffffffe); var x491: u32 = undefined; var x492: u32 = undefined; fiatP256MulxU32(&x491, &x492, x7, 0xfffffffb); var x493: u32 = undefined; var x494: u32 = undefined; fiatP256MulxU32(&x493, &x494, x7, 0xffffffff); var x495: u32 = undefined; var x496: u32 = undefined; fiatP256MulxU32(&x495, &x496, x7, 0x3); var x497: u32 = undefined; var x498: u1 = undefined; fiatP256AddcarryxU32(&x497, &x498, 0x0, x494, x491); var x499: u32 = undefined; var x500: u1 = undefined; fiatP256AddcarryxU32(&x499, &x500, x498, x492, x489); var x501: u32 = undefined; var x502: u1 = undefined; fiatP256AddcarryxU32(&x501, &x502, x500, x490, x487); var x503: u32 = undefined; var x504: u1 = undefined; fiatP256AddcarryxU32(&x503, &x504, x502, x488, x485); var x505: u32 = undefined; var x506: u1 = undefined; fiatP256AddcarryxU32(&x505, &x506, x504, x486, x483); var x507: u32 = undefined; var x508: u1 = undefined; fiatP256AddcarryxU32(&x507, &x508, 0x0, x467, x495); var x509: u32 = undefined; var x510: u1 = undefined; fiatP256AddcarryxU32(&x509, &x510, x508, x469, x496); var x511: u32 = undefined; var x512: u1 = undefined; fiatP256AddcarryxU32(&x511, &x512, x510, x471, x493); var x513: u32 = undefined; var x514: u1 = undefined; fiatP256AddcarryxU32(&x513, &x514, x512, x473, x497); var x515: u32 = undefined; var x516: u1 = undefined; fiatP256AddcarryxU32(&x515, &x516, x514, x475, x499); var x517: u32 = undefined; var x518: u1 = undefined; fiatP256AddcarryxU32(&x517, &x518, x516, x477, x501); var x519: u32 = undefined; var x520: u1 = undefined; fiatP256AddcarryxU32(&x519, &x520, x518, x479, x503); var x521: u32 = undefined; var x522: u1 = undefined; fiatP256AddcarryxU32(&x521, &x522, x520, x481, x505); var x523: u32 = undefined; var x524: u32 = undefined; fiatP256MulxU32(&x523, &x524, x507, 0xffffffff); var x525: u32 = undefined; var x526: u32 = undefined; fiatP256MulxU32(&x525, &x526, x507, 0xffffffff); var x527: u32 = undefined; var x528: u32 = undefined; fiatP256MulxU32(&x527, &x528, x507, 0xffffffff); var x529: u32 = undefined; var x530: u32 = undefined; fiatP256MulxU32(&x529, &x530, x507, 0xffffffff); var x531: u32 = undefined; var x532: u1 = undefined; fiatP256AddcarryxU32(&x531, &x532, 0x0, x530, x527); var x533: u32 = undefined; var x534: u1 = undefined; fiatP256AddcarryxU32(&x533, &x534, x532, x528, x525); var x535: u32 = undefined; var x536: u1 = undefined; fiatP256AddcarryxU32(&x535, &x536, 0x0, x507, x529); var x537: u32 = undefined; var x538: u1 = undefined; fiatP256AddcarryxU32(&x537, &x538, x536, x509, x531); var x539: u32 = undefined; var x540: u1 = undefined; fiatP256AddcarryxU32(&x539, &x540, x538, x511, x533); var x541: u32 = undefined; var x542: u1 = undefined; fiatP256AddcarryxU32(&x541, &x542, x540, x513, (@intCast(u32, x534) + x526)); var x543: u32 = undefined; var x544: u1 = undefined; fiatP256AddcarryxU32(&x543, &x544, x542, x515, @intCast(u32, 0x0)); var x545: u32 = undefined; var x546: u1 = undefined; fiatP256AddcarryxU32(&x545, &x546, x544, x517, @intCast(u32, 0x0)); var x547: u32 = undefined; var x548: u1 = undefined; fiatP256AddcarryxU32(&x547, &x548, x546, x519, x507); var x549: u32 = undefined; var x550: u1 = undefined; fiatP256AddcarryxU32(&x549, &x550, x548, x521, x523); var x551: u32 = undefined; var x552: u1 = undefined; fiatP256AddcarryxU32(&x551, &x552, x550, ((@intCast(u32, x522) + @intCast(u32, x482)) + (@intCast(u32, x506) + x484)), x524); var x553: u32 = undefined; var x554: u1 = undefined; fiatP256SubborrowxU32(&x553, &x554, 0x0, x537, 0xffffffff); var x555: u32 = undefined; var x556: u1 = undefined; fiatP256SubborrowxU32(&x555, &x556, x554, x539, 0xffffffff); var x557: u32 = undefined; var x558: u1 = undefined; fiatP256SubborrowxU32(&x557, &x558, x556, x541, 0xffffffff); var x559: u32 = undefined; var x560: u1 = undefined; fiatP256SubborrowxU32(&x559, &x560, x558, x543, @intCast(u32, 0x0)); var x561: u32 = undefined; var x562: u1 = undefined; fiatP256SubborrowxU32(&x561, &x562, x560, x545, @intCast(u32, 0x0)); var x563: u32 = undefined; var x564: u1 = undefined; fiatP256SubborrowxU32(&x563, &x564, x562, x547, @intCast(u32, 0x0)); var x565: u32 = undefined; var x566: u1 = undefined; fiatP256SubborrowxU32(&x565, &x566, x564, x549, @intCast(u32, 0x1)); var x567: u32 = undefined; var x568: u1 = undefined; fiatP256SubborrowxU32(&x567, &x568, x566, x551, 0xffffffff); var x569: u32 = undefined; var x570: u1 = undefined; fiatP256SubborrowxU32(&x569, &x570, x568, @intCast(u32, x552), @intCast(u32, 0x0)); var x571: u32 = undefined; fiatP256CmovznzU32(&x571, x570, x553, x537); var x572: u32 = undefined; fiatP256CmovznzU32(&x572, x570, x555, x539); var x573: u32 = undefined; fiatP256CmovznzU32(&x573, x570, x557, x541); var x574: u32 = undefined; fiatP256CmovznzU32(&x574, x570, x559, x543); var x575: u32 = undefined; fiatP256CmovznzU32(&x575, x570, x561, x545); var x576: u32 = undefined; fiatP256CmovznzU32(&x576, x570, x563, x547); var x577: u32 = undefined; fiatP256CmovznzU32(&x577, x570, x565, x549); var x578: u32 = undefined; fiatP256CmovznzU32(&x578, x570, x567, x551); out1[0] = x571; out1[1] = x572; out1[2] = x573; out1[3] = x574; out1[4] = x575; out1[5] = x576; out1[6] = x577; out1[7] = x578; } /// The function fiatP256Nonzero 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 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] /// Output Bounds: /// out1: [0x0 ~> 0xffffffff] pub fn fiatP256Nonzero(out1: *u32, arg1: [8]u32) void { const x1: u32 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | ((arg1[3]) | ((arg1[4]) | ((arg1[5]) | ((arg1[6]) | (arg1[7])))))))); out1.* = x1; } /// The function fiatP256Selectznz 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]] /// arg3: [[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]] pub fn fiatP256Selectznz(out1: *[8]u32, arg1: u1, arg2: [8]u32, arg3: [8]u32) void { var x1: u32 = undefined; fiatP256CmovznzU32(&x1, arg1, (arg2[0]), (arg3[0])); var x2: u32 = undefined; fiatP256CmovznzU32(&x2, arg1, (arg2[1]), (arg3[1])); var x3: u32 = undefined; fiatP256CmovznzU32(&x3, arg1, (arg2[2]), (arg3[2])); var x4: u32 = undefined; fiatP256CmovznzU32(&x4, arg1, (arg2[3]), (arg3[3])); var x5: u32 = undefined; fiatP256CmovznzU32(&x5, arg1, (arg2[4]), (arg3[4])); var x6: u32 = undefined; fiatP256CmovznzU32(&x6, arg1, (arg2[5]), (arg3[5])); var x7: u32 = undefined; fiatP256CmovznzU32(&x7, arg1, (arg2[6]), (arg3[6])); var x8: u32 = undefined; fiatP256CmovznzU32(&x8, arg1, (arg2[7]), (arg3[7])); out1[0] = x1; out1[1] = x2; out1[2] = x3; out1[3] = x4; out1[4] = x5; out1[5] = x6; out1[6] = x7; out1[7] = x8; } /// The function fiatP256ToBytes 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..31] /// /// Input Bounds: /// arg1: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [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], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]] pub fn fiatP256ToBytes(out1: *[32]u8, arg1: [8]u32) void { const x1: u32 = (arg1[7]); const x2: u32 = (arg1[6]); const x3: u32 = (arg1[5]); const x4: u32 = (arg1[4]); const x5: u32 = (arg1[3]); const x6: u32 = (arg1[2]); const x7: u32 = (arg1[1]); const x8: u32 = (arg1[0]); const x9: u8 = @intCast(u8, (x8 & @intCast(u32, 0xff))); const x10: u32 = (x8 >> 8); const x11: u8 = @intCast(u8, (x10 & @intCast(u32, 0xff))); const x12: u32 = (x10 >> 8); const x13: u8 = @intCast(u8, (x12 & @intCast(u32, 0xff))); const x14: u8 = @intCast(u8, (x12 >> 8)); const x15: u8 = @intCast(u8, (x7 & @intCast(u32, 0xff))); const x16: u32 = (x7 >> 8); const x17: u8 = @intCast(u8, (x16 & @intCast(u32, 0xff))); const x18: u32 = (x16 >> 8); const x19: u8 = @intCast(u8, (x18 & @intCast(u32, 0xff))); const x20: u8 = @intCast(u8, (x18 >> 8)); const x21: u8 = @intCast(u8, (x6 & @intCast(u32, 0xff))); const x22: u32 = (x6 >> 8); const x23: u8 = @intCast(u8, (x22 & @intCast(u32, 0xff))); const x24: u32 = (x22 >> 8); const x25: u8 = @intCast(u8, (x24 & @intCast(u32, 0xff))); const x26: u8 = @intCast(u8, (x24 >> 8)); const x27: u8 = @intCast(u8, (x5 & @intCast(u32, 0xff))); const x28: u32 = (x5 >> 8); const x29: u8 = @intCast(u8, (x28 & @intCast(u32, 0xff))); const x30: u32 = (x28 >> 8); const x31: u8 = @intCast(u8, (x30 & @intCast(u32, 0xff))); const x32: u8 = @intCast(u8, (x30 >> 8)); const x33: u8 = @intCast(u8, (x4 & @intCast(u32, 0xff))); const x34: u32 = (x4 >> 8); const x35: u8 = @intCast(u8, (x34 & @intCast(u32, 0xff))); const x36: u32 = (x34 >> 8); const x37: u8 = @intCast(u8, (x36 & @intCast(u32, 0xff))); const x38: u8 = @intCast(u8, (x36 >> 8)); const x39: u8 = @intCast(u8, (x3 & @intCast(u32, 0xff))); const x40: u32 = (x3 >> 8); const x41: u8 = @intCast(u8, (x40 & @intCast(u32, 0xff))); const x42: u32 = (x40 >> 8); const x43: u8 = @intCast(u8, (x42 & @intCast(u32, 0xff))); const x44: u8 = @intCast(u8, (x42 >> 8)); const x45: u8 = @intCast(u8, (x2 & @intCast(u32, 0xff))); const x46: u32 = (x2 >> 8); const x47: u8 = @intCast(u8, (x46 & @intCast(u32, 0xff))); const x48: u32 = (x46 >> 8); const x49: u8 = @intCast(u8, (x48 & @intCast(u32, 0xff))); const x50: u8 = @intCast(u8, (x48 >> 8)); const x51: u8 = @intCast(u8, (x1 & @intCast(u32, 0xff))); const x52: u32 = (x1 >> 8); const x53: u8 = @intCast(u8, (x52 & @intCast(u32, 0xff))); const x54: u32 = (x52 >> 8); const x55: u8 = @intCast(u8, (x54 & @intCast(u32, 0xff))); const x56: u8 = @intCast(u8, (x54 >> 8)); out1[0] = x9; out1[1] = x11; out1[2] = x13; out1[3] = x14; out1[4] = x15; out1[5] = x17; out1[6] = x19; out1[7] = x20; out1[8] = x21; out1[9] = x23; out1[10] = x25; out1[11] = x26; out1[12] = x27; out1[13] = x29; out1[14] = x31; out1[15] = x32; out1[16] = x33; out1[17] = x35; out1[18] = x37; out1[19] = x38; out1[20] = x39; out1[21] = x41; out1[22] = x43; out1[23] = x44; out1[24] = x45; out1[25] = x47; out1[26] = x49; out1[27] = x50; out1[28] = x51; out1[29] = x53; out1[30] = x55; out1[31] = x56; } /// The function fiatP256FromBytes 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], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]] /// Output Bounds: /// out1: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] pub fn fiatP256FromBytes(out1: *[8]u32, arg1: [32]u8) void { const x1: u32 = (@intCast(u32, (arg1[31])) << 24); const x2: u32 = (@intCast(u32, (arg1[30])) << 16); const x3: u32 = (@intCast(u32, (arg1[29])) << 8); const x4: u8 = (arg1[28]); const x5: u32 = (@intCast(u32, (arg1[27])) << 24); const x6: u32 = (@intCast(u32, (arg1[26])) << 16); const x7: u32 = (@intCast(u32, (arg1[25])) << 8); const x8: u8 = (arg1[24]); const x9: u32 = (@intCast(u32, (arg1[23])) << 24); const x10: u32 = (@intCast(u32, (arg1[22])) << 16); const x11: u32 = (@intCast(u32, (arg1[21])) << 8); const x12: u8 = (arg1[20]); 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])) << 24); const x18: u32 = (@intCast(u32, (arg1[14])) << 16); const x19: u32 = (@intCast(u32, (arg1[13])) << 8); const x20: u8 = (arg1[12]); const x21: u32 = (@intCast(u32, (arg1[11])) << 24); const x22: u32 = (@intCast(u32, (arg1[10])) << 16); const x23: u32 = (@intCast(u32, (arg1[9])) << 8); const x24: u8 = (arg1[8]); const x25: u32 = (@intCast(u32, (arg1[7])) << 24); const x26: u32 = (@intCast(u32, (arg1[6])) << 16); const x27: u32 = (@intCast(u32, (arg1[5])) << 8); const x28: u8 = (arg1[4]); 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 = (x27 + @intCast(u32, x28)); const x37: u32 = (x26 + x36); const x38: u32 = (x25 + x37); const x39: u32 = (x23 + @intCast(u32, x24)); const x40: u32 = (x22 + x39); const x41: u32 = (x21 + x40); const x42: u32 = (x19 + @intCast(u32, x20)); const x43: u32 = (x18 + x42); const x44: u32 = (x17 + x43); const x45: u32 = (x15 + @intCast(u32, x16)); const x46: u32 = (x14 + x45); const x47: u32 = (x13 + x46); const x48: u32 = (x11 + @intCast(u32, x12)); const x49: u32 = (x10 + x48); const x50: u32 = (x9 + x49); const x51: u32 = (x7 + @intCast(u32, x8)); const x52: u32 = (x6 + x51); const x53: u32 = (x5 + x52); const x54: u32 = (x3 + @intCast(u32, x4)); const x55: u32 = (x2 + x54); const x56: u32 = (x1 + x55); out1[0] = x35; out1[1] = x38; out1[2] = x41; out1[3] = x44; out1[4] = x47; out1[5] = x50; out1[6] = x53; out1[7] = x56; } /// The function fiatP256SetOne 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 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] pub fn fiatP256SetOne(out1: *[8]u32) void { out1[0] = @intCast(u32, 0x1); out1[1] = @intCast(u32, 0x0); out1[2] = @intCast(u32, 0x0); out1[3] = 0xffffffff; out1[4] = 0xffffffff; out1[5] = 0xffffffff; out1[6] = 0xfffffffe; out1[7] = @intCast(u32, 0x0); } /// The function fiatP256Msat returns the saturated representation of the prime modulus. /// Postconditions: /// twos_complement_eval out1 = m /// 0 ≤ eval out1 < m /// /// Input Bounds: /// Output Bounds: /// out1: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] pub fn fiatP256Msat(out1: *[9]u32) void { out1[0] = 0xffffffff; out1[1] = 0xffffffff; out1[2] = 0xffffffff; out1[3] = @intCast(u32, 0x0); out1[4] = @intCast(u32, 0x0); out1[5] = @intCast(u32, 0x0); out1[6] = @intCast(u32, 0x1); out1[7] = 0xffffffff; out1[8] = @intCast(u32, 0x0); } /// The function fiatP256Divstep 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 ~> 0xffffffff] /// arg2: [[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]] /// arg4: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] /// arg5: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] /// Output Bounds: /// out1: [0x0 ~> 0xffffffff] /// out2: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] /// out3: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] /// out4: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] /// out5: [[0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] pub fn fiatP256Divstep(out1: *u32, out2: *[9]u32, out3: *[9]u32, out4: *[8]u32, out5: *[8]u32, arg1: u32, arg2: [9]u32, arg3: [9]u32, arg4: [8]u32, arg5: [8]u32) void { var x1: u32 = undefined; var x2: u1 = undefined; fiatP256AddcarryxU32(&x1, &x2, 0x0, (~arg1), @intCast(u32, 0x1)); const x3: u1 = (@intCast(u1, (x1 >> 31)) & @intCast(u1, ((arg3[0]) & @intCast(u32, 0x1)))); var x4: u32 = undefined; var x5: u1 = undefined; fiatP256AddcarryxU32(&x4, &x5, 0x0, (~arg1), @intCast(u32, 0x1)); var x6: u32 = undefined; fiatP256CmovznzU32(&x6, x3, arg1, x4); var x7: u32 = undefined; fiatP256CmovznzU32(&x7, x3, (arg2[0]), (arg3[0])); var x8: u32 = undefined; fiatP256CmovznzU32(&x8, x3, (arg2[1]), (arg3[1])); var x9: u32 = undefined; fiatP256CmovznzU32(&x9, x3, (arg2[2]), (arg3[2])); var x10: u32 = undefined; fiatP256CmovznzU32(&x10, x3, (arg2[3]), (arg3[3])); var x11: u32 = undefined; fiatP256CmovznzU32(&x11, x3, (arg2[4]), (arg3[4])); var x12: u32 = undefined; fiatP256CmovznzU32(&x12, x3, (arg2[5]), (arg3[5])); var x13: u32 = undefined; fiatP256CmovznzU32(&x13, x3, (arg2[6]), (arg3[6])); var x14: u32 = undefined; fiatP256CmovznzU32(&x14, x3, (arg2[7]), (arg3[7])); var x15: u32 = undefined; fiatP256CmovznzU32(&x15, x3, (arg2[8]), (arg3[8])); var x16: u32 = undefined; var x17: u1 = undefined; fiatP256AddcarryxU32(&x16, &x17, 0x0, @intCast(u32, 0x1), (~(arg2[0]))); var x18: u32 = undefined; var x19: u1 = undefined; fiatP256AddcarryxU32(&x18, &x19, x17, @intCast(u32, 0x0), (~(arg2[1]))); var x20: u32 = undefined; var x21: u1 = undefined; fiatP256AddcarryxU32(&x20, &x21, x19, @intCast(u32, 0x0), (~(arg2[2]))); var x22: u32 = undefined; var x23: u1 = undefined; fiatP256AddcarryxU32(&x22, &x23, x21, @intCast(u32, 0x0), (~(arg2[3]))); var x24: u32 = undefined; var x25: u1 = undefined; fiatP256AddcarryxU32(&x24, &x25, x23, @intCast(u32, 0x0), (~(arg2[4]))); var x26: u32 = undefined; var x27: u1 = undefined; fiatP256AddcarryxU32(&x26, &x27, x25, @intCast(u32, 0x0), (~(arg2[5]))); var x28: u32 = undefined; var x29: u1 = undefined; fiatP256AddcarryxU32(&x28, &x29, x27, @intCast(u32, 0x0), (~(arg2[6]))); var x30: u32 = undefined; var x31: u1 = undefined; fiatP256AddcarryxU32(&x30, &x31, x29, @intCast(u32, 0x0), (~(arg2[7]))); var x32: u32 = undefined; var x33: u1 = undefined; fiatP256AddcarryxU32(&x32, &x33, x31, @intCast(u32, 0x0), (~(arg2[8]))); var x34: u32 = undefined; fiatP256CmovznzU32(&x34, x3, (arg3[0]), x16); var x35: u32 = undefined; fiatP256CmovznzU32(&x35, x3, (arg3[1]), x18); var x36: u32 = undefined; fiatP256CmovznzU32(&x36, x3, (arg3[2]), x20); var x37: u32 = undefined; fiatP256CmovznzU32(&x37, x3, (arg3[3]), x22); var x38: u32 = undefined; fiatP256CmovznzU32(&x38, x3, (arg3[4]), x24); var x39: u32 = undefined; fiatP256CmovznzU32(&x39, x3, (arg3[5]), x26); var x40: u32 = undefined; fiatP256CmovznzU32(&x40, x3, (arg3[6]), x28); var x41: u32 = undefined; fiatP256CmovznzU32(&x41, x3, (arg3[7]), x30); var x42: u32 = undefined; fiatP256CmovznzU32(&x42, x3, (arg3[8]), x32); var x43: u32 = undefined; fiatP256CmovznzU32(&x43, x3, (arg4[0]), (arg5[0])); var x44: u32 = undefined; fiatP256CmovznzU32(&x44, x3, (arg4[1]), (arg5[1])); var x45: u32 = undefined; fiatP256CmovznzU32(&x45, x3, (arg4[2]), (arg5[2])); var x46: u32 = undefined; fiatP256CmovznzU32(&x46, x3, (arg4[3]), (arg5[3])); var x47: u32 = undefined; fiatP256CmovznzU32(&x47, x3, (arg4[4]), (arg5[4])); var x48: u32 = undefined; fiatP256CmovznzU32(&x48, x3, (arg4[5]), (arg5[5])); var x49: u32 = undefined; fiatP256CmovznzU32(&x49, x3, (arg4[6]), (arg5[6])); var x50: u32 = undefined; fiatP256CmovznzU32(&x50, x3, (arg4[7]), (arg5[7])); var x51: u32 = undefined; var x52: u1 = undefined; fiatP256AddcarryxU32(&x51, &x52, 0x0, x43, x43); var x53: u32 = undefined; var x54: u1 = undefined; fiatP256AddcarryxU32(&x53, &x54, x52, x44, x44); var x55: u32 = undefined; var x56: u1 = undefined; fiatP256AddcarryxU32(&x55, &x56, x54, x45, x45); var x57: u32 = undefined; var x58: u1 = undefined; fiatP256AddcarryxU32(&x57, &x58, x56, x46, x46); var x59: u32 = undefined; var x60: u1 = undefined; fiatP256AddcarryxU32(&x59, &x60, x58, x47, x47); var x61: u32 = undefined; var x62: u1 = undefined; fiatP256AddcarryxU32(&x61, &x62, x60, x48, x48); var x63: u32 = undefined; var x64: u1 = undefined; fiatP256AddcarryxU32(&x63, &x64, x62, x49, x49); var x65: u32 = undefined; var x66: u1 = undefined; fiatP256AddcarryxU32(&x65, &x66, x64, x50, x50); var x67: u32 = undefined; var x68: u1 = undefined; fiatP256SubborrowxU32(&x67, &x68, 0x0, x51, 0xffffffff); var x69: u32 = undefined; var x70: u1 = undefined; fiatP256SubborrowxU32(&x69, &x70, x68, x53, 0xffffffff); var x71: u32 = undefined; var x72: u1 = undefined; fiatP256SubborrowxU32(&x71, &x72, x70, x55, 0xffffffff); var x73: u32 = undefined; var x74: u1 = undefined; fiatP256SubborrowxU32(&x73, &x74, x72, x57, @intCast(u32, 0x0)); var x75: u32 = undefined; var x76: u1 = undefined; fiatP256SubborrowxU32(&x75, &x76, x74, x59, @intCast(u32, 0x0)); var x77: u32 = undefined; var x78: u1 = undefined; fiatP256SubborrowxU32(&x77, &x78, x76, x61, @intCast(u32, 0x0)); var x79: u32 = undefined; var x80: u1 = undefined; fiatP256SubborrowxU32(&x79, &x80, x78, x63, @intCast(u32, 0x1)); var x81: u32 = undefined; var x82: u1 = undefined; fiatP256SubborrowxU32(&x81, &x82, x80, x65, 0xffffffff); var x83: u32 = undefined; var x84: u1 = undefined; fiatP256SubborrowxU32(&x83, &x84, x82, @intCast(u32, x66), @intCast(u32, 0x0)); const x85: u32 = (arg4[7]); const x86: u32 = (arg4[6]); const x87: u32 = (arg4[5]); const x88: u32 = (arg4[4]); const x89: u32 = (arg4[3]); const x90: u32 = (arg4[2]); const x91: u32 = (arg4[1]); const x92: u32 = (arg4[0]); var x93: u32 = undefined; var x94: u1 = undefined; fiatP256SubborrowxU32(&x93, &x94, 0x0, @intCast(u32, 0x0), x92); var x95: u32 = undefined; var x96: u1 = undefined; fiatP256SubborrowxU32(&x95, &x96, x94, @intCast(u32, 0x0), x91); var x97: u32 = undefined; var x98: u1 = undefined; fiatP256SubborrowxU32(&x97, &x98, x96, @intCast(u32, 0x0), x90); var x99: u32 = undefined; var x100: u1 = undefined; fiatP256SubborrowxU32(&x99, &x100, x98, @intCast(u32, 0x0), x89); var x101: u32 = undefined; var x102: u1 = undefined; fiatP256SubborrowxU32(&x101, &x102, x100, @intCast(u32, 0x0), x88); var x103: u32 = undefined; var x104: u1 = undefined; fiatP256SubborrowxU32(&x103, &x104, x102, @intCast(u32, 0x0), x87); var x105: u32 = undefined; var x106: u1 = undefined; fiatP256SubborrowxU32(&x105, &x106, x104, @intCast(u32, 0x0), x86); var x107: u32 = undefined; var x108: u1 = undefined; fiatP256SubborrowxU32(&x107, &x108, x106, @intCast(u32, 0x0), x85); var x109: u32 = undefined; fiatP256CmovznzU32(&x109, x108, @intCast(u32, 0x0), 0xffffffff); var x110: u32 = undefined; var x111: u1 = undefined; fiatP256AddcarryxU32(&x110, &x111, 0x0, x93, x109); var x112: u32 = undefined; var x113: u1 = undefined; fiatP256AddcarryxU32(&x112, &x113, x111, x95, x109); var x114: u32 = undefined; var x115: u1 = undefined; fiatP256AddcarryxU32(&x114, &x115, x113, x97, x109); var x116: u32 = undefined; var x117: u1 = undefined; fiatP256AddcarryxU32(&x116, &x117, x115, x99, @intCast(u32, 0x0)); var x118: u32 = undefined; var x119: u1 = undefined; fiatP256AddcarryxU32(&x118, &x119, x117, x101, @intCast(u32, 0x0)); var x120: u32 = undefined; var x121: u1 = undefined; fiatP256AddcarryxU32(&x120, &x121, x119, x103, @intCast(u32, 0x0)); var x122: u32 = undefined; var x123: u1 = undefined; fiatP256AddcarryxU32(&x122, &x123, x121, x105, @intCast(u32, @intCast(u1, (x109 & @intCast(u32, 0x1))))); var x124: u32 = undefined; var x125: u1 = undefined; fiatP256AddcarryxU32(&x124, &x125, x123, x107, x109); var x126: u32 = undefined; fiatP256CmovznzU32(&x126, x3, (arg5[0]), x110); var x127: u32 = undefined; fiatP256CmovznzU32(&x127, x3, (arg5[1]), x112); var x128: u32 = undefined; fiatP256CmovznzU32(&x128, x3, (arg5[2]), x114); var x129: u32 = undefined; fiatP256CmovznzU32(&x129, x3, (arg5[3]), x116); var x130: u32 = undefined; fiatP256CmovznzU32(&x130, x3, (arg5[4]), x118); var x131: u32 = undefined; fiatP256CmovznzU32(&x131, x3, (arg5[5]), x120); var x132: u32 = undefined; fiatP256CmovznzU32(&x132, x3, (arg5[6]), x122); var x133: u32 = undefined; fiatP256CmovznzU32(&x133, x3, (arg5[7]), x124); const x134: u1 = @intCast(u1, (x34 & @intCast(u32, 0x1))); var x135: u32 = undefined; fiatP256CmovznzU32(&x135, x134, @intCast(u32, 0x0), x7); var x136: u32 = undefined; fiatP256CmovznzU32(&x136, x134, @intCast(u32, 0x0), x8); var x137: u32 = undefined; fiatP256CmovznzU32(&x137, x134, @intCast(u32, 0x0), x9); var x138: u32 = undefined; fiatP256CmovznzU32(&x138, x134, @intCast(u32, 0x0), x10); var x139: u32 = undefined; fiatP256CmovznzU32(&x139, x134, @intCast(u32, 0x0), x11); var x140: u32 = undefined; fiatP256CmovznzU32(&x140, x134, @intCast(u32, 0x0), x12); var x141: u32 = undefined; fiatP256CmovznzU32(&x141, x134, @intCast(u32, 0x0), x13); var x142: u32 = undefined; fiatP256CmovznzU32(&x142, x134, @intCast(u32, 0x0), x14); var x143: u32 = undefined; fiatP256CmovznzU32(&x143, x134, @intCast(u32, 0x0), x15); var x144: u32 = undefined; var x145: u1 = undefined; fiatP256AddcarryxU32(&x144, &x145, 0x0, x34, x135); var x146: u32 = undefined; var x147: u1 = undefined; fiatP256AddcarryxU32(&x146, &x147, x145, x35, x136); var x148: u32 = undefined; var x149: u1 = undefined; fiatP256AddcarryxU32(&x148, &x149, x147, x36, x137); var x150: u32 = undefined; var x151: u1 = undefined; fiatP256AddcarryxU32(&x150, &x151, x149, x37, x138); var x152: u32 = undefined; var x153: u1 = undefined; fiatP256AddcarryxU32(&x152, &x153, x151, x38, x139); var x154: u32 = undefined; var x155: u1 = undefined; fiatP256AddcarryxU32(&x154, &x155, x153, x39, x140); var x156: u32 = undefined; var x157: u1 = undefined; fiatP256AddcarryxU32(&x156, &x157, x155, x40, x141); var x158: u32 = undefined; var x159: u1 = undefined; fiatP256AddcarryxU32(&x158, &x159, x157, x41, x142); var x160: u32 = undefined; var x161: u1 = undefined; fiatP256AddcarryxU32(&x160, &x161, x159, x42, x143); var x162: u32 = undefined; fiatP256CmovznzU32(&x162, x134, @intCast(u32, 0x0), x43); var x163: u32 = undefined; fiatP256CmovznzU32(&x163, x134, @intCast(u32, 0x0), x44); var x164: u32 = undefined; fiatP256CmovznzU32(&x164, x134, @intCast(u32, 0x0), x45); var x165: u32 = undefined; fiatP256CmovznzU32(&x165, x134, @intCast(u32, 0x0), x46); var x166: u32 = undefined; fiatP256CmovznzU32(&x166, x134, @intCast(u32, 0x0), x47); var x167: u32 = undefined; fiatP256CmovznzU32(&x167, x134, @intCast(u32, 0x0), x48); var x168: u32 = undefined; fiatP256CmovznzU32(&x168, x134, @intCast(u32, 0x0), x49); var x169: u32 = undefined; fiatP256CmovznzU32(&x169, x134, @intCast(u32, 0x0), x50); var x170: u32 = undefined; var x171: u1 = undefined; fiatP256AddcarryxU32(&x170, &x171, 0x0, x126, x162); var x172: u32 = undefined; var x173: u1 = undefined; fiatP256AddcarryxU32(&x172, &x173, x171, x127, x163); var x174: u32 = undefined; var x175: u1 = undefined; fiatP256AddcarryxU32(&x174, &x175, x173, x128, x164); var x176: u32 = undefined; var x177: u1 = undefined; fiatP256AddcarryxU32(&x176, &x177, x175, x129, x165); var x178: u32 = undefined; var x179: u1 = undefined; fiatP256AddcarryxU32(&x178, &x179, x177, x130, x166); var x180: u32 = undefined; var x181: u1 = undefined; fiatP256AddcarryxU32(&x180, &x181, x179, x131, x167); var x182: u32 = undefined; var x183: u1 = undefined; fiatP256AddcarryxU32(&x182, &x183, x181, x132, x168); var x184: u32 = undefined; var x185: u1 = undefined; fiatP256AddcarryxU32(&x184, &x185, x183, x133, x169); var x186: u32 = undefined; var x187: u1 = undefined; fiatP256SubborrowxU32(&x186, &x187, 0x0, x170, 0xffffffff); var x188: u32 = undefined; var x189: u1 = undefined; fiatP256SubborrowxU32(&x188, &x189, x187, x172, 0xffffffff); var x190: u32 = undefined; var x191: u1 = undefined; fiatP256SubborrowxU32(&x190, &x191, x189, x174, 0xffffffff); var x192: u32 = undefined; var x193: u1 = undefined; fiatP256SubborrowxU32(&x192, &x193, x191, x176, @intCast(u32, 0x0)); var x194: u32 = undefined; var x195: u1 = undefined; fiatP256SubborrowxU32(&x194, &x195, x193, x178, @intCast(u32, 0x0)); var x196: u32 = undefined; var x197: u1 = undefined; fiatP256SubborrowxU32(&x196, &x197, x195, x180, @intCast(u32, 0x0)); var x198: u32 = undefined; var x199: u1 = undefined; fiatP256SubborrowxU32(&x198, &x199, x197, x182, @intCast(u32, 0x1)); var x200: u32 = undefined; var x201: u1 = undefined; fiatP256SubborrowxU32(&x200, &x201, x199, x184, 0xffffffff); var x202: u32 = undefined; var x203: u1 = undefined; fiatP256SubborrowxU32(&x202, &x203, x201, @intCast(u32, x185), @intCast(u32, 0x0)); var x204: u32 = undefined; var x205: u1 = undefined; fiatP256AddcarryxU32(&x204, &x205, 0x0, x6, @intCast(u32, 0x1)); const x206: u32 = ((x144 >> 1) | ((x146 << 31) & 0xffffffff)); const x207: u32 = ((x146 >> 1) | ((x148 << 31) & 0xffffffff)); const x208: u32 = ((x148 >> 1) | ((x150 << 31) & 0xffffffff)); const x209: u32 = ((x150 >> 1) | ((x152 << 31) & 0xffffffff)); const x210: u32 = ((x152 >> 1) | ((x154 << 31) & 0xffffffff)); const x211: u32 = ((x154 >> 1) | ((x156 << 31) & 0xffffffff)); const x212: u32 = ((x156 >> 1) | ((x158 << 31) & 0xffffffff)); const x213: u32 = ((x158 >> 1) | ((x160 << 31) & 0xffffffff)); const x214: u32 = ((x160 & 0x80000000) | (x160 >> 1)); var x215: u32 = undefined; fiatP256CmovznzU32(&x215, x84, x67, x51); var x216: u32 = undefined; fiatP256CmovznzU32(&x216, x84, x69, x53); var x217: u32 = undefined; fiatP256CmovznzU32(&x217, x84, x71, x55); var x218: u32 = undefined; fiatP256CmovznzU32(&x218, x84, x73, x57); var x219: u32 = undefined; fiatP256CmovznzU32(&x219, x84, x75, x59); var x220: u32 = undefined; fiatP256CmovznzU32(&x220, x84, x77, x61); var x221: u32 = undefined; fiatP256CmovznzU32(&x221, x84, x79, x63); var x222: u32 = undefined; fiatP256CmovznzU32(&x222, x84, x81, x65); var x223: u32 = undefined; fiatP256CmovznzU32(&x223, x203, x186, x170); var x224: u32 = undefined; fiatP256CmovznzU32(&x224, x203, x188, x172); var x225: u32 = undefined; fiatP256CmovznzU32(&x225, x203, x190, x174); var x226: u32 = undefined; fiatP256CmovznzU32(&x226, x203, x192, x176); var x227: u32 = undefined; fiatP256CmovznzU32(&x227, x203, x194, x178); var x228: u32 = undefined; fiatP256CmovznzU32(&x228, x203, x196, x180); var x229: u32 = undefined; fiatP256CmovznzU32(&x229, x203, x198, x182); var x230: u32 = undefined; fiatP256CmovznzU32(&x230, x203, x200, x184); out1.* = x204; out2[0] = x7; out2[1] = x8; out2[2] = x9; out2[3] = x10; out2[4] = x11; out2[5] = x12; out2[6] = x13; out2[7] = x14; out2[8] = x15; out3[0] = x206; out3[1] = x207; out3[2] = x208; out3[3] = x209; out3[4] = x210; out3[5] = x211; out3[6] = x212; out3[7] = x213; out3[8] = x214; out4[0] = x215; out4[1] = x216; out4[2] = x217; out4[3] = x218; out4[4] = x219; out4[5] = x220; out4[6] = x221; out4[7] = x222; out5[0] = x223; out5[1] = x224; out5[2] = x225; out5[3] = x226; out5[4] = x227; out5[5] = x228; out5[6] = x229; out5[7] = x230; } /// The function fiatP256DivstepPrecomp 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 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff], [0x0 ~> 0xffffffff]] pub fn fiatP256DivstepPrecomp(out1: *[8]u32) void { out1[0] = 0xb8000000; out1[1] = 0x67ffffff; out1[2] = 0x38000000; out1[3] = 0xc0000000; out1[4] = 0x7fffffff; out1[5] = 0xd8000000; out1[6] = 0xffffffff; out1[7] = 0x2fffffff; }
fiat-zig/src/p256_32.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const EncoderHandler = @import("../encode.zig").EncoderHandler; const HandlerResult = @import("../encode.zig").HandlerResult; const WebEncError = @import("../error.zig").WebEncError; const IoQueue = @import("../io_queue.zig").IoQueue; // https://encoding.spec.whatwg.org/#utf-8-encoder pub const Utf8EncoderHandler = struct { allocator: *Allocator, handler: EncoderHandler = EncoderHandler{ .handleFn = handle, .deinitFn = deinit, }, pub fn init(allocator: *Allocator) !*Utf8EncoderHandler { var handler = try allocator.create(Utf8EncoderHandler); handler.* = Utf8EncoderHandler{ .allocator = allocator }; return handler; } fn deinit(self: *EncoderHandler) void { var utf8EncoderHandler: *Utf8EncoderHandler = @fieldParentPtr(Utf8EncoderHandler, "handler", self); utf8EncoderHandler.allocator.destroy(utf8EncoderHandler); } fn handle(self: *EncoderHandler, item: IoQueue(u21).Item) !HandlerResult { var utf8_handler = @fieldParentPtr(Utf8EncoderHandler, "handler", self); var alloc = utf8_handler.allocator; switch (item) { .EndOfQueue => { return .Finished; }, .Regular => |code_point| { var byte_count: u3 = undefined; var offset: u8 = undefined; var first_byte: u8 = undefined; switch (code_point) { 0x00...0x7F => { byte_count = 1; first_byte = @intCast(u8, item.Regular); }, 0x0080...0x07FF => { byte_count = 2; offset = 0xC0; }, 0x0800...0xFFFF => { byte_count = 3; offset = 0xE0; }, 0x10000...0x10FFFF => { byte_count = 4; offset = 0xF0; }, else => { return WebEncError.RangeError; }, } if (byte_count > 1) { first_byte = @intCast(u8, (code_point >> @intCast(u5, (6 * @intCast(u8, (byte_count - 1)))))) + offset; } var bytes: []u8 = try alloc.alloc(u8, byte_count); bytes[0] = first_byte; var i: u3 = 1; while (byte_count > 1) : (byte_count -= 1) { var temp = code_point >> @intCast(u5, @intCast(u8, 6) * @intCast(u8, byte_count - 1 - 1)); bytes[i] = @intCast(u8, 0x80 | (temp & 0x3F)); i += 1; } return HandlerResult{ .Items = bytes, }; }, } } };
src/encoding/utf8.zig
pub const MARSHALINTERFACE_MIN = @as(u32, 500); pub const ASYNC_MODE_COMPATIBILITY = @as(i32, 1); pub const ASYNC_MODE_DEFAULT = @as(i32, 0); pub const STGTY_REPEAT = @as(i32, 256); pub const STG_TOEND = @as(i32, -1); pub const STG_LAYOUT_SEQUENTIAL = @as(i32, 0); pub const STG_LAYOUT_INTERLEAVED = @as(i32, 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 (232) //-------------------------------------------------------------------------------- pub const LPEXCEPFINO_DEFERRED_FILLIN = fn( pExcepInfo: ?*EXCEPINFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT; 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 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 CY = extern union { Anonymous: extern struct { Lo: u32, Hi: i32, }, int64: i64, }; 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 uCLSSPEC = extern struct { tyspec: u32, tagged_union: extern struct { clsid: Guid, pFileExt: ?PWSTR, pMimeType: ?PWSTR, pProgId: ?PWSTR, pFileName: ?PWSTR, ByName: extern struct { pPackageName: ?PWSTR, PolicyId: Guid, }, ByObjectId: extern struct { ObjectId: Guid, PolicyId: Guid, }, }, }; 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, CONTAINER = 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_CONTAINER = MSHCTX.CONTAINER; 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, }; 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? }; 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: ?*?*anyopaque, ) 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: ?*?*anyopaque) 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: ?*?*anyopaque, ) 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: ?*?*anyopaque) 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: ?*?*anyopaque, ) 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: ?*?*anyopaque) 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 '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()); }; // 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) ?*anyopaque, Realloc: fn( self: *const IMalloc, pv: ?*anyopaque, cb: usize, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque, Free: fn( self: *const IMalloc, pv: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void, GetSize: fn( self: *const IMalloc, pv: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) usize, DidAlloc: fn( self: *const IMalloc, pv: ?*anyopaque, ) 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) ?*anyopaque { 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: ?*anyopaque, cb: usize) callconv(.Inline) ?*anyopaque { 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: ?*anyopaque) 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: ?*anyopaque) 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: ?*anyopaque) 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: ?*anyopaque, 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: ?*anyopaque, 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: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IInternalUnknown_QueryInternalInterface(self: *const T, riid: ?*const Guid, ppv: ?*?*anyopaque) 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()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ISequentialStream_Value = @import("../zig.zig").Guid.initString("0c733a30-2a1c-11ce-ade5-00aa0044773d"); pub const IID_ISequentialStream = &IID_ISequentialStream_Value; pub const ISequentialStream = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Read: fn( self: *const ISequentialStream, // TODO: what to do with BytesParamIndex 1? pv: ?*anyopaque, cb: u32, pcbRead: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Write: fn( self: *const ISequentialStream, // TODO: what to do with BytesParamIndex 1? pv: ?*const anyopaque, cb: u32, pcbWritten: ?*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 ISequentialStream_Read(self: *const T, pv: ?*anyopaque, cb: u32, pcbRead: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISequentialStream.VTable, self.vtable).Read(@ptrCast(*const ISequentialStream, self), pv, cb, pcbRead); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISequentialStream_Write(self: *const T, pv: ?*const anyopaque, cb: u32, pcbWritten: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISequentialStream.VTable, self.vtable).Write(@ptrCast(*const ISequentialStream, self), pv, cb, pcbWritten); } };} pub usingnamespace MethodMixin(@This()); }; pub const STATSTG = extern struct { pwcsName: ?PWSTR, type: u32, cbSize: ULARGE_INTEGER, mtime: FILETIME, ctime: FILETIME, atime: FILETIME, grfMode: u32, grfLocksSupported: u32, clsid: Guid, grfStateBits: u32, reserved: u32, }; pub const STGTY = enum(i32) { STORAGE = 1, STREAM = 2, LOCKBYTES = 3, PROPERTY = 4, }; pub const STGTY_STORAGE = STGTY.STORAGE; pub const STGTY_STREAM = STGTY.STREAM; pub const STGTY_LOCKBYTES = STGTY.LOCKBYTES; pub const STGTY_PROPERTY = STGTY.PROPERTY; pub const STREAM_SEEK = enum(u32) { SET = 0, CUR = 1, END = 2, }; pub const STREAM_SEEK_SET = STREAM_SEEK.SET; pub const STREAM_SEEK_CUR = STREAM_SEEK.CUR; pub const STREAM_SEEK_END = STREAM_SEEK.END; // TODO: this type is limited to platform 'windows5.0' const IID_IStream_Value = @import("../zig.zig").Guid.initString("0000000c-0000-0000-c000-000000000046"); pub const IID_IStream = &IID_IStream_Value; pub const IStream = extern struct { pub const VTable = extern struct { base: ISequentialStream.VTable, Seek: fn( self: *const IStream, dlibMove: LARGE_INTEGER, dwOrigin: STREAM_SEEK, plibNewPosition: ?*ULARGE_INTEGER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSize: fn( self: *const IStream, libNewSize: ULARGE_INTEGER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CopyTo: fn( self: *const IStream, pstm: ?*IStream, cb: ULARGE_INTEGER, pcbRead: ?*ULARGE_INTEGER, pcbWritten: ?*ULARGE_INTEGER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Commit: fn( self: *const IStream, grfCommitFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Revert: fn( self: *const IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, LockRegion: fn( self: *const IStream, libOffset: ULARGE_INTEGER, cb: ULARGE_INTEGER, dwLockType: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnlockRegion: fn( self: *const IStream, libOffset: ULARGE_INTEGER, cb: ULARGE_INTEGER, dwLockType: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Stat: fn( self: *const IStream, pstatstg: ?*STATSTG, grfStatFlag: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IStream, ppstm: ?*?*IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ISequentialStream.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStream_Seek(self: *const T, dlibMove: LARGE_INTEGER, dwOrigin: STREAM_SEEK, plibNewPosition: ?*ULARGE_INTEGER) callconv(.Inline) HRESULT { return @ptrCast(*const IStream.VTable, self.vtable).Seek(@ptrCast(*const IStream, self), dlibMove, dwOrigin, plibNewPosition); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStream_SetSize(self: *const T, libNewSize: ULARGE_INTEGER) callconv(.Inline) HRESULT { return @ptrCast(*const IStream.VTable, self.vtable).SetSize(@ptrCast(*const IStream, self), libNewSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStream_CopyTo(self: *const T, pstm: ?*IStream, cb: ULARGE_INTEGER, pcbRead: ?*ULARGE_INTEGER, pcbWritten: ?*ULARGE_INTEGER) callconv(.Inline) HRESULT { return @ptrCast(*const IStream.VTable, self.vtable).CopyTo(@ptrCast(*const IStream, self), pstm, cb, pcbRead, pcbWritten); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStream_Commit(self: *const T, grfCommitFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IStream.VTable, self.vtable).Commit(@ptrCast(*const IStream, self), grfCommitFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStream_Revert(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IStream.VTable, self.vtable).Revert(@ptrCast(*const IStream, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStream_LockRegion(self: *const T, libOffset: ULARGE_INTEGER, cb: ULARGE_INTEGER, dwLockType: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IStream.VTable, self.vtable).LockRegion(@ptrCast(*const IStream, self), libOffset, cb, dwLockType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStream_UnlockRegion(self: *const T, libOffset: ULARGE_INTEGER, cb: ULARGE_INTEGER, dwLockType: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IStream.VTable, self.vtable).UnlockRegion(@ptrCast(*const IStream, self), libOffset, cb, dwLockType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStream_Stat(self: *const T, pstatstg: ?*STATSTG, grfStatFlag: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IStream.VTable, self.vtable).Stat(@ptrCast(*const IStream, self), pstatstg, grfStatFlag); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IStream_Clone(self: *const T, ppstm: ?*?*IStream) callconv(.Inline) HRESULT { return @ptrCast(*const IStream.VTable, self.vtable).Clone(@ptrCast(*const IStream, self), ppstm); } };} pub usingnamespace MethodMixin(@This()); }; pub const RPCOLEMESSAGE = extern struct { reserved1: ?*anyopaque, dataRepresentation: u32, Buffer: ?*anyopaque, cbBuffer: u32, iMethod: u32, reserved2: [5]?*anyopaque, 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: ?*?*anyopaque, ) 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: ?*?*anyopaque) 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: ?*?*anyopaque, ) 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: ?*?*anyopaque) 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: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDestCtxEx: fn( self: *const IRpcChannelBuffer3, pMsg: ?*RPCOLEMESSAGE, pdwDestContext: ?*u32, ppvDestContext: ?*?*anyopaque, ) 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: ?*?*anyopaque) 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: ?*?*anyopaque) 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: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DebugServerRelease: fn( self: *const IRpcStubBuffer, pv: ?*anyopaque, ) 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: ?*?*anyopaque) 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: ?*anyopaque) 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: ?*?*anyopaque, ) 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: ?*?*anyopaque) 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: ?*anyopaque, }; 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: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void, ClientNotify: fn( self: *const IChannelHook, uExtent: ?*const Guid, riid: ?*const Guid, cbDataSize: u32, pDataBuffer: ?*anyopaque, 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: ?*anyopaque, 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: ?*anyopaque, 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: ?*anyopaque) 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: ?*anyopaque, 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: ?*anyopaque, 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: ?*anyopaque, 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: ?*anyopaque, }; 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: ?*?*anyopaque, 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: ?*anyopaque, 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: ?*?*anyopaque, 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: ?*anyopaque, 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: ?*?*anyopaque, 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: ?*?*anyopaque, 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: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn 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: ?*?*anyopaque) 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: ?*?*anyopaque, ) 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: ?*?*anyopaque) 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: ?*anyopaque, 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: ?*anyopaque, 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: ?*?*anyopaque, ) 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: ?*?*anyopaque) 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; pub const MachineGlobalObjectTableRegistrationToken__ = extern struct { unused: i32, }; const IID_IMachineGlobalObjectTable_Value = @import("../zig.zig").Guid.initString("26d709ac-f70b-4421-a96f-d2878fafb00d"); pub const IID_IMachineGlobalObjectTable = &IID_IMachineGlobalObjectTable_Value; pub const IMachineGlobalObjectTable = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, RegisterObject: fn( self: *const IMachineGlobalObjectTable, clsid: ?*const Guid, identifier: ?[*:0]const u16, object: ?*IUnknown, token: ?*?*MachineGlobalObjectTableRegistrationToken__, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetObject: fn( self: *const IMachineGlobalObjectTable, clsid: ?*const Guid, identifier: ?[*:0]const u16, riid: ?*const Guid, ppv: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RevokeObject: fn( self: *const IMachineGlobalObjectTable, token: ?*MachineGlobalObjectTableRegistrationToken__, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMachineGlobalObjectTable_RegisterObject(self: *const T, clsid: ?*const Guid, identifier: ?[*:0]const u16, object: ?*IUnknown, token: ?*?*MachineGlobalObjectTableRegistrationToken__) callconv(.Inline) HRESULT { return @ptrCast(*const IMachineGlobalObjectTable.VTable, self.vtable).RegisterObject(@ptrCast(*const IMachineGlobalObjectTable, self), clsid, identifier, object, token); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMachineGlobalObjectTable_GetObject(self: *const T, clsid: ?*const Guid, identifier: ?[*:0]const u16, riid: ?*const Guid, ppv: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IMachineGlobalObjectTable.VTable, self.vtable).GetObject(@ptrCast(*const IMachineGlobalObjectTable, self), clsid, identifier, riid, ppv); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMachineGlobalObjectTable_RevokeObject(self: *const T, token: ?*MachineGlobalObjectTableRegistrationToken__) callconv(.Inline) HRESULT { return @ptrCast(*const IMachineGlobalObjectTable.VTable, self.vtable).RevokeObject(@ptrCast(*const IMachineGlobalObjectTable, self), token); } };} 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: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque, PreFree: fn( self: *const IMallocSpy, pRequest: ?*anyopaque, fSpyed: BOOL, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque, PostFree: fn( self: *const IMallocSpy, fSpyed: BOOL, ) callconv(@import("std").os.windows.WINAPI) void, PreRealloc: fn( self: *const IMallocSpy, pRequest: ?*anyopaque, cbRequest: usize, ppNewRequest: ?*?*anyopaque, fSpyed: BOOL, ) callconv(@import("std").os.windows.WINAPI) usize, PostRealloc: fn( self: *const IMallocSpy, pActual: ?*anyopaque, fSpyed: BOOL, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque, PreGetSize: fn( self: *const IMallocSpy, pRequest: ?*anyopaque, fSpyed: BOOL, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque, PostGetSize: fn( self: *const IMallocSpy, cbActual: usize, fSpyed: BOOL, ) callconv(@import("std").os.windows.WINAPI) usize, PreDidAlloc: fn( self: *const IMallocSpy, pRequest: ?*anyopaque, fSpyed: BOOL, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque, PostDidAlloc: fn( self: *const IMallocSpy, pRequest: ?*anyopaque, 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: ?*anyopaque) callconv(.Inline) ?*anyopaque { 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: ?*anyopaque, fSpyed: BOOL) callconv(.Inline) ?*anyopaque { 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: ?*anyopaque, cbRequest: usize, ppNewRequest: ?*?*anyopaque, 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: ?*anyopaque, fSpyed: BOOL) callconv(.Inline) ?*anyopaque { 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: ?*anyopaque, fSpyed: BOOL) callconv(.Inline) ?*anyopaque { 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: ?*anyopaque, fSpyed: BOOL) callconv(.Inline) ?*anyopaque { 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: ?*anyopaque, 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_L9017_C36: BIND_OPTS, dwTrackFlags: u32, dwClassContext: u32, locale: u32, pServerInfo: ?*COSERVERINFO, }; pub const BIND_OPTS3 = extern struct { __AnonymousBase_objidl_L9041_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: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BindToStorage: fn( self: *const IMoniker, pbc: ?*IBindCtx, pmkToLeft: ?*IMoniker, riid: ?*const Guid, ppvObj: ?*?*anyopaque, ) 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: ?*?*anyopaque) 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: ?*?*anyopaque) 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()); }; 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: ?*anyopaque, 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_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: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IClassActivator_GetClassObject(self: *const T, rclsid: ?*const Guid, dwClassContext: u32, locale: u32, riid: ?*const Guid, ppv: ?*?*anyopaque) 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()); }; pub const StorageLayout = extern struct { LayoutType: u32, pwcsElementName: ?PWSTR, cOffset: LARGE_INTEGER, cBytes: LARGE_INTEGER, }; // 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: ?*?*anyopaque, ) 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: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOplockStorage_CreateStorageEx(self: *const T, pwcsName: ?[*:0]const u16, grfMode: u32, stgfmt: u32, grfAttrs: u32, riid: ?*const Guid, ppstgOpen: ?*?*anyopaque) 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: ?*?*anyopaque) 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: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IForegroundTransfer_AllowForegroundTransfer(self: *const T, lpvReserved: ?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IForegroundTransfer.VTable, self.vtable).AllowForegroundTransfer(@ptrCast(*const IForegroundTransfer, self), lpvReserved); } };} 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()); }; 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; const IID_IServiceProvider_Value = @import("../zig.zig").Guid.initString("6d5140c1-7436-11ce-8034-00aa006009fa"); pub const IID_IServiceProvider = &IID_IServiceProvider_Value; pub const IServiceProvider = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, QueryService: fn( self: *const IServiceProvider, guidService: ?*const Guid, riid: ?*const Guid, ppvObject: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IServiceProvider_QueryService(self: *const T, guidService: ?*const Guid, riid: ?*const Guid, ppvObject: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IServiceProvider.VTable, self.vtable).QueryService(@ptrCast(*const IServiceProvider, self), guidService, riid, ppvObject); } };} pub usingnamespace MethodMixin(@This()); }; 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: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const LPFNCANUNLOADNOW = fn( ) callconv(@import("std").os.windows.WINAPI) HRESULT; // 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 ComCallData = extern struct { dwDispid: u32, dwReserved: u32, pUserDefined: ?*anyopaque, }; 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()); }; 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 BINDINFOF = enum(i32) { STGMEDDATA = 1, DEXTRAINFO = 2, }; pub const BINDINFOF_URLENCODESTGMEDDATA = BINDINFOF.STGMEDDATA; pub const BINDINFOF_URLENCODEDEXTRAINFO = BINDINFOF.DEXTRAINFO; 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, }; 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()); }; 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 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()); }; 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; 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_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_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: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MonikerBindToObject: fn( self: *const IBindHost, pMk: ?*IMoniker, pBC: ?*IBindCtx, pBSC: ?*IBindStatusCallback, riid: ?*const Guid, ppvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn 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: ?*?*anyopaque) 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: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IBindHost.VTable, self.vtable).MonikerBindToObject(@ptrCast(*const IBindHost, self), pMk, pBC, pBSC, riid, ppvObj); } };} pub usingnamespace MethodMixin(@This()); }; pub const SAFEARRAYBOUND = extern struct { cElements: u32, lLbound: i32, }; pub const SAFEARRAY = extern struct { cDims: u16, fFeatures: u16, cbElements: u32, cLocks: u32, pvData: ?*anyopaque, rgsabound: [1]SAFEARRAYBOUND, }; pub const VARIANT = extern struct { Anonymous: extern union { Anonymous: extern struct { vt: u16, wReserved1: u16, wReserved2: u16, wReserved3: u16, Anonymous: extern union { llVal: i64, lVal: i32, bVal: u8, iVal: i16, fltVal: f32, dblVal: f64, boolVal: i16, __OBSOLETE__VARIANT_BOOL: i16, scode: i32, cyVal: CY, date: f64, bstrVal: ?BSTR, punkVal: ?*IUnknown, pdispVal: ?*IDispatch, parray: ?*SAFEARRAY, pbVal: ?*u8, piVal: ?*i16, plVal: ?*i32, pllVal: ?*i64, pfltVal: ?*f32, pdblVal: ?*f64, pboolVal: ?*i16, __OBSOLETE__VARIANT_PBOOL: ?*i16, pscode: ?*i32, pcyVal: ?*CY, pdate: ?*f64, pbstrVal: ?*?BSTR, ppunkVal: ?*?*IUnknown, ppdispVal: ?*?*IDispatch, pparray: ?*?*SAFEARRAY, pvarVal: ?*VARIANT, byref: ?*anyopaque, cVal: CHAR, uiVal: u16, ulVal: u32, ullVal: u64, intVal: i32, uintVal: u32, pdecVal: ?*DECIMAL, pcVal: ?PSTR, puiVal: ?*u16, pulVal: ?*u32, pullVal: ?*u64, pintVal: ?*i32, puintVal: ?*u32, Anonymous: extern struct { pvRecord: ?*anyopaque, pRecInfo: ?*IRecordInfo, }, }, }, decVal: DECIMAL, }, }; pub const TYPEKIND = enum(i32) { ENUM = 0, RECORD = 1, MODULE = 2, INTERFACE = 3, DISPATCH = 4, COCLASS = 5, ALIAS = 6, UNION = 7, MAX = 8, }; pub const TKIND_ENUM = TYPEKIND.ENUM; pub const TKIND_RECORD = TYPEKIND.RECORD; pub const TKIND_MODULE = TYPEKIND.MODULE; pub const TKIND_INTERFACE = TYPEKIND.INTERFACE; pub const TKIND_DISPATCH = TYPEKIND.DISPATCH; pub const TKIND_COCLASS = TYPEKIND.COCLASS; pub const TKIND_ALIAS = TYPEKIND.ALIAS; pub const TKIND_UNION = TYPEKIND.UNION; pub const TKIND_MAX = TYPEKIND.MAX; pub const TYPEDESC = extern struct { Anonymous: extern union { lptdesc: ?*TYPEDESC, lpadesc: ?*ARRAYDESC, hreftype: u32, }, vt: u16, }; pub const IDLDESC = extern struct { dwReserved: usize, wIDLFlags: u16, }; pub const ELEMDESC = extern struct { tdesc: TYPEDESC, Anonymous: extern union { idldesc: IDLDESC, paramdesc: PARAMDESC, }, }; pub const TYPEATTR = extern struct { guid: Guid, lcid: u32, dwReserved: u32, memidConstructor: i32, memidDestructor: i32, lpstrSchema: ?PWSTR, cbSizeInstance: u32, typekind: TYPEKIND, cFuncs: u16, cVars: u16, cImplTypes: u16, cbSizeVft: u16, cbAlignment: u16, wTypeFlags: u16, wMajorVerNum: u16, wMinorVerNum: u16, tdescAlias: TYPEDESC, idldescType: IDLDESC, }; pub const DISPPARAMS = extern struct { rgvarg: ?*VARIANT, rgdispidNamedArgs: ?*i32, cArgs: u32, cNamedArgs: u32, }; pub const EXCEPINFO = extern struct { wCode: u16, wReserved: u16, bstrSource: ?BSTR, bstrDescription: ?BSTR, bstrHelpFile: ?BSTR, dwHelpContext: u32, pvReserved: ?*anyopaque, pfnDeferredFillIn: ?LPEXCEPFINO_DEFERRED_FILLIN, scode: i32, }; pub const CALLCONV = enum(i32) { FASTCALL = 0, CDECL = 1, MSCPASCAL = 2, // PASCAL = 2, this enum value conflicts with MSCPASCAL MACPASCAL = 3, STDCALL = 4, FPFASTCALL = 5, SYSCALL = 6, MPWCDECL = 7, MPWPASCAL = 8, MAX = 9, }; pub const CC_FASTCALL = CALLCONV.FASTCALL; pub const CC_CDECL = CALLCONV.CDECL; pub const CC_MSCPASCAL = CALLCONV.MSCPASCAL; pub const CC_PASCAL = CALLCONV.MSCPASCAL; pub const CC_MACPASCAL = CALLCONV.MACPASCAL; pub const CC_STDCALL = CALLCONV.STDCALL; pub const CC_FPFASTCALL = CALLCONV.FPFASTCALL; pub const CC_SYSCALL = CALLCONV.SYSCALL; pub const CC_MPWCDECL = CALLCONV.MPWCDECL; pub const CC_MPWPASCAL = CALLCONV.MPWPASCAL; pub const CC_MAX = CALLCONV.MAX; pub const FUNCKIND = enum(i32) { VIRTUAL = 0, PUREVIRTUAL = 1, NONVIRTUAL = 2, STATIC = 3, DISPATCH = 4, }; pub const FUNC_VIRTUAL = FUNCKIND.VIRTUAL; pub const FUNC_PUREVIRTUAL = FUNCKIND.PUREVIRTUAL; pub const FUNC_NONVIRTUAL = FUNCKIND.NONVIRTUAL; pub const FUNC_STATIC = FUNCKIND.STATIC; pub const FUNC_DISPATCH = FUNCKIND.DISPATCH; pub const INVOKEKIND = enum(i32) { FUNC = 1, PROPERTYGET = 2, PROPERTYPUT = 4, PROPERTYPUTREF = 8, }; pub const INVOKE_FUNC = INVOKEKIND.FUNC; pub const INVOKE_PROPERTYGET = INVOKEKIND.PROPERTYGET; pub const INVOKE_PROPERTYPUT = INVOKEKIND.PROPERTYPUT; pub const INVOKE_PROPERTYPUTREF = INVOKEKIND.PROPERTYPUTREF; pub const FUNCDESC = extern struct { memid: i32, lprgscode: ?*i32, lprgelemdescParam: ?*ELEMDESC, funckind: FUNCKIND, invkind: INVOKEKIND, @"callconv": CALLCONV, cParams: i16, cParamsOpt: i16, oVft: i16, cScodes: i16, elemdescFunc: ELEMDESC, wFuncFlags: u16, }; pub const VARKIND = enum(i32) { PERINSTANCE = 0, STATIC = 1, CONST = 2, DISPATCH = 3, }; pub const VAR_PERINSTANCE = VARKIND.PERINSTANCE; pub const VAR_STATIC = VARKIND.STATIC; pub const VAR_CONST = VARKIND.CONST; pub const VAR_DISPATCH = VARKIND.DISPATCH; pub const VARDESC = extern struct { memid: i32, lpstrSchema: ?PWSTR, Anonymous: extern union { oInst: u32, lpvarValue: ?*VARIANT, }, elemdescVar: ELEMDESC, wVarFlags: u16, varkind: VARKIND, }; pub const CUSTDATAITEM = extern struct { guid: Guid, varValue: VARIANT, }; pub const CUSTDATA = extern struct { cCustData: u32, prgCustData: ?*CUSTDATAITEM, }; const IID_IDispatch_Value = @import("../zig.zig").Guid.initString("00020400-0000-0000-c000-000000000046"); pub const IID_IDispatch = &IID_IDispatch_Value; pub const IDispatch = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetTypeInfoCount: fn( self: *const IDispatch, pctinfo: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTypeInfo: fn( self: *const IDispatch, iTInfo: u32, lcid: u32, ppTInfo: ?*?*ITypeInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIDsOfNames: fn( self: *const IDispatch, riid: ?*const Guid, rgszNames: [*]?PWSTR, cNames: u32, lcid: u32, rgDispId: [*]i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Invoke: fn( self: *const IDispatch, dispIdMember: i32, riid: ?*const Guid, lcid: u32, wFlags: u16, pDispParams: ?*DISPPARAMS, pVarResult: ?*VARIANT, pExcepInfo: ?*EXCEPINFO, puArgErr: ?*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 IDispatch_GetTypeInfoCount(self: *const T, pctinfo: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDispatch.VTable, self.vtable).GetTypeInfoCount(@ptrCast(*const IDispatch, self), pctinfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDispatch_GetTypeInfo(self: *const T, iTInfo: u32, lcid: u32, ppTInfo: ?*?*ITypeInfo) callconv(.Inline) HRESULT { return @ptrCast(*const IDispatch.VTable, self.vtable).GetTypeInfo(@ptrCast(*const IDispatch, self), iTInfo, lcid, ppTInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDispatch_GetIDsOfNames(self: *const T, riid: ?*const Guid, rgszNames: [*]?PWSTR, cNames: u32, lcid: u32, rgDispId: [*]i32) callconv(.Inline) HRESULT { return @ptrCast(*const IDispatch.VTable, self.vtable).GetIDsOfNames(@ptrCast(*const IDispatch, self), riid, rgszNames, cNames, lcid, rgDispId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDispatch_Invoke(self: *const T, dispIdMember: i32, riid: ?*const Guid, lcid: u32, wFlags: u16, pDispParams: ?*DISPPARAMS, pVarResult: ?*VARIANT, pExcepInfo: ?*EXCEPINFO, puArgErr: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDispatch.VTable, self.vtable).Invoke(@ptrCast(*const IDispatch, self), dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); } };} pub usingnamespace MethodMixin(@This()); }; pub const DESCKIND = enum(i32) { NONE = 0, FUNCDESC = 1, VARDESC = 2, TYPECOMP = 3, IMPLICITAPPOBJ = 4, MAX = 5, }; pub const DESCKIND_NONE = DESCKIND.NONE; pub const DESCKIND_FUNCDESC = DESCKIND.FUNCDESC; pub const DESCKIND_VARDESC = DESCKIND.VARDESC; pub const DESCKIND_TYPECOMP = DESCKIND.TYPECOMP; pub const DESCKIND_IMPLICITAPPOBJ = DESCKIND.IMPLICITAPPOBJ; pub const DESCKIND_MAX = DESCKIND.MAX; pub const BINDPTR = extern union { lpfuncdesc: ?*FUNCDESC, lpvardesc: ?*VARDESC, lptcomp: ?*ITypeComp, }; const IID_ITypeComp_Value = @import("../zig.zig").Guid.initString("00020403-0000-0000-c000-000000000046"); pub const IID_ITypeComp = &IID_ITypeComp_Value; pub const ITypeComp = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Bind: fn( self: *const ITypeComp, szName: ?PWSTR, lHashVal: u32, wFlags: u16, ppTInfo: ?*?*ITypeInfo, pDescKind: ?*DESCKIND, pBindPtr: ?*BINDPTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BindType: fn( self: *const ITypeComp, szName: ?PWSTR, lHashVal: u32, ppTInfo: ?*?*ITypeInfo, ppTComp: ?*?*ITypeComp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeComp_Bind(self: *const T, szName: ?PWSTR, lHashVal: u32, wFlags: u16, ppTInfo: ?*?*ITypeInfo, pDescKind: ?*DESCKIND, pBindPtr: ?*BINDPTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeComp.VTable, self.vtable).Bind(@ptrCast(*const ITypeComp, self), szName, lHashVal, wFlags, ppTInfo, pDescKind, pBindPtr); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeComp_BindType(self: *const T, szName: ?PWSTR, lHashVal: u32, ppTInfo: ?*?*ITypeInfo, ppTComp: ?*?*ITypeComp) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeComp.VTable, self.vtable).BindType(@ptrCast(*const ITypeComp, self), szName, lHashVal, ppTInfo, ppTComp); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ITypeInfo_Value = @import("../zig.zig").Guid.initString("00020401-0000-0000-c000-000000000046"); pub const IID_ITypeInfo = &IID_ITypeInfo_Value; pub const ITypeInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetTypeAttr: fn( self: *const ITypeInfo, ppTypeAttr: ?*?*TYPEATTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTypeComp: fn( self: *const ITypeInfo, ppTComp: ?*?*ITypeComp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFuncDesc: fn( self: *const ITypeInfo, index: u32, ppFuncDesc: ?*?*FUNCDESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetVarDesc: fn( self: *const ITypeInfo, index: u32, ppVarDesc: ?*?*VARDESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetNames: fn( self: *const ITypeInfo, memid: i32, rgBstrNames: [*]?BSTR, cMaxNames: u32, pcNames: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRefTypeOfImplType: fn( self: *const ITypeInfo, index: u32, pRefType: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetImplTypeFlags: fn( self: *const ITypeInfo, index: u32, pImplTypeFlags: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIDsOfNames: fn( self: *const ITypeInfo, rgszNames: [*]?PWSTR, cNames: u32, pMemId: [*]i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Invoke: fn( self: *const ITypeInfo, pvInstance: ?*anyopaque, memid: i32, wFlags: u16, pDispParams: ?*DISPPARAMS, pVarResult: ?*VARIANT, pExcepInfo: ?*EXCEPINFO, puArgErr: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDocumentation: fn( self: *const ITypeInfo, memid: i32, pBstrName: ?*?BSTR, pBstrDocString: ?*?BSTR, pdwHelpContext: ?*u32, pBstrHelpFile: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDllEntry: fn( self: *const ITypeInfo, memid: i32, invKind: INVOKEKIND, pBstrDllName: ?*?BSTR, pBstrName: ?*?BSTR, pwOrdinal: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRefTypeInfo: fn( self: *const ITypeInfo, hRefType: u32, ppTInfo: ?*?*ITypeInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddressOfMember: fn( self: *const ITypeInfo, memid: i32, invKind: INVOKEKIND, ppv: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateInstance: fn( self: *const ITypeInfo, pUnkOuter: ?*IUnknown, riid: ?*const Guid, ppvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMops: fn( self: *const ITypeInfo, memid: i32, pBstrMops: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetContainingTypeLib: fn( self: *const ITypeInfo, ppTLib: ?*?*ITypeLib, pIndex: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReleaseTypeAttr: fn( self: *const ITypeInfo, pTypeAttr: ?*TYPEATTR, ) callconv(@import("std").os.windows.WINAPI) void, ReleaseFuncDesc: fn( self: *const ITypeInfo, pFuncDesc: ?*FUNCDESC, ) callconv(@import("std").os.windows.WINAPI) void, ReleaseVarDesc: fn( self: *const ITypeInfo, pVarDesc: ?*VARDESC, ) 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 ITypeInfo_GetTypeAttr(self: *const T, ppTypeAttr: ?*?*TYPEATTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo.VTable, self.vtable).GetTypeAttr(@ptrCast(*const ITypeInfo, self), ppTypeAttr); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo_GetTypeComp(self: *const T, ppTComp: ?*?*ITypeComp) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo.VTable, self.vtable).GetTypeComp(@ptrCast(*const ITypeInfo, self), ppTComp); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo_GetFuncDesc(self: *const T, index: u32, ppFuncDesc: ?*?*FUNCDESC) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo.VTable, self.vtable).GetFuncDesc(@ptrCast(*const ITypeInfo, self), index, ppFuncDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo_GetVarDesc(self: *const T, index: u32, ppVarDesc: ?*?*VARDESC) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo.VTable, self.vtable).GetVarDesc(@ptrCast(*const ITypeInfo, self), index, ppVarDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo_GetNames(self: *const T, memid: i32, rgBstrNames: [*]?BSTR, cMaxNames: u32, pcNames: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo.VTable, self.vtable).GetNames(@ptrCast(*const ITypeInfo, self), memid, rgBstrNames, cMaxNames, pcNames); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo_GetRefTypeOfImplType(self: *const T, index: u32, pRefType: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo.VTable, self.vtable).GetRefTypeOfImplType(@ptrCast(*const ITypeInfo, self), index, pRefType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo_GetImplTypeFlags(self: *const T, index: u32, pImplTypeFlags: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo.VTable, self.vtable).GetImplTypeFlags(@ptrCast(*const ITypeInfo, self), index, pImplTypeFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo_GetIDsOfNames(self: *const T, rgszNames: [*]?PWSTR, cNames: u32, pMemId: [*]i32) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo.VTable, self.vtable).GetIDsOfNames(@ptrCast(*const ITypeInfo, self), rgszNames, cNames, pMemId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo_Invoke(self: *const T, pvInstance: ?*anyopaque, memid: i32, wFlags: u16, pDispParams: ?*DISPPARAMS, pVarResult: ?*VARIANT, pExcepInfo: ?*EXCEPINFO, puArgErr: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo.VTable, self.vtable).Invoke(@ptrCast(*const ITypeInfo, self), pvInstance, memid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo_GetDocumentation(self: *const T, memid: i32, pBstrName: ?*?BSTR, pBstrDocString: ?*?BSTR, pdwHelpContext: ?*u32, pBstrHelpFile: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo.VTable, self.vtable).GetDocumentation(@ptrCast(*const ITypeInfo, self), memid, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo_GetDllEntry(self: *const T, memid: i32, invKind: INVOKEKIND, pBstrDllName: ?*?BSTR, pBstrName: ?*?BSTR, pwOrdinal: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo.VTable, self.vtable).GetDllEntry(@ptrCast(*const ITypeInfo, self), memid, invKind, pBstrDllName, pBstrName, pwOrdinal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo_GetRefTypeInfo(self: *const T, hRefType: u32, ppTInfo: ?*?*ITypeInfo) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo.VTable, self.vtable).GetRefTypeInfo(@ptrCast(*const ITypeInfo, self), hRefType, ppTInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo_AddressOfMember(self: *const T, memid: i32, invKind: INVOKEKIND, ppv: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo.VTable, self.vtable).AddressOfMember(@ptrCast(*const ITypeInfo, self), memid, invKind, ppv); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo_CreateInstance(self: *const T, pUnkOuter: ?*IUnknown, riid: ?*const Guid, ppvObj: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo.VTable, self.vtable).CreateInstance(@ptrCast(*const ITypeInfo, self), pUnkOuter, riid, ppvObj); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo_GetMops(self: *const T, memid: i32, pBstrMops: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo.VTable, self.vtable).GetMops(@ptrCast(*const ITypeInfo, self), memid, pBstrMops); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo_GetContainingTypeLib(self: *const T, ppTLib: ?*?*ITypeLib, pIndex: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo.VTable, self.vtable).GetContainingTypeLib(@ptrCast(*const ITypeInfo, self), ppTLib, pIndex); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo_ReleaseTypeAttr(self: *const T, pTypeAttr: ?*TYPEATTR) callconv(.Inline) void { return @ptrCast(*const ITypeInfo.VTable, self.vtable).ReleaseTypeAttr(@ptrCast(*const ITypeInfo, self), pTypeAttr); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo_ReleaseFuncDesc(self: *const T, pFuncDesc: ?*FUNCDESC) callconv(.Inline) void { return @ptrCast(*const ITypeInfo.VTable, self.vtable).ReleaseFuncDesc(@ptrCast(*const ITypeInfo, self), pFuncDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo_ReleaseVarDesc(self: *const T, pVarDesc: ?*VARDESC) callconv(.Inline) void { return @ptrCast(*const ITypeInfo.VTable, self.vtable).ReleaseVarDesc(@ptrCast(*const ITypeInfo, self), pVarDesc); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ITypeInfo2_Value = @import("../zig.zig").Guid.initString("00020412-0000-0000-c000-000000000046"); pub const IID_ITypeInfo2 = &IID_ITypeInfo2_Value; pub const ITypeInfo2 = extern struct { pub const VTable = extern struct { base: ITypeInfo.VTable, GetTypeKind: fn( self: *const ITypeInfo2, pTypeKind: ?*TYPEKIND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTypeFlags: fn( self: *const ITypeInfo2, pTypeFlags: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFuncIndexOfMemId: fn( self: *const ITypeInfo2, memid: i32, invKind: INVOKEKIND, pFuncIndex: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetVarIndexOfMemId: fn( self: *const ITypeInfo2, memid: i32, pVarIndex: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCustData: fn( self: *const ITypeInfo2, guid: ?*const Guid, pVarVal: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFuncCustData: fn( self: *const ITypeInfo2, index: u32, guid: ?*const Guid, pVarVal: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetParamCustData: fn( self: *const ITypeInfo2, indexFunc: u32, indexParam: u32, guid: ?*const Guid, pVarVal: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetVarCustData: fn( self: *const ITypeInfo2, index: u32, guid: ?*const Guid, pVarVal: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetImplTypeCustData: fn( self: *const ITypeInfo2, index: u32, guid: ?*const Guid, pVarVal: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDocumentation2: fn( self: *const ITypeInfo2, memid: i32, lcid: u32, pbstrHelpString: ?*?BSTR, pdwHelpStringContext: ?*u32, pbstrHelpStringDll: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAllCustData: fn( self: *const ITypeInfo2, pCustData: ?*CUSTDATA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAllFuncCustData: fn( self: *const ITypeInfo2, index: u32, pCustData: ?*CUSTDATA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAllParamCustData: fn( self: *const ITypeInfo2, indexFunc: u32, indexParam: u32, pCustData: ?*CUSTDATA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAllVarCustData: fn( self: *const ITypeInfo2, index: u32, pCustData: ?*CUSTDATA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAllImplTypeCustData: fn( self: *const ITypeInfo2, index: u32, pCustData: ?*CUSTDATA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ITypeInfo.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo2_GetTypeKind(self: *const T, pTypeKind: ?*TYPEKIND) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo2.VTable, self.vtable).GetTypeKind(@ptrCast(*const ITypeInfo2, self), pTypeKind); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo2_GetTypeFlags(self: *const T, pTypeFlags: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo2.VTable, self.vtable).GetTypeFlags(@ptrCast(*const ITypeInfo2, self), pTypeFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo2_GetFuncIndexOfMemId(self: *const T, memid: i32, invKind: INVOKEKIND, pFuncIndex: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo2.VTable, self.vtable).GetFuncIndexOfMemId(@ptrCast(*const ITypeInfo2, self), memid, invKind, pFuncIndex); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo2_GetVarIndexOfMemId(self: *const T, memid: i32, pVarIndex: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo2.VTable, self.vtable).GetVarIndexOfMemId(@ptrCast(*const ITypeInfo2, self), memid, pVarIndex); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo2_GetCustData(self: *const T, guid: ?*const Guid, pVarVal: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo2.VTable, self.vtable).GetCustData(@ptrCast(*const ITypeInfo2, self), guid, pVarVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo2_GetFuncCustData(self: *const T, index: u32, guid: ?*const Guid, pVarVal: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo2.VTable, self.vtable).GetFuncCustData(@ptrCast(*const ITypeInfo2, self), index, guid, pVarVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo2_GetParamCustData(self: *const T, indexFunc: u32, indexParam: u32, guid: ?*const Guid, pVarVal: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo2.VTable, self.vtable).GetParamCustData(@ptrCast(*const ITypeInfo2, self), indexFunc, indexParam, guid, pVarVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo2_GetVarCustData(self: *const T, index: u32, guid: ?*const Guid, pVarVal: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo2.VTable, self.vtable).GetVarCustData(@ptrCast(*const ITypeInfo2, self), index, guid, pVarVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo2_GetImplTypeCustData(self: *const T, index: u32, guid: ?*const Guid, pVarVal: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo2.VTable, self.vtable).GetImplTypeCustData(@ptrCast(*const ITypeInfo2, self), index, guid, pVarVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo2_GetDocumentation2(self: *const T, memid: i32, lcid: u32, pbstrHelpString: ?*?BSTR, pdwHelpStringContext: ?*u32, pbstrHelpStringDll: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo2.VTable, self.vtable).GetDocumentation2(@ptrCast(*const ITypeInfo2, self), memid, lcid, pbstrHelpString, pdwHelpStringContext, pbstrHelpStringDll); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo2_GetAllCustData(self: *const T, pCustData: ?*CUSTDATA) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo2.VTable, self.vtable).GetAllCustData(@ptrCast(*const ITypeInfo2, self), pCustData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo2_GetAllFuncCustData(self: *const T, index: u32, pCustData: ?*CUSTDATA) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo2.VTable, self.vtable).GetAllFuncCustData(@ptrCast(*const ITypeInfo2, self), index, pCustData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo2_GetAllParamCustData(self: *const T, indexFunc: u32, indexParam: u32, pCustData: ?*CUSTDATA) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo2.VTable, self.vtable).GetAllParamCustData(@ptrCast(*const ITypeInfo2, self), indexFunc, indexParam, pCustData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo2_GetAllVarCustData(self: *const T, index: u32, pCustData: ?*CUSTDATA) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo2.VTable, self.vtable).GetAllVarCustData(@ptrCast(*const ITypeInfo2, self), index, pCustData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeInfo2_GetAllImplTypeCustData(self: *const T, index: u32, pCustData: ?*CUSTDATA) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeInfo2.VTable, self.vtable).GetAllImplTypeCustData(@ptrCast(*const ITypeInfo2, self), index, pCustData); } };} pub usingnamespace MethodMixin(@This()); }; pub const SYSKIND = enum(i32) { WIN16 = 0, WIN32 = 1, MAC = 2, WIN64 = 3, }; pub const SYS_WIN16 = SYSKIND.WIN16; pub const SYS_WIN32 = SYSKIND.WIN32; pub const SYS_MAC = SYSKIND.MAC; pub const SYS_WIN64 = SYSKIND.WIN64; pub const TLIBATTR = extern struct { guid: Guid, lcid: u32, syskind: SYSKIND, wMajorVerNum: u16, wMinorVerNum: u16, wLibFlags: u16, }; const IID_ITypeLib_Value = @import("../zig.zig").Guid.initString("00020402-0000-0000-c000-000000000046"); pub const IID_ITypeLib = &IID_ITypeLib_Value; pub const ITypeLib = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetTypeInfoCount: fn( self: *const ITypeLib, ) callconv(@import("std").os.windows.WINAPI) u32, GetTypeInfo: fn( self: *const ITypeLib, index: u32, ppTInfo: ?*?*ITypeInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTypeInfoType: fn( self: *const ITypeLib, index: u32, pTKind: ?*TYPEKIND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTypeInfoOfGuid: fn( self: *const ITypeLib, guid: ?*const Guid, ppTinfo: ?*?*ITypeInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLibAttr: fn( self: *const ITypeLib, ppTLibAttr: ?*?*TLIBATTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTypeComp: fn( self: *const ITypeLib, ppTComp: ?*?*ITypeComp, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDocumentation: fn( self: *const ITypeLib, index: i32, pBstrName: ?*?BSTR, pBstrDocString: ?*?BSTR, pdwHelpContext: ?*u32, pBstrHelpFile: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsName: fn( self: *const ITypeLib, szNameBuf: ?PWSTR, lHashVal: u32, pfName: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FindName: fn( self: *const ITypeLib, szNameBuf: ?PWSTR, lHashVal: u32, ppTInfo: [*]?*ITypeInfo, rgMemId: [*]i32, pcFound: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReleaseTLibAttr: fn( self: *const ITypeLib, pTLibAttr: ?*TLIBATTR, ) 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 ITypeLib_GetTypeInfoCount(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const ITypeLib.VTable, self.vtable).GetTypeInfoCount(@ptrCast(*const ITypeLib, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLib_GetTypeInfo(self: *const T, index: u32, ppTInfo: ?*?*ITypeInfo) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLib.VTable, self.vtable).GetTypeInfo(@ptrCast(*const ITypeLib, self), index, ppTInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLib_GetTypeInfoType(self: *const T, index: u32, pTKind: ?*TYPEKIND) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLib.VTable, self.vtable).GetTypeInfoType(@ptrCast(*const ITypeLib, self), index, pTKind); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLib_GetTypeInfoOfGuid(self: *const T, guid: ?*const Guid, ppTinfo: ?*?*ITypeInfo) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLib.VTable, self.vtable).GetTypeInfoOfGuid(@ptrCast(*const ITypeLib, self), guid, ppTinfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLib_GetLibAttr(self: *const T, ppTLibAttr: ?*?*TLIBATTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLib.VTable, self.vtable).GetLibAttr(@ptrCast(*const ITypeLib, self), ppTLibAttr); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLib_GetTypeComp(self: *const T, ppTComp: ?*?*ITypeComp) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLib.VTable, self.vtable).GetTypeComp(@ptrCast(*const ITypeLib, self), ppTComp); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLib_GetDocumentation(self: *const T, index: i32, pBstrName: ?*?BSTR, pBstrDocString: ?*?BSTR, pdwHelpContext: ?*u32, pBstrHelpFile: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLib.VTable, self.vtable).GetDocumentation(@ptrCast(*const ITypeLib, self), index, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLib_IsName(self: *const T, szNameBuf: ?PWSTR, lHashVal: u32, pfName: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLib.VTable, self.vtable).IsName(@ptrCast(*const ITypeLib, self), szNameBuf, lHashVal, pfName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLib_FindName(self: *const T, szNameBuf: ?PWSTR, lHashVal: u32, ppTInfo: [*]?*ITypeInfo, rgMemId: [*]i32, pcFound: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLib.VTable, self.vtable).FindName(@ptrCast(*const ITypeLib, self), szNameBuf, lHashVal, ppTInfo, rgMemId, pcFound); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLib_ReleaseTLibAttr(self: *const T, pTLibAttr: ?*TLIBATTR) callconv(.Inline) void { return @ptrCast(*const ITypeLib.VTable, self.vtable).ReleaseTLibAttr(@ptrCast(*const ITypeLib, self), pTLibAttr); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ITypeLib2_Value = @import("../zig.zig").Guid.initString("00020411-0000-0000-c000-000000000046"); pub const IID_ITypeLib2 = &IID_ITypeLib2_Value; pub const ITypeLib2 = extern struct { pub const VTable = extern struct { base: ITypeLib.VTable, GetCustData: fn( self: *const ITypeLib2, guid: ?*const Guid, pVarVal: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLibStatistics: fn( self: *const ITypeLib2, pcUniqueNames: ?*u32, pcchUniqueNames: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDocumentation2: fn( self: *const ITypeLib2, index: i32, lcid: u32, pbstrHelpString: ?*?BSTR, pdwHelpStringContext: ?*u32, pbstrHelpStringDll: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAllCustData: fn( self: *const ITypeLib2, pCustData: ?*CUSTDATA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ITypeLib.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLib2_GetCustData(self: *const T, guid: ?*const Guid, pVarVal: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLib2.VTable, self.vtable).GetCustData(@ptrCast(*const ITypeLib2, self), guid, pVarVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLib2_GetLibStatistics(self: *const T, pcUniqueNames: ?*u32, pcchUniqueNames: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLib2.VTable, self.vtable).GetLibStatistics(@ptrCast(*const ITypeLib2, self), pcUniqueNames, pcchUniqueNames); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLib2_GetDocumentation2(self: *const T, index: i32, lcid: u32, pbstrHelpString: ?*?BSTR, pdwHelpStringContext: ?*u32, pbstrHelpStringDll: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLib2.VTable, self.vtable).GetDocumentation2(@ptrCast(*const ITypeLib2, self), index, lcid, pbstrHelpString, pdwHelpStringContext, pbstrHelpStringDll); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLib2_GetAllCustData(self: *const T, pCustData: ?*CUSTDATA) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLib2.VTable, self.vtable).GetAllCustData(@ptrCast(*const ITypeLib2, self), pCustData); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IErrorInfo_Value = @import("../zig.zig").Guid.initString("1cf2b120-547d-101b-8e65-08002b2bd119"); pub const IID_IErrorInfo = &IID_IErrorInfo_Value; pub const IErrorInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetGUID: fn( self: *const IErrorInfo, pGUID: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSource: fn( self: *const IErrorInfo, pBstrSource: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDescription: fn( self: *const IErrorInfo, pBstrDescription: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetHelpFile: fn( self: *const IErrorInfo, pBstrHelpFile: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetHelpContext: fn( self: *const IErrorInfo, pdwHelpContext: ?*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 IErrorInfo_GetGUID(self: *const T, pGUID: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IErrorInfo.VTable, self.vtable).GetGUID(@ptrCast(*const IErrorInfo, self), pGUID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IErrorInfo_GetSource(self: *const T, pBstrSource: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IErrorInfo.VTable, self.vtable).GetSource(@ptrCast(*const IErrorInfo, self), pBstrSource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IErrorInfo_GetDescription(self: *const T, pBstrDescription: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IErrorInfo.VTable, self.vtable).GetDescription(@ptrCast(*const IErrorInfo, self), pBstrDescription); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IErrorInfo_GetHelpFile(self: *const T, pBstrHelpFile: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IErrorInfo.VTable, self.vtable).GetHelpFile(@ptrCast(*const IErrorInfo, self), pBstrHelpFile); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IErrorInfo_GetHelpContext(self: *const T, pdwHelpContext: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IErrorInfo.VTable, self.vtable).GetHelpContext(@ptrCast(*const IErrorInfo, self), pdwHelpContext); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISupportErrorInfo_Value = @import("../zig.zig").Guid.initString("df0b3d60-548f-101b-8e65-08002b2bd119"); pub const IID_ISupportErrorInfo = &IID_ISupportErrorInfo_Value; pub const ISupportErrorInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, InterfaceSupportsErrorInfo: fn( self: *const ISupportErrorInfo, riid: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISupportErrorInfo_InterfaceSupportsErrorInfo(self: *const T, riid: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const ISupportErrorInfo.VTable, self.vtable).InterfaceSupportsErrorInfo(@ptrCast(*const ISupportErrorInfo, self), riid); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IErrorLog_Value = @import("../zig.zig").Guid.initString("3127ca40-446e-11ce-8135-00aa004bb851"); pub const IID_IErrorLog = &IID_IErrorLog_Value; pub const IErrorLog = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AddError: fn( self: *const IErrorLog, pszPropName: ?[*:0]const u16, pExcepInfo: ?*EXCEPINFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IErrorLog_AddError(self: *const T, pszPropName: ?[*:0]const u16, pExcepInfo: ?*EXCEPINFO) callconv(.Inline) HRESULT { return @ptrCast(*const IErrorLog.VTable, self.vtable).AddError(@ptrCast(*const IErrorLog, self), pszPropName, pExcepInfo); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ITypeLibRegistrationReader_Value = @import("../zig.zig").Guid.initString("ed6a8a2a-b160-4e77-8f73-aa7435cd5c27"); pub const IID_ITypeLibRegistrationReader = &IID_ITypeLibRegistrationReader_Value; pub const ITypeLibRegistrationReader = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, EnumTypeLibRegistrations: fn( self: *const ITypeLibRegistrationReader, ppEnumUnknown: ?*?*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 ITypeLibRegistrationReader_EnumTypeLibRegistrations(self: *const T, ppEnumUnknown: ?*?*IEnumUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLibRegistrationReader.VTable, self.vtable).EnumTypeLibRegistrations(@ptrCast(*const ITypeLibRegistrationReader, self), ppEnumUnknown); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ITypeLibRegistration_Value = @import("../zig.zig").Guid.initString("76a3e735-02df-4a12-98eb-043ad3600af3"); pub const IID_ITypeLibRegistration = &IID_ITypeLibRegistration_Value; pub const ITypeLibRegistration = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetGuid: fn( self: *const ITypeLibRegistration, pGuid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetVersion: fn( self: *const ITypeLibRegistration, pVersion: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLcid: fn( self: *const ITypeLibRegistration, pLcid: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetWin32Path: fn( self: *const ITypeLibRegistration, pWin32Path: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetWin64Path: fn( self: *const ITypeLibRegistration, pWin64Path: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDisplayName: fn( self: *const ITypeLibRegistration, pDisplayName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFlags: fn( self: *const ITypeLibRegistration, pFlags: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetHelpDir: fn( self: *const ITypeLibRegistration, pHelpDir: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLibRegistration_GetGuid(self: *const T, pGuid: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLibRegistration.VTable, self.vtable).GetGuid(@ptrCast(*const ITypeLibRegistration, self), pGuid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLibRegistration_GetVersion(self: *const T, pVersion: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLibRegistration.VTable, self.vtable).GetVersion(@ptrCast(*const ITypeLibRegistration, self), pVersion); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLibRegistration_GetLcid(self: *const T, pLcid: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLibRegistration.VTable, self.vtable).GetLcid(@ptrCast(*const ITypeLibRegistration, self), pLcid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLibRegistration_GetWin32Path(self: *const T, pWin32Path: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLibRegistration.VTable, self.vtable).GetWin32Path(@ptrCast(*const ITypeLibRegistration, self), pWin32Path); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLibRegistration_GetWin64Path(self: *const T, pWin64Path: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLibRegistration.VTable, self.vtable).GetWin64Path(@ptrCast(*const ITypeLibRegistration, self), pWin64Path); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLibRegistration_GetDisplayName(self: *const T, pDisplayName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLibRegistration.VTable, self.vtable).GetDisplayName(@ptrCast(*const ITypeLibRegistration, self), pDisplayName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLibRegistration_GetFlags(self: *const T, pFlags: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLibRegistration.VTable, self.vtable).GetFlags(@ptrCast(*const ITypeLibRegistration, self), pFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeLibRegistration_GetHelpDir(self: *const T, pHelpDir: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeLibRegistration.VTable, self.vtable).GetHelpDir(@ptrCast(*const ITypeLibRegistration, self), pHelpDir); } };} pub usingnamespace MethodMixin(@This()); }; 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()); }; 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()); }; //-------------------------------------------------------------------------------- // Section: Functions (110) //-------------------------------------------------------------------------------- pub extern "ole32" fn CoBuildVersion( ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoInitialize( pvReserved: ?*anyopaque, ) 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 CoAllowSetForegroundWindow( pUnk: ?*IUnknown, lpvReserved: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "ole32" fn DcomChannelSetHResult( pvReserved: ?*anyopaque, pulReserved: ?*u32, appsHR: HRESULT, ) 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 CLSIDFromProgIDEx( 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 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 CoFileTimeNow( lpFileTime: ?*FILETIME, ) 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 CreateDataAdviseHolder( ppDAHolder: ?*?*IDataAdviseHolder, ) 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: ?*?*anyopaque, ) 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: ?*?*anyopaque, ) 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: ?*?*anyopaque, ) 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; pub extern "ole32" fn CreateStdProgressIndicator( hwndParent: ?HWND, pszTitle: ?[*:0]const u16, pIbscCaller: ?*IBindStatusCallback, ppIbsc: ?*?*IBindStatusCallback, ) 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: ?*anyopaque, 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: ?*?*anyopaque, ) 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: ?*anyopaque, riid: ?*const Guid, ppv: ?*?*anyopaque, ) 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 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 CoIsHandlerConnected( pUnk: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) BOOL; // 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: ?*anyopaque, dwAuthnLevel: RPC_C_AUTHN_LEVEL, dwImpLevel: RPC_C_IMP_LEVEL, pAuthList: ?*anyopaque, dwCapabilities: EOLE_AUTHENTICATION_CAPABILITIES, pReserved3: ?*anyopaque, ) 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: ?*?*anyopaque, ) 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: ?*?*anyopaque, 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: ?*anyopaque, 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: ?*?*anyopaque, 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: ?*?*anyopaque, ) 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: ?*anyopaque, 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: ?*?*anyopaque, ) 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: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoDisableCallCancellation( pReserved: ?*anyopaque, ) 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) ?*anyopaque; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoTaskMemRealloc( pv: ?*anyopaque, cb: usize, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CoTaskMemFree( pv: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; 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 "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 "OLEAUT32" fn SetErrorInfo( dwReserved: u32, perrinfo: ?*IErrorInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn GetErrorInfo( dwReserved: u32, pperrinfo: ?*?*IErrorInfo, ) 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 (27) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const ARRAYDESC = @import("../system/ole.zig").ARRAYDESC; const BOOL = @import("../foundation.zig").BOOL; const BSTR = @import("../foundation.zig").BSTR; const CHAR = @import("../foundation.zig").CHAR; const DECIMAL = @import("../foundation.zig").DECIMAL; const FILETIME = @import("../foundation.zig").FILETIME; const HANDLE = @import("../foundation.zig").HANDLE; const HBITMAP = @import("../graphics/gdi.zig").HBITMAP; const HENHMETAFILE = @import("../graphics/gdi.zig").HENHMETAFILE; const HINSTANCE = @import("../foundation.zig").HINSTANCE; const HRESULT = @import("../foundation.zig").HRESULT; const HWND = @import("../foundation.zig").HWND; const IRecordInfo = @import("../system/ole.zig").IRecordInfo; const IStorage = @import("../system/com/structured_storage.zig").IStorage; const LARGE_INTEGER = @import("../foundation.zig").LARGE_INTEGER; const PARAMDESC = @import("../system/ole.zig").PARAMDESC; const PSTR = @import("../foundation.zig").PSTR; const PWSTR = @import("../foundation.zig").PWSTR; const SECURITY_ATTRIBUTES = @import("../security.zig").SECURITY_ATTRIBUTES; const SECURITY_DESCRIPTOR = @import("../security.zig").SECURITY_DESCRIPTOR; const ULARGE_INTEGER = @import("../foundation.zig").ULARGE_INTEGER; 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; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "LPEXCEPFINO_DEFERRED_FILLIN")) { _ = LPEXCEPFINO_DEFERRED_FILLIN; } if (@hasDecl(@This(), "LPFNGETCLASSOBJECT")) { _ = LPFNGETCLASSOBJECT; } if (@hasDecl(@This(), "LPFNCANUNLOADNOW")) { _ = LPFNCANUNLOADNOW; } 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; } } } //-------------------------------------------------------------------------------- // Section: SubModules (7) //-------------------------------------------------------------------------------- pub const call_obj = @import("com/call_obj.zig"); pub const channel_credentials = @import("com/channel_credentials.zig"); pub const events = @import("com/events.zig"); pub const marshal = @import("com/marshal.zig"); pub const structured_storage = @import("com/structured_storage.zig"); pub const ui = @import("com/ui.zig"); pub const urlmon = @import("com/urlmon.zig");
win32/system/com.zig
const builtin = @import("builtin"); const is_test = builtin.is_test; const std = @import("std"); const math = std.math; const expect = std.testing.expect; pub fn floatXiYf(comptime T: type, x: anytype) T { @setRuntimeSafety(is_test); if (x == 0) return 0; // Various constants whose values follow from the type parameters. // Any reasonable optimizer will fold and propagate all of these. const Z = std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(x))); const uT = std.meta.Int(.unsigned, @bitSizeOf(T)); const inf = math.inf(T); const float_bits = @bitSizeOf(T); const int_bits = @bitSizeOf(@TypeOf(x)); const exp_bits = math.floatExponentBits(T); const fractional_bits = math.floatFractionalBits(T); const exp_bias = math.maxInt(std.meta.Int(.unsigned, exp_bits - 1)); const implicit_bit = if (T != f80) @as(uT, 1) << fractional_bits else 0; const max_exp = exp_bias; // Sign var abs_val = math.absCast(x); const sign_bit = if (x < 0) @as(uT, 1) << (float_bits - 1) else 0; var result: uT = sign_bit; // Compute significand var exp = int_bits - @clz(Z, abs_val) - 1; if (int_bits <= fractional_bits or exp <= fractional_bits) { const shift_amt = fractional_bits - @intCast(math.Log2Int(uT), exp); // Shift up result to line up with the significand - no rounding required result = (@intCast(uT, abs_val) << shift_amt); result ^= implicit_bit; // Remove implicit integer bit } else { var shift_amt = @intCast(math.Log2Int(Z), exp - fractional_bits); const exact_tie: bool = @ctz(Z, abs_val) == shift_amt - 1; // Shift down result and remove implicit integer bit result = @intCast(uT, (abs_val >> (shift_amt - 1))) ^ (implicit_bit << 1); // Round result, including round-to-even for exact ties result = ((result + 1) >> 1) & ~@as(uT, @boolToInt(exact_tie)); } // Compute exponent if ((int_bits > max_exp) and (exp > max_exp)) // If exponent too large, overflow to infinity return @bitCast(T, sign_bit | @bitCast(uT, inf)); result += (@as(uT, exp) + exp_bias) << math.floatMantissaBits(T); // If the result included a carry, we need to restore the explicit integer bit if (T == f80) result |= 1 << fractional_bits; return @bitCast(T, sign_bit | result); } // Conversion to f16 pub fn __floatsihf(a: i32) callconv(.C) f16 { return floatXiYf(f16, a); } pub fn __floatunsihf(a: u32) callconv(.C) f16 { return floatXiYf(f16, a); } pub fn __floatdihf(a: i64) callconv(.C) f16 { return floatXiYf(f16, a); } pub fn __floatundihf(a: u64) callconv(.C) f16 { return floatXiYf(f16, a); } pub fn __floattihf(a: i128) callconv(.C) f16 { return floatXiYf(f16, a); } pub fn __floatuntihf(a: u128) callconv(.C) f16 { return floatXiYf(f16, a); } // Conversion to f32 pub fn __floatsisf(a: i32) callconv(.C) f32 { return floatXiYf(f32, a); } pub fn __floatunsisf(a: u32) callconv(.C) f32 { return floatXiYf(f32, a); } pub fn __floatdisf(a: i64) callconv(.C) f32 { return floatXiYf(f32, a); } pub fn __floatundisf(a: u64) callconv(.C) f32 { return floatXiYf(f32, a); } pub fn __floattisf(a: i128) callconv(.C) f32 { return floatXiYf(f32, a); } pub fn __floatuntisf(a: u128) callconv(.C) f32 { return floatXiYf(f32, a); } // Conversion to f64 pub fn __floatsidf(a: i32) callconv(.C) f64 { return floatXiYf(f64, a); } pub fn __floatunsidf(a: u32) callconv(.C) f64 { return floatXiYf(f64, a); } pub fn __floatdidf(a: i64) callconv(.C) f64 { return floatXiYf(f64, a); } pub fn __floatundidf(a: u64) callconv(.C) f64 { return floatXiYf(f64, a); } pub fn __floattidf(a: i128) callconv(.C) f64 { return floatXiYf(f64, a); } pub fn __floatuntidf(a: u128) callconv(.C) f64 { return floatXiYf(f64, a); } // Conversion to f80 pub fn __floatsixf(a: i32) callconv(.C) f80 { return floatXiYf(f80, a); } pub fn __floatunsixf(a: u32) callconv(.C) f80 { return floatXiYf(f80, a); } pub fn __floatdixf(a: i64) callconv(.C) f80 { return floatXiYf(f80, a); } pub fn __floatundixf(a: u64) callconv(.C) f80 { return floatXiYf(f80, a); } pub fn __floattixf(a: i128) callconv(.C) f80 { return floatXiYf(f80, a); } pub fn __floatuntixf(a: u128) callconv(.C) f80 { return floatXiYf(f80, a); } // Conversion to f128 pub fn __floatsitf(a: i32) callconv(.C) f128 { return floatXiYf(f128, a); } pub fn __floatunsitf(a: u32) callconv(.C) f128 { return floatXiYf(f128, a); } pub fn __floatditf(a: i64) callconv(.C) f128 { return floatXiYf(f128, a); } pub fn __floatunditf(a: u64) callconv(.C) f128 { return floatXiYf(f128, a); } pub fn __floattitf(a: i128) callconv(.C) f128 { return floatXiYf(f128, a); } pub fn __floatuntitf(a: u128) callconv(.C) f128 { return floatXiYf(f128, a); } // Conversion to f32 pub fn __aeabi_ui2f(arg: u32) callconv(.AAPCS) f32 { return floatXiYf(f32, arg); } pub fn __aeabi_i2f(arg: i32) callconv(.AAPCS) f32 { return floatXiYf(f32, arg); } pub fn __aeabi_ul2f(arg: u64) callconv(.AAPCS) f32 { return floatXiYf(f32, arg); } pub fn __aeabi_l2f(arg: i64) callconv(.AAPCS) f32 { return floatXiYf(f32, arg); } // Conversion to f64 pub fn __aeabi_ui2d(arg: u32) callconv(.AAPCS) f64 { return floatXiYf(f64, arg); } pub fn __aeabi_i2d(arg: i32) callconv(.AAPCS) f64 { return floatXiYf(f64, arg); } pub fn __aeabi_ul2d(arg: u64) callconv(.AAPCS) f64 { return floatXiYf(f64, arg); } pub fn __aeabi_l2d(arg: i64) callconv(.AAPCS) f64 { return floatXiYf(f64, arg); } test { _ = @import("floatXiYf_test.zig"); }
lib/std/special/compiler_rt/floatXiYf.zig
const std = @import("../std.zig"); const Cpu = std.Target.Cpu; pub const Feature = enum { ext, hwmult16, hwmult32, hwmultf5, }; pub usingnamespace Cpu.Feature.feature_set_fns(Feature); pub const all_features = blk: { const len = @typeInfo(Feature).Enum.fields.len; std.debug.assert(len <= Cpu.Feature.Set.needed_bit_count); var result: [len]Cpu.Feature = undefined; result[@enumToInt(Feature.ext)] = .{ .llvm_name = "ext", .description = "Enable MSP430-X extensions", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.hwmult16)] = .{ .llvm_name = "hwmult16", .description = "Enable 16-bit hardware multiplier", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.hwmult32)] = .{ .llvm_name = "hwmult32", .description = "Enable 32-bit hardware multiplier", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.hwmultf5)] = .{ .llvm_name = "hwmultf5", .description = "Enable F5 series hardware multiplier", .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 generic = Cpu{ .name = "generic", .llvm_name = "generic", .features = featureSet(&[_]Feature{}), }; pub const msp430 = Cpu{ .name = "msp430", .llvm_name = "msp430", .features = featureSet(&[_]Feature{}), }; pub const msp430x = Cpu{ .name = "msp430x", .llvm_name = "msp430x", .features = featureSet(&[_]Feature{ .ext, }), }; }; /// All msp430 CPUs, sorted alphabetically by name. /// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1 /// compiler has inefficient memory and CPU usage, affecting build times. pub const all_cpus = &[_]*const Cpu{ &cpu.generic, &cpu.msp430, &cpu.msp430x, };
lib/std/target/msp430.zig
const std = @import("../../std.zig"); const os = std.os; const mem = std.mem; const testing = std.testing; const native_os = std.Target.current.os; /// POSIX `iovec`, or Windows `WSABUF`. The difference between the two are the ordering /// of fields, alongside the length being represented as either a ULONG or a size_t. pub const Buffer = if (native_os.tag == .windows) extern struct { len: c_ulong, ptr: usize, pub fn from(slice: []const u8) Buffer { return .{ .len = @intCast(c_ulong, slice.len), .ptr = @ptrToInt(slice.ptr) }; } pub fn into(self: Buffer) []const u8 { return @intToPtr([*]const u8, self.ptr)[0..self.len]; } pub fn intoMutable(self: Buffer) []u8 { return @intToPtr([*]u8, self.ptr)[0..self.len]; } } else extern struct { ptr: usize, len: usize, pub fn from(slice: []const u8) Buffer { return .{ .ptr = @ptrToInt(slice.ptr), .len = slice.len }; } pub fn into(self: Buffer) []const u8 { return @intToPtr([*]const u8, self.ptr)[0..self.len]; } pub fn intoMutable(self: Buffer) []u8 { return @intToPtr([*]u8, self.ptr)[0..self.len]; } }; pub const Reactor = struct { pub const InitFlags = enum { close_on_exec, }; pub const Event = struct { data: usize, is_error: bool, is_hup: bool, is_readable: bool, is_writable: bool, }; pub const Interest = struct { hup: bool = false, oneshot: bool = false, readable: bool = false, writable: bool = false, }; fd: os.fd_t, pub fn init(flags: std.enums.EnumFieldStruct(Reactor.InitFlags, bool, false)) !Reactor { var raw_flags: u32 = 0; const set = std.EnumSet(Reactor.InitFlags).init(flags); if (set.contains(.close_on_exec)) raw_flags |= os.EPOLL_CLOEXEC; return Reactor{ .fd = try os.epoll_create1(raw_flags) }; } pub fn deinit(self: Reactor) void { os.close(self.fd); } pub fn update(self: Reactor, fd: os.fd_t, identifier: usize, interest: Reactor.Interest) !void { var flags: u32 = 0; flags |= if (interest.oneshot) os.EPOLLONESHOT else os.EPOLLET; if (interest.hup) flags |= os.EPOLLRDHUP; if (interest.readable) flags |= os.EPOLLIN; if (interest.writable) flags |= os.EPOLLOUT; const event = &os.epoll_event{ .events = flags, .data = .{ .ptr = identifier }, }; os.epoll_ctl(self.fd, os.EPOLL_CTL_MOD, fd, event) catch |err| switch (err) { error.FileDescriptorNotRegistered => try os.epoll_ctl(self.fd, os.EPOLL_CTL_ADD, fd, event), else => return err, }; } pub fn poll(self: Reactor, comptime max_num_events: comptime_int, closure: anytype, timeout_milliseconds: ?u64) !void { var events: [max_num_events]os.epoll_event = undefined; const num_events = os.epoll_wait(self.fd, &events, if (timeout_milliseconds) |ms| @intCast(i32, ms) else -1); for (events[0..num_events]) |ev| { const is_error = ev.events & os.EPOLLERR != 0; const is_hup = ev.events & (os.EPOLLHUP | os.EPOLLRDHUP) != 0; const is_readable = ev.events & os.EPOLLIN != 0; const is_writable = ev.events & os.EPOLLOUT != 0; try closure.call(Reactor.Event{ .data = ev.data.ptr, .is_error = is_error, .is_hup = is_hup, .is_readable = is_readable, .is_writable = is_writable, }); } } }; test "reactor/linux: drive async tcp client/listener pair" { if (native_os.tag != .linux) return error.SkipZigTest; const ip = std.x.net.ip; const tcp = std.x.net.tcp; const IPv4 = std.x.os.IPv4; const IPv6 = std.x.os.IPv6; const Socket = std.x.os.Socket; const reactor = try Reactor.init(.{ .close_on_exec = true }); defer reactor.deinit(); const listener = try tcp.Listener.init(.ip, .{ .close_on_exec = true, .nonblocking = true, }); defer listener.deinit(); try reactor.update(listener.socket.fd, 0, .{ .readable = true }); try reactor.poll(1, struct { fn call(event: Reactor.Event) !void { try testing.expectEqual(Reactor.Event{ .data = 0, .is_error = false, .is_hup = true, .is_readable = false, .is_writable = false, }, event); } }, null); try listener.bind(ip.Address.initIPv4(IPv4.unspecified, 0)); try listener.listen(128); var binded_address = try listener.getLocalAddress(); switch (binded_address) { .ipv4 => |*ipv4| ipv4.host = IPv4.localhost, .ipv6 => |*ipv6| ipv6.host = IPv6.localhost, } const client = try tcp.Client.init(.ip, .{ .close_on_exec = true, .nonblocking = true, }); defer client.deinit(); try reactor.update(client.socket.fd, 1, .{ .readable = true, .writable = true }); try reactor.poll(1, struct { fn call(event: Reactor.Event) !void { try testing.expectEqual(Reactor.Event{ .data = 1, .is_error = false, .is_hup = true, .is_readable = false, .is_writable = true, }, event); } }, null); client.connect(binded_address) catch |err| switch (err) { error.WouldBlock => {}, else => return err, }; try reactor.poll(1, struct { fn call(event: Reactor.Event) !void { try testing.expectEqual(Reactor.Event{ .data = 1, .is_error = false, .is_hup = false, .is_readable = false, .is_writable = true, }, event); } }, null); try reactor.poll(1, struct { fn call(event: Reactor.Event) !void { try testing.expectEqual(Reactor.Event{ .data = 0, .is_error = false, .is_hup = false, .is_readable = true, .is_writable = false, }, event); } }, null); }
lib/std/x/os/io.zig
const sabaton = @import("root").sabaton; const std = @import("std"); var base: ?u64 = null; const File = packed struct { size: u32, select: u16, reserved: u16, name: [56]u8, pub fn write(self: *const @This(), buffer: []const u8) void { const dma_addr = @intToPtr(*volatile u64, base.? + 16); do_dma(@intToPtr([*]u8, @ptrToInt(buffer.ptr))[0..buffer.len], (1 << 4) | (1 << 3) | (@as(u32, self.select) << 16), dma_addr); } pub fn read(self: *const @This(), buffer: []u8) void { const dma_addr = @intToPtr(*volatile u64, base.? + 16); do_dma(buffer, (1 << 1) | (1 << 3) | (@as(u32, self.select) << 16), dma_addr); } }; pub fn init_from_dtb() void { const fw_cfg = sabaton.dtb.find("fw-cfg@", "reg") catch return; base = std.mem.readIntBig(u64, fw_cfg[0..][0..8]); if (sabaton.debug) sabaton.log_hex("fw_cfg base: ", base.?); const data = @intToPtr(*volatile u64, base.?); const selector = @intToPtr(*volatile u16, base.? + 8); const dma_addr = @intToPtr(*volatile u64, base.? + 16); if (sabaton.safety) { selector.* = std.mem.nativeToBig(u16, 0); std.debug.assert(@truncate(u32, data.*) == 0x554D4551); // 'QEMU' selector.* = std.mem.nativeToBig(u16, 1); std.debug.assert(@truncate(u32, data.*) & 2 != 0); // DMA bit std.debug.assert(std.mem.bigToNative(u64, dma_addr.*) == 0x51454d5520434647); } } const DMAAccess = packed struct { control: u32, length: u32, addr: u64, }; pub fn do_dma(buffer: []u8, control: u32, dma_addr: *volatile u64) void { var access_bytes: [@sizeOf(DMAAccess)]u8 = undefined; var access = @ptrCast(*volatile DMAAccess, &access_bytes[0]); access.* = .{ .control = std.mem.nativeToBig(u32, control), .length = std.mem.nativeToBig(u32, @intCast(u32, buffer.len)), .addr = std.mem.nativeToBig(u64, @ptrToInt(buffer.ptr)), }; dma_addr.* = std.mem.nativeToBig(u64, @ptrToInt(access)); asm volatile ("" ::: "memory"); if (sabaton.safety) { while (true) { const ctrl = std.mem.bigToNative(u32, access.control); if (ctrl & 1 != 0) @panic("fw_cfg dma error!"); if (ctrl == 0) return; sabaton.puts("Still waiting...\n"); } } } pub fn find_file(filename: []const u8) ?File { if (base) |b| { const dma_addr = @intToPtr(*volatile u64, b + 16); // Get number of files var num_files: u32 = undefined; do_dma(@ptrCast([*]u8, &num_files)[0..4], (1 << 1) | (1 << 3) | (0x0019 << 16), dma_addr); num_files = std.mem.bigToNative(u32, num_files); var current_file: u32 = 0; while (current_file < num_files) : (current_file += 1) { // Get a file at a time var f: File = undefined; do_dma(@ptrCast([*]u8, &f)[0..@sizeOf(File)], (1 << 1), dma_addr); f.size = std.mem.bigToNative(u32, f.size); f.select = std.mem.bigToNative(u16, f.select); if (sabaton.debug) { sabaton.puts("fw cfg file:\n"); sabaton.log_hex(" size: ", f.size); sabaton.puts(" filename: "); sabaton.puts(@ptrCast([*:0]u8, &f.name[0])); sabaton.putchar('\n'); } if (std.mem.eql(u8, filename, f.name[0..filename.len]) and f.name[filename.len] == 0) { return f; } } } return null; }
src/platform/drivers/fw_cfg.zig
const Register = @import("../../../mmio_register.zig").Register; pub const Uart0 = Uart(0x1001_3000); pub const Uart1 = Uart(0x1002_3000); fn Uart(base_address: usize) type { return struct { pub fn setBaudRate() void { // For now, hardcode to 115200 assuming a 16 MHz tlclk. // Value is from the manual, Section 18.9 Table 62. div.modify(.{ .div = 138, }); } pub fn enableTx() void { txctrl.modify(.{ .txen = true, }); } pub fn writeString(string: []const u8) void { for (string) |c| { writeByte(c); } } pub fn writeByte(byte: u8) void { // Wait for TX FIFO to have space available. while (txdata.read().full) {} // Write the byte to the TX FIFO. txdata.write(.{ .data = byte, }); } /// Writing to the txdata register enqueues the character contained in /// the data field to the transmit FIFO if the FIFO is able to accept /// new entries. Reading from txdata returns the current value of the /// full flag and zero in the data field. The full flag indicates /// whether the transmit FIFO is able to accept new entries; when set, /// writes to data are ignored. A RISC‑V amoor.w instruction can be used /// to both read the full status and attempt to enqueue data, with a /// non-zero return value indicating the character was not accepted. const txdata = Register(u32, packed struct { /// Transmit data (RW) data: u8, _reserved_8: u23 = 0, /// Transmit FIFO full (RO) full: bool = false, }).init(base_address + 0x0); /// Reading the rxdata register dequeues a character from the receive /// FIFO and returns the value in the data field. The empty flag /// indicates if the receive FIFO was empty; when set, the data field /// does not contain a valid character. Writes to rxdata are ignored. const rxdata = Register(u32, packed struct { /// Received data (RO) data: u8, _reserved_8: u23, /// Receive FIFO empty (RO) empty: bool, }).init(base_address + 0x4); /// The read-write txctrl register controls the operation of the /// transmit channel. The txen bit controls whether the Tx channel /// is active. When cleared, transmission of Tx FIFO contents is /// suppressed, and the txd pin is driven high. const txctrl = Register(u32, packed struct { /// Transmit enable (RW) txen: bool, /// Number of stop bits (RW) nstop: enum(u1) { one = 0, two = 1, }, _reserved_2: u14, /// Transmit watermark level (RW) /// The threshold at which the TX FIFO watermark interrupt triggers. txcnt: u3, _reserved_19: u13, }).init(base_address + 0x08); /// The read-write rxctrl register controls the operation of the receive /// channel. The rxen bit controls whether the Rx channel is active. /// When cleared, the state of the rxd pin is ignored, and no /// characters will be enqueued into the Rx FIFO. const rxctrl = Register(u32, packed struct { /// Receive enable (RW) rxen: bool, /// Number of stop bits (RW) nstop: enum(u1) { one = 0, two = 1, }, _reserved_2: u14, /// Receive watermark level (RW) /// The threshold at which the RX FIFO watermark interrupt triggers. rxcnt: u3, _reserved_19: u13, }).init(base_address + 0x0C); /// The read-write ie register controls which UART interrupts are /// enabled. /// /// The txwm condition becomes raised when the number of entries in /// the transmit FIFO is strictly less than the count specified by the /// txcnt field of the txctrl register. The pending bit is cleared when /// sufficient entries have been enqueued to exceed the watermark. /// /// The rxwm condition becomes raised when the number of entries in the /// receive FIFO is strictly greater than the count specified by the /// rxcnt field of the rxctrl register. The pending bit is cleared when /// sufficient entries have been dequeued to fall below the watermark. const ie = Register(u32, packed struct { /// Transmit watermark interrupt enable. txwm: bool, /// Receive watermark interrupt enable. rxwm: bool, _reserved_2: u30, }).init(base_address + 0x10); /// The ip register is a read-only register indicating the pending /// interrupt conditions. See ie for more details. const ip = Register(u32, packed struct { /// Transmit watermark interrupt pending. txwm: bool, /// Receive watermark interrupt pending. rxwm: bool, _reserved_2: u30, }).init(base_address + 0x14); const div = Register(u32, packed struct { /// Baud rate divisor. div: u16, _reserved_16: u16, }).init(base_address + 0x18); }; }
src/target/soc/fe310-g002/uart.zig
const std = @import("std"); const subcommands = @import("subcommands.zig"); const build_options = @import("options"); const builtin = @import("builtin"); pub const is_debug_or_test = builtin.is_test or builtin.mode == .Debug; pub const free_on_close = is_debug_or_test or tracy.enable; const log = std.log.scoped(.shared); pub const tracy = @import("tracy.zig"); pub fn printHelp(comptime subcommand: type, io: anytype, exe_path: []const u8) u8 { const z = tracy.traceNamed(@src(), "print help"); defer z.end(); log.debug("printing help for " ++ subcommand.name, .{}); io.stdout.print(subcommand.usage, .{exe_path}) catch {}; return 0; } pub fn printVersion(comptime subcommand: type, io: anytype) u8 { const z = tracy.traceNamed(@src(), "print version"); defer z.end(); log.debug("printing version for " ++ subcommand.name, .{}); io.stdout.print(version_string, .{subcommand.name}) catch {}; return 0; } pub fn unableToWriteTo(comptime destination: []const u8, io: anytype, err: anyerror) void { io.stderr.writeAll("unable to write to " ++ destination ++ ": ") catch return; io.stderr.writeAll(@errorName(err)) catch return; io.stderr.writeByte('\n') catch return; } pub fn printError(comptime subcommand: type, io: anytype, error_message: []const u8) u8 { const z = tracy.traceNamed(@src(), "print error"); defer z.end(); z.addText(error_message); log.debug("printing error for " ++ subcommand.name, .{}); output: { io.stderr.writeAll(subcommand.name) catch break :output; io.stderr.writeAll(": ") catch break :output; io.stderr.writeAll(error_message) catch break :output; io.stderr.writeByte('\n') catch break :output; } return 1; } pub fn printErrorAlloc( comptime subcommand: type, allocator: std.mem.Allocator, io: anytype, comptime msg: []const u8, args: anytype, ) !u8 { const z = tracy.traceNamed(@src(), "print error alloc"); defer z.end(); const error_message = try std.fmt.allocPrint(allocator, msg, args); defer if (free_on_close) allocator.free(error_message); return printError(subcommand, io, error_message); } pub fn printInvalidUsage(comptime subcommand: type, io: anytype, exe_path: []const u8, error_message: []const u8) u8 { const z = tracy.traceNamed(@src(), "print invalid usage"); defer z.end(); z.addText(error_message); log.debug("printing error for " ++ subcommand.name, .{}); output: { io.stderr.writeAll(exe_path) catch break :output; io.stderr.writeAll(": ") catch break :output; io.stderr.writeAll(error_message) catch break :output; io.stderr.writeAll("\nTry '") catch break :output; io.stderr.writeAll(exe_path) catch break :output; io.stderr.writeAll(" --help' for more information\n") catch break :output; } return 1; } pub fn printInvalidUsageAlloc( comptime subcommand: type, allocator: std.mem.Allocator, io: anytype, exe_path: []const u8, comptime msg: []const u8, args: anytype, ) !u8 { const z = tracy.traceNamed(@src(), "print invalid usage alloc"); defer z.end(); const error_message = try std.fmt.allocPrint(allocator, msg, args); defer if (free_on_close) allocator.free(error_message); return printInvalidUsage(subcommand, io, exe_path, error_message); } pub const version_string = "{s} (zig-coreutils) " ++ build_options.version ++ "\nMIT License Copyright (c) 2021 <NAME>\n"; pub fn ArgIterator(comptime T: type) type { return struct { arg_iter: T, const Self = @This(); pub fn init(arg_iter: T) Self { return .{ .arg_iter = arg_iter }; } // BUG: this function should return `?[:0]const u8` but that hits a compiler bug // broken LLVM module found: Call parameter type does not match function signature! pub fn nextRaw(self: *Self) ?[]const u8 { const z = tracy.traceNamed(@src(), "raw next arg"); defer z.end(); if (self.arg_iter.next()) |arg| { z.addText(arg); return arg; } return null; } pub fn next(self: *Self) ?Arg { const z = tracy.traceNamed(@src(), "next arg"); defer z.end(); const current_arg = self.arg_iter.next() orelse return null; z.addText(current_arg); // the length checks in the below ifs allow '-' and '--' to fall through as positional arguments if (current_arg.len > 1 and current_arg[0] == '-') longhand_shorthand_blk: { if (current_arg.len > 2 and current_arg[1] == '-') { // longhand argument e.g. '--help' const entire_longhand = current_arg[2..]; if (std.mem.indexOfScalar(u8, entire_longhand, '=')) |equal_index| { // if equal_index is zero then the argument starts with '--=' which we do not count as a valid // version of either longhand argument type nor a shorthand argument, so break out to make it positional if (equal_index == 0) break :longhand_shorthand_blk; const longhand = entire_longhand[0..equal_index]; const value = entire_longhand[equal_index + 1 ..]; log.debug("longhand argument with value \"{s}\" = \"{s}\"", .{ longhand, value }); return Arg.init(current_arg, .{ .longhand_with_value = .{ .longhand = longhand, .value = value } }); } log.debug("longhand argument \"{s}\"", .{entire_longhand}); return Arg.init(current_arg, .{ .longhand = entire_longhand }); } // this check allows '--' to fall through as a positional argument if (current_arg[1] != '-') { log.debug("shorthand argument \"{s}\"", .{current_arg}); return Arg.init(current_arg, .{ .shorthand = .{ .value = current_arg } }); } } log.debug("positional \"{s}\"", .{current_arg}); return Arg.init(current_arg, .positional); } pub fn nextWithHelpOrVersion(self: *Self) error{ Help, Version }!?Arg { const z = tracy.traceNamed(@src(), "next arg with help/version"); defer z.end(); var arg = self.next() orelse return null; switch (arg.arg_type) { .longhand => |longhand| { if (std.mem.eql(u8, longhand, "help")) { return error.Help; } if (std.mem.eql(u8, longhand, "version")) { return error.Version; } }, .shorthand => |*shorthand| { while (shorthand.nextNoSkip()) |char| { if (char == 'h') { return error.Help; } } shorthand.reset(); }, else => {}, } return arg; } }; } pub const Arg = struct { raw: []const u8, arg_type: ArgType, pub fn init(value: []const u8, arg_type: ArgType) Arg { return .{ .raw = value, .arg_type = arg_type }; } pub const ArgType = union(enum) { shorthand: Shorthand, longhand: []const u8, longhand_with_value: LonghandWithValue, positional: void, pub const LonghandWithValue = struct { longhand: []const u8, value: []const u8, }; pub const Shorthand = struct { value: []const u8, index: usize = 1, pub fn next(self: *Shorthand) ?u8 { var index = self.index; defer self.index = index; while (index < self.value.len) { defer index += 1; const char = self.value[index]; if (char == 'h' or char == 'v') { continue; } else { log.debug("\"{s}\" - shorthand sub-index {} is '{c}'", .{ self.value, index, char }); } return char; } return null; } fn nextNoSkip(self: *Shorthand) ?u8 { if (self.index >= self.value.len) return null; const char = self.value[self.index]; if (char == 'h' or char == 'v') log.debug("\"{s}\" - shorthand sub-index {} is '{c}'", .{ self.value, self.index, char }); self.index += 1; return char; } pub fn reset(self: *Shorthand) void { self.index = 1; } }; }; }; comptime { std.testing.refAllDecls(@This()); }
src/shared.zig
const std = @import("std"); const c = @import("c.zig"); const vec3 = @import("scene/vec3.zig"); const Shape = @import("scene/shape.zig").Shape; const Material = @import("scene/material.zig").Material; pub const Scene = struct { const Self = @This(); alloc: *std.mem.Allocator, shapes: std.ArrayList(Shape), materials: std.ArrayList(Material), camera: c.rayCamera, pub fn new(alloc: *std.mem.Allocator) Self { return Scene{ .alloc = alloc, .shapes = std.ArrayList(Shape).init(alloc), .materials = std.ArrayList(Material).init(alloc), .camera = default_camera(), }; } pub fn add_cube( self: *Self, center: c.vec3, dx: c.vec3, dy: c.vec3, // dz is implied by cross(dx, dy) size: c.vec3, mat: u32, ) !void { const dz = vec3.cross(dx, dy); const x = vec3.dot(center, dx); const y = vec3.dot(center, dy); const z = vec3.dot(center, dz); try self.shapes.append(Shape.new_finite_plane( dx, x + size.x / 2, dy, .{ .x = y - size.y / 2, .y = y + size.y / 2, .z = z - size.z / 2, .w = z + size.z / 2, }, mat, )); try self.shapes.append(Shape.new_finite_plane( vec3.neg(dx), -(x - size.x / 2), dy, .{ .x = y - size.y / 2, .y = y + size.y / 2, .z = -z - size.z / 2, .w = -z + size.z / 2, }, mat, )); try self.shapes.append(Shape.new_finite_plane( dy, y + size.y / 2, dx, .{ .x = x - size.x / 2, .y = x + size.x / 2, .z = -z - size.z / 2, .w = -z + size.z / 2, }, mat, )); try self.shapes.append(Shape.new_finite_plane( vec3.neg(dy), -(y - size.y / 2), dx, .{ .x = x - size.x / 2, .y = x + size.x / 2, .z = z - size.z / 2, .w = z + size.z / 2, }, mat, )); try self.shapes.append(Shape.new_finite_plane( dz, z + size.z / 2, dx, .{ .x = x - size.x / 2, .y = x + size.x / 2, .z = y - size.y / 2, .w = y + size.y / 2, }, mat, )); try self.shapes.append(Shape.new_finite_plane( vec3.neg(dz), -(z - size.z / 2), dx, .{ .x = x - size.x / 2, .y = x + size.x / 2, .z = -y - size.y / 2, .w = -y + size.y / 2, }, mat, )); } pub fn clone(self: *const Self) !Self { var shapes = try std.ArrayList(Shape).initCapacity( self.alloc, self.shapes.items.len, ); for (self.shapes.items) |s| { try shapes.append(s); } var materials = try std.ArrayList(Material).initCapacity( self.alloc, self.materials.items.len, ); for (self.materials.items) |m| { try materials.append(m); } return Self{ .alloc = self.alloc, .shapes = shapes, .materials = materials, .camera = self.camera, }; } fn default_camera() c.rayCamera { return .{ .pos = .{ .x = 0, .y = 0, .z = 1 }, .target = .{ .x = 0, .y = 0, .z = 0 }, .up = .{ .x = 0, .y = 1, .z = 0 }, .scale = 1, .defocus = 0.02, .perspective = 0.4, .focal_distance = 0.8, }; } pub fn new_material(self: *Self, m: Material) !u32 { try self.materials.append(m); return @intCast(u32, self.materials.items.len - 1); } pub fn deinit(self: *Self) void { self.shapes.deinit(); self.materials.deinit(); } pub fn encode(self: *const Self) ![]c.vec4 { const offset = self.shapes.items.len + 1; // Data is packed into an array of vec4s in a GPU buffer: // num shapes | 0 | 0 | 0 // shape type | data offset | mat offset | mat type // shape type | data offset | mat offset | mat type // shape type | data offset | mat offset | mat type // ... // mat data (arbitrary) // ... // shape data // ... // // Shape data is split between the "stack" (indexed in order, tightly // packed) and "heap" (randomly indexed, arbitrary data). // // Each shape stores an offset for the shape and material data, as well // as tags for shape and material type. // // (strictly speaking, the mat tag is assocated belong with the // material, but we had a spare slot in the vec4, so this saves memory) // Store the list length as the first element var stack = std.ArrayList(c.vec4).init(self.alloc); defer stack.deinit(); try stack.append(.{ .x = @bitCast(f32, @intCast(u32, self.shapes.items.len)), .y = 0, .z = 0, .w = 0, }); var heap = std.ArrayList(c.vec4).init(self.alloc); defer heap.deinit(); // Materials all live on the heap, with tags stored in the shapes var mat_indexes = std.ArrayList(u32).init(self.alloc); defer mat_indexes.deinit(); for (self.materials.items) |m| { try mat_indexes.append(@intCast(u32, offset + heap.items.len)); try m.encode(&heap); } // Encode all of the shapes and their respective data for (self.shapes.items) |s| { // Encode the shape's primary key const m = self.materials.items[s.mat]; try stack.append(.{ .x = @bitCast(f32, s.prim.tag()), // kind .y = @bitCast(f32, @intCast(u32, offset + heap.items.len)), // data offset .z = @bitCast(f32, mat_indexes.items[s.mat]), // mat index .w = @bitCast(f32, m.tag()), // mat tag }); // Encode any data that the shape needs try s.encode(&heap); } for (heap.items) |v| { try stack.append(v); } return stack.toOwnedSlice(); } fn del_shape(self: *Self, index: usize) void { var i = index; while (i < self.shapes.items.len - 1) : (i += 1) { self.shapes.items[i] = self.shapes.items[i + 1]; } _ = self.shapes.pop(); } fn del_material(self: *Self, index: usize) void { var i = index; for (self.shapes.items) |*s| { if (s.mat == index) { s.mat = 0; } else if (s.mat > index) { s.mat -= 1; } } while (i < self.materials.items.len - 1) : (i += 1) { self.materials.items[i] = self.materials.items[i + 1]; } _ = self.materials.pop(); } pub fn draw_shapes_gui(self: *Self) !bool { var changed = false; var i: usize = 0; const num_mats = self.materials.items.len; const width = c.igGetWindowWidth(); while (i < self.shapes.items.len) : (i += 1) { c.igPushIDPtr(@ptrCast(*c_void, &self.shapes.items[i])); c.igText("Shape %i:", i); c.igIndent(c.igGetTreeNodeToLabelSpacing()); changed = (try self.shapes.items[i].draw_gui(num_mats)) or changed; c.igUnindent(c.igGetTreeNodeToLabelSpacing()); const w = width - c.igGetCursorPosX(); c.igIndent(w * 0.25); if (c.igButton("Delete", .{ .x = w * 0.5, .y = 0 })) { changed = true; self.del_shape(i); } c.igUnindent(w * 0.25); c.igSeparator(); c.igPopID(); } const w = width - c.igGetCursorPosX(); c.igIndent(w * 0.25); if (c.igButton("Add shape", .{ .x = w * 0.5, .y = 0 })) { try self.shapes.append(Shape.new_sphere(.{ .x = 0, .y = 0, .z = 0 }, 1, 0)); changed = true; } c.igUnindent(w * 0.25); return changed; } pub fn draw_materials_gui(self: *Self) !bool { var changed = false; var i: usize = 0; const width = c.igGetWindowWidth(); while (i < self.materials.items.len) : (i += 1) { c.igPushIDPtr(@ptrCast(*c_void, &self.materials.items[i])); c.igText("Material %i:", i); c.igIndent(c.igGetTreeNodeToLabelSpacing()); changed = (self.materials.items[i].draw_gui()) or changed; c.igUnindent(c.igGetTreeNodeToLabelSpacing()); const w = width - c.igGetCursorPosX(); c.igIndent(w * 0.25); if (self.materials.items.len > 1 and c.igButton("Delete", .{ .x = w * 0.5, .y = 0 })) { changed = true; self.del_material(i); } c.igUnindent(w * 0.25); c.igSeparator(); c.igPopID(); } const w = c.igGetWindowWidth() - c.igGetCursorPosX(); c.igIndent(w * 0.25); if (c.igButton("Add material", .{ .x = w * 0.5, .y = 0 })) { _ = try self.new_material(Material.new_diffuse(1, 1, 1)); changed = true; } c.igUnindent(w * 0.25); return changed; } pub fn trace_glsl(self: *const Self) ![]const u8 { var arena = std.heap.ArenaAllocator.init(self.alloc); const tmp_alloc: *std.mem.Allocator = &arena.allocator; defer arena.deinit(); var out = try std.fmt.allocPrint(tmp_alloc, \\#version 440 \\#pragma shader_stage(compute) \\#include "shaders/rt_core.comp" \\ \\bool trace(inout uint seed, inout vec3 pos, inout vec3 dir, inout vec4 color) \\{{ \\ float best_dist = 1e8; \\ uint best_hit = 0; \\ float dist; , .{}); var i: usize = 1; for (self.shapes.items) |shape| { const dist = switch (shape.prim) { .Sphere => |s| std.fmt.allocPrint( tmp_alloc, "hit_sphere(pos, dir, vec3({}, {}, {}), {})", .{ s.center.x, s.center.y, s.center.z, s.radius }, ), .InfinitePlane => |s| plane: { const norm = vec3.normalize(s.normal); break :plane std.fmt.allocPrint( tmp_alloc, "hit_plane(pos, dir, vec3({}, {}, {}), {})", .{ norm.x, norm.y, norm.z, s.offset }, ); }, .FinitePlane => |s| plane: { const norm = vec3.normalize(s.normal); const q = vec3.normalize(s.q); break :plane std.fmt.allocPrint( tmp_alloc, \\hit_finite_plane(pos, dir, vec3({}, {}, {}), {}, \\ vec3({}, {}, {}), vec4({}, {}, {}, {})) , .{ norm.x, norm.y, norm.z, s.offset, q.x, q.y, q.z, s.bounds.x, s.bounds.y, s.bounds.z, s.bounds.w, }, ); }, .Cylinder => |s| cyl: { const dir = vec3.normalize(s.dir); break :cyl std.fmt.allocPrint(tmp_alloc, \\hit_cylinder(pos, dir, vec3({}, {}, {}), \\ vec3({}, {}, {}), {}) , .{ s.pos.x, s.pos.y, s.pos.z, dir.x, dir.y, dir.z, s.radius, }); }, .CappedCylinder => |s| capped: { const delta = vec3.sub(s.end, s.pos); const dir = vec3.normalize(delta); break :capped std.fmt.allocPrint( tmp_alloc, \\hit_capped_cylinder(pos, dir, vec3({}, {}, {}), \\ vec3({}, {}, {}), {}, {}) , .{ s.pos.x, s.pos.y, s.pos.z, dir.x, dir.y, dir.z, s.radius, vec3.length(delta), }, ); }, }; out = try std.fmt.allocPrint( tmp_alloc, \\{s} \\ dist = {s}; \\ if (dist > SURFACE_EPSILON && dist < best_dist) {{ \\ best_dist = dist; \\ best_hit = {}; \\ }} , .{ out, dist, i }, ); i += 1; } // Close up the function, and switch to the non-temporary allocator out = try std.fmt.allocPrint(tmp_alloc, \\{s} \\ \\ // If we missed all objects, terminate immediately with blackness \\ if (best_hit == 0) {{ \\ color = vec4(0); \\ return true; \\ }} \\ pos = pos + dir*best_dist; \\ \\ const uvec4 key_arr[] = {{ \\ uvec4(0), // Dummy , .{out}); var mat_count: [c.LAST_MAT]usize = undefined; std.mem.set(usize, mat_count[0..], 1); var mat_index = try tmp_alloc.alloc(usize, self.materials.items.len); i = 0; for (self.materials.items) |mat| { const mat_tag: u32 = mat.tag(); const m = mat_count[mat_tag]; mat_count[mat_tag] += 1; mat_index[i] = m; i += 1; } // Each shape needs to know its material (unless it is LIGHT) // We dispatch first on shape tag (SPHERE / PLANE / etc), then on // sub-index (0-n_shape for each shape type) var shape_count: [c.LAST_SHAPE]usize = undefined; std.mem.set(usize, shape_count[0..], 1); for (self.shapes.items) |shape| { const shape_tag: u32 = shape.prim.tag(); const n = shape_count[shape_tag]; shape_count[shape_tag] += 1; const mat_tag: u32 = self.materials.items[shape.mat].tag(); const m = mat_index[shape.mat]; out = try std.fmt.allocPrint( tmp_alloc, "{s}\n uvec4({}, {}, {}, {}),", .{ out, shape_tag, n, mat_tag, m }, ); } out = try std.fmt.allocPrint(tmp_alloc, \\{s} \\ }}; \\ uvec4 key = key_arr[best_hit]; \\ , .{out}); var sphere_data: []u8 = ""; var plane_data: []u8 = ""; var finite_plane_data: []u8 = ""; var cylinder_data: []u8 = ""; var capped_cylinder_data: []u8 = ""; var diffuse_data: []u8 = ""; var light_data: []u8 = ""; var metal_data: []u8 = ""; var glass_data: []u8 = ""; var laser_data: []u8 = ""; for (self.shapes.items) |shape| { switch (shape.prim) { .Sphere => |s| sphere_data = try std.fmt.allocPrint(tmp_alloc, \\{s} \\ vec3({}, {}, {}), , .{ sphere_data, s.center.x, s.center.y, s.center.z }), .InfinitePlane => |s| { const norm = vec3.normalize(s.normal); plane_data = try std.fmt.allocPrint(tmp_alloc, \\{s} \\ vec3({}, {}, {}), , .{ plane_data, norm.x, norm.y, norm.z }); }, .FinitePlane => |s| { const norm = vec3.normalize(s.normal); finite_plane_data = try std.fmt.allocPrint(tmp_alloc, \\{s} \\ vec3({}, {}, {}), , .{ finite_plane_data, norm.x, norm.y, norm.z }); }, .Cylinder => |s| { const dir = vec3.normalize(s.dir); cylinder_data = try std.fmt.allocPrint(tmp_alloc, \\{s} \\ vec3({}, {}, {}), \\ vec3({}, {}, {}), , .{ cylinder_data, s.pos.x, s.pos.y, s.pos.z, dir.x, dir.y, dir.z, }); }, .CappedCylinder => |s| { const delta = vec3.sub(s.end, s.pos); const dir = vec3.normalize(delta); capped_cylinder_data = try std.fmt.allocPrint(tmp_alloc, \\{s} \\ vec4({}, {}, {}, {}), \\ vec4({}, {}, {}, {}), , .{ capped_cylinder_data, s.pos.x, s.pos.y, s.pos.z, s.radius, dir.x, dir.y, dir.z, vec3.length(delta), }); }, } } for (self.materials.items) |mat| { switch (mat) { .Diffuse => |s| diffuse_data = try std.fmt.allocPrint(tmp_alloc, \\{s} \\ vec3({}, {}, {}), , .{ diffuse_data, s.color.r, s.color.g, s.color.b }), .Light => |s| light_data = try std.fmt.allocPrint(tmp_alloc, \\{s} \\ vec3({}, {}, {}), , .{ light_data, s.color.r * s.intensity, s.color.g * s.intensity, s.color.b * s.intensity }), .Metal => |s| metal_data = try std.fmt.allocPrint(tmp_alloc, \\{s} \\ vec4({}, {}, {}, {}), , .{ metal_data, s.color.r, s.color.g, s.color.b, s.fuzz }), .Glass => |s| glass_data = try std.fmt.allocPrint(tmp_alloc, \\{s} \\ vec2({}, {}), , .{ glass_data, s.eta, s.slope }), .Laser => |s| laser_data = try std.fmt.allocPrint(tmp_alloc, \\{s} \\ vec4({}, {}, {}, {}), , .{ laser_data, s.color.r * s.intensity, s.color.g * s.intensity, s.color.b * s.intensity, s.focus }), .Metaflat => {}, } } out = try std.fmt.allocPrint(tmp_alloc, \\{s} \\ // Calculate normal based on shape type and sub-index \\ vec3 norm = vec3(0); \\ switch (key.x) {{ \\ case SHAPE_SPHERE: {{ \\ // Sphere centers \\ const vec3 data[] = {{ \\ vec3(0), // Dummy{s} \\ }}; \\ norm = norm_sphere(pos, data[key.y]); \\ break; \\ }} \\ case SHAPE_INFINITE_PLANE: {{ \\ // Plane normals \\ const vec3 data[] = {{ \\ vec3(0), // Dummy{s} \\ }}; \\ norm = norm_plane(data[key.y]); \\ break; \\ }} \\ case SHAPE_FINITE_PLANE: {{ \\ // Plane normals \\ const vec3 data[] = {{ \\ vec3(0), // Dummy{s} \\ }}; \\ norm = norm_plane(data[key.y]); \\ break; \\ }} \\ case SHAPE_CYLINDER: {{ \\ // Cylinder centers \\ const vec3 data[] = {{ \\ vec3(0), // Dummy{s} \\ }}; \\ norm = norm_cylinder(pos, data[key.y*2 - 1], data[key.y*2]); \\ break; \\ }} \\ case SHAPE_CAPPED_CYLINDER: {{ \\ // Cylinder centers \\ const vec4 data[] = {{ \\ vec4(0), // Dummy{s} \\ }}; \\ norm = norm_capped_cylinder( \\ pos, data[key.y*2 - 1].xyz, \\ data[key.y*2].xyz, data[key.y*2].w); \\ break; \\ }} \\ }} \\ \\ // Calculate material behavior based on mat type and sub-index \\ switch (key.z) {{ \\ case MAT_DIFFUSE: {{ \\ const vec3 data[] = {{ \\ vec3(0), // Dummy{s} \\ }}; \\ return mat_diffuse(seed, color, dir, norm, data[key.w]); \\ }} \\ case MAT_LIGHT: {{ \\ const vec3 data[] = {{ \\ vec3(0), // Dummy{s} \\ }}; \\ return mat_light(color, data[key.w]); \\ }} \\ case MAT_METAL: {{ \\ // R, G, B, fuzz \\ const vec4 data[] = {{ \\ vec4(0), // Dummy{s} \\ }}; \\ vec4 m = data[key.w]; \\ return mat_metal(seed, color, dir, norm, m.xyz, m.w); \\ }} \\ case MAT_GLASS: {{ \\ // R, G, B, eta \\ const vec2 data[] = {{ \\ vec2(0), // Dummy{s} \\ }}; \\ vec2 m = data[key.w]; \\ return mat_glass(seed, color, dir, norm, m.x, m.y); \\ }} \\ case MAT_LASER: {{ \\ // R, G, B, focus \\ const vec4 data[] = {{ \\ vec4(0), // Dummy{s} \\ }}; \\ vec4 m = data[key.w]; \\ return mat_laser(color, dir, norm, m.xyz, m.w); \\ }} \\ case MAT_METAFLAT: {{ \\ // No parameters \\ return mat_metaflat(seed, dir, norm); \\ }} \\ }} \\ \\ // Reaching here is an error, so set the color to green and terminate \\ color = vec4(0, 1, 0, 0); \\ return true; \\}} , .{ out, sphere_data, plane_data, finite_plane_data, cylinder_data, capped_cylinder_data, diffuse_data, light_data, metal_data, glass_data, laser_data, }); // Dupe to the standard allocator, so it won't be freed return self.alloc.dupe(u8, out); } };
src/scene.zig
const clz = @import("count0bits.zig"); const testing = @import("std").testing; fn test__clzdi2(a: u64, expected: i64) !void { var x = @bitCast(i64, a); var result = clz.__clzdi2(x); try testing.expectEqual(expected, result); } test "clzdi2" { try test__clzdi2(0x00800000_00000000, 8); try test__clzdi2(0x01000000_00000000, 7); try test__clzdi2(0x02000000_00000000, 6); try test__clzdi2(0x03000000_00000000, 6); try test__clzdi2(0x04000000_00000000, 5); try test__clzdi2(0x05000000_00000000, 5); try test__clzdi2(0x06000000_00000000, 5); try test__clzdi2(0x07000000_00000000, 5); try test__clzdi2(0x08000000_00000000, 4); try test__clzdi2(0x09000000_00000000, 4); try test__clzdi2(0x0A000000_00000000, 4); try test__clzdi2(0x0B000000_00000000, 4); try test__clzdi2(0x0C000000_00000000, 4); try test__clzdi2(0x0D000000_00000000, 4); try test__clzdi2(0x0E000000_00000000, 4); try test__clzdi2(0x0F000000_00000000, 4); try test__clzdi2(0x10000000_00000000, 3); try test__clzdi2(0x11000000_00000000, 3); try test__clzdi2(0x12000000_00000000, 3); try test__clzdi2(0x13000000_00000000, 3); try test__clzdi2(0x14000000_00000000, 3); try test__clzdi2(0x15000000_00000000, 3); try test__clzdi2(0x16000000_00000000, 3); try test__clzdi2(0x17000000_00000000, 3); try test__clzdi2(0x18000000_00000000, 3); try test__clzdi2(0x19000000_00000000, 3); try test__clzdi2(0x1A000000_00000000, 3); try test__clzdi2(0x1B000000_00000000, 3); try test__clzdi2(0x1C000000_00000000, 3); try test__clzdi2(0x1D000000_00000000, 3); try test__clzdi2(0x1E000000_00000000, 3); try test__clzdi2(0x1F000000_00000000, 3); try test__clzdi2(0x20000000_00000000, 2); try test__clzdi2(0x21000000_00000000, 2); try test__clzdi2(0x22000000_00000000, 2); try test__clzdi2(0x23000000_00000000, 2); try test__clzdi2(0x24000000_00000000, 2); try test__clzdi2(0x25000000_00000000, 2); try test__clzdi2(0x26000000_00000000, 2); try test__clzdi2(0x27000000_00000000, 2); try test__clzdi2(0x28000000_00000000, 2); try test__clzdi2(0x29000000_00000000, 2); try test__clzdi2(0x2A000000_00000000, 2); try test__clzdi2(0x2B000000_00000000, 2); try test__clzdi2(0x2C000000_00000000, 2); try test__clzdi2(0x2D000000_00000000, 2); try test__clzdi2(0x2E000000_00000000, 2); try test__clzdi2(0x2F000000_00000000, 2); try test__clzdi2(0x30000000_00000000, 2); try test__clzdi2(0x31000000_00000000, 2); try test__clzdi2(0x32000000_00000000, 2); try test__clzdi2(0x33000000_00000000, 2); try test__clzdi2(0x34000000_00000000, 2); try test__clzdi2(0x35000000_00000000, 2); try test__clzdi2(0x36000000_00000000, 2); try test__clzdi2(0x37000000_00000000, 2); try test__clzdi2(0x38000000_00000000, 2); try test__clzdi2(0x39000000_00000000, 2); try test__clzdi2(0x3A000000_00000000, 2); try test__clzdi2(0x3B000000_00000000, 2); try test__clzdi2(0x3C000000_00000000, 2); try test__clzdi2(0x3D000000_00000000, 2); try test__clzdi2(0x3E000000_00000000, 2); try test__clzdi2(0x3F000000_00000000, 2); try test__clzdi2(0x40000000_00000000, 1); try test__clzdi2(0x41000000_00000000, 1); try test__clzdi2(0x42000000_00000000, 1); try test__clzdi2(0x43000000_00000000, 1); try test__clzdi2(0x44000000_00000000, 1); try test__clzdi2(0x45000000_00000000, 1); try test__clzdi2(0x46000000_00000000, 1); try test__clzdi2(0x47000000_00000000, 1); try test__clzdi2(0x48000000_00000000, 1); try test__clzdi2(0x49000000_00000000, 1); try test__clzdi2(0x4A000000_00000000, 1); try test__clzdi2(0x4B000000_00000000, 1); try test__clzdi2(0x4C000000_00000000, 1); try test__clzdi2(0x4D000000_00000000, 1); try test__clzdi2(0x4E000000_00000000, 1); try test__clzdi2(0x4F000000_00000000, 1); try test__clzdi2(0x50000000_00000000, 1); try test__clzdi2(0x51000000_00000000, 1); try test__clzdi2(0x52000000_00000000, 1); try test__clzdi2(0x53000000_00000000, 1); try test__clzdi2(0x54000000_00000000, 1); try test__clzdi2(0x55000000_00000000, 1); try test__clzdi2(0x56000000_00000000, 1); try test__clzdi2(0x57000000_00000000, 1); try test__clzdi2(0x58000000_00000000, 1); try test__clzdi2(0x59000000_00000000, 1); try test__clzdi2(0x5A000000_00000000, 1); try test__clzdi2(0x5B000000_00000000, 1); try test__clzdi2(0x5C000000_00000000, 1); try test__clzdi2(0x5D000000_00000000, 1); try test__clzdi2(0x5E000000_00000000, 1); try test__clzdi2(0x5F000000_00000000, 1); try test__clzdi2(0x60000000_00000000, 1); try test__clzdi2(0x61000000_00000000, 1); try test__clzdi2(0x62000000_00000000, 1); try test__clzdi2(0x63000000_00000000, 1); try test__clzdi2(0x64000000_00000000, 1); try test__clzdi2(0x65000000_00000000, 1); try test__clzdi2(0x66000000_00000000, 1); try test__clzdi2(0x67000000_00000000, 1); try test__clzdi2(0x68000000_00000000, 1); try test__clzdi2(0x69000000_00000000, 1); try test__clzdi2(0x6A000000_00000000, 1); try test__clzdi2(0x6B000000_00000000, 1); try test__clzdi2(0x6C000000_00000000, 1); try test__clzdi2(0x6D000000_00000000, 1); try test__clzdi2(0x6E000000_00000000, 1); try test__clzdi2(0x6F000000_00000000, 1); try test__clzdi2(0x70000000_00000000, 1); try test__clzdi2(0x71000000_00000000, 1); try test__clzdi2(0x72000000_00000000, 1); try test__clzdi2(0x73000000_00000000, 1); try test__clzdi2(0x74000000_00000000, 1); try test__clzdi2(0x75000000_00000000, 1); try test__clzdi2(0x76000000_00000000, 1); try test__clzdi2(0x77000000_00000000, 1); try test__clzdi2(0x78000000_00000000, 1); try test__clzdi2(0x79000000_00000000, 1); try test__clzdi2(0x7A000000_00000000, 1); try test__clzdi2(0x7B000000_00000000, 1); try test__clzdi2(0x7C000000_00000000, 1); try test__clzdi2(0x7D000000_00000000, 1); try test__clzdi2(0x7E000000_00000000, 1); try test__clzdi2(0x7F000000_00000000, 1); try test__clzdi2(0x80000000_00000000, 0); try test__clzdi2(0x81000000_00000000, 0); try test__clzdi2(0x82000000_00000000, 0); try test__clzdi2(0x83000000_00000000, 0); try test__clzdi2(0x84000000_00000000, 0); try test__clzdi2(0x85000000_00000000, 0); try test__clzdi2(0x86000000_00000000, 0); try test__clzdi2(0x87000000_00000000, 0); try test__clzdi2(0x88000000_00000000, 0); try test__clzdi2(0x89000000_00000000, 0); try test__clzdi2(0x8A000000_00000000, 0); try test__clzdi2(0x8B000000_00000000, 0); try test__clzdi2(0x8C000000_00000000, 0); try test__clzdi2(0x8D000000_00000000, 0); try test__clzdi2(0x8E000000_00000000, 0); try test__clzdi2(0x8F000000_00000000, 0); try test__clzdi2(0x90000000_00000000, 0); try test__clzdi2(0x91000000_00000000, 0); try test__clzdi2(0x92000000_00000000, 0); try test__clzdi2(0x93000000_00000000, 0); try test__clzdi2(0x94000000_00000000, 0); try test__clzdi2(0x95000000_00000000, 0); try test__clzdi2(0x96000000_00000000, 0); try test__clzdi2(0x97000000_00000000, 0); try test__clzdi2(0x98000000_00000000, 0); try test__clzdi2(0x99000000_00000000, 0); try test__clzdi2(0x9A000000_00000000, 0); try test__clzdi2(0x9B000000_00000000, 0); try test__clzdi2(0x9C000000_00000000, 0); try test__clzdi2(0x9D000000_00000000, 0); try test__clzdi2(0x9E000000_00000000, 0); try test__clzdi2(0x9F000000_00000000, 0); try test__clzdi2(0xA0000000_00000000, 0); try test__clzdi2(0xA1000000_00000000, 0); try test__clzdi2(0xA2000000_00000000, 0); try test__clzdi2(0xA3000000_00000000, 0); try test__clzdi2(0xA4000000_00000000, 0); try test__clzdi2(0xA5000000_00000000, 0); try test__clzdi2(0xA6000000_00000000, 0); try test__clzdi2(0xA7000000_00000000, 0); try test__clzdi2(0xA8000000_00000000, 0); try test__clzdi2(0xA9000000_00000000, 0); try test__clzdi2(0xAA000000_00000000, 0); try test__clzdi2(0xAB000000_00000000, 0); try test__clzdi2(0xAC000000_00000000, 0); try test__clzdi2(0xAD000000_00000000, 0); try test__clzdi2(0xAE000000_00000000, 0); try test__clzdi2(0xAF000000_00000000, 0); try test__clzdi2(0xB0000000_00000000, 0); try test__clzdi2(0xB1000000_00000000, 0); try test__clzdi2(0xB2000000_00000000, 0); try test__clzdi2(0xB3000000_00000000, 0); try test__clzdi2(0xB4000000_00000000, 0); try test__clzdi2(0xB5000000_00000000, 0); try test__clzdi2(0xB6000000_00000000, 0); try test__clzdi2(0xB7000000_00000000, 0); try test__clzdi2(0xB8000000_00000000, 0); try test__clzdi2(0xB9000000_00000000, 0); try test__clzdi2(0xBA000000_00000000, 0); try test__clzdi2(0xBB000000_00000000, 0); try test__clzdi2(0xBC000000_00000000, 0); try test__clzdi2(0xBD000000_00000000, 0); try test__clzdi2(0xBE000000_00000000, 0); try test__clzdi2(0xBF000000_00000000, 0); try test__clzdi2(0xC0000000_00000000, 0); try test__clzdi2(0xC1000000_00000000, 0); try test__clzdi2(0xC2000000_00000000, 0); try test__clzdi2(0xC3000000_00000000, 0); try test__clzdi2(0xC4000000_00000000, 0); try test__clzdi2(0xC5000000_00000000, 0); try test__clzdi2(0xC6000000_00000000, 0); try test__clzdi2(0xC7000000_00000000, 0); try test__clzdi2(0xC8000000_00000000, 0); try test__clzdi2(0xC9000000_00000000, 0); try test__clzdi2(0xCA000000_00000000, 0); try test__clzdi2(0xCB000000_00000000, 0); try test__clzdi2(0xCC000000_00000000, 0); try test__clzdi2(0xCD000000_00000000, 0); try test__clzdi2(0xCE000000_00000000, 0); try test__clzdi2(0xCF000000_00000000, 0); try test__clzdi2(0xD0000000_00000000, 0); try test__clzdi2(0xD1000000_00000000, 0); try test__clzdi2(0xD2000000_00000000, 0); try test__clzdi2(0xD3000000_00000000, 0); try test__clzdi2(0xD4000000_00000000, 0); try test__clzdi2(0xD5000000_00000000, 0); try test__clzdi2(0xD6000000_00000000, 0); try test__clzdi2(0xD7000000_00000000, 0); try test__clzdi2(0xD8000000_00000000, 0); try test__clzdi2(0xD9000000_00000000, 0); try test__clzdi2(0xDA000000_00000000, 0); try test__clzdi2(0xDB000000_00000000, 0); try test__clzdi2(0xDC000000_00000000, 0); try test__clzdi2(0xDD000000_00000000, 0); try test__clzdi2(0xDE000000_00000000, 0); try test__clzdi2(0xDF000000_00000000, 0); try test__clzdi2(0xE0000000_00000000, 0); try test__clzdi2(0xE1000000_00000000, 0); try test__clzdi2(0xE2000000_00000000, 0); try test__clzdi2(0xE3000000_00000000, 0); try test__clzdi2(0xE4000000_00000000, 0); try test__clzdi2(0xE5000000_00000000, 0); try test__clzdi2(0xE6000000_00000000, 0); try test__clzdi2(0xE7000000_00000000, 0); try test__clzdi2(0xE8000000_00000000, 0); try test__clzdi2(0xE9000000_00000000, 0); try test__clzdi2(0xEA000000_00000000, 0); try test__clzdi2(0xEB000000_00000000, 0); try test__clzdi2(0xEC000000_00000000, 0); try test__clzdi2(0xED000000_00000000, 0); try test__clzdi2(0xEE000000_00000000, 0); try test__clzdi2(0xEF000000_00000000, 0); try test__clzdi2(0xF0000000_00000000, 0); try test__clzdi2(0xF1000000_00000000, 0); try test__clzdi2(0xF2000000_00000000, 0); try test__clzdi2(0xF3000000_00000000, 0); try test__clzdi2(0xF4000000_00000000, 0); try test__clzdi2(0xF5000000_00000000, 0); try test__clzdi2(0xF6000000_00000000, 0); try test__clzdi2(0xF7000000_00000000, 0); try test__clzdi2(0xF8000000_00000000, 0); try test__clzdi2(0xF9000000_00000000, 0); try test__clzdi2(0xFA000000_00000000, 0); try test__clzdi2(0xFB000000_00000000, 0); try test__clzdi2(0xFC000000_00000000, 0); try test__clzdi2(0xFD000000_00000000, 0); try test__clzdi2(0xFE000000_00000000, 0); try test__clzdi2(0xFF000000_00000000, 0); try test__clzdi2(0x00000000_00000000, 64); try test__clzdi2(0x00000000_00000001, 63); try test__clzdi2(0x00000000_00000002, 62); try test__clzdi2(0x00000000_00000004, 61); try test__clzdi2(0x00000000_00000008, 60); try test__clzdi2(0x00000000_00000010, 59); try test__clzdi2(0x00000000_00000020, 58); try test__clzdi2(0x00000000_00000040, 57); try test__clzdi2(0x00000000_00000080, 56); try test__clzdi2(0x00000000_00000100, 55); try test__clzdi2(0x00000000_00000200, 54); try test__clzdi2(0x00000000_00000400, 53); try test__clzdi2(0x00000000_00000800, 52); try test__clzdi2(0x00000000_00001000, 51); try test__clzdi2(0x00000000_00002000, 50); try test__clzdi2(0x00000000_00004000, 49); try test__clzdi2(0x00000000_00008000, 48); try test__clzdi2(0x00000000_00010000, 47); try test__clzdi2(0x00000000_00020000, 46); try test__clzdi2(0x00000000_00040000, 45); try test__clzdi2(0x00000000_00080000, 44); try test__clzdi2(0x00000000_00100000, 43); try test__clzdi2(0x00000000_00200000, 42); try test__clzdi2(0x00000000_00400000, 41); try test__clzdi2(0x00000000_00800000, 40); try test__clzdi2(0x00000000_01000000, 39); try test__clzdi2(0x00000000_02000000, 38); try test__clzdi2(0x00000000_04000000, 37); try test__clzdi2(0x00000000_08000000, 36); try test__clzdi2(0x00000000_10000000, 35); try test__clzdi2(0x00000000_20000000, 34); try test__clzdi2(0x00000000_40000000, 33); try test__clzdi2(0x00000000_80000000, 32); try test__clzdi2(0x00000001_00000000, 31); try test__clzdi2(0x00000002_00000000, 30); try test__clzdi2(0x00000004_00000000, 29); try test__clzdi2(0x00000008_00000000, 28); try test__clzdi2(0x00000010_00000000, 27); try test__clzdi2(0x00000020_00000000, 26); try test__clzdi2(0x00000040_00000000, 25); try test__clzdi2(0x00000080_00000000, 24); try test__clzdi2(0x00000100_00000000, 23); try test__clzdi2(0x00000200_00000000, 22); try test__clzdi2(0x00000400_00000000, 21); try test__clzdi2(0x00000800_00000000, 20); try test__clzdi2(0x00001000_00000000, 19); try test__clzdi2(0x00002000_00000000, 18); try test__clzdi2(0x00004000_00000000, 17); try test__clzdi2(0x00008000_00000000, 16); try test__clzdi2(0x00010000_00000000, 15); try test__clzdi2(0x00020000_00000000, 14); try test__clzdi2(0x00040000_00000000, 13); try test__clzdi2(0x00080000_00000000, 12); try test__clzdi2(0x00100000_00000000, 11); try test__clzdi2(0x00200000_00000000, 10); try test__clzdi2(0x00400000_00000000, 9); }
lib/std/special/compiler_rt/clzdi2_test.zig
const device = @import("device.zig"); const dtb = @import("dtb.zig"); const log = @import("log.zig"); extern fn __delay(count: i32) void; /// Register offsets. const Reg = enum(u32) { DR = 0x000, RSRECR = 0x004, FR = 0x018, ILPR = 0x020, IBRD = 0x024, FBRD = 0x028, LCR_H = 0x02C, CR = 0x030, IFLS = 0x034, IMSC = 0x038, RIS = 0x03C, MIS = 0x040, ICR = 0x044, DMACR = 0x048, ITCR = 0x080, ITIP = 0x084, ITOP = 0x088, TDR = 0x08C, PeriphID0 = 0xFE0, PeriphID1 = 0xFE4, PeriphID2 = 0xFE8, PeriphID3 = 0xFEC, PCellID0 = 0xFF0, PCellID1 = 0xFF4, PCellID2 = 0xFF8, PCellID3 = 0xFFC, }; // Flag bits for the UARTFR register. const FR_CTS = 1 << 0; const FR_DSR = 1 << 1; const FR_DCD = 1 << 2; const FR_BUSY = 1 << 3; const FR_RXFE = 1 << 4; const FR_TXFF = 1 << 5; const FR_RXFF = 1 << 6; const FR_TXFE = 1 << 7; const FR_RI = 1 << 8; // Flag bits for the UARTLCR_H register. const LCR_H_BRK = 1 << 0; const LCR_H_PEN = 1 << 1; const LCR_H_EPS = 1 << 2; const LCR_H_STP2 = 1 << 3; const LCR_H_FEN = 1 << 4; const LCR_H_SPS = 1 << 6; // Flag bits for the UARTCR register. const CR_UARTEN = 1 << 0; const CR_SIREN = 1 << 1; const CR_SIRLP = 1 << 2; const CR_LBE = 1 << 7; const CR_TXE = 1 << 8; const CR_RXE = 1 << 9; const CR_DTR = 1 << 10; const CR_RTS = 1 << 11; const CR_Out1 = 1 << 12; const CR_Out2 = 1 << 13; const CR_RTSEn = 1 << 14; const CR_CTSEn = 1 << 15; pub const pl011 = struct { const Self = @This(); dev: device.MMIOPeripheralDevice(Reg), fn setBaudRate(self: Self, clock: u32, baud: u32) void { const divider = @divFloor(clock, 16 * baud); const fract = @divFloor(64 * clock, 16 * baud) - 64 * divider; self.dev.writeReg(.IBRD, divider); self.dev.writeReg(.FBRD, fract); } pub fn enable(self: Self, clock: u32, baud: u32) void { self.setBaudRate(clock, baud); // Enable FIFO and 8 bit data transmission (1 stop bit, no parity). self.dev.writeReg(.LCR_H, LCR_H_FEN | (0b11 << 5)); // Mask all interrupts. self.dev.writeReg(.IMSC, (1 << 10) - 1); // Enable UART, transmit and receive. self.dev.writeReg(.CR, CR_UARTEN | CR_TXE | CR_RXE); } /// Blocking read of a single character. pub fn read(self: Self) u8 { // Wait until there is data in the receive FIFO. while ((self.dev.readReg(.FR) & FR_RXFE) != 0) {} return self.dev.readReg(.DR); } /// Blocking write of a single character. pub fn write(self: Self, c: u8) void { // Wait until there is space in the transmit FIFO. while ((self.dev.readReg(.FR) & FR_TXFF) != 0) {} self.dev.writeReg(.DR, c); } pub fn probe(node: dtb.Node) !Self { const self = Self{ .dev = try device.MMIOPeripheralDevice(Reg).init(node) }; // Disable everything. self.dev.writeReg(.CR, 0x00000000); // Clear all pending interrupts. self.dev.writeReg(.ICR, 0x7FF); return self; } };
pl011.zig
const std = @import("std"); const zangscript = @import("zangscript"); const ParsedBuiltins = @import("zangc/parse_builtins.zig").ParsedBuiltins; const parseBuiltins = @import("zangc/parse_builtins.zig").parseBuiltins; const dumpBuiltins = @import("zangc/dump_builtins.zig").dumpBuiltins; // TODO add an option called `--check` or something, to skip final zig codegen. // TODO allow --add-builtins and --dump-builtins to be used with no input script at all fn usage(out: *std.fs.File.OutStream, program_name: []const u8) !void { try out.print("Usage: {} [options...] -o <dest> <file>\n\n", .{program_name}); try out.writeAll( \\Compile the zangscript source at <file> into Zig code. \\ \\ --add-builtins <file> Import native modules from the given Zig source \\ file. Can be used more than once \\ --dump-parse <file> Dump result of parse stage to file \\ --dump-codegen <file> Dump result of codegen stage to file \\ --dump-builtins <file> Dump information on all default and custom \\ builtins to file \\ --help Print this help text \\ -o, --output <file> Write Zig code to this file \\ --color <when> Colorize compile errors; 'when' can be 'auto' \\ (default if omitted), 'always', or 'never' \\ ); } const Options = struct { const Color = enum { auto, always, never }; arena: std.heap.ArenaAllocator, script_filename: []const u8, output_filename: []const u8, builtin_filenames: []const []const u8, dump_parse_filename: ?[]const u8, dump_codegen_filename: ?[]const u8, dump_builtins_filename: ?[]const u8, color: Color, fn deinit(self: Options) void { self.arena.deinit(); } }; const OptionsParser = struct { arena_allocator: *std.mem.Allocator, stderr: *std.fs.File.OutStream, args: std.process.ArgIterator, program: []const u8, fn init(arena_allocator: *std.mem.Allocator, stderr: *std.fs.File.OutStream) !OptionsParser { var args = std.process.args(); const program = try args.next(arena_allocator) orelse "zangc"; return OptionsParser{ .arena_allocator = arena_allocator, .stderr = stderr, .args = args, .program = program, }; } fn next(self: *OptionsParser) !?[]const u8 { return try self.args.next(self.arena_allocator) orelse return null; } fn argWithValue(self: *OptionsParser, arg: []const u8, comptime variants: []const []const u8) !?[]const u8 { for (variants) |variant| { if (std.mem.eql(u8, arg, variant)) break; } else return null; const value = try self.args.next(self.arena_allocator) orelse return self.argError("missing value for '{}'\n", .{arg}); return value; } fn argError(self: OptionsParser, comptime fmt: []const u8, args: var) error{ArgError} { self.stderr.print("{}: ", .{self.program}) catch {}; self.stderr.print(fmt, args) catch {}; self.stderr.print("Try '{} --help' for more information.\n", .{self.program}) catch {}; return error.ArgError; } }; fn parseOptions(stderr: *std.fs.File.OutStream, allocator: *std.mem.Allocator) !?Options { var arena = std.heap.ArenaAllocator.init(allocator); errdefer arena.deinit(); var help = false; var script_filename: ?[]const u8 = null; var output_filename: ?[]const u8 = null; var builtin_filenames = std.ArrayList([]const u8).init(&arena.allocator); var dump_parse_filename: ?[]const u8 = null; var dump_codegen_filename: ?[]const u8 = null; var dump_builtins_filename: ?[]const u8 = null; var color: Options.Color = .auto; var parser = try OptionsParser.init(&arena.allocator, stderr); while (try parser.next()) |arg| { if (std.mem.eql(u8, arg, "--help")) { help = true; } else if (try parser.argWithValue(arg, &[_][]const u8{ "--output", "-o" })) |value| { output_filename = value; } else if (try parser.argWithValue(arg, &[_][]const u8{"--add-builtins"})) |value| { try builtin_filenames.append(value); } else if (try parser.argWithValue(arg, &[_][]const u8{"--dump-parse"})) |value| { dump_parse_filename = value; } else if (try parser.argWithValue(arg, &[_][]const u8{"--dump-codegen"})) |value| { dump_codegen_filename = value; } else if (try parser.argWithValue(arg, &[_][]const u8{"--dump-builtins"})) |value| { dump_builtins_filename = value; } else if (try parser.argWithValue(arg, &[_][]const u8{"--color"})) |value| { if (std.mem.eql(u8, value, "auto")) { color = .auto; } else if (std.mem.eql(u8, value, "always")) { color = .always; } else if (std.mem.eql(u8, value, "never")) { color = .never; } else { return parser.argError("invalid value '{}' for '{}'; must be one of 'auto', 'always', 'never'\n", .{ value, arg }); } } else if (std.mem.startsWith(u8, arg, "-")) { return parser.argError("unrecognized option '{}'\n", .{arg}); } else { script_filename = arg; } } if (help) { defer arena.deinit(); var stdout = std.io.getStdOut().outStream(); try usage(&stdout, parser.program); return null; } return Options{ .arena = arena, .script_filename = script_filename orelse return parser.argError("missing file operand\n", .{}), .output_filename = output_filename orelse return parser.argError("missing --output argument\n", .{}), .builtin_filenames = builtin_filenames.items, .dump_parse_filename = dump_parse_filename, .dump_codegen_filename = dump_codegen_filename, .dump_builtins_filename = dump_builtins_filename, .color = color, }; } fn loadFile(stderr: *std.fs.File.OutStream, allocator: *std.mem.Allocator, filename: []const u8) ![]const u8 { return std.fs.cwd().readFileAlloc(allocator, filename, 16 * 1024 * 1024) catch |err| { stderr.print("failed to load {}: {}\n", .{ filename, err }) catch {}; return error.Failed; }; } fn createFile(stderr: *std.fs.File.OutStream, filename: []const u8) !std.fs.File { return std.fs.cwd().createFile(filename, .{}) catch |err| { stderr.print("failed to open {} for writing: {}\n", .{ filename, err }) catch {}; return error.Failed; }; } fn mainInner(stderr: *std.fs.File.OutStream) !void { var leak_count_allocator = std.testing.LeakCountAllocator.init(std.heap.page_allocator); defer leak_count_allocator.validate() catch {}; var allocator = &leak_count_allocator.allocator; // parse command line options const maybe_options = try parseOptions(stderr, allocator); const options = maybe_options orelse return; // we're done already if `--help` flag was passed defer options.deinit(); // prepare builtin packages var builtin_packages = std.ArrayList(zangscript.BuiltinPackage).init(allocator); defer builtin_packages.deinit(); var custom_builtins_arena = std.heap.ArenaAllocator.init(allocator); defer custom_builtins_arena.deinit(); // add default builtin package try builtin_packages.append(zangscript.zang_builtin_package); // add custom builtin packages, if any were passed for (options.builtin_filenames) |filename, i| { const contents = try loadFile(stderr, allocator, filename); defer allocator.free(contents); // make a unique name for the top level decl we'll assign the import to in the generated zig code. // start with an underscore because such identifiers are illegal in zangscript so there's no chance of collision var buf: [100]u8 = undefined; var fbs = std.io.fixedBufferStream(&buf); fbs.outStream().print("_custom{}", .{i}) catch unreachable; const name = fbs.getWritten(); // generated zig code will be importing this file, so get a path relative to the output zig file const dirname = std.fs.path.dirname(options.output_filename) orelse return error.NoDirName; const rel_path = try std.fs.path.relative(&custom_builtins_arena.allocator, dirname, filename); const pkg = try parseBuiltins(&custom_builtins_arena.allocator, allocator, stderr, name, rel_path, contents); try builtin_packages.append(pkg); } // dump info about builtins if (options.dump_builtins_filename) |filename| { var file = try createFile(stderr, filename); defer file.close(); try dumpBuiltins(@as(std.io.StreamSource, .{ .file = file }).outStream(), builtin_packages.items); } // read in source file const contents = try loadFile(stderr, allocator, options.script_filename); defer allocator.free(contents); // set up context for parse and codegen const errors_file = std.io.getStdErr(); const context: zangscript.Context = .{ .builtin_packages = builtin_packages.items, .source = .{ .filename = options.script_filename, .contents = contents }, .errors_out = @as(std.io.StreamSource, .{ .file = errors_file }).outStream(), .errors_color = switch (options.color) { .auto => errors_file.isTty(), .always => true, .never => false, }, }; // parse var parse_result = blk: { if (options.dump_parse_filename) |filename| { var file = try createFile(stderr, filename); defer file.close(); break :blk try zangscript.parse(context, allocator, @as(std.io.StreamSource, .{ .file = file }).outStream()); } else { break :blk try zangscript.parse(context, allocator, null); } }; defer parse_result.deinit(); // codegen var codegen_result = blk: { if (options.dump_codegen_filename) |filename| { var file = try createFile(stderr, filename); defer file.close(); break :blk try zangscript.codegen(context, parse_result, allocator, @as(std.io.StreamSource, .{ .file = file }).outStream()); } else { break :blk try zangscript.codegen(context, parse_result, allocator, null); } }; defer codegen_result.deinit(); // assemble CompiledScript object var script: zangscript.CompiledScript = .{ .parse_arena = parse_result.arena, .codegen_arena = codegen_result.arena, .curves = parse_result.curves, .tracks = parse_result.tracks, .modules = parse_result.modules, .track_results = codegen_result.track_results, .module_results = codegen_result.module_results, .exported_modules = codegen_result.exported_modules, }; // (don't use script.deinit() - we are already deiniting parse and codegen results individually) // generate zig code var file = try createFile(stderr, options.output_filename); defer file.close(); try zangscript.generateZig(@as(std.io.StreamSource, .{ .file = file }).outStream(), builtin_packages.items, script); } pub fn main() u8 { var stderr = std.debug.getStderrStream(); mainInner(stderr) catch |err| { // Failed or ArgError means a message has already been printed if (err != error.Failed and err != error.ArgError) { stderr.print("failed: {}\n", .{err}) catch {}; } return 1; }; return 0; }
tools/zangc.zig
pub const GL_VERSION_1_1 = @as(u32, 1); pub const GL_ACCUM = @as(u32, 256); pub const GL_LOAD = @as(u32, 257); pub const GL_RETURN = @as(u32, 258); pub const GL_MULT = @as(u32, 259); pub const GL_ADD = @as(u32, 260); pub const GL_NEVER = @as(u32, 512); pub const GL_LESS = @as(u32, 513); pub const GL_EQUAL = @as(u32, 514); pub const GL_LEQUAL = @as(u32, 515); pub const GL_GREATER = @as(u32, 516); pub const GL_NOTEQUAL = @as(u32, 517); pub const GL_GEQUAL = @as(u32, 518); pub const GL_ALWAYS = @as(u32, 519); pub const GL_CURRENT_BIT = @as(u32, 1); pub const GL_POINT_BIT = @as(u32, 2); pub const GL_LINE_BIT = @as(u32, 4); pub const GL_POLYGON_BIT = @as(u32, 8); pub const GL_POLYGON_STIPPLE_BIT = @as(u32, 16); pub const GL_PIXEL_MODE_BIT = @as(u32, 32); pub const GL_LIGHTING_BIT = @as(u32, 64); pub const GL_FOG_BIT = @as(u32, 128); pub const GL_DEPTH_BUFFER_BIT = @as(u32, 256); pub const GL_ACCUM_BUFFER_BIT = @as(u32, 512); pub const GL_STENCIL_BUFFER_BIT = @as(u32, 1024); pub const GL_VIEWPORT_BIT = @as(u32, 2048); pub const GL_TRANSFORM_BIT = @as(u32, 4096); pub const GL_ENABLE_BIT = @as(u32, 8192); pub const GL_COLOR_BUFFER_BIT = @as(u32, 16384); pub const GL_HINT_BIT = @as(u32, 32768); pub const GL_EVAL_BIT = @as(u32, 65536); pub const GL_LIST_BIT = @as(u32, 131072); pub const GL_TEXTURE_BIT = @as(u32, 262144); pub const GL_SCISSOR_BIT = @as(u32, 524288); pub const GL_ALL_ATTRIB_BITS = @as(u32, 1048575); pub const GL_POINTS = @as(u32, 0); pub const GL_LINES = @as(u32, 1); pub const GL_LINE_LOOP = @as(u32, 2); pub const GL_LINE_STRIP = @as(u32, 3); pub const GL_TRIANGLES = @as(u32, 4); pub const GL_TRIANGLE_STRIP = @as(u32, 5); pub const GL_TRIANGLE_FAN = @as(u32, 6); pub const GL_QUADS = @as(u32, 7); pub const GL_QUAD_STRIP = @as(u32, 8); pub const GL_POLYGON = @as(u32, 9); pub const GL_ZERO = @as(u32, 0); pub const GL_ONE = @as(u32, 1); pub const GL_SRC_COLOR = @as(u32, 768); pub const GL_ONE_MINUS_SRC_COLOR = @as(u32, 769); pub const GL_SRC_ALPHA = @as(u32, 770); pub const GL_ONE_MINUS_SRC_ALPHA = @as(u32, 771); pub const GL_DST_ALPHA = @as(u32, 772); pub const GL_ONE_MINUS_DST_ALPHA = @as(u32, 773); pub const GL_DST_COLOR = @as(u32, 774); pub const GL_ONE_MINUS_DST_COLOR = @as(u32, 775); pub const GL_SRC_ALPHA_SATURATE = @as(u32, 776); pub const GL_TRUE = @as(u32, 1); pub const GL_FALSE = @as(u32, 0); pub const GL_CLIP_PLANE0 = @as(u32, 12288); pub const GL_CLIP_PLANE1 = @as(u32, 12289); pub const GL_CLIP_PLANE2 = @as(u32, 12290); pub const GL_CLIP_PLANE3 = @as(u32, 12291); pub const GL_CLIP_PLANE4 = @as(u32, 12292); pub const GL_CLIP_PLANE5 = @as(u32, 12293); pub const GL_BYTE = @as(u32, 5120); pub const GL_UNSIGNED_BYTE = @as(u32, 5121); pub const GL_SHORT = @as(u32, 5122); pub const GL_UNSIGNED_SHORT = @as(u32, 5123); pub const GL_INT = @as(u32, 5124); pub const GL_UNSIGNED_INT = @as(u32, 5125); pub const GL_FLOAT = @as(u32, 5126); pub const GL_2_BYTES = @as(u32, 5127); pub const GL_3_BYTES = @as(u32, 5128); pub const GL_4_BYTES = @as(u32, 5129); pub const GL_DOUBLE = @as(u32, 5130); pub const GL_NONE = @as(u32, 0); pub const GL_FRONT_LEFT = @as(u32, 1024); pub const GL_FRONT_RIGHT = @as(u32, 1025); pub const GL_BACK_LEFT = @as(u32, 1026); pub const GL_BACK_RIGHT = @as(u32, 1027); pub const GL_FRONT = @as(u32, 1028); pub const GL_BACK = @as(u32, 1029); pub const GL_LEFT = @as(u32, 1030); pub const GL_RIGHT = @as(u32, 1031); pub const GL_FRONT_AND_BACK = @as(u32, 1032); pub const GL_AUX0 = @as(u32, 1033); pub const GL_AUX1 = @as(u32, 1034); pub const GL_AUX2 = @as(u32, 1035); pub const GL_AUX3 = @as(u32, 1036); pub const GL_NO_ERROR = @as(u32, 0); pub const GL_INVALID_ENUM = @as(u32, 1280); pub const GL_INVALID_VALUE = @as(u32, 1281); pub const GL_INVALID_OPERATION = @as(u32, 1282); pub const GL_STACK_OVERFLOW = @as(u32, 1283); pub const GL_STACK_UNDERFLOW = @as(u32, 1284); pub const GL_OUT_OF_MEMORY = @as(u32, 1285); pub const GL_2D = @as(u32, 1536); pub const GL_3D = @as(u32, 1537); pub const GL_3D_COLOR = @as(u32, 1538); pub const GL_3D_COLOR_TEXTURE = @as(u32, 1539); pub const GL_4D_COLOR_TEXTURE = @as(u32, 1540); pub const GL_PASS_THROUGH_TOKEN = @as(u32, 1792); pub const GL_POINT_TOKEN = @as(u32, 1793); pub const GL_LINE_TOKEN = @as(u32, 1794); pub const GL_POLYGON_TOKEN = @as(u32, 1795); pub const GL_BITMAP_TOKEN = @as(u32, 1796); pub const GL_DRAW_PIXEL_TOKEN = @as(u32, 1797); pub const GL_COPY_PIXEL_TOKEN = @as(u32, 1798); pub const GL_LINE_RESET_TOKEN = @as(u32, 1799); pub const GL_EXP = @as(u32, 2048); pub const GL_EXP2 = @as(u32, 2049); pub const GL_CW = @as(u32, 2304); pub const GL_CCW = @as(u32, 2305); pub const GL_COEFF = @as(u32, 2560); pub const GL_ORDER = @as(u32, 2561); pub const GL_DOMAIN = @as(u32, 2562); pub const GL_CURRENT_COLOR = @as(u32, 2816); pub const GL_CURRENT_INDEX = @as(u32, 2817); pub const GL_CURRENT_NORMAL = @as(u32, 2818); pub const GL_CURRENT_TEXTURE_COORDS = @as(u32, 2819); pub const GL_CURRENT_RASTER_COLOR = @as(u32, 2820); pub const GL_CURRENT_RASTER_INDEX = @as(u32, 2821); pub const GL_CURRENT_RASTER_TEXTURE_COORDS = @as(u32, 2822); pub const GL_CURRENT_RASTER_POSITION = @as(u32, 2823); pub const GL_CURRENT_RASTER_POSITION_VALID = @as(u32, 2824); pub const GL_CURRENT_RASTER_DISTANCE = @as(u32, 2825); pub const GL_POINT_SMOOTH = @as(u32, 2832); pub const GL_POINT_SIZE = @as(u32, 2833); pub const GL_POINT_SIZE_RANGE = @as(u32, 2834); pub const GL_POINT_SIZE_GRANULARITY = @as(u32, 2835); pub const GL_LINE_SMOOTH = @as(u32, 2848); pub const GL_LINE_WIDTH = @as(u32, 2849); pub const GL_LINE_WIDTH_RANGE = @as(u32, 2850); pub const GL_LINE_WIDTH_GRANULARITY = @as(u32, 2851); pub const GL_LINE_STIPPLE = @as(u32, 2852); pub const GL_LINE_STIPPLE_PATTERN = @as(u32, 2853); pub const GL_LINE_STIPPLE_REPEAT = @as(u32, 2854); pub const GL_LIST_MODE = @as(u32, 2864); pub const GL_MAX_LIST_NESTING = @as(u32, 2865); pub const GL_LIST_BASE = @as(u32, 2866); pub const GL_LIST_INDEX = @as(u32, 2867); pub const GL_POLYGON_MODE = @as(u32, 2880); pub const GL_POLYGON_SMOOTH = @as(u32, 2881); pub const GL_POLYGON_STIPPLE = @as(u32, 2882); pub const GL_EDGE_FLAG = @as(u32, 2883); pub const GL_CULL_FACE = @as(u32, 2884); pub const GL_CULL_FACE_MODE = @as(u32, 2885); pub const GL_FRONT_FACE = @as(u32, 2886); pub const GL_LIGHTING = @as(u32, 2896); pub const GL_LIGHT_MODEL_LOCAL_VIEWER = @as(u32, 2897); pub const GL_LIGHT_MODEL_TWO_SIDE = @as(u32, 2898); pub const GL_LIGHT_MODEL_AMBIENT = @as(u32, 2899); pub const GL_SHADE_MODEL = @as(u32, 2900); pub const GL_COLOR_MATERIAL_FACE = @as(u32, 2901); pub const GL_COLOR_MATERIAL_PARAMETER = @as(u32, 2902); pub const GL_COLOR_MATERIAL = @as(u32, 2903); pub const GL_FOG = @as(u32, 2912); pub const GL_FOG_INDEX = @as(u32, 2913); pub const GL_FOG_DENSITY = @as(u32, 2914); pub const GL_FOG_START = @as(u32, 2915); pub const GL_FOG_END = @as(u32, 2916); pub const GL_FOG_MODE = @as(u32, 2917); pub const GL_FOG_COLOR = @as(u32, 2918); pub const GL_DEPTH_RANGE = @as(u32, 2928); pub const GL_DEPTH_TEST = @as(u32, 2929); pub const GL_DEPTH_WRITEMASK = @as(u32, 2930); pub const GL_DEPTH_CLEAR_VALUE = @as(u32, 2931); pub const GL_DEPTH_FUNC = @as(u32, 2932); pub const GL_ACCUM_CLEAR_VALUE = @as(u32, 2944); pub const GL_STENCIL_TEST = @as(u32, 2960); pub const GL_STENCIL_CLEAR_VALUE = @as(u32, 2961); pub const GL_STENCIL_FUNC = @as(u32, 2962); pub const GL_STENCIL_VALUE_MASK = @as(u32, 2963); pub const GL_STENCIL_FAIL = @as(u32, 2964); pub const GL_STENCIL_PASS_DEPTH_FAIL = @as(u32, 2965); pub const GL_STENCIL_PASS_DEPTH_PASS = @as(u32, 2966); pub const GL_STENCIL_REF = @as(u32, 2967); pub const GL_STENCIL_WRITEMASK = @as(u32, 2968); pub const GL_MATRIX_MODE = @as(u32, 2976); pub const GL_NORMALIZE = @as(u32, 2977); pub const GL_VIEWPORT = @as(u32, 2978); pub const GL_MODELVIEW_STACK_DEPTH = @as(u32, 2979); pub const GL_PROJECTION_STACK_DEPTH = @as(u32, 2980); pub const GL_TEXTURE_STACK_DEPTH = @as(u32, 2981); pub const GL_MODELVIEW_MATRIX = @as(u32, 2982); pub const GL_PROJECTION_MATRIX = @as(u32, 2983); pub const GL_TEXTURE_MATRIX = @as(u32, 2984); pub const GL_ATTRIB_STACK_DEPTH = @as(u32, 2992); pub const GL_CLIENT_ATTRIB_STACK_DEPTH = @as(u32, 2993); pub const GL_ALPHA_TEST = @as(u32, 3008); pub const GL_ALPHA_TEST_FUNC = @as(u32, 3009); pub const GL_ALPHA_TEST_REF = @as(u32, 3010); pub const GL_DITHER = @as(u32, 3024); pub const GL_BLEND_DST = @as(u32, 3040); pub const GL_BLEND_SRC = @as(u32, 3041); pub const GL_BLEND = @as(u32, 3042); pub const GL_LOGIC_OP_MODE = @as(u32, 3056); pub const GL_INDEX_LOGIC_OP = @as(u32, 3057); pub const GL_COLOR_LOGIC_OP = @as(u32, 3058); pub const GL_AUX_BUFFERS = @as(u32, 3072); pub const GL_DRAW_BUFFER = @as(u32, 3073); pub const GL_READ_BUFFER = @as(u32, 3074); pub const GL_SCISSOR_BOX = @as(u32, 3088); pub const GL_SCISSOR_TEST = @as(u32, 3089); pub const GL_INDEX_CLEAR_VALUE = @as(u32, 3104); pub const GL_INDEX_WRITEMASK = @as(u32, 3105); pub const GL_COLOR_CLEAR_VALUE = @as(u32, 3106); pub const GL_COLOR_WRITEMASK = @as(u32, 3107); pub const GL_INDEX_MODE = @as(u32, 3120); pub const GL_RGBA_MODE = @as(u32, 3121); pub const GL_DOUBLEBUFFER = @as(u32, 3122); pub const GL_STEREO = @as(u32, 3123); pub const GL_RENDER_MODE = @as(u32, 3136); pub const GL_PERSPECTIVE_CORRECTION_HINT = @as(u32, 3152); pub const GL_POINT_SMOOTH_HINT = @as(u32, 3153); pub const GL_LINE_SMOOTH_HINT = @as(u32, 3154); pub const GL_POLYGON_SMOOTH_HINT = @as(u32, 3155); pub const GL_FOG_HINT = @as(u32, 3156); pub const GL_TEXTURE_GEN_S = @as(u32, 3168); pub const GL_TEXTURE_GEN_T = @as(u32, 3169); pub const GL_TEXTURE_GEN_R = @as(u32, 3170); pub const GL_TEXTURE_GEN_Q = @as(u32, 3171); pub const GL_PIXEL_MAP_I_TO_I = @as(u32, 3184); pub const GL_PIXEL_MAP_S_TO_S = @as(u32, 3185); pub const GL_PIXEL_MAP_I_TO_R = @as(u32, 3186); pub const GL_PIXEL_MAP_I_TO_G = @as(u32, 3187); pub const GL_PIXEL_MAP_I_TO_B = @as(u32, 3188); pub const GL_PIXEL_MAP_I_TO_A = @as(u32, 3189); pub const GL_PIXEL_MAP_R_TO_R = @as(u32, 3190); pub const GL_PIXEL_MAP_G_TO_G = @as(u32, 3191); pub const GL_PIXEL_MAP_B_TO_B = @as(u32, 3192); pub const GL_PIXEL_MAP_A_TO_A = @as(u32, 3193); pub const GL_PIXEL_MAP_I_TO_I_SIZE = @as(u32, 3248); pub const GL_PIXEL_MAP_S_TO_S_SIZE = @as(u32, 3249); pub const GL_PIXEL_MAP_I_TO_R_SIZE = @as(u32, 3250); pub const GL_PIXEL_MAP_I_TO_G_SIZE = @as(u32, 3251); pub const GL_PIXEL_MAP_I_TO_B_SIZE = @as(u32, 3252); pub const GL_PIXEL_MAP_I_TO_A_SIZE = @as(u32, 3253); pub const GL_PIXEL_MAP_R_TO_R_SIZE = @as(u32, 3254); pub const GL_PIXEL_MAP_G_TO_G_SIZE = @as(u32, 3255); pub const GL_PIXEL_MAP_B_TO_B_SIZE = @as(u32, 3256); pub const GL_PIXEL_MAP_A_TO_A_SIZE = @as(u32, 3257); pub const GL_UNPACK_SWAP_BYTES = @as(u32, 3312); pub const GL_UNPACK_LSB_FIRST = @as(u32, 3313); pub const GL_UNPACK_ROW_LENGTH = @as(u32, 3314); pub const GL_UNPACK_SKIP_ROWS = @as(u32, 3315); pub const GL_UNPACK_SKIP_PIXELS = @as(u32, 3316); pub const GL_UNPACK_ALIGNMENT = @as(u32, 3317); pub const GL_PACK_SWAP_BYTES = @as(u32, 3328); pub const GL_PACK_LSB_FIRST = @as(u32, 3329); pub const GL_PACK_ROW_LENGTH = @as(u32, 3330); pub const GL_PACK_SKIP_ROWS = @as(u32, 3331); pub const GL_PACK_SKIP_PIXELS = @as(u32, 3332); pub const GL_PACK_ALIGNMENT = @as(u32, 3333); pub const GL_MAP_COLOR = @as(u32, 3344); pub const GL_MAP_STENCIL = @as(u32, 3345); pub const GL_INDEX_SHIFT = @as(u32, 3346); pub const GL_INDEX_OFFSET = @as(u32, 3347); pub const GL_RED_SCALE = @as(u32, 3348); pub const GL_RED_BIAS = @as(u32, 3349); pub const GL_ZOOM_X = @as(u32, 3350); pub const GL_ZOOM_Y = @as(u32, 3351); pub const GL_GREEN_SCALE = @as(u32, 3352); pub const GL_GREEN_BIAS = @as(u32, 3353); pub const GL_BLUE_SCALE = @as(u32, 3354); pub const GL_BLUE_BIAS = @as(u32, 3355); pub const GL_ALPHA_SCALE = @as(u32, 3356); pub const GL_ALPHA_BIAS = @as(u32, 3357); pub const GL_DEPTH_SCALE = @as(u32, 3358); pub const GL_DEPTH_BIAS = @as(u32, 3359); pub const GL_MAX_EVAL_ORDER = @as(u32, 3376); pub const GL_MAX_LIGHTS = @as(u32, 3377); pub const GL_MAX_CLIP_PLANES = @as(u32, 3378); pub const GL_MAX_TEXTURE_SIZE = @as(u32, 3379); pub const GL_MAX_PIXEL_MAP_TABLE = @as(u32, 3380); pub const GL_MAX_ATTRIB_STACK_DEPTH = @as(u32, 3381); pub const GL_MAX_MODELVIEW_STACK_DEPTH = @as(u32, 3382); pub const GL_MAX_NAME_STACK_DEPTH = @as(u32, 3383); pub const GL_MAX_PROJECTION_STACK_DEPTH = @as(u32, 3384); pub const GL_MAX_TEXTURE_STACK_DEPTH = @as(u32, 3385); pub const GL_MAX_VIEWPORT_DIMS = @as(u32, 3386); pub const GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = @as(u32, 3387); pub const GL_SUBPIXEL_BITS = @as(u32, 3408); pub const GL_INDEX_BITS = @as(u32, 3409); pub const GL_RED_BITS = @as(u32, 3410); pub const GL_GREEN_BITS = @as(u32, 3411); pub const GL_BLUE_BITS = @as(u32, 3412); pub const GL_ALPHA_BITS = @as(u32, 3413); pub const GL_DEPTH_BITS = @as(u32, 3414); pub const GL_STENCIL_BITS = @as(u32, 3415); pub const GL_ACCUM_RED_BITS = @as(u32, 3416); pub const GL_ACCUM_GREEN_BITS = @as(u32, 3417); pub const GL_ACCUM_BLUE_BITS = @as(u32, 3418); pub const GL_ACCUM_ALPHA_BITS = @as(u32, 3419); pub const GL_NAME_STACK_DEPTH = @as(u32, 3440); pub const GL_AUTO_NORMAL = @as(u32, 3456); pub const GL_MAP1_COLOR_4 = @as(u32, 3472); pub const GL_MAP1_INDEX = @as(u32, 3473); pub const GL_MAP1_NORMAL = @as(u32, 3474); pub const GL_MAP1_TEXTURE_COORD_1 = @as(u32, 3475); pub const GL_MAP1_TEXTURE_COORD_2 = @as(u32, 3476); pub const GL_MAP1_TEXTURE_COORD_3 = @as(u32, 3477); pub const GL_MAP1_TEXTURE_COORD_4 = @as(u32, 3478); pub const GL_MAP1_VERTEX_3 = @as(u32, 3479); pub const GL_MAP1_VERTEX_4 = @as(u32, 3480); pub const GL_MAP2_COLOR_4 = @as(u32, 3504); pub const GL_MAP2_INDEX = @as(u32, 3505); pub const GL_MAP2_NORMAL = @as(u32, 3506); pub const GL_MAP2_TEXTURE_COORD_1 = @as(u32, 3507); pub const GL_MAP2_TEXTURE_COORD_2 = @as(u32, 3508); pub const GL_MAP2_TEXTURE_COORD_3 = @as(u32, 3509); pub const GL_MAP2_TEXTURE_COORD_4 = @as(u32, 3510); pub const GL_MAP2_VERTEX_3 = @as(u32, 3511); pub const GL_MAP2_VERTEX_4 = @as(u32, 3512); pub const GL_MAP1_GRID_DOMAIN = @as(u32, 3536); pub const GL_MAP1_GRID_SEGMENTS = @as(u32, 3537); pub const GL_MAP2_GRID_DOMAIN = @as(u32, 3538); pub const GL_MAP2_GRID_SEGMENTS = @as(u32, 3539); pub const GL_TEXTURE_1D = @as(u32, 3552); pub const GL_TEXTURE_2D = @as(u32, 3553); pub const GL_FEEDBACK_BUFFER_POINTER = @as(u32, 3568); pub const GL_FEEDBACK_BUFFER_SIZE = @as(u32, 3569); pub const GL_FEEDBACK_BUFFER_TYPE = @as(u32, 3570); pub const GL_SELECTION_BUFFER_POINTER = @as(u32, 3571); pub const GL_SELECTION_BUFFER_SIZE = @as(u32, 3572); pub const GL_TEXTURE_WIDTH = @as(u32, 4096); pub const GL_TEXTURE_HEIGHT = @as(u32, 4097); pub const GL_TEXTURE_INTERNAL_FORMAT = @as(u32, 4099); pub const GL_TEXTURE_BORDER_COLOR = @as(u32, 4100); pub const GL_TEXTURE_BORDER = @as(u32, 4101); pub const GL_DONT_CARE = @as(u32, 4352); pub const GL_FASTEST = @as(u32, 4353); pub const GL_NICEST = @as(u32, 4354); pub const GL_LIGHT0 = @as(u32, 16384); pub const GL_LIGHT1 = @as(u32, 16385); pub const GL_LIGHT2 = @as(u32, 16386); pub const GL_LIGHT3 = @as(u32, 16387); pub const GL_LIGHT4 = @as(u32, 16388); pub const GL_LIGHT5 = @as(u32, 16389); pub const GL_LIGHT6 = @as(u32, 16390); pub const GL_LIGHT7 = @as(u32, 16391); pub const GL_AMBIENT = @as(u32, 4608); pub const GL_DIFFUSE = @as(u32, 4609); pub const GL_SPECULAR = @as(u32, 4610); pub const GL_POSITION = @as(u32, 4611); pub const GL_SPOT_DIRECTION = @as(u32, 4612); pub const GL_SPOT_EXPONENT = @as(u32, 4613); pub const GL_SPOT_CUTOFF = @as(u32, 4614); pub const GL_CONSTANT_ATTENUATION = @as(u32, 4615); pub const GL_LINEAR_ATTENUATION = @as(u32, 4616); pub const GL_QUADRATIC_ATTENUATION = @as(u32, 4617); pub const GL_COMPILE = @as(u32, 4864); pub const GL_COMPILE_AND_EXECUTE = @as(u32, 4865); pub const GL_CLEAR = @as(u32, 5376); pub const GL_AND = @as(u32, 5377); pub const GL_AND_REVERSE = @as(u32, 5378); pub const GL_COPY = @as(u32, 5379); pub const GL_AND_INVERTED = @as(u32, 5380); pub const GL_NOOP = @as(u32, 5381); pub const GL_XOR = @as(u32, 5382); pub const GL_OR = @as(u32, 5383); pub const GL_NOR = @as(u32, 5384); pub const GL_EQUIV = @as(u32, 5385); pub const GL_INVERT = @as(u32, 5386); pub const GL_OR_REVERSE = @as(u32, 5387); pub const GL_COPY_INVERTED = @as(u32, 5388); pub const GL_OR_INVERTED = @as(u32, 5389); pub const GL_NAND = @as(u32, 5390); pub const GL_SET = @as(u32, 5391); pub const GL_EMISSION = @as(u32, 5632); pub const GL_SHININESS = @as(u32, 5633); pub const GL_AMBIENT_AND_DIFFUSE = @as(u32, 5634); pub const GL_COLOR_INDEXES = @as(u32, 5635); pub const GL_MODELVIEW = @as(u32, 5888); pub const GL_PROJECTION = @as(u32, 5889); pub const GL_TEXTURE = @as(u32, 5890); pub const GL_COLOR = @as(u32, 6144); pub const GL_DEPTH = @as(u32, 6145); pub const GL_STENCIL = @as(u32, 6146); pub const GL_COLOR_INDEX = @as(u32, 6400); pub const GL_STENCIL_INDEX = @as(u32, 6401); pub const GL_DEPTH_COMPONENT = @as(u32, 6402); pub const GL_RED = @as(u32, 6403); pub const GL_GREEN = @as(u32, 6404); pub const GL_BLUE = @as(u32, 6405); pub const GL_ALPHA = @as(u32, 6406); pub const GL_RGB = @as(u32, 6407); pub const GL_RGBA = @as(u32, 6408); pub const GL_LUMINANCE = @as(u32, 6409); pub const GL_LUMINANCE_ALPHA = @as(u32, 6410); pub const GL_BITMAP = @as(u32, 6656); pub const GL_POINT = @as(u32, 6912); pub const GL_LINE = @as(u32, 6913); pub const GL_FILL = @as(u32, 6914); pub const GL_RENDER = @as(u32, 7168); pub const GL_FEEDBACK = @as(u32, 7169); pub const GL_SELECT = @as(u32, 7170); pub const GL_FLAT = @as(u32, 7424); pub const GL_SMOOTH = @as(u32, 7425); pub const GL_KEEP = @as(u32, 7680); pub const GL_REPLACE = @as(u32, 7681); pub const GL_INCR = @as(u32, 7682); pub const GL_DECR = @as(u32, 7683); pub const GL_VENDOR = @as(u32, 7936); pub const GL_RENDERER = @as(u32, 7937); pub const GL_VERSION = @as(u32, 7938); pub const GL_EXTENSIONS = @as(u32, 7939); pub const GL_S = @as(u32, 8192); pub const GL_T = @as(u32, 8193); pub const GL_R = @as(u32, 8194); pub const GL_Q = @as(u32, 8195); pub const GL_MODULATE = @as(u32, 8448); pub const GL_DECAL = @as(u32, 8449); pub const GL_TEXTURE_ENV_MODE = @as(u32, 8704); pub const GL_TEXTURE_ENV_COLOR = @as(u32, 8705); pub const GL_TEXTURE_ENV = @as(u32, 8960); pub const GL_EYE_LINEAR = @as(u32, 9216); pub const GL_OBJECT_LINEAR = @as(u32, 9217); pub const GL_SPHERE_MAP = @as(u32, 9218); pub const GL_TEXTURE_GEN_MODE = @as(u32, 9472); pub const GL_OBJECT_PLANE = @as(u32, 9473); pub const GL_EYE_PLANE = @as(u32, 9474); pub const GL_NEAREST = @as(u32, 9728); pub const GL_LINEAR = @as(u32, 9729); pub const GL_NEAREST_MIPMAP_NEAREST = @as(u32, 9984); pub const GL_LINEAR_MIPMAP_NEAREST = @as(u32, 9985); pub const GL_NEAREST_MIPMAP_LINEAR = @as(u32, 9986); pub const GL_LINEAR_MIPMAP_LINEAR = @as(u32, 9987); pub const GL_TEXTURE_MAG_FILTER = @as(u32, 10240); pub const GL_TEXTURE_MIN_FILTER = @as(u32, 10241); pub const GL_TEXTURE_WRAP_S = @as(u32, 10242); pub const GL_TEXTURE_WRAP_T = @as(u32, 10243); pub const GL_CLAMP = @as(u32, 10496); pub const GL_REPEAT = @as(u32, 10497); pub const GL_CLIENT_PIXEL_STORE_BIT = @as(u32, 1); pub const GL_CLIENT_VERTEX_ARRAY_BIT = @as(u32, 2); pub const GL_CLIENT_ALL_ATTRIB_BITS = @as(u32, 4294967295); pub const GL_POLYGON_OFFSET_FACTOR = @as(u32, 32824); pub const GL_POLYGON_OFFSET_UNITS = @as(u32, 10752); pub const GL_POLYGON_OFFSET_POINT = @as(u32, 10753); pub const GL_POLYGON_OFFSET_LINE = @as(u32, 10754); pub const GL_POLYGON_OFFSET_FILL = @as(u32, 32823); pub const GL_ALPHA4 = @as(u32, 32827); pub const GL_ALPHA8 = @as(u32, 32828); pub const GL_ALPHA12 = @as(u32, 32829); pub const GL_ALPHA16 = @as(u32, 32830); pub const GL_LUMINANCE4 = @as(u32, 32831); pub const GL_LUMINANCE8 = @as(u32, 32832); pub const GL_LUMINANCE12 = @as(u32, 32833); pub const GL_LUMINANCE16 = @as(u32, 32834); pub const GL_LUMINANCE4_ALPHA4 = @as(u32, 32835); pub const GL_LUMINANCE6_ALPHA2 = @as(u32, 32836); pub const GL_LUMINANCE8_ALPHA8 = @as(u32, 32837); pub const GL_LUMINANCE12_ALPHA4 = @as(u32, 32838); pub const GL_LUMINANCE12_ALPHA12 = @as(u32, 32839); pub const GL_LUMINANCE16_ALPHA16 = @as(u32, 32840); pub const GL_INTENSITY = @as(u32, 32841); pub const GL_INTENSITY4 = @as(u32, 32842); pub const GL_INTENSITY8 = @as(u32, 32843); pub const GL_INTENSITY12 = @as(u32, 32844); pub const GL_INTENSITY16 = @as(u32, 32845); pub const GL_R3_G3_B2 = @as(u32, 10768); pub const GL_RGB4 = @as(u32, 32847); pub const GL_RGB5 = @as(u32, 32848); pub const GL_RGB8 = @as(u32, 32849); pub const GL_RGB10 = @as(u32, 32850); pub const GL_RGB12 = @as(u32, 32851); pub const GL_RGB16 = @as(u32, 32852); pub const GL_RGBA2 = @as(u32, 32853); pub const GL_RGBA4 = @as(u32, 32854); pub const GL_RGB5_A1 = @as(u32, 32855); pub const GL_RGBA8 = @as(u32, 32856); pub const GL_RGB10_A2 = @as(u32, 32857); pub const GL_RGBA12 = @as(u32, 32858); pub const GL_RGBA16 = @as(u32, 32859); pub const GL_TEXTURE_RED_SIZE = @as(u32, 32860); pub const GL_TEXTURE_GREEN_SIZE = @as(u32, 32861); pub const GL_TEXTURE_BLUE_SIZE = @as(u32, 32862); pub const GL_TEXTURE_ALPHA_SIZE = @as(u32, 32863); pub const GL_TEXTURE_LUMINANCE_SIZE = @as(u32, 32864); pub const GL_TEXTURE_INTENSITY_SIZE = @as(u32, 32865); pub const GL_PROXY_TEXTURE_1D = @as(u32, 32867); pub const GL_PROXY_TEXTURE_2D = @as(u32, 32868); pub const GL_TEXTURE_PRIORITY = @as(u32, 32870); pub const GL_TEXTURE_RESIDENT = @as(u32, 32871); pub const GL_TEXTURE_BINDING_1D = @as(u32, 32872); pub const GL_TEXTURE_BINDING_2D = @as(u32, 32873); pub const GL_VERTEX_ARRAY = @as(u32, 32884); pub const GL_NORMAL_ARRAY = @as(u32, 32885); pub const GL_COLOR_ARRAY = @as(u32, 32886); pub const GL_INDEX_ARRAY = @as(u32, 32887); pub const GL_TEXTURE_COORD_ARRAY = @as(u32, 32888); pub const GL_EDGE_FLAG_ARRAY = @as(u32, 32889); pub const GL_VERTEX_ARRAY_SIZE = @as(u32, 32890); pub const GL_VERTEX_ARRAY_TYPE = @as(u32, 32891); pub const GL_VERTEX_ARRAY_STRIDE = @as(u32, 32892); pub const GL_NORMAL_ARRAY_TYPE = @as(u32, 32894); pub const GL_NORMAL_ARRAY_STRIDE = @as(u32, 32895); pub const GL_COLOR_ARRAY_SIZE = @as(u32, 32897); pub const GL_COLOR_ARRAY_TYPE = @as(u32, 32898); pub const GL_COLOR_ARRAY_STRIDE = @as(u32, 32899); pub const GL_INDEX_ARRAY_TYPE = @as(u32, 32901); pub const GL_INDEX_ARRAY_STRIDE = @as(u32, 32902); pub const GL_TEXTURE_COORD_ARRAY_SIZE = @as(u32, 32904); pub const GL_TEXTURE_COORD_ARRAY_TYPE = @as(u32, 32905); pub const GL_TEXTURE_COORD_ARRAY_STRIDE = @as(u32, 32906); pub const GL_EDGE_FLAG_ARRAY_STRIDE = @as(u32, 32908); pub const GL_VERTEX_ARRAY_POINTER = @as(u32, 32910); pub const GL_NORMAL_ARRAY_POINTER = @as(u32, 32911); pub const GL_COLOR_ARRAY_POINTER = @as(u32, 32912); pub const GL_INDEX_ARRAY_POINTER = @as(u32, 32913); pub const GL_TEXTURE_COORD_ARRAY_POINTER = @as(u32, 32914); pub const GL_EDGE_FLAG_ARRAY_POINTER = @as(u32, 32915); pub const GL_V2F = @as(u32, 10784); pub const GL_V3F = @as(u32, 10785); pub const GL_C4UB_V2F = @as(u32, 10786); pub const GL_C4UB_V3F = @as(u32, 10787); pub const GL_C3F_V3F = @as(u32, 10788); pub const GL_N3F_V3F = @as(u32, 10789); pub const GL_C4F_N3F_V3F = @as(u32, 10790); pub const GL_T2F_V3F = @as(u32, 10791); pub const GL_T4F_V4F = @as(u32, 10792); pub const GL_T2F_C4UB_V3F = @as(u32, 10793); pub const GL_T2F_C3F_V3F = @as(u32, 10794); pub const GL_T2F_N3F_V3F = @as(u32, 10795); pub const GL_T2F_C4F_N3F_V3F = @as(u32, 10796); pub const GL_T4F_C4F_N3F_V4F = @as(u32, 10797); pub const GL_EXT_vertex_array = @as(u32, 1); pub const GL_EXT_bgra = @as(u32, 1); pub const GL_EXT_paletted_texture = @as(u32, 1); pub const GL_WIN_swap_hint = @as(u32, 1); pub const GL_WIN_draw_range_elements = @as(u32, 1); pub const GL_VERTEX_ARRAY_EXT = @as(u32, 32884); pub const GL_NORMAL_ARRAY_EXT = @as(u32, 32885); pub const GL_COLOR_ARRAY_EXT = @as(u32, 32886); pub const GL_INDEX_ARRAY_EXT = @as(u32, 32887); pub const GL_TEXTURE_COORD_ARRAY_EXT = @as(u32, 32888); pub const GL_EDGE_FLAG_ARRAY_EXT = @as(u32, 32889); pub const GL_VERTEX_ARRAY_SIZE_EXT = @as(u32, 32890); pub const GL_VERTEX_ARRAY_TYPE_EXT = @as(u32, 32891); pub const GL_VERTEX_ARRAY_STRIDE_EXT = @as(u32, 32892); pub const GL_VERTEX_ARRAY_COUNT_EXT = @as(u32, 32893); pub const GL_NORMAL_ARRAY_TYPE_EXT = @as(u32, 32894); pub const GL_NORMAL_ARRAY_STRIDE_EXT = @as(u32, 32895); pub const GL_NORMAL_ARRAY_COUNT_EXT = @as(u32, 32896); pub const GL_COLOR_ARRAY_SIZE_EXT = @as(u32, 32897); pub const GL_COLOR_ARRAY_TYPE_EXT = @as(u32, 32898); pub const GL_COLOR_ARRAY_STRIDE_EXT = @as(u32, 32899); pub const GL_COLOR_ARRAY_COUNT_EXT = @as(u32, 32900); pub const GL_INDEX_ARRAY_TYPE_EXT = @as(u32, 32901); pub const GL_INDEX_ARRAY_STRIDE_EXT = @as(u32, 32902); pub const GL_INDEX_ARRAY_COUNT_EXT = @as(u32, 32903); pub const GL_TEXTURE_COORD_ARRAY_SIZE_EXT = @as(u32, 32904); pub const GL_TEXTURE_COORD_ARRAY_TYPE_EXT = @as(u32, 32905); pub const GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = @as(u32, 32906); pub const GL_TEXTURE_COORD_ARRAY_COUNT_EXT = @as(u32, 32907); pub const GL_EDGE_FLAG_ARRAY_STRIDE_EXT = @as(u32, 32908); pub const GL_EDGE_FLAG_ARRAY_COUNT_EXT = @as(u32, 32909); pub const GL_VERTEX_ARRAY_POINTER_EXT = @as(u32, 32910); pub const GL_NORMAL_ARRAY_POINTER_EXT = @as(u32, 32911); pub const GL_COLOR_ARRAY_POINTER_EXT = @as(u32, 32912); pub const GL_INDEX_ARRAY_POINTER_EXT = @as(u32, 32913); pub const GL_TEXTURE_COORD_ARRAY_POINTER_EXT = @as(u32, 32914); pub const GL_EDGE_FLAG_ARRAY_POINTER_EXT = @as(u32, 32915); pub const GL_DOUBLE_EXT = @as(u32, 5130); pub const GL_BGR_EXT = @as(u32, 32992); pub const GL_BGRA_EXT = @as(u32, 32993); pub const GL_COLOR_TABLE_FORMAT_EXT = @as(u32, 32984); pub const GL_COLOR_TABLE_WIDTH_EXT = @as(u32, 32985); pub const GL_COLOR_TABLE_RED_SIZE_EXT = @as(u32, 32986); pub const GL_COLOR_TABLE_GREEN_SIZE_EXT = @as(u32, 32987); pub const GL_COLOR_TABLE_BLUE_SIZE_EXT = @as(u32, 32988); pub const GL_COLOR_TABLE_ALPHA_SIZE_EXT = @as(u32, 32989); pub const GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = @as(u32, 32990); pub const GL_COLOR_TABLE_INTENSITY_SIZE_EXT = @as(u32, 32991); pub const GL_COLOR_INDEX1_EXT = @as(u32, 32994); pub const GL_COLOR_INDEX2_EXT = @as(u32, 32995); pub const GL_COLOR_INDEX4_EXT = @as(u32, 32996); pub const GL_COLOR_INDEX8_EXT = @as(u32, 32997); pub const GL_COLOR_INDEX12_EXT = @as(u32, 32998); pub const GL_COLOR_INDEX16_EXT = @as(u32, 32999); pub const GL_MAX_ELEMENTS_VERTICES_WIN = @as(u32, 33000); pub const GL_MAX_ELEMENTS_INDICES_WIN = @as(u32, 33001); pub const GL_PHONG_WIN = @as(u32, 33002); pub const GL_PHONG_HINT_WIN = @as(u32, 33003); pub const GL_FOG_SPECULAR_TEXTURE_WIN = @as(u32, 33004); pub const GL_LOGIC_OP = @as(u32, 3057); pub const GL_TEXTURE_COMPONENTS = @as(u32, 4099); pub const GLU_VERSION_1_1 = @as(u32, 1); pub const GLU_VERSION_1_2 = @as(u32, 1); pub const GLU_INVALID_ENUM = @as(u32, 100900); pub const GLU_INVALID_VALUE = @as(u32, 100901); pub const GLU_OUT_OF_MEMORY = @as(u32, 100902); pub const GLU_INCOMPATIBLE_GL_VERSION = @as(u32, 100903); pub const GLU_VERSION = @as(u32, 100800); pub const GLU_EXTENSIONS = @as(u32, 100801); pub const GLU_TRUE = @as(u32, 1); pub const GLU_FALSE = @as(u32, 0); pub const GLU_SMOOTH = @as(u32, 100000); pub const GLU_FLAT = @as(u32, 100001); pub const GLU_NONE = @as(u32, 100002); pub const GLU_POINT = @as(u32, 100010); pub const GLU_LINE = @as(u32, 100011); pub const GLU_FILL = @as(u32, 100012); pub const GLU_SILHOUETTE = @as(u32, 100013); pub const GLU_OUTSIDE = @as(u32, 100020); pub const GLU_INSIDE = @as(u32, 100021); pub const GLU_TESS_WINDING_RULE = @as(u32, 100140); pub const GLU_TESS_BOUNDARY_ONLY = @as(u32, 100141); pub const GLU_TESS_TOLERANCE = @as(u32, 100142); pub const GLU_TESS_WINDING_ODD = @as(u32, 100130); pub const GLU_TESS_WINDING_NONZERO = @as(u32, 100131); pub const GLU_TESS_WINDING_POSITIVE = @as(u32, 100132); pub const GLU_TESS_WINDING_NEGATIVE = @as(u32, 100133); pub const GLU_TESS_WINDING_ABS_GEQ_TWO = @as(u32, 100134); pub const GLU_TESS_BEGIN = @as(u32, 100100); pub const GLU_TESS_VERTEX = @as(u32, 100101); pub const GLU_TESS_END = @as(u32, 100102); pub const GLU_TESS_ERROR = @as(u32, 100103); pub const GLU_TESS_EDGE_FLAG = @as(u32, 100104); pub const GLU_TESS_COMBINE = @as(u32, 100105); pub const GLU_TESS_BEGIN_DATA = @as(u32, 100106); pub const GLU_TESS_VERTEX_DATA = @as(u32, 100107); pub const GLU_TESS_END_DATA = @as(u32, 100108); pub const GLU_TESS_ERROR_DATA = @as(u32, 100109); pub const GLU_TESS_EDGE_FLAG_DATA = @as(u32, 100110); pub const GLU_TESS_COMBINE_DATA = @as(u32, 100111); pub const GLU_TESS_ERROR1 = @as(u32, 100151); pub const GLU_TESS_ERROR2 = @as(u32, 100152); pub const GLU_TESS_ERROR3 = @as(u32, 100153); pub const GLU_TESS_ERROR4 = @as(u32, 100154); pub const GLU_TESS_ERROR5 = @as(u32, 100155); pub const GLU_TESS_ERROR6 = @as(u32, 100156); pub const GLU_TESS_ERROR7 = @as(u32, 100157); pub const GLU_TESS_ERROR8 = @as(u32, 100158); pub const GLU_TESS_MISSING_BEGIN_POLYGON = @as(u32, 100151); pub const GLU_TESS_MISSING_BEGIN_CONTOUR = @as(u32, 100152); pub const GLU_TESS_MISSING_END_POLYGON = @as(u32, 100153); pub const GLU_TESS_MISSING_END_CONTOUR = @as(u32, 100154); pub const GLU_TESS_COORD_TOO_LARGE = @as(u32, 100155); pub const GLU_TESS_NEED_COMBINE_CALLBACK = @as(u32, 100156); pub const GLU_AUTO_LOAD_MATRIX = @as(u32, 100200); pub const GLU_CULLING = @as(u32, 100201); pub const GLU_SAMPLING_TOLERANCE = @as(u32, 100203); pub const GLU_DISPLAY_MODE = @as(u32, 100204); pub const GLU_PARAMETRIC_TOLERANCE = @as(u32, 100202); pub const GLU_SAMPLING_METHOD = @as(u32, 100205); pub const GLU_U_STEP = @as(u32, 100206); pub const GLU_V_STEP = @as(u32, 100207); pub const GLU_PATH_LENGTH = @as(u32, 100215); pub const GLU_PARAMETRIC_ERROR = @as(u32, 100216); pub const GLU_DOMAIN_DISTANCE = @as(u32, 100217); pub const GLU_MAP1_TRIM_2 = @as(u32, 100210); pub const GLU_MAP1_TRIM_3 = @as(u32, 100211); pub const GLU_OUTLINE_POLYGON = @as(u32, 100240); pub const GLU_OUTLINE_PATCH = @as(u32, 100241); pub const GLU_NURBS_ERROR1 = @as(u32, 100251); pub const GLU_NURBS_ERROR2 = @as(u32, 100252); pub const GLU_NURBS_ERROR3 = @as(u32, 100253); pub const GLU_NURBS_ERROR4 = @as(u32, 100254); pub const GLU_NURBS_ERROR5 = @as(u32, 100255); pub const GLU_NURBS_ERROR6 = @as(u32, 100256); pub const GLU_NURBS_ERROR7 = @as(u32, 100257); pub const GLU_NURBS_ERROR8 = @as(u32, 100258); pub const GLU_NURBS_ERROR9 = @as(u32, 100259); pub const GLU_NURBS_ERROR10 = @as(u32, 100260); pub const GLU_NURBS_ERROR11 = @as(u32, 100261); pub const GLU_NURBS_ERROR12 = @as(u32, 100262); pub const GLU_NURBS_ERROR13 = @as(u32, 100263); pub const GLU_NURBS_ERROR14 = @as(u32, 100264); pub const GLU_NURBS_ERROR15 = @as(u32, 100265); pub const GLU_NURBS_ERROR16 = @as(u32, 100266); pub const GLU_NURBS_ERROR17 = @as(u32, 100267); pub const GLU_NURBS_ERROR18 = @as(u32, 100268); pub const GLU_NURBS_ERROR19 = @as(u32, 100269); pub const GLU_NURBS_ERROR20 = @as(u32, 100270); pub const GLU_NURBS_ERROR21 = @as(u32, 100271); pub const GLU_NURBS_ERROR22 = @as(u32, 100272); pub const GLU_NURBS_ERROR23 = @as(u32, 100273); pub const GLU_NURBS_ERROR24 = @as(u32, 100274); pub const GLU_NURBS_ERROR25 = @as(u32, 100275); pub const GLU_NURBS_ERROR26 = @as(u32, 100276); pub const GLU_NURBS_ERROR27 = @as(u32, 100277); pub const GLU_NURBS_ERROR28 = @as(u32, 100278); pub const GLU_NURBS_ERROR29 = @as(u32, 100279); pub const GLU_NURBS_ERROR30 = @as(u32, 100280); pub const GLU_NURBS_ERROR31 = @as(u32, 100281); pub const GLU_NURBS_ERROR32 = @as(u32, 100282); pub const GLU_NURBS_ERROR33 = @as(u32, 100283); pub const GLU_NURBS_ERROR34 = @as(u32, 100284); pub const GLU_NURBS_ERROR35 = @as(u32, 100285); pub const GLU_NURBS_ERROR36 = @as(u32, 100286); pub const GLU_NURBS_ERROR37 = @as(u32, 100287); pub const GLU_CW = @as(u32, 100120); pub const GLU_CCW = @as(u32, 100121); pub const GLU_INTERIOR = @as(u32, 100122); pub const GLU_EXTERIOR = @as(u32, 100123); pub const GLU_UNKNOWN = @as(u32, 100124); pub const GLU_BEGIN = @as(u32, 100100); pub const GLU_VERTEX = @as(u32, 100101); pub const GLU_END = @as(u32, 100102); pub const GLU_ERROR = @as(u32, 100103); pub const GLU_EDGE_FLAG = @as(u32, 100104); //-------------------------------------------------------------------------------- // Section: Types (40) //-------------------------------------------------------------------------------- // TODO: this type has a FreeFunc 'wglDeleteContext', what can Zig do with this information? pub const HGLRC = *opaque{}; pub const PIXELFORMATDESCRIPTOR = extern struct { nSize: u16, nVersion: u16, dwFlags: u32, iPixelType: u8, cColorBits: u8, cRedBits: u8, cRedShift: u8, cGreenBits: u8, cGreenShift: u8, cBlueBits: u8, cBlueShift: u8, cAlphaBits: u8, cAlphaShift: u8, cAccumBits: u8, cAccumRedBits: u8, cAccumGreenBits: u8, cAccumBlueBits: u8, cAccumAlphaBits: u8, cDepthBits: u8, cStencilBits: u8, cAuxBuffers: u8, iLayerType: u8, bReserved: u8, dwLayerMask: u32, dwVisibleMask: u32, dwDamageMask: u32, }; pub const EMRPIXELFORMAT = extern struct { emr: EMR, pfd: PIXELFORMATDESCRIPTOR, }; pub const POINTFLOAT = extern struct { x: f32, y: f32, }; pub const GLYPHMETRICSFLOAT = extern struct { gmfBlackBoxX: f32, gmfBlackBoxY: f32, gmfptGlyphOrigin: POINTFLOAT, gmfCellIncX: f32, gmfCellIncY: f32, }; pub const LAYERPLANEDESCRIPTOR = extern struct { nSize: u16, nVersion: u16, dwFlags: u32, iPixelType: u8, cColorBits: u8, cRedBits: u8, cRedShift: u8, cGreenBits: u8, cGreenShift: u8, cBlueBits: u8, cBlueShift: u8, cAlphaBits: u8, cAlphaShift: u8, cAccumBits: u8, cAccumRedBits: u8, cAccumGreenBits: u8, cAccumBlueBits: u8, cAccumAlphaBits: u8, cDepthBits: u8, cStencilBits: u8, cAuxBuffers: u8, iLayerPlane: u8, bReserved: u8, crTransparent: u32, }; pub const PFNGLARRAYELEMENTEXTPROC = fn( i: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub const PFNGLDRAWARRAYSEXTPROC = fn( mode: u32, first: i32, count: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub const PFNGLVERTEXPOINTEREXTPROC = fn( size: i32, type: u32, stride: i32, count: i32, pointer: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const PFNGLNORMALPOINTEREXTPROC = fn( type: u32, stride: i32, count: i32, pointer: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const PFNGLCOLORPOINTEREXTPROC = fn( size: i32, type: u32, stride: i32, count: i32, pointer: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const PFNGLINDEXPOINTEREXTPROC = fn( type: u32, stride: i32, count: i32, pointer: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const PFNGLTEXCOORDPOINTEREXTPROC = fn( size: i32, type: u32, stride: i32, count: i32, pointer: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const PFNGLEDGEFLAGPOINTEREXTPROC = fn( stride: i32, count: i32, pointer: ?*const u8, ) callconv(@import("std").os.windows.WINAPI) void; pub const PFNGLGETPOINTERVEXTPROC = fn( pname: u32, params: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const PFNGLARRAYELEMENTARRAYEXTPROC = fn( mode: u32, count: i32, pi: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const PFNGLDRAWRANGEELEMENTSWINPROC = fn( mode: u32, start: u32, end: u32, count: i32, type: u32, indices: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const PFNGLADDSWAPHINTRECTWINPROC = fn( x: i32, y: i32, width: i32, height: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub const PFNGLCOLORTABLEEXTPROC = fn( target: u32, internalFormat: u32, width: i32, format: u32, type: u32, data: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const PFNGLCOLORSUBTABLEEXTPROC = fn( target: u32, start: i32, count: i32, format: u32, type: u32, data: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const PFNGLGETCOLORTABLEEXTPROC = fn( target: u32, format: u32, type: u32, data: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const PFNGLGETCOLORTABLEPARAMETERIVEXTPROC = fn( target: u32, pname: u32, params: ?*i32, ) callconv(@import("std").os.windows.WINAPI) void; pub const PFNGLGETCOLORTABLEPARAMETERFVEXTPROC = fn( target: u32, pname: u32, params: ?*f32, ) callconv(@import("std").os.windows.WINAPI) void; pub const GLUnurbs = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const GLUquadric = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const GLUtesselator = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const GLUquadricErrorProc = fn( param0: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub const GLUtessBeginProc = fn( param0: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub const GLUtessEdgeFlagProc = fn( param0: u8, ) callconv(@import("std").os.windows.WINAPI) void; pub const GLUtessVertexProc = fn( param0: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const GLUtessEndProc = fn( ) callconv(@import("std").os.windows.WINAPI) void; pub const GLUtessErrorProc = fn( param0: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub const GLUtessCombineProc = fn( param0: ?*f64, param1: ?*?*anyopaque, param2: ?*f32, param3: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const GLUtessBeginDataProc = fn( param0: u32, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const GLUtessEdgeFlagDataProc = fn( param0: u8, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const GLUtessVertexDataProc = fn( param0: ?*anyopaque, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const GLUtessEndDataProc = fn( param0: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const GLUtessErrorDataProc = fn( param0: u32, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const GLUtessCombineDataProc = fn( param0: ?*f64, param1: ?*?*anyopaque, param2: ?*f32, param3: ?*?*anyopaque, param4: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const GLUnurbsErrorProc = fn( param0: u32, ) callconv(@import("std").os.windows.WINAPI) void; //-------------------------------------------------------------------------------- // Section: Functions (412) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows5.0' pub extern "GDI32" fn ChoosePixelFormat( hdc: ?HDC, ppfd: ?*const PIXELFORMATDESCRIPTOR, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "GDI32" fn DescribePixelFormat( hdc: ?HDC, iPixelFormat: i32, nBytes: u32, // TODO: what to do with BytesParamIndex 2? ppfd: ?*PIXELFORMATDESCRIPTOR, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "GDI32" fn GetPixelFormat( hdc: ?HDC, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "GDI32" fn SetPixelFormat( hdc: ?HDC, format: i32, ppfd: ?*const PIXELFORMATDESCRIPTOR, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "GDI32" fn GetEnhMetaFilePixelFormat( hemf: ?HENHMETAFILE, cbBuffer: u32, // TODO: what to do with BytesParamIndex 1? ppfd: ?*PIXELFORMATDESCRIPTOR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "OPENGL32" fn wglCopyContext( param0: ?HGLRC, param1: ?HGLRC, param2: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "OPENGL32" fn wglCreateContext( param0: ?HDC, ) callconv(@import("std").os.windows.WINAPI) ?HGLRC; // TODO: this type is limited to platform 'windows5.0' pub extern "OPENGL32" fn wglCreateLayerContext( param0: ?HDC, param1: i32, ) callconv(@import("std").os.windows.WINAPI) ?HGLRC; // TODO: this type is limited to platform 'windows5.0' pub extern "OPENGL32" fn wglDeleteContext( param0: ?HGLRC, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "OPENGL32" fn wglGetCurrentContext( ) callconv(@import("std").os.windows.WINAPI) ?HGLRC; // TODO: this type is limited to platform 'windows5.0' pub extern "OPENGL32" fn wglGetCurrentDC( ) callconv(@import("std").os.windows.WINAPI) ?HDC; // TODO: this type is limited to platform 'windows5.0' pub extern "OPENGL32" fn wglGetProcAddress( param0: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?PROC; // TODO: this type is limited to platform 'windows5.0' pub extern "OPENGL32" fn wglMakeCurrent( param0: ?HDC, param1: ?HGLRC, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "OPENGL32" fn wglShareLists( param0: ?HGLRC, param1: ?HGLRC, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "OPENGL32" fn wglUseFontBitmapsA( param0: ?HDC, param1: u32, param2: u32, param3: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "OPENGL32" fn wglUseFontBitmapsW( param0: ?HDC, param1: u32, param2: u32, param3: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "GDI32" fn SwapBuffers( param0: ?HDC, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "OPENGL32" fn wglUseFontOutlinesA( param0: ?HDC, param1: u32, param2: u32, param3: u32, param4: f32, param5: f32, param6: i32, param7: ?*GLYPHMETRICSFLOAT, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "OPENGL32" fn wglUseFontOutlinesW( param0: ?HDC, param1: u32, param2: u32, param3: u32, param4: f32, param5: f32, param6: i32, param7: ?*GLYPHMETRICSFLOAT, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "OPENGL32" fn wglDescribeLayerPlane( param0: ?HDC, param1: i32, param2: i32, param3: u32, param4: ?*LAYERPLANEDESCRIPTOR, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "OPENGL32" fn wglSetLayerPaletteEntries( param0: ?HDC, param1: i32, param2: i32, param3: i32, param4: ?*const u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "OPENGL32" fn wglGetLayerPaletteEntries( param0: ?HDC, param1: i32, param2: i32, param3: i32, param4: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "OPENGL32" fn wglRealizeLayerPalette( param0: ?HDC, param1: i32, param2: BOOL, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "OPENGL32" fn wglSwapLayerBuffers( param0: ?HDC, param1: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "OPENGL32" fn glAccum( op: u32, value: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glAlphaFunc( func: u32, ref: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glAreTexturesResident( n: i32, textures: ?*const u32, residences: ?*u8, ) callconv(@import("std").os.windows.WINAPI) u8; pub extern "OPENGL32" fn glArrayElement( i: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glBegin( mode: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glBindTexture( target: u32, texture: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glBitmap( width: i32, height: i32, xorig: f32, yorig: f32, xmove: f32, ymove: f32, bitmap: ?*const u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glBlendFunc( sfactor: u32, dfactor: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glCallList( list: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glCallLists( n: i32, type: u32, lists: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glClear( mask: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glClearAccum( red: f32, green: f32, blue: f32, alpha: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glClearColor( red: f32, green: f32, blue: f32, alpha: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glClearDepth( depth: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glClearIndex( c: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glClearStencil( s: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glClipPlane( plane: u32, equation: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor3b( red: i8, green: i8, blue: i8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor3bv( v: ?*const i8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor3d( red: f64, green: f64, blue: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor3dv( v: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor3f( red: f32, green: f32, blue: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor3fv( v: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor3i( red: i32, green: i32, blue: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor3iv( v: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor3s( red: i16, green: i16, blue: i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor3sv( v: ?*const i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor3ub( red: u8, green: u8, blue: u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor3ubv( v: ?*const u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor3ui( red: u32, green: u32, blue: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor3uiv( v: ?*const u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor3us( red: u16, green: u16, blue: u16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor3usv( v: ?*const u16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor4b( red: i8, green: i8, blue: i8, alpha: i8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor4bv( v: ?*const i8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor4d( red: f64, green: f64, blue: f64, alpha: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor4dv( v: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor4f( red: f32, green: f32, blue: f32, alpha: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor4fv( v: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor4i( red: i32, green: i32, blue: i32, alpha: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor4iv( v: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor4s( red: i16, green: i16, blue: i16, alpha: i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor4sv( v: ?*const i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor4ub( red: u8, green: u8, blue: u8, alpha: u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor4ubv( v: ?*const u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor4ui( red: u32, green: u32, blue: u32, alpha: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor4uiv( v: ?*const u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor4us( red: u16, green: u16, blue: u16, alpha: u16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColor4usv( v: ?*const u16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColorMask( red: u8, green: u8, blue: u8, alpha: u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColorMaterial( face: u32, mode: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glColorPointer( size: i32, type: u32, stride: i32, pointer: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glCopyPixels( x: i32, y: i32, width: i32, height: i32, type: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glCopyTexImage1D( target: u32, level: i32, internalFormat: u32, x: i32, y: i32, width: i32, border: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glCopyTexImage2D( target: u32, level: i32, internalFormat: u32, x: i32, y: i32, width: i32, height: i32, border: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glCopyTexSubImage1D( target: u32, level: i32, xoffset: i32, x: i32, y: i32, width: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glCopyTexSubImage2D( target: u32, level: i32, xoffset: i32, yoffset: i32, x: i32, y: i32, width: i32, height: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glCullFace( mode: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glDeleteLists( list: u32, range: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glDeleteTextures( n: i32, textures: ?*const u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glDepthFunc( func: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glDepthMask( flag: u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glDepthRange( zNear: f64, zFar: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glDisable( cap: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glDisableClientState( array: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glDrawArrays( mode: u32, first: i32, count: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glDrawBuffer( mode: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glDrawElements( mode: u32, count: i32, type: u32, indices: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glDrawPixels( width: i32, height: i32, format: u32, type: u32, pixels: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glEdgeFlag( flag: u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glEdgeFlagPointer( stride: i32, pointer: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glEdgeFlagv( flag: ?*const u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glEnable( cap: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glEnableClientState( array: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glEnd( ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glEndList( ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glEvalCoord1d( u: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glEvalCoord1dv( u: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glEvalCoord1f( u: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glEvalCoord1fv( u: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glEvalCoord2d( u: f64, v: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glEvalCoord2dv( u: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glEvalCoord2f( u: f32, v: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glEvalCoord2fv( u: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glEvalMesh1( mode: u32, i1: i32, i2: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glEvalMesh2( mode: u32, i1: i32, i2: i32, j1: i32, j2: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glEvalPoint1( i: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glEvalPoint2( i: i32, j: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glFeedbackBuffer( size: i32, type: u32, buffer: ?*f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glFinish( ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glFlush( ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glFogf( pname: u32, param1: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glFogfv( pname: u32, params: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glFogi( pname: u32, param1: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glFogiv( pname: u32, params: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glFrontFace( mode: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glFrustum( left: f64, right: f64, bottom: f64, top: f64, zNear: f64, zFar: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGenLists( range: i32, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OPENGL32" fn glGenTextures( n: i32, textures: ?*u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetBooleanv( pname: u32, params: ?*u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetClipPlane( plane: u32, equation: ?*f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetDoublev( pname: u32, params: ?*f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetError( ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OPENGL32" fn glGetFloatv( pname: u32, params: ?*f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetIntegerv( pname: u32, params: ?*i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetLightfv( light: u32, pname: u32, params: ?*f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetLightiv( light: u32, pname: u32, params: ?*i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetMapdv( target: u32, query: u32, v: ?*f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetMapfv( target: u32, query: u32, v: ?*f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetMapiv( target: u32, query: u32, v: ?*i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetMaterialfv( face: u32, pname: u32, params: ?*f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetMaterialiv( face: u32, pname: u32, params: ?*i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetPixelMapfv( map: u32, values: ?*f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetPixelMapuiv( map: u32, values: ?*u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetPixelMapusv( map: u32, values: ?*u16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetPointerv( pname: u32, params: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetPolygonStipple( mask: ?*u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetString( name: u32, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OPENGL32" fn glGetTexEnvfv( target: u32, pname: u32, params: ?*f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetTexEnviv( target: u32, pname: u32, params: ?*i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetTexGendv( coord: u32, pname: u32, params: ?*f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetTexGenfv( coord: u32, pname: u32, params: ?*f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetTexGeniv( coord: u32, pname: u32, params: ?*i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetTexImage( target: u32, level: i32, format: u32, type: u32, pixels: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetTexLevelParameterfv( target: u32, level: i32, pname: u32, params: ?*f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetTexLevelParameteriv( target: u32, level: i32, pname: u32, params: ?*i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetTexParameterfv( target: u32, pname: u32, params: ?*f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glGetTexParameteriv( target: u32, pname: u32, params: ?*i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glHint( target: u32, mode: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glIndexMask( mask: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glIndexPointer( type: u32, stride: i32, pointer: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glIndexd( c: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glIndexdv( c: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glIndexf( c: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glIndexfv( c: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glIndexi( c: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glIndexiv( c: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glIndexs( c: i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glIndexsv( c: ?*const i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glIndexub( c: u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glIndexubv( c: ?*const u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glInitNames( ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glInterleavedArrays( format: u32, stride: i32, pointer: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glIsEnabled( cap: u32, ) callconv(@import("std").os.windows.WINAPI) u8; pub extern "OPENGL32" fn glIsList( list: u32, ) callconv(@import("std").os.windows.WINAPI) u8; pub extern "OPENGL32" fn glIsTexture( texture: u32, ) callconv(@import("std").os.windows.WINAPI) u8; pub extern "OPENGL32" fn glLightModelf( pname: u32, param1: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glLightModelfv( pname: u32, params: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glLightModeli( pname: u32, param1: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glLightModeliv( pname: u32, params: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glLightf( light: u32, pname: u32, param2: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glLightfv( light: u32, pname: u32, params: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glLighti( light: u32, pname: u32, param2: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glLightiv( light: u32, pname: u32, params: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glLineStipple( factor: i32, pattern: u16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glLineWidth( width: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glListBase( base: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glLoadIdentity( ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glLoadMatrixd( m: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glLoadMatrixf( m: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glLoadName( name: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glLogicOp( opcode: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glMap1d( target: u32, u1: f64, u2: f64, stride: i32, order: i32, points: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glMap1f( target: u32, u1: f32, u2: f32, stride: i32, order: i32, points: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glMap2d( target: u32, u1: f64, u2: f64, ustride: i32, uorder: i32, v1: f64, v2: f64, vstride: i32, vorder: i32, points: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glMap2f( target: u32, u1: f32, u2: f32, ustride: i32, uorder: i32, v1: f32, v2: f32, vstride: i32, vorder: i32, points: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glMapGrid1d( un: i32, u1: f64, u2: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glMapGrid1f( un: i32, u1: f32, u2: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glMapGrid2d( un: i32, u1: f64, u2: f64, vn: i32, v1: f64, v2: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glMapGrid2f( un: i32, u1: f32, u2: f32, vn: i32, v1: f32, v2: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glMaterialf( face: u32, pname: u32, param2: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glMaterialfv( face: u32, pname: u32, params: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glMateriali( face: u32, pname: u32, param2: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glMaterialiv( face: u32, pname: u32, params: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glMatrixMode( mode: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glMultMatrixd( m: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glMultMatrixf( m: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glNewList( list: u32, mode: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glNormal3b( nx: i8, ny: i8, nz: i8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glNormal3bv( v: ?*const i8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glNormal3d( nx: f64, ny: f64, nz: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glNormal3dv( v: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glNormal3f( nx: f32, ny: f32, nz: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glNormal3fv( v: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glNormal3i( nx: i32, ny: i32, nz: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glNormal3iv( v: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glNormal3s( nx: i16, ny: i16, nz: i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glNormal3sv( v: ?*const i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glNormalPointer( type: u32, stride: i32, pointer: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glOrtho( left: f64, right: f64, bottom: f64, top: f64, zNear: f64, zFar: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPassThrough( token: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPixelMapfv( map: u32, mapsize: i32, values: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPixelMapuiv( map: u32, mapsize: i32, values: ?*const u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPixelMapusv( map: u32, mapsize: i32, values: ?*const u16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPixelStoref( pname: u32, param1: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPixelStorei( pname: u32, param1: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPixelTransferf( pname: u32, param1: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPixelTransferi( pname: u32, param1: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPixelZoom( xfactor: f32, yfactor: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPointSize( size: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPolygonMode( face: u32, mode: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPolygonOffset( factor: f32, units: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPolygonStipple( mask: ?*const u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPopAttrib( ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPopClientAttrib( ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPopMatrix( ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPopName( ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPrioritizeTextures( n: i32, textures: ?*const u32, priorities: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPushAttrib( mask: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPushClientAttrib( mask: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPushMatrix( ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glPushName( name: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos2d( x: f64, y: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos2dv( v: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos2f( x: f32, y: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos2fv( v: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos2i( x: i32, y: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos2iv( v: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos2s( x: i16, y: i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos2sv( v: ?*const i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos3d( x: f64, y: f64, z: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos3dv( v: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos3f( x: f32, y: f32, z: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos3fv( v: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos3i( x: i32, y: i32, z: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos3iv( v: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos3s( x: i16, y: i16, z: i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos3sv( v: ?*const i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos4d( x: f64, y: f64, z: f64, w: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos4dv( v: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos4f( x: f32, y: f32, z: f32, w: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos4fv( v: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos4i( x: i32, y: i32, z: i32, w: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos4iv( v: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos4s( x: i16, y: i16, z: i16, w: i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRasterPos4sv( v: ?*const i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glReadBuffer( mode: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glReadPixels( x: i32, y: i32, width: i32, height: i32, format: u32, type: u32, pixels: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRectd( x1: f64, y1: f64, x2: f64, y2: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRectdv( v1: ?*const f64, v2: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRectf( x1: f32, y1: f32, x2: f32, y2: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRectfv( v1: ?*const f32, v2: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRecti( x1: i32, y1: i32, x2: i32, y2: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRectiv( v1: ?*const i32, v2: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRects( x1: i16, y1: i16, x2: i16, y2: i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRectsv( v1: ?*const i16, v2: ?*const i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRenderMode( mode: u32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "OPENGL32" fn glRotated( angle: f64, x: f64, y: f64, z: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glRotatef( angle: f32, x: f32, y: f32, z: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glScaled( x: f64, y: f64, z: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glScalef( x: f32, y: f32, z: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glScissor( x: i32, y: i32, width: i32, height: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glSelectBuffer( size: i32, buffer: ?*u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glShadeModel( mode: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glStencilFunc( func: u32, ref: i32, mask: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glStencilMask( mask: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glStencilOp( fail: u32, zfail: u32, zpass: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord1d( s: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord1dv( v: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord1f( s: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord1fv( v: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord1i( s: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord1iv( v: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord1s( s: i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord1sv( v: ?*const i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord2d( s: f64, t: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord2dv( v: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord2f( s: f32, t: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord2fv( v: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord2i( s: i32, t: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord2iv( v: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord2s( s: i16, t: i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord2sv( v: ?*const i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord3d( s: f64, t: f64, r: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord3dv( v: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord3f( s: f32, t: f32, r: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord3fv( v: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord3i( s: i32, t: i32, r: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord3iv( v: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord3s( s: i16, t: i16, r: i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord3sv( v: ?*const i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord4d( s: f64, t: f64, r: f64, q: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord4dv( v: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord4f( s: f32, t: f32, r: f32, q: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord4fv( v: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord4i( s: i32, t: i32, r: i32, q: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord4iv( v: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord4s( s: i16, t: i16, r: i16, q: i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoord4sv( v: ?*const i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexCoordPointer( size: i32, type: u32, stride: i32, pointer: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexEnvf( target: u32, pname: u32, param2: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexEnvfv( target: u32, pname: u32, params: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexEnvi( target: u32, pname: u32, param2: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexEnviv( target: u32, pname: u32, params: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexGend( coord: u32, pname: u32, param2: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexGendv( coord: u32, pname: u32, params: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexGenf( coord: u32, pname: u32, param2: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexGenfv( coord: u32, pname: u32, params: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexGeni( coord: u32, pname: u32, param2: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexGeniv( coord: u32, pname: u32, params: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexImage1D( target: u32, level: i32, internalformat: i32, width: i32, border: i32, format: u32, type: u32, pixels: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexImage2D( target: u32, level: i32, internalformat: i32, width: i32, height: i32, border: i32, format: u32, type: u32, pixels: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexParameterf( target: u32, pname: u32, param2: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexParameterfv( target: u32, pname: u32, params: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexParameteri( target: u32, pname: u32, param2: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexParameteriv( target: u32, pname: u32, params: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexSubImage1D( target: u32, level: i32, xoffset: i32, width: i32, format: u32, type: u32, pixels: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTexSubImage2D( target: u32, level: i32, xoffset: i32, yoffset: i32, width: i32, height: i32, format: u32, type: u32, pixels: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTranslated( x: f64, y: f64, z: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glTranslatef( x: f32, y: f32, z: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex2d( x: f64, y: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex2dv( v: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex2f( x: f32, y: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex2fv( v: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex2i( x: i32, y: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex2iv( v: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex2s( x: i16, y: i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex2sv( v: ?*const i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex3d( x: f64, y: f64, z: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex3dv( v: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex3f( x: f32, y: f32, z: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex3fv( v: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex3i( x: i32, y: i32, z: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex3iv( v: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex3s( x: i16, y: i16, z: i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex3sv( v: ?*const i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex4d( x: f64, y: f64, z: f64, w: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex4dv( v: ?*const f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex4f( x: f32, y: f32, z: f32, w: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex4fv( v: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex4i( x: i32, y: i32, z: i32, w: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex4iv( v: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex4s( x: i16, y: i16, z: i16, w: i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertex4sv( v: ?*const i16, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glVertexPointer( size: i32, type: u32, stride: i32, pointer: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OPENGL32" fn glViewport( x: i32, y: i32, width: i32, height: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluErrorString( errCode: u32, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "GLU32" fn gluErrorUnicodeStringEXT( errCode: u32, ) callconv(@import("std").os.windows.WINAPI) ?PWSTR; pub extern "GLU32" fn gluGetString( name: u32, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "GLU32" fn gluOrtho2D( left: f64, right: f64, bottom: f64, top: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluPerspective( fovy: f64, aspect: f64, zNear: f64, zFar: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluPickMatrix( x: f64, y: f64, width: f64, height: f64, viewport: ?*i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluLookAt( eyex: f64, eyey: f64, eyez: f64, centerx: f64, centery: f64, centerz: f64, upx: f64, upy: f64, upz: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluProject( objx: f64, objy: f64, objz: f64, modelMatrix: ?*const f64, projMatrix: ?*const f64, viewport: ?*const i32, winx: ?*f64, winy: ?*f64, winz: ?*f64, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "GLU32" fn gluUnProject( winx: f64, winy: f64, winz: f64, modelMatrix: ?*const f64, projMatrix: ?*const f64, viewport: ?*const i32, objx: ?*f64, objy: ?*f64, objz: ?*f64, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "GLU32" fn gluScaleImage( format: u32, widthin: i32, heightin: i32, typein: u32, datain: ?*const anyopaque, widthout: i32, heightout: i32, typeout: u32, dataout: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "GLU32" fn gluBuild1DMipmaps( target: u32, components: i32, width: i32, format: u32, type: u32, data: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "GLU32" fn gluBuild2DMipmaps( target: u32, components: i32, width: i32, height: i32, format: u32, type: u32, data: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "GLU32" fn gluNewQuadric( ) callconv(@import("std").os.windows.WINAPI) ?*GLUquadric; pub extern "GLU32" fn gluDeleteQuadric( state: ?*GLUquadric, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluQuadricNormals( quadObject: ?*GLUquadric, normals: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluQuadricTexture( quadObject: ?*GLUquadric, textureCoords: u8, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluQuadricOrientation( quadObject: ?*GLUquadric, orientation: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluQuadricDrawStyle( quadObject: ?*GLUquadric, drawStyle: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluCylinder( qobj: ?*GLUquadric, baseRadius: f64, topRadius: f64, height: f64, slices: i32, stacks: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluDisk( qobj: ?*GLUquadric, innerRadius: f64, outerRadius: f64, slices: i32, loops: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluPartialDisk( qobj: ?*GLUquadric, innerRadius: f64, outerRadius: f64, slices: i32, loops: i32, startAngle: f64, sweepAngle: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluSphere( qobj: ?*GLUquadric, radius: f64, slices: i32, stacks: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluQuadricCallback( qobj: ?*GLUquadric, which: u32, @"fn": isize, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluNewTess( ) callconv(@import("std").os.windows.WINAPI) ?*GLUtesselator; pub extern "GLU32" fn gluDeleteTess( tess: ?*GLUtesselator, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluTessBeginPolygon( tess: ?*GLUtesselator, polygon_data: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluTessBeginContour( tess: ?*GLUtesselator, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluTessVertex( tess: ?*GLUtesselator, coords: ?*f64, data: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluTessEndContour( tess: ?*GLUtesselator, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluTessEndPolygon( tess: ?*GLUtesselator, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluTessProperty( tess: ?*GLUtesselator, which: u32, value: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluTessNormal( tess: ?*GLUtesselator, x: f64, y: f64, z: f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluTessCallback( tess: ?*GLUtesselator, which: u32, @"fn": isize, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluGetTessProperty( tess: ?*GLUtesselator, which: u32, value: ?*f64, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluNewNurbsRenderer( ) callconv(@import("std").os.windows.WINAPI) ?*GLUnurbs; pub extern "GLU32" fn gluDeleteNurbsRenderer( nobj: ?*GLUnurbs, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluBeginSurface( nobj: ?*GLUnurbs, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluBeginCurve( nobj: ?*GLUnurbs, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluEndCurve( nobj: ?*GLUnurbs, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluEndSurface( nobj: ?*GLUnurbs, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluBeginTrim( nobj: ?*GLUnurbs, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluEndTrim( nobj: ?*GLUnurbs, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluPwlCurve( nobj: ?*GLUnurbs, count: i32, array: ?*f32, stride: i32, type: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluNurbsCurve( nobj: ?*GLUnurbs, nknots: i32, knot: ?*f32, stride: i32, ctlarray: ?*f32, order: i32, type: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluNurbsSurface( nobj: ?*GLUnurbs, sknot_count: i32, sknot: ?*f32, tknot_count: i32, tknot: ?*f32, s_stride: i32, t_stride: i32, ctlarray: ?*f32, sorder: i32, torder: i32, type: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluLoadSamplingMatrices( nobj: ?*GLUnurbs, modelMatrix: ?*const f32, projMatrix: ?*const f32, viewport: ?*const i32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluNurbsProperty( nobj: ?*GLUnurbs, property: u32, value: f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluGetNurbsProperty( nobj: ?*GLUnurbs, property: u32, value: ?*f32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluNurbsCallback( nobj: ?*GLUnurbs, which: u32, @"fn": isize, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluBeginPolygon( tess: ?*GLUtesselator, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluNextContour( tess: ?*GLUtesselator, type: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "GLU32" fn gluEndPolygon( tess: ?*GLUtesselator, ) callconv(@import("std").os.windows.WINAPI) void; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (2) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { pub const wglUseFontBitmaps = thismodule.wglUseFontBitmapsA; pub const wglUseFontOutlines = thismodule.wglUseFontOutlinesA; }, .wide => struct { pub const wglUseFontBitmaps = thismodule.wglUseFontBitmapsW; pub const wglUseFontOutlines = thismodule.wglUseFontOutlinesW; }, .unspecified => if (@import("builtin").is_test) struct { pub const wglUseFontBitmaps = *opaque{}; pub const wglUseFontOutlines = *opaque{}; } else struct { pub const wglUseFontBitmaps = @compileError("'wglUseFontBitmaps' requires that UNICODE be set to true or false in the root module"); pub const wglUseFontOutlines = @compileError("'wglUseFontOutlines' requires that UNICODE be set to true or false in the root module"); }, }; //-------------------------------------------------------------------------------- // Section: Imports (7) //-------------------------------------------------------------------------------- const BOOL = @import("../foundation.zig").BOOL; const EMR = @import("../graphics/gdi.zig").EMR; const HDC = @import("../graphics/gdi.zig").HDC; const HENHMETAFILE = @import("../graphics/gdi.zig").HENHMETAFILE; const PROC = @import("../foundation.zig").PROC; const PSTR = @import("../foundation.zig").PSTR; const PWSTR = @import("../foundation.zig").PWSTR; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "PFNGLARRAYELEMENTEXTPROC")) { _ = PFNGLARRAYELEMENTEXTPROC; } if (@hasDecl(@This(), "PFNGLDRAWARRAYSEXTPROC")) { _ = PFNGLDRAWARRAYSEXTPROC; } if (@hasDecl(@This(), "PFNGLVERTEXPOINTEREXTPROC")) { _ = PFNGLVERTEXPOINTEREXTPROC; } if (@hasDecl(@This(), "PFNGLNORMALPOINTEREXTPROC")) { _ = PFNGLNORMALPOINTEREXTPROC; } if (@hasDecl(@This(), "PFNGLCOLORPOINTEREXTPROC")) { _ = PFNGLCOLORPOINTEREXTPROC; } if (@hasDecl(@This(), "PFNGLINDEXPOINTEREXTPROC")) { _ = PFNGLINDEXPOINTEREXTPROC; } if (@hasDecl(@This(), "PFNGLTEXCOORDPOINTEREXTPROC")) { _ = PFNGLTEXCOORDPOINTEREXTPROC; } if (@hasDecl(@This(), "PFNGLEDGEFLAGPOINTEREXTPROC")) { _ = PFNGLEDGEFLAGPOINTEREXTPROC; } if (@hasDecl(@This(), "PFNGLGETPOINTERVEXTPROC")) { _ = PFNGLGETPOINTERVEXTPROC; } if (@hasDecl(@This(), "PFNGLARRAYELEMENTARRAYEXTPROC")) { _ = PFNGLARRAYELEMENTARRAYEXTPROC; } if (@hasDecl(@This(), "PFNGLDRAWRANGEELEMENTSWINPROC")) { _ = PFNGLDRAWRANGEELEMENTSWINPROC; } if (@hasDecl(@This(), "PFNGLADDSWAPHINTRECTWINPROC")) { _ = PFNGLADDSWAPHINTRECTWINPROC; } if (@hasDecl(@This(), "PFNGLCOLORTABLEEXTPROC")) { _ = PFNGLCOLORTABLEEXTPROC; } if (@hasDecl(@This(), "PFNGLCOLORSUBTABLEEXTPROC")) { _ = PFNGLCOLORSUBTABLEEXTPROC; } if (@hasDecl(@This(), "PFNGLGETCOLORTABLEEXTPROC")) { _ = PFNGLGETCOLORTABLEEXTPROC; } if (@hasDecl(@This(), "PFNGLGETCOLORTABLEPARAMETERIVEXTPROC")) { _ = PFNGLGETCOLORTABLEPARAMETERIVEXTPROC; } if (@hasDecl(@This(), "PFNGLGETCOLORTABLEPARAMETERFVEXTPROC")) { _ = PFNGLGETCOLORTABLEPARAMETERFVEXTPROC; } if (@hasDecl(@This(), "GLUquadricErrorProc")) { _ = GLUquadricErrorProc; } if (@hasDecl(@This(), "GLUtessBeginProc")) { _ = GLUtessBeginProc; } if (@hasDecl(@This(), "GLUtessEdgeFlagProc")) { _ = GLUtessEdgeFlagProc; } if (@hasDecl(@This(), "GLUtessVertexProc")) { _ = GLUtessVertexProc; } if (@hasDecl(@This(), "GLUtessEndProc")) { _ = GLUtessEndProc; } if (@hasDecl(@This(), "GLUtessErrorProc")) { _ = GLUtessErrorProc; } if (@hasDecl(@This(), "GLUtessCombineProc")) { _ = GLUtessCombineProc; } if (@hasDecl(@This(), "GLUtessBeginDataProc")) { _ = GLUtessBeginDataProc; } if (@hasDecl(@This(), "GLUtessEdgeFlagDataProc")) { _ = GLUtessEdgeFlagDataProc; } if (@hasDecl(@This(), "GLUtessVertexDataProc")) { _ = GLUtessVertexDataProc; } if (@hasDecl(@This(), "GLUtessEndDataProc")) { _ = GLUtessEndDataProc; } if (@hasDecl(@This(), "GLUtessErrorDataProc")) { _ = GLUtessErrorDataProc; } if (@hasDecl(@This(), "GLUtessCombineDataProc")) { _ = GLUtessCombineDataProc; } if (@hasDecl(@This(), "GLUnurbsErrorProc")) { _ = GLUnurbsErrorProc; } @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/graphics/open_gl.zig
const std = @import("std"); const board = @import("board.zig"); const utils = @import("utils.zig"); const n = board.sum_for_all_positions(board.number_of_moves_for_pawns); fn take_some_slice(slice: []u32) void { slice[1] = 42; } pub fn main() anyerror!void { std.log.info("All your codebase are belong to us.", .{}); var b = board.Board.create_classic_game(std.heap.c_allocator); defer b.deinit(); b.precompute_all_moves(); std.log.debug("sizeof cells: {} bytes", .{@sizeOf(@TypeOf(b.cells))}); std.log.debug( \\ size of: \\ PieceMove: {} bytes ({} bits) \\ Action: {} bytes ({} bits) \\ Board: {} bytes , .{ @sizeOf(board.PieceMove), @bitSizeOf(board.PieceMove), @sizeOf(board.Action), @bitSizeOf(board.Action), @sizeOf(board.Board) }); std.log.debug( \\ \\ MAIN PIECES: {} \\ KINGS : {} \\ KNIGHTS : {} \\ PAWNS : {} , .{ utils.number_of_moves_for_main_pieces(), utils.number_of_moves_for_kings(), utils.number_of_moves_for_knights(), utils.number_of_moves_for_pawns() }); var slice = [_]u32{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; take_some_slice(slice[4..]); std.log.debug("slice[5] = {}", .{slice[5]}); std.log.debug("MAX_MOVES = {}", .{utils.MAX_MOVES}); var move_buffer: [1024]board.PieceMove = undefined; var count : i32 = 0; var outer : i32 = 0; while (outer < 10000000) : (outer += 1) { var i: i32 = 0; while (i < 100) : (i +=1) { var c = b.collect_all_moves(move_buffer[0..]); // std.log.debug("moves: {}", .{moves.items.len}); if (c == 0) { break; } b.push_move(move_buffer[0]); count += 1; // _ = b.pop_move(); } // _ = b.pop_move(); while (i > 0):(i -= 1) { // _ = b.collect_all_moves(move_buffer[0..]); // std.log.debug("moves: {}", .{moves.items.len}); _ = b.pop_move(); } } std.log.err("Made {} moves", .{count}); }
src/main.zig
const std = @import("std"); const testing = std.testing; pub const c = @cImport({ @cInclude("gravity_compiler.h"); @cInclude("gravity_macros.h"); @cInclude("gravity_core.h"); @cInclude("gravity_vm.h"); @cInclude("gravity_delegate.h"); }); pub const Delegate = @import("delegate.zig").Delegate; pub const Compiler = @import("compiler.zig").Compiler; pub const Vm = @import("vm.zig").Vm; pub fn default_report_error(vm: ?*c.gravity_vm, err_type: c_uint, msg: [*c]const u8, desc: c.error_desc_t, xdata: ?*anyopaque) callconv(.C) void { _ = vm; _ = err_type; _ = msg; _ = desc; _ = xdata; if (msg) |m| { std.debug.print("error is: {s}", .{m}); } std.os.exit(0); } const source_code = \\ func sum (a, b) { \\ return a + b \\ } \\ func mul (a, b) { \\ return a * b \\ } \\ func main () { \\ var a = 10 \\ var b = 20 \\ return "hi" \\ } ; test "basic embed example" { // example found: https://marcobambini.github.io/gravity/#/embedding var delegate = c.gravity_delegate_t{ .error_callback = default_report_error, .xdata = null, .report_null_errors = true, .disable_gccheck_1 = false, .log_callback = null, .log_clear = null, .unittest_callback = null, .parser_callback = null, .type_callback = null, .precode_callback = null, .loadfile_callback = null, .filename_callback = null, .optional_classes = null, .bridge_initinstance = null, .bridge_setvalue = null, .bridge_getvalue = null, .bridge_setundef = null, .bridge_getundef = null, .bridge_execute = null, .bridge_blacken = null, .bridge_string = null, .bridge_equals = null, .bridge_clone = null, .bridge_size = null, .bridge_free = null, }; const compiler = c.gravity_compiler_create(&delegate); defer c.gravity_compiler_free(compiler); const closure = c.gravity_compiler_run(compiler, source_code, source_code.len, 0, true, true); const vm = c.gravity_vm_new(&delegate); defer c.gravity_vm_free(vm); defer c.gravity_core_free(); c.gravity_compiler_transfer(compiler, vm); // execute main closure if (c.gravity_vm_runmain(vm, closure)) { // get returned value const res = c.gravity_vm_result(vm); var buf = [_]u8{0} ** 512; c.gravity_value_dump(vm, res, &buf, buf.len); std.debug.print("RESULT: {s}\n", .{buf}); } } test "same example but using the wrappers" { var config = Delegate.init(.{ .error_callback = default_report_error }); var compiler = try Compiler.init(&config); defer compiler.deinit(); const closure = try compiler.run(source_code, 0, true, true); var vm = try Vm.init(&config); defer vm.deinit(); compiler.transfer(&vm); if (vm.runmain(closure)) { const res = vm.result(); var buf: [512]u8 = .{0} ** 512; vm.valueDump(res, buf[0..]); std.debug.print("RESULT: {s}\n", .{buf}); } }
src/gravity.zig
const std = @import("std"); const mem = std.mem; const print = std.debug.print; const ChildProcess = std.ChildProcess; pub fn dumpArgs(args: []const []const u8) void { for (args) |arg| print("{} ", .{arg}) else print("\n", .{}); } pub fn escapeHtml(allocator: *mem.Allocator, input: []const u8) ![]u8 { var buf = std.ArrayList(u8).init(allocator); defer buf.deinit(); const out = buf.outStream(); try writeEscaped(out, input); return buf.toOwnedSlice(); } pub fn writeEscaped(out: anytype, input: []const u8) !void { for (input) |c| { try switch (c) { '&' => out.writeAll("&amp;"), '<' => out.writeAll("&lt;"), '>' => out.writeAll("&gt;"), '"' => out.writeAll("&quot;"), else => out.writeByte(c), }; } } //#define VT_RED "\x1b[31;1m" //#define VT_GREEN "\x1b[32;1m" //#define VT_CYAN "\x1b[36;1m" //#define VT_WHITE "\x1b[37;1m" //#define VT_BOLD "\x1b[0;1m" //#define VT_RESET "\x1b[0m" const TermState = enum { Start, Escape, LBracket, Number, AfterNumber, Arg, ArgNumber, ExpectEnd, }; test "term color" { const input_bytes = "A\x1b[32;1mgreen\x1b[0mB"; const result = try termColor(std.testing.allocator, input_bytes); defer std.testing.allocator.free(result); testing.expectEqualSlices(u8, "A<span class=\"t32\">green</span>B", result); } pub fn termColor(allocator: *mem.Allocator, input: []const u8) ![]u8 { var buf = std.ArrayList(u8).init(allocator); defer buf.deinit(); var out = buf.outStream(); var number_start_index: usize = undefined; var first_number: usize = undefined; var second_number: usize = undefined; var i: usize = 0; var state = TermState.Start; var open_span_count: usize = 0; while (i < input.len) : (i += 1) { const c = input[i]; switch (state) { TermState.Start => switch (c) { '\x1b' => state = TermState.Escape, else => try out.writeByte(c), }, TermState.Escape => switch (c) { '[' => state = TermState.LBracket, else => return error.UnsupportedEscape, }, TermState.LBracket => switch (c) { '0'...'9' => { number_start_index = i; state = TermState.Number; }, else => return error.UnsupportedEscape, }, TermState.Number => switch (c) { '0'...'9' => {}, else => { first_number = std.fmt.parseInt(usize, input[number_start_index..i], 10) catch unreachable; second_number = 0; state = TermState.AfterNumber; i -= 1; }, }, TermState.AfterNumber => switch (c) { ';' => state = TermState.Arg, else => { state = TermState.ExpectEnd; i -= 1; }, }, TermState.Arg => switch (c) { '0'...'9' => { number_start_index = i; state = TermState.ArgNumber; }, else => return error.UnsupportedEscape, }, TermState.ArgNumber => switch (c) { '0'...'9' => {}, else => { second_number = std.fmt.parseInt(usize, input[number_start_index..i], 10) catch unreachable; state = TermState.ExpectEnd; i -= 1; }, }, TermState.ExpectEnd => switch (c) { 'm' => { state = TermState.Start; while (open_span_count != 0) : (open_span_count -= 1) { try out.writeAll("</span>"); } if (first_number != 0 or second_number != 0) { try out.print("<span class=\"t{}_{}\">", .{ first_number, second_number }); open_span_count += 1; } }, else => return error.UnsupportedEscape, }, } } return buf.toOwnedSlice(); } pub fn exec( allocator: *mem.Allocator, env_map: *std.BufMap, max_size: usize, args: []const []const u8, ) !ChildProcess.ExecResult { const result = try ChildProcess.exec(.{ .allocator = allocator, .argv = args, .env_map = env_map, .max_output_bytes = max_size, }); switch (result.term) { .Exited => |exit_code| { if (exit_code != 0) { print("{}\nThe following command exited with code {}:\n", .{ result.stderr, exit_code }); dumpArgs(args); return error.ChildExitError; } }, else => { print("{}\nThe following command crashed:\n", .{result.stderr}); dumpArgs(args); return error.ChildCrashed; }, } return result; }
src/doctest/render_utils.zig
const std = @import("std"); const panic = std.debug.panic; const utils = @import("lib/utils.zig"); const print = utils.print; const puts = utils.puts; const puts_fmt = utils.puts_fmt; const print_e = utils.print_e; const puts_e = utils.puts_e; const putskv_e = utils.putskv_e; const puts_fn = utils.puts_fn; const bufPrint = utils.bufPrint; const strEq = utils.strEq; const strlen = utils.strlen; const allocator = std.heap.page_allocator; const types = @import("lib/types.zig"); const List = types.List; const Node = types.Node; const NodeKind = types.NodeKind; const Names = types.Names; const json = @import("lib/json.zig"); var gLabelId: i32 = 0; // -------------------------------- fn getLabelId() i32 { gLabelId += 1; return gLabelId; } fn head(list: *List) *Node { return list.get(0); } fn rest(list: *List) *List { const new_list = List.init(); var i: usize = 1; while (i < list.len) : (i += 1) { new_list.add(list.get(i)); } return new_list; } // -------------------------------- fn fnArgDisp(names: *Names, name: []const u8) i32 { const i = names.indexOf(name); if (i == -1) { panic("fn arg not found", .{}); } return i + 2; } fn lvarDisp(dest: []u8, names: *Names, name: []const u8) i32 { const i = names.indexOf(name); if (i == -1) { panic("lvar not found", .{}); } return -(i + 1); } fn formatIndirection(buf: []u8, base: []const u8, disp: i32) []u8 { return bufPrint(buf, "[{}:{}]", .{base, disp}); } fn matchNumber(str: []const u8) bool { var i: usize = 0; while (i < str.len) : (i += 1) { if (!utils.isNumeric(str[i])) { return false; } } return true; } // -------------------------------- fn genVar( fn_arg_names: *Names, lvar_names: *Names, stmt_rest: *List, ) void { puts(" sub_sp 1"); if (stmt_rest.len == 2) { genSet(fn_arg_names, lvar_names, stmt_rest); } } fn genExprAdd() void { puts(" pop reg_b"); puts(" pop reg_a"); puts(" add_ab"); } fn genExprMult() void { puts(" pop reg_b"); puts(" pop reg_a"); puts(" mult_ab"); } fn genExprEq() void { const label_id = getLabelId(); var buf1: [32]u8 = undefined; const then_label = bufPrint(&buf1, "then_{}", .{label_id}); var buf2: [32]u8 = undefined; const end_label = bufPrint(&buf2, "end_eq_{}", .{label_id}); puts(" pop reg_b"); puts(" pop reg_a"); puts(" compare"); puts_fmt(" jump_eq {}", .{then_label}); puts(" cp 0 reg_a"); puts_fmt(" jump {}", .{end_label}); puts_fmt("label {}", .{then_label}); puts(" cp 1 reg_a"); puts_fmt("label {}", .{end_label}); } fn genExprNeq() void { const label_id = getLabelId(); var buf1: [32]u8 = undefined; const then_label = bufPrint(&buf1, "then_{}", .{label_id}); var buf2: [32]u8 = undefined; const end_label = bufPrint(&buf2, "end_neq_{}", .{label_id}); puts(" pop reg_b"); puts(" pop reg_a"); puts(" compare"); puts_fmt(" jump_eq {}", .{then_label}); puts(" cp 1 reg_a"); puts_fmt(" jump {}", .{end_label}); puts_fmt("label {}", .{then_label}); puts(" cp 0 reg_a"); puts_fmt("label {}", .{end_label}); } fn _genExprBinary( fn_arg_names: *Names, lvar_names: *Names, expr: *List, ) void { // puts_fn("_genExprBinary"); const op = head(expr).getStr(); const args = rest(expr); const term_l = args.get(0); const term_r = args.get(1); genExpr(fn_arg_names, lvar_names, term_l); puts(" push reg_a"); genExpr(fn_arg_names, lvar_names, term_r); puts(" push reg_a"); if (strEq(op, "+")) { genExprAdd(); } else if (strEq(op, "*")) { genExprMult(); } else if (strEq(op, "eq")) { genExprEq(); } else if (strEq(op, "neq")) { genExprNeq(); } else { panic("not_yet_impl ({})", .{op}); } } fn genExpr( fn_arg_names: *Names, lvar_names: *Names, expr: *Node, ) void { puts_fn("genExpr"); switch (expr.kind) { .INT => { if (expr.int) |intval| { var buf1: [16]u8 = undefined; puts_fmt(" cp {} reg_a", .{ intval }); } else { panic("must not happen", .{}); } }, .STR => { var buf2: [16]u8 = undefined; const str = expr.getStr(); if (0 <= lvar_names.indexOf(str)) { const disp = lvarDisp(buf2[0..], lvar_names, str); const cp_src = formatIndirection(buf2[0..], "bp", disp); puts_fmt(" cp {} reg_a", .{ cp_src }); } else if (0 <= fn_arg_names.indexOf(str)) { const disp = fnArgDisp(fn_arg_names, str); const cp_src = formatIndirection(buf2[0..], "bp", disp); puts_fmt(" cp {} reg_a", .{ cp_src }); } else { panic("must not happen", .{}); } }, .LIST => { _genExprBinary(fn_arg_names, lvar_names, expr.getList()); }, } } fn genCall(fn_arg_names: *Names, lvar_names: *Names, stmt_rest: *List) void { puts_fn("genCall"); const fn_name = head(stmt_rest).getStr(); const fn_args = rest(stmt_rest); if (1 <= fn_args.len) { var i: usize = fn_args.len - 1; while (true) { const fn_arg = fn_args.get(i); genExpr(fn_arg_names, lvar_names, fn_arg); puts(" push reg_a"); if (i == 0) { break; } else { i -= 1; } } } var buf1: [256]u8 = undefined; const vm_cmt = bufPrint(&buf1, "call {}", .{fn_name}); genVmComment(vm_cmt); puts_fmt(" call {}", .{fn_name}); puts_fmt(" add_sp {}", .{fn_args.len}); } fn genCallSet( fn_arg_names: *Names, lvar_names: *Names, stmt_rest: *List, ) void { puts_fn("genCallSet"); const lvar_name = stmt_rest.get(0).getStr(); const funcall = stmt_rest.get(1).getList(); genCall(fn_arg_names, lvar_names, funcall); var buf: [8]u8 = undefined; const disp = lvarDisp(buf[0..], lvar_names, lvar_name); var cp_dest = formatIndirection(buf[0..], "bp", disp); puts_fmt(" cp reg_a {}", .{ cp_dest }); } fn genSet( fn_arg_names: *Names, lvar_names: *Names, stmt_rest: *List, ) void { puts_fn("genSet"); const dest = stmt_rest.get(0); const expr = stmt_rest.get(1); genExpr(fn_arg_names, lvar_names, expr); switch (dest.kind) { .STR => { var buf2: [16]u8 = undefined; const str = dest.getStr(); if (0 <= lvar_names.indexOf(str)) { const disp = lvarDisp(buf2[0..], lvar_names, str); const cp_dest = formatIndirection(buf2[0..], "bp", disp); puts_fmt(" cp reg_a {}", .{ cp_dest }); } else if (0 <= fn_arg_names.indexOf(str)) { const disp = fnArgDisp(fn_arg_names, str); const cp_dest = formatIndirection(buf2[0..], "bp", disp); puts_fmt(" cp reg_a {}", .{ cp_dest }); } else { panic("must not happen", .{}); } }, else => { panic("not yet implemented", .{}); }, } } fn genReturn( lvar_names: *Names, stmt_rest: *List, ) void { const retval = head(stmt_rest); genExpr(Names.empty(), lvar_names, retval); } fn genVmComment(cmt: []const u8) void { puts_fn("genVmComment"); var temp: [256]u8 = undefined; var i: usize = 0; while (i < cmt.len and cmt[i] != 0) : (i += 1) { if (cmt[i] == ' ') { temp[i] = '~'; } else { temp[i] = cmt[i]; } } puts_fmt(" _cmt {}", .{temp[0..i]}); } fn genWhile( fn_arg_names: *Names, lvar_names: *Names, stmt_rest: *List, ) void { puts_fn("genWhile"); const cond_expr = stmt_rest.get(0); const body = stmt_rest.get(1).getList(); const label_id = getLabelId(); var buf1: [16]u8 = undefined; const label_begin = bufPrint(&buf1, "while_{}", .{label_id}); var buf2: [16]u8 = undefined; const label_end = bufPrint(&buf2, "end_while_{}", .{label_id}); var buf3: [16]u8 = undefined; const label_true = bufPrint(&buf3, "true_{}", .{label_id}); print("\n"); puts_fmt("label {}", .{label_begin}); genExpr(fn_arg_names, lvar_names, cond_expr); puts(" cp 1 reg_b"); puts(" compare"); puts_fmt(" jump_eq {}\n", .{label_true}); puts_fmt(" jump {}\n", .{label_end}); puts_fmt("label {}\n", .{label_true}); genStmts(fn_arg_names, lvar_names, body); puts_fmt(" jump {}", .{label_begin}); puts_fmt("label {}\n", .{label_end}); print("\n"); } fn genCase( fn_arg_names: *Names, lvar_names: *Names, when_clauses: *List, ) void { puts_fn("genCase"); const label_id = getLabelId(); var when_idx: i32 = -1; var buf1: [32]u8 = undefined; const label_end = bufPrint(&buf1, "end_case_{}", .{label_id}); var buf2: [32]u8 = undefined; const label_when_head = bufPrint(&buf2, "when_{}", .{label_id}); var buf3: [32]u8 = undefined; const label_end_when_head = bufPrint(&buf3, "end_when_{}", .{label_id}); print("\n"); puts_fmt(" # -->> case_{}", .{label_id}); var i: usize = 0; while (i < when_clauses.len) : (i += 1) { const when_clause = when_clauses.get(i).getList(); when_idx += 1; const cond = head(when_clause); const _rest = rest(when_clause); puts_fmt(" # when_{}_{}", .{ label_id, when_idx }); puts(" # -->> expr"); genExpr(fn_arg_names, lvar_names, cond); puts(" # <<-- expr"); puts(" cp 1 reg_b"); puts(" compare"); puts_fmt(" jump_eq {}_{}", .{ label_when_head, when_idx }); puts_fmt(" jump {}_{}", .{ label_end_when_head, when_idx }); puts_fmt("label {}_{}", .{ label_when_head, when_idx }); genStmts(fn_arg_names, lvar_names, _rest); puts_fmt(" jump {}", .{label_end}); puts_fmt("label {}_{}", .{ label_end_when_head, when_idx }); } puts_fmt("label end_case_{}", .{label_id}); puts_fmt(" # <<-- case_{}", .{label_id}); print("\n"); } fn genStmt( fn_arg_names: *Names, lvar_names: *Names, stmt: *List, ) void { puts_fn("genStmt"); const stmt_head = head(stmt).getStr(); const stmt_rest = rest(stmt); if (strEq(stmt_head, "set")) { genSet(fn_arg_names, lvar_names, stmt_rest); } else if (strEq(stmt_head, "call")) { genCall(fn_arg_names, lvar_names, stmt_rest); } else if (strEq(stmt_head, "call_set")) { genCallSet(fn_arg_names, lvar_names, stmt_rest); } else if (strEq(stmt_head, "return")) { genReturn(lvar_names, stmt_rest); } else if (strEq(stmt_head, "while")) { genWhile(fn_arg_names, lvar_names, stmt_rest); } else if (strEq(stmt_head, "case")) { genCase(fn_arg_names, lvar_names, stmt_rest); } else if (strEq(stmt_head, "_cmt")) { genVmComment(stmt_rest.get(0).str[0..]); } else { panic("Unsupported statement ({})", .{stmt_head}); } } fn genStmts( fn_arg_names: *Names, lvar_names: *Names, stmts: *List, ) void { var i: usize = 0; while (i < stmts.len) : (i += 1) { const stmt = stmts.get(i).getList(); genStmt(fn_arg_names, lvar_names, stmt); } } fn genFuncDef(top_stmt: *List) void { const fn_name = top_stmt.get(0).getStr(); const fn_arg_vals = top_stmt.get(1).getList(); const body = top_stmt.get(2).getList(); const fn_arg_names = Names.init(); var i: usize = 0; while (i < fn_arg_vals.size()) : (i += 1) { fn_arg_names.add(fn_arg_vals.get(i).getStr()); } const lvar_names = Names.init(); puts_fmt("label {}", .{fn_name}); puts(" push bp"); puts(" cp sp bp"); i = 0; while (i < body.len) : (i += 1) { const stmt = body.get(i).getList(); const stmt_head = head(stmt).getStr(); const stmt_rest = rest(stmt); if (strEq(stmt_head, "var")) { const varName = stmt_rest.get(0).getStr(); lvar_names.add(varName); genVar(fn_arg_names, lvar_names, stmt_rest); } else { genStmt(fn_arg_names, lvar_names, stmt); } } puts(" cp bp sp"); puts(" pop bp"); puts(" ret"); } fn genTopStmts(top_stmts: *List) void { var i: usize = 1; while (i < top_stmts.len) : (i += 1) { const top_stmt = top_stmts.get(i).getList(); const stmt_head = head(top_stmt).getStr(); const stmt_rest = rest(top_stmt); if (strEq(stmt_head, "func")) { genFuncDef(stmt_rest); } else { panic("must not happen ({})", .{stmt_head}); } } } fn genBuiltinSetVram() void { puts(""); puts("label set_vram"); puts(" push bp"); puts(" cp sp bp"); puts(" set_vram [bp:2] [bp:3]"); // vram_addr value puts(" cp bp sp"); puts(" pop bp"); puts(" ret"); } fn genBuiltinGetVram() void { puts(""); puts("label get_vram"); puts(" push bp"); puts(" cp sp bp"); puts(" get_vram [bp:2] reg_a"); // vram_addr dest puts(" cp bp sp"); puts(" pop bp"); puts(" ret"); } pub fn main() !void { var buf: [20000]u8 = undefined; const src = utils.readStdinAll(&buf); const top_stmts = json.parse(src); puts(" call main"); puts(" exit"); genTopStmts(top_stmts); puts(""); puts("#>builtins"); genBuiltinSetVram(); genBuiltinGetVram(); puts("#<builtins"); }
vgcodegen.zig
const std = @import("std"); const dbg = std.debug; const mem = std.mem; pub fn main() !void { var arena = std.heap.ArenaAllocator.init(std.heap.direct_allocator); defer arena.deinit(); const allocator = &arena.allocator; var program: [input.len]u32 = undefined; mem.copy(u32, program[0..input.len], input[0..input.len]); var initial_output = try get_program_output(allocator, program[0..program.len], 12, 2); dbg.warn("02-1: {}\n", initial_output); var noun: u32 = 0; var verb: u32 = 0; search: while (noun < 100) : ({ verb = 0; noun += 1; }) { while (verb < 100) : (verb += 1) { if ((try get_program_output(allocator, program[0..program.len], noun, verb)) == 19690720) { break :search; } } } dbg.warn("02-2: {}\n", (100 * noun) + verb); } const OpCode = enum(u32) { Add = 1, Mult = 2, Term = 99, }; fn run_intcode_program(allocator: *mem.Allocator, program: []const u32) ![]const u32 { const num_codes = program.len; var memory = try allocator.alloc(u32, num_codes); mem.copy(u32, memory[0..num_codes], program[0..num_codes]); var opcode = OpCode.Add; var instruction_pointer: usize = 0; while (true) { dbg.assert(instruction_pointer < num_codes); opcode = @intToEnum(OpCode, memory[instruction_pointer]); var instruction_num_values: u32 = undefined; switch (opcode) { .Add => { instruction_num_values = 4; var param1 = memory[instruction_pointer + 1]; var param2 = memory[instruction_pointer + 2]; var param3 = memory[instruction_pointer + 3]; var a = memory[param1]; var b = memory[param2]; var dest_address = &memory[param3]; dest_address.* = a + b; }, .Mult => { instruction_num_values = 4; var param1 = memory[instruction_pointer + 1]; var param2 = memory[instruction_pointer + 2]; var param3 = memory[instruction_pointer + 3]; var a = memory[param1]; var b = memory[param2]; var dest_address = &memory[param3]; dest_address.* = a * b; }, .Term => { instruction_num_values = 1; break; }, } instruction_pointer += instruction_num_values; } return memory; } test "run intcode program" { var a = dbg.global_allocator; dbg.assert(mem.eql(u32, try run_intcode_program(a, [_]u32{ 1, 0, 0, 0, 99 }), [_]u32{ 2, 0, 0, 0, 99 })); dbg.assert(mem.eql(u32, try run_intcode_program(a, [_]u32{ 2, 3, 0, 3, 99 }), [_]u32{ 2, 3, 0, 6, 99 })); dbg.assert(mem.eql(u32, try run_intcode_program(a, [_]u32{ 2, 4, 4, 5, 99, 0 }), [_]u32{ 2, 4, 4, 5, 99, 9801 })); dbg.assert(mem.eql(u32, try run_intcode_program(a, [_]u32{ 1, 1, 1, 4, 99, 5, 6, 0, 99 }), [_]u32{ 30, 1, 1, 4, 2, 5, 6, 0, 99 })); } fn get_program_output(allocator: *mem.Allocator, program: []u32, noun: u32, verb: u32) !u32 { program[1] = noun; program[2] = verb; var final_state = try run_intcode_program(allocator, program); return final_state[0]; } const input = [_]u32{ 1, 0, 0, 3, 1, 1, 2, 3, 1, 3, 4, 3, 1, 5, 0, 3, 2, 9, 1, 19, 1, 19, 5, 23, 1, 23, 5, 27, 2, 27, 10, 31, 1, 31, 9, 35, 1, 35, 5, 39, 1, 6, 39, 43, 2, 9, 43, 47, 1, 5, 47, 51, 2, 6, 51, 55, 1, 5, 55, 59, 2, 10, 59, 63, 1, 63, 6, 67, 2, 67, 6, 71, 2, 10, 71, 75, 1, 6, 75, 79, 2, 79, 9, 83, 1, 83, 5, 87, 1, 87, 9, 91, 1, 91, 9, 95, 1, 10, 95, 99, 1, 99, 13, 103, 2, 6, 103, 107, 1, 107, 5, 111, 1, 6, 111, 115, 1, 9, 115, 119, 1, 119, 9, 123, 2, 123, 10, 127, 1, 6, 127, 131, 2, 131, 13, 135, 1, 13, 135, 139, 1, 9, 139, 143, 1, 9, 143, 147, 1, 147, 13, 151, 1, 151, 9, 155, 1, 155, 13, 159, 1, 6, 159, 163, 1, 13, 163, 167, 1, 2, 167, 171, 1, 171, 13, 0, 99, 2, 0, 14, 0, };
2019/day02.zig
const std = @import("std"); const root = @import("main.zig"); const tls = root.tls; pub const TlsConfigurationParams = struct { const Self = @This(); pub const Protocol = enum { tls1_0, tls1_1, tls1_2, tls1_3, tls1, all, default, fn native(self: Protocol) u32 { return switch (self) { .tls1_0 => tls.TLS_PROTOCOL_TLSv1_0, .tls1_1 => tls.TLS_PROTOCOL_TLSv1_1, .tls1_2 => tls.TLS_PROTOCOL_TLSv1_2, .tls1_3 => tls.TLS_PROTOCOL_TLSv1_3, .tls1 => tls.TLS_PROTOCOL_TLSv1, .all => tls.TLS_PROTOCOLS_ALL, .default => tls.TLS_PROTOCOLS_DEFAULT, }; } }; // NOTE(haze): we don't use `@tagName` here because enum tags are interned and don't come with a // null byte (which is what libtls needs) pub const Ciphers = union(enum) { secure, compat, legacy, insecure, custom: [*:0]const u8, pub fn native(self: Ciphers) [*:0]const u8 { return switch (self) { .custom => |payload| payload, else => @tagName(self) }; } }; pub const DheParams = enum { none, auto, legacy, pub fn native(self: DheParams) []const u8 { return switch (self) { .none => "none", .auto => "auto", .legacy => "legacy", }; } }; const RootCertificateLoadingMechanism = union(enum) { /// sets the path (directory) which should be searched for root certificates. dir_path: []const u8, /// loads a file containing the root certificates. file_path: []const u8, /// sets the root certificates directly from memory. memory: []const u8, /// load the default ca_cert as reported by `tls_default_ca_cert_file` default: void, }; const LoadingMechanism = union(enum) { /// loads a file containing the item. file_path: []const u8, /// sets the item directly from memory. memory: []const u8, }; const KeypairLoadingMechanism = union(enum) { /// loads two files from which the public certificate and private key will be read. file_path: struct { cert_file_path: []const u8, key_file_path: []const u8, }, /// directly sets the public certificate and private key from memory. memory: struct { cert_memory: []const u8, key_memory: []const u8, }, }; const KeypairOcspLoadingMechanism = union(enum) { /// loads three files containing the public certificate, private key, and DER-encoded OCSP staple. file_path: struct { cert_file_path: []const u8, key_file_path: []const u8, ocsp_file_path: []const u8, }, /// directly sets the public certificate, private key, and DER-encoded OCSP staple from memory. memory: struct { cert_memory: []const u8, key_memory: []const u8, ocsp_memory: []const u8, }, }; /// specifies which versions of the TLS protocol may be used. protocol: Protocol = .default, /// sets the ALPN protocols that are supported. The alpn string is a comma separated list of protocols, in order of preference. alpn_protocols: ?[]const u8 = null, /// sets the list of ciphers that may be used. ciphers: Ciphers = .secure, /// specifies the parameters that will be used during Diffie-Hellman Ephemeral (DHE) key exchange /// In auto mode, the key size for the ephemeral key is automatically selected based on the size of the private key being used for signing. In legacy mode, 1024 bit ephemeral keys are used. The default value is none, which disables DHE key exchange. dhe_params: DheParams = .none, /// specifies the names of the elliptic curves that may be used during Elliptic Curve Diffie-Hellman Ephemeral (ECDHE) key exchange. This is a comma separated list, given in order of preference. The special value of "default" will use the default curves (currently X25519, P-256 and P-384). ecdhe_curves: []const u8 = "default", /// prefers ciphers in the client's cipher list when selecting a cipher suite (server only). This is considered to be less secure than preferring the server's list. prefer_client_ciphers: bool = false, /// prefers ciphers in the server's cipher list when selecting a cipher suite (server only). This is considered to be more secure than preferring the client's list and is the default. prefer_server_ciphers: bool = true, /// requires that a valid stapled OCSP response be provided during the TLS handshake. require_oscp_stapling: bool = false, ca: ?RootCertificateLoadingMechanism = null, cert: ?LoadingMechanism = null, crl: ?LoadingMechanism = null, key: ?LoadingMechanism = null, ocsp_staple: ?LoadingMechanism = null, keypair: ?KeypairLoadingMechanism = null, keypair_ocsp: ?KeypairOcspLoadingMechanism = null, /// limits the number of intermediate certificates that will be followed during certificate validation. verify_depth: ?usize = null, /// enables client certificate verification, requiring the client to send a certificate (server only). verify_client: bool = false, /// enables client certificate verification, without requiring the client to send a certificate (server only). verify_client_optional_cert: bool = false, const BuildError = error{ OutOfMemory, BadProtocols, BadAlpn, BadCiphers, BadDheParams, BadEcdheCurves, BadVerifyDepth, BadCaPath, BadCaFilePath, BadCaMemory, BadDefaultCaCertFile, BadCertFilePath, BadCertMemory, BadCrlFilePath, BadCrlMemory, BadKeyFilePath, BadKeyMemory, BadOcspStapleFilePath, BadOcspStapleMemory, BadKeypairFilePath, BadKeypairMemory, BadKeypairOcspFilePath, BadKeypairOcspMemory, }; pub fn build(self: Self) BuildError!TlsConfiguration { const maybe_config = tls.tls_config_new(); if (maybe_config == null) return error.OutOfMemory; var config = maybe_config.?; if (tls.tls_config_set_protocols(config, self.protocol.native()) == -1) return error.BadProtocols; if (self.alpn_protocols) |alpn_protocols| if (tls.tls_config_set_alpn(config, alpn_protocols.ptr) == -1) return error.BadAlpn; if (tls.tls_config_set_ciphers(config, self.ciphers.native()) == -1) return error.BadCiphers; if (tls.tls_config_set_dheparams(config, self.dhe_params.native().ptr) == -1) return error.BadDheParams; if (tls.tls_config_set_ecdhecurves(config, self.ecdhe_curves.ptr) == -1) return error.BadEcdheCurves; if (self.prefer_server_ciphers) tls.tls_config_prefer_ciphers_server(config); if (self.prefer_client_ciphers) tls.tls_config_prefer_ciphers_client(config); if (self.require_oscp_stapling) tls.tls_config_ocsp_require_stapling(config); if (self.verify_depth) |depth| if (tls.tls_config_set_verify_depth(config, @intCast(c_int, depth)) == -1) return error.BadVerifyDepth; if (self.verify_client) tls.tls_config_verify_client(config); if (self.verify_client_optional_cert) tls.tls_config_verify_client_optional(config); if (self.ca) |ca_mechanism| { switch (ca_mechanism) { .dir_path => |path| if (tls.tls_config_set_ca_path(config, path.ptr) == -1) return error.BadCaPath, .file_path => |path| if (tls.tls_config_set_ca_file(config, path.ptr) == -1) return error.BadCaFilePath, .memory => |data| if (tls.tls_config_set_ca_mem(config, data.ptr, data.len) == -1) return error.BadCaMemory, .default => if (tls.tls_config_set_ca_file(config, tls.tls_default_ca_cert_file()) == -1) return error.BadDefaultCaCertFile, } } if (self.cert) |cert_loading_mechanism| { switch (cert_loading_mechanism) { .file_path => |path| if (tls.tls_config_set_cert_file(config, path.ptr) == -1) return error.BadCertFilePath, .memory => |data| if (tls.tls_config_set_cert_mem(config, data.ptr, data.len) == -1) return error.BadCertMemory, } } if (self.crl) |crl_loading_mechanism| { switch (crl_loading_mechanism) { .file_path => |path| if (tls.tls_config_set_crl_file(config, path.ptr) == -1) return error.BadCrlFilePath, .memory => |data| if (tls.tls_config_set_crl_mem(config, data.ptr, data.len) == -1) return error.BadCrlMemory, } } if (self.key) |key_loading_mechanism| { switch (key_loading_mechanism) { .file_path => |path| if (tls.tls_config_set_key_file(config, path.ptr) == -1) return error.BadKeyFilePath, .memory => |data| if (tls.tls_config_set_key_mem(config, data.ptr, data.len) == -1) return error.BadKeyMemory, } } if (self.ocsp_staple) |ocsp_staple_loading_mechanism| { switch (ocsp_staple_loading_mechanism) { .file_path => |path| if (tls.tls_config_set_ocsp_staple_file(config, path.ptr) == -1) return error.BadOcspStapleFilePath, .memory => |data| if (tls.tls_config_set_ocsp_staple_mem(config, data.ptr, data.len) == -1) return error.BadOcspStapleMemory, } } if (self.keypair) |keypair_loading_mechanism| { switch (keypair_loading_mechanism) { .file_path => |paths| if (tls.tls_config_set_keypair_file(config, paths.cert_file_path.ptr, paths.key_file_path.ptr) == -1) return error.BadKeypairFilePath, .memory => |data| if (tls.tls_config_set_keypair_mem(config, data.cert_memory.ptr, data.cert_memory.len, data.key_memory.ptr, data.key_memory.len) == -1) return error.BadKeypairMemory, } } if (self.keypair_ocsp) |keypair_ocsp_loading_mechanism| { switch (keypair_ocsp_loading_mechanism) { .file_path => |paths| if (tls.tls_config_set_keypair_ocsp_file(config, paths.cert_file_path.ptr, paths.key_file_path.ptr, paths.ocsp_file_path.ptr) == -1) return error.BadKeypairOcspFilePath, .memory => |data| if (tls.tls_config_set_keypair_ocsp_mem(config, data.cert_memory.ptr, data.cert_memory.len, data.key_memory.ptr, data.key_memory.len, data.ocsp_memory.ptr, data.ocsp_memory.len) == -1) return error.BadKeypairOcspMemory, } } return TlsConfiguration{ .params = self, .config = config, }; } }; pub const TlsConfiguration = struct { const Self = @This(); params: TlsConfigurationParams, config: *tls.tls_config, pub fn deinit(self: *Self) void { tls.tls_config_free(self.config); self.* = undefined; } };
src/tls_config.zig
const std = @import("std"); const mem = std.mem; const net = std.net; const os = std.os; const time = std.time; const IO = @import("tigerbeetle-io").IO; const ClientHandler = struct { io: *IO, sock: os.socket_t, delay_ns: u63, recv_buf: []u8, received: usize = 0, allocator: mem.Allocator, completion: IO.Completion, fn init(allocator: mem.Allocator, io: *IO, sock: os.socket_t, delay_ns: u63) !*ClientHandler { var buf = try allocator.alloc(u8, 1024); var self = try allocator.create(ClientHandler); self.* = ClientHandler{ .io = io, .sock = sock, .delay_ns = delay_ns, .recv_buf = buf, .allocator = allocator, .completion = undefined, }; return self; } fn deinit(self: *ClientHandler) !void { self.allocator.free(self.recv_buf); self.allocator.destroy(self); } fn start(self: *ClientHandler) !void { self.recv(); } fn recv(self: *ClientHandler) void { self.io.recv( *ClientHandler, self, recvCallback, &self.completion, self.sock, self.recv_buf, if (std.Target.current.os.tag == .linux) os.MSG_NOSIGNAL else 0, ); } fn recvCallback( self: *ClientHandler, completion: *IO.Completion, result: IO.RecvError!usize, ) void { self.received = result catch @panic("recv error"); if (self.received == 0) { self.io.close( *ClientHandler, self, closeCallback, completion, self.sock, ); return; } self.io.timeout( *ClientHandler, self, timeoutCallback, completion, self.delay_ns, ); } fn timeoutCallback( self: *ClientHandler, completion: *IO.Completion, result: IO.TimeoutError!void, ) void { self.io.send( *ClientHandler, self, sendCallback, completion, self.sock, self.recv_buf[0..self.received], if (std.Target.current.os.tag == .linux) os.MSG_NOSIGNAL else 0, ); } fn sendCallback( self: *ClientHandler, completion: *IO.Completion, result: IO.SendError!usize, ) void { _ = result catch @panic("send error"); self.recv(); } fn closeCallback( self: *ClientHandler, completion: *IO.Completion, result: IO.CloseError!void, ) void { _ = result catch @panic("close error"); self.deinit() catch @panic("ClientHandler deinit error"); } }; const Server = struct { io: IO, server: os.socket_t, delay_ns: u63, allocator: mem.Allocator, fn init(allocator: mem.Allocator, address: std.net.Address, delay_ns: u63) !Server { const kernel_backlog = 1; const server = try os.socket(address.any.family, os.SOCK_STREAM | os.SOCK_CLOEXEC, 0); try os.setsockopt( server, os.SOL_SOCKET, os.SO_REUSEADDR, &std.mem.toBytes(@as(c_int, 1)), ); try os.bind(server, &address.any, address.getOsSockLen()); try os.listen(server, kernel_backlog); var self: Server = .{ .io = try IO.init(32, 0), .server = server, .delay_ns = delay_ns, .allocator = allocator, }; return self; } pub fn deinit(self: *Server) void { os.close(self.server); self.io.deinit(); } pub fn run(self: *Server) !void { var server_completion: IO.Completion = undefined; self.io.accept(*Server, self, acceptCallback, &server_completion, self.server, 0); while (true) try self.io.tick(); } fn acceptCallback( self: *Server, completion: *IO.Completion, result: IO.AcceptError!os.socket_t, ) void { const accepted_sock = result catch @panic("accept error"); var handler = ClientHandler.init(self.allocator, &self.io, accepted_sock, self.delay_ns) catch @panic("handler create error"); handler.start() catch @panic("handler"); self.io.accept(*Server, self, acceptCallback, completion, self.server, 0); } }; pub fn main() anyerror!void { const allocator = std.heap.page_allocator; const address = try std.net.Address.parseIp4("127.0.0.1", 3131); var delay: u63 = std.time.ns_per_s; var args = std.process.args(); if (args.nextPosix()) |_| { if (args.nextPosix()) |arg| { if (std.fmt.parseInt(u63, arg, 10)) |v| { delay = v * std.time.ns_per_ms; } else |_| {} } } std.debug.print("delay={d} ms.\n", .{delay / time.ns_per_ms}); var server = try Server.init(allocator, address, delay); defer server.deinit(); try server.run(); }
examples/tcp_echo_server_delay.zig
const std = @import("std"); const tokenize = std.mem.tokenize; const split = std.mem.split; const ArrayList = std.ArrayList; const Allocator = std.mem.Allocator; const assert = std.debug.assert; const parseFloat = std.fmt.parseFloat; const parseInt = std.fmt.parseInt; pub const ObjData = struct { material_libs: []const []const u8, vertices: []const f32, tex_coords: []const f32, normals: []const f32, meshes: []const Mesh, pub fn deinit(self: ObjData, allocator: Allocator) void { allocator.free(self.material_libs); allocator.free(self.vertices); allocator.free(self.tex_coords); allocator.free(self.normals); for (self.meshes) |mesh| mesh.deinit(allocator); allocator.free(self.meshes); } }; fn compareOpt(a: ?u32, b: ?u32) bool { if (a != null and b != null) { return a.? == b.?; } return a == null and b == null; } fn eqlZ(comptime T: type, a: ?[]const T, b: ?[]const T) bool { if (a != null and b != null) { return std.mem.eql(T, a.?, b.?); } return a == null and b == null; } pub const Mesh = struct { pub const Index = struct { vertex: ?u32, tex_coord: ?u32, normal: ?u32, fn eq(self: Mesh.Index, other: Mesh.Index) bool { return compareOpt(self.vertex, other.vertex) and compareOpt(self.tex_coord, other.tex_coord) and compareOpt(self.normal, other.normal); } }; name: ?[]const u8, material: ?[]const u8, num_vertices: []const u32, indices: []const Mesh.Index, pub fn deinit(self: Mesh, allocator: Allocator) void { if (self.name) |name| allocator.free(name); if (self.material) |material| allocator.free(material); allocator.free(self.num_vertices); allocator.free(self.indices); } fn eq(self: Mesh, other: Mesh) bool { if (!eqlZ(u8, self.name, other.name)) return false; if (!eqlZ(u8, self.material, other.material)) return false; if (self.indices.len != other.indices.len) return false; if (!std.mem.eql(u32, self.num_vertices, other.num_vertices)) return false; for (self.indices) |index, i| { if (!index.eq(other.indices[i])) return false; } return true; } }; const DefType = enum { comment, vertex, tex_coord, normal, face, object, group, material_lib, use_material, smoothing, line, param_vertex, }; pub fn parse(allocator: Allocator, data: []const u8) !ObjData { var material_libs = ArrayList([]const u8).init(allocator); errdefer material_libs.deinit(); var vertices = ArrayList(f32).init(allocator); errdefer vertices.deinit(); var tex_coords = ArrayList(f32).init(allocator); errdefer tex_coords.deinit(); var normals = ArrayList(f32).init(allocator); errdefer normals.deinit(); var meshes = ArrayList(Mesh).init(allocator); errdefer meshes.deinit(); // current mesh var name: ?[]const u8 = null; var material: ?[]const u8 = null; var num_verts = ArrayList(u32).init(allocator); errdefer num_verts.deinit(); var indices = ArrayList(Mesh.Index).init(allocator); errdefer indices.deinit(); var lines = tokenize(u8, data, "\n"); while (lines.next()) |line| { var iter = tokenize(u8, line, " "); const def_type = try parseType(iter.next().?); switch (def_type) { .vertex => { try vertices.append(try parseFloat(f32, iter.next().?)); try vertices.append(try parseFloat(f32, iter.next().?)); try vertices.append(try parseFloat(f32, iter.next().?)); }, .tex_coord => { try tex_coords.append(try parseFloat(f32, iter.next().?)); try tex_coords.append(try parseFloat(f32, iter.next().?)); }, .normal => { try normals.append(try parseFloat(f32, iter.next().?)); try normals.append(try parseFloat(f32, iter.next().?)); try normals.append(try parseFloat(f32, iter.next().?)); }, .face => { var i: u32 = 0; while (iter.next()) |entry| { var entry_iter = split(u8, entry, "/"); // TODO support x//y and similar // NOTE obj is one-indexed - let's make it zero-indexed try indices.append(.{ .vertex = if (entry_iter.next()) |e| (try parseOptionalIndex(e, vertices.items)) else null, .tex_coord = if (entry_iter.next()) |e| (try parseOptionalIndex(e, tex_coords.items)) else null, .normal = if (entry_iter.next()) |e| (try parseOptionalIndex(e, normals.items)) else null, }); i += 1; } try num_verts.append(i); }, .object => { if (num_verts.items.len > 0) { try meshes.append(.{ .name = if (name) |n| try allocator.dupe(u8, n) else null, .material = if (material) |m| try allocator.dupe(u8, m) else null, .num_vertices = num_verts.toOwnedSlice(), .indices = indices.toOwnedSlice(), }); } name = iter.next().?; num_verts = ArrayList(u32).init(allocator); errdefer num_verts.deinit(); indices = ArrayList(Mesh.Index).init(allocator); errdefer indices.deinit(); }, .use_material => { material = iter.next().?; }, .material_lib => { try material_libs.append(iter.next().?); }, else => {}, } } // add last mesh (as long as it is not empty) if (num_verts.items.len > 0) { try meshes.append(Mesh{ .name = if (name) |n| try allocator.dupe(u8, n) else null, .material = if (material) |m| try allocator.dupe(u8, m) else null, .num_vertices = num_verts.toOwnedSlice(), .indices = indices.toOwnedSlice(), }); } return ObjData{ .material_libs = material_libs.toOwnedSlice(), .vertices = vertices.toOwnedSlice(), .tex_coords = tex_coords.toOwnedSlice(), .normals = normals.toOwnedSlice(), .meshes = meshes.toOwnedSlice(), }; } fn parseOptionalIndex(v: []const u8, indices: []f32) !?u32 { if (std.mem.eql(u8, v, "")) return null; const i = try parseInt(i32, v, 10); if (i < 0) { // index is relative to end of indices list, -1 meaning the last element return @intCast(u32, @intCast(i32, indices.len) + i); } else { return @intCast(u32, i) - 1; } } fn parseType(t: []const u8) !DefType { if (std.mem.eql(u8, t, "#")) { return .comment; } else if (std.mem.eql(u8, t, "v")) { return .vertex; } else if (std.mem.eql(u8, t, "vt")) { return .tex_coord; } else if (std.mem.eql(u8, t, "vn")) { return .normal; } else if (std.mem.eql(u8, t, "f")) { return .face; } else if (std.mem.eql(u8, t, "o")) { return .object; } else if (std.mem.eql(u8, t, "g")) { return .group; } else if (std.mem.eql(u8, t, "mtllib")) { return .material_lib; } else if (std.mem.eql(u8, t, "usemtl")) { return .use_material; } else if (std.mem.eql(u8, t, "s")) { return .smoothing; } else if (std.mem.eql(u8, t, "l")) { return .line; } else if (std.mem.eql(u8, t, "vp")) { return .param_vertex; } else { std.log.warn("Unknown type: {s}", .{t}); return error.UnknownDefType; } } // ------------------------------------------------------------------------------ const test_allocator = std.testing.allocator; const expect = std.testing.expect; const expectError = std.testing.expectError; const expectEqualSlices = std.testing.expectEqualSlices; const expectEqualStrings = std.testing.expectEqualStrings; test "unknown def" { try expectError(error.UnknownDefType, parse(test_allocator, "invalid 0 1 2")); } test "comment" { const result = try parse(test_allocator, "# this is a comment"); defer result.deinit(test_allocator); try expect(result.vertices.len == 0); try expect(result.tex_coords.len == 0); try expect(result.normals.len == 0); try expect(result.meshes.len == 0); } test "single vertex def xyz" { var result = try parse(test_allocator, "v 0.123 0.234 0.345"); defer result.deinit(test_allocator); try expect(std.mem.eql(f32, result.vertices, &[_]f32{ 0.123, 0.234, 0.345 })); try expect(result.tex_coords.len == 0); try expect(result.normals.len == 0); try expect(result.meshes.len == 0); } test "single vertex def xyzw" { var result = try parse(test_allocator, "v 0.123 0.234 0.345 0.456"); defer result.deinit(test_allocator); try expect(std.mem.eql(f32, result.vertices, &[_]f32{ 0.123, 0.234, 0.345 })); try expect(result.tex_coords.len == 0); try expect(result.normals.len == 0); try expect(result.meshes.len == 0); } test "single tex coord def uv" { var result = try parse(test_allocator, "vt 0.123 0.234"); defer result.deinit(test_allocator); try expect(std.mem.eql(f32, result.tex_coords, &[_]f32{ 0.123, 0.234 })); try expect(result.vertices.len == 0); try expect(result.normals.len == 0); try expect(result.meshes.len == 0); } test "single tex coord def uvw" { var result = try parse(test_allocator, "vt 0.123 0.234 0.345"); defer result.deinit(test_allocator); try expect(std.mem.eql(f32, result.tex_coords, &[_]f32{ 0.123, 0.234 })); try expect(result.vertices.len == 0); try expect(result.normals.len == 0); try expect(result.meshes.len == 0); } test "single normal def xyz" { var result = try parse(test_allocator, "vn 0.123 0.234 0.345"); defer result.deinit(test_allocator); try expect(std.mem.eql(f32, result.normals, &[_]f32{ 0.123, 0.234, 0.345 })); try expect(result.vertices.len == 0); try expect(result.tex_coords.len == 0); try expect(result.meshes.len == 0); } test "single face def vertex only" { var result = try parse(test_allocator, "f 1 2 3"); defer result.deinit(test_allocator); const mesh = Mesh{ .name = null, .material = null, .num_vertices = &[_]u32{3}, .indices = &[_]Mesh.Index{ Mesh.Index{ .vertex = 0, .tex_coord = null, .normal = null }, Mesh.Index{ .vertex = 1, .tex_coord = null, .normal = null }, Mesh.Index{ .vertex = 2, .tex_coord = null, .normal = null }, }, }; try expect(result.meshes.len == 1); try expect(result.meshes[0].eq(mesh)); } test "single face def vertex + tex coord" { var result = try parse(test_allocator, "f 1/4 2/5 3/6"); defer result.deinit(test_allocator); const mesh = Mesh{ .name = null, .material = null, .num_vertices = &[_]u32{3}, .indices = &[_]Mesh.Index{ .{ .vertex = 0, .tex_coord = 3, .normal = null }, .{ .vertex = 1, .tex_coord = 4, .normal = null }, .{ .vertex = 2, .tex_coord = 5, .normal = null }, }, }; try expect(result.meshes.len == 1); try expect(result.meshes[0].eq(mesh)); } test "single face def vertex + tex coord + normal" { var result = try parse(test_allocator, "f 1/4/7 2/5/8 3/6/9"); defer result.deinit(test_allocator); const mesh = Mesh{ .name = null, .material = null, .num_vertices = &[_]u32{3}, .indices = &[_]Mesh.Index{ .{ .vertex = 0, .tex_coord = 3, .normal = 6 }, .{ .vertex = 1, .tex_coord = 4, .normal = 7 }, .{ .vertex = 2, .tex_coord = 5, .normal = 8 }, }, }; try expect(result.meshes.len == 1); try expect(result.meshes[0].eq(mesh)); } test "single face def vertex + normal" { var result = try parse(test_allocator, "f 1//7 2//8 3//9"); defer result.deinit(test_allocator); const mesh = Mesh{ .name = null, .material = null, .num_vertices = &[_]u32{3}, .indices = &[_]Mesh.Index{ .{ .vertex = 0, .tex_coord = null, .normal = 6 }, .{ .vertex = 1, .tex_coord = null, .normal = 7 }, .{ .vertex = 2, .tex_coord = null, .normal = 8 }, }, }; try expect(result.meshes.len == 1); try expect(result.meshes[0].eq(mesh)); } test "triangle obj exported from blender" { const data = @embedFile("../triangle.obj"); var result = try parse(test_allocator, data); defer result.deinit(test_allocator); const expected = ObjData{ .material_libs = &[_][]const u8{"triangle.mtl"}, .vertices = &[_]f32{ -1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, -1.0, }, .tex_coords = &[_]f32{ 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, }, .normals = &[_]f32{ 0.0, 1.0, 0.0 }, .meshes = &[_]Mesh{ Mesh{ .name = "Plane", .material = "None", .num_vertices = &[_]u32{3}, .indices = &[_]Mesh.Index{ .{ .vertex = 0, .tex_coord = 0, .normal = 0 }, .{ .vertex = 1, .tex_coord = 1, .normal = 0 }, .{ .vertex = 2, .tex_coord = 2, .normal = 0 }, }, }, }, }; try expect(result.material_libs.len == 1); try expectEqualStrings(result.material_libs[0], expected.material_libs[0]); try expectEqualSlices(f32, result.vertices, expected.vertices); try expectEqualSlices(f32, result.tex_coords, expected.tex_coords); try expectEqualSlices(f32, result.normals, expected.normals); try expect(result.meshes.len == 1); try expect(result.meshes[0].eq(expected.meshes[0])); } test "cube obj exported from blender" { const data = @embedFile("../cube.obj"); var result = try parse(test_allocator, data); defer result.deinit(test_allocator); const expected = ObjData{ .material_libs = &[_][]const u8{"cube.mtl"}, .vertices = &[_]f32{ 1.0, 1.0, -1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, -1.0, -1.0, 1.0, }, .tex_coords = &[_]f32{ 0.625, 0.500, 0.875, 0.500, 0.875, 0.750, 0.625, 0.750, 0.375, 0.750, 0.625, 1.000, 0.375, 1.000, 0.375, 0.000, 0.625, 0.000, 0.625, 0.250, 0.375, 0.250, 0.125, 0.500, 0.375, 0.500, 0.125, 0.750, }, .normals = &[_]f32{ 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, -1.0, }, .meshes = &[_]Mesh{ Mesh{ .name = "Cube", .material = "Material", .num_vertices = &[_]u32{ 4, 4, 4, 4, 4, 4 }, .indices = &[_]Mesh.Index{ .{ .vertex = 0, .tex_coord = 0, .normal = 0 }, .{ .vertex = 4, .tex_coord = 1, .normal = 0 }, .{ .vertex = 6, .tex_coord = 2, .normal = 0 }, .{ .vertex = 2, .tex_coord = 3, .normal = 0 }, .{ .vertex = 3, .tex_coord = 4, .normal = 1 }, .{ .vertex = 2, .tex_coord = 3, .normal = 1 }, .{ .vertex = 6, .tex_coord = 5, .normal = 1 }, .{ .vertex = 7, .tex_coord = 6, .normal = 1 }, .{ .vertex = 7, .tex_coord = 7, .normal = 2 }, .{ .vertex = 6, .tex_coord = 8, .normal = 2 }, .{ .vertex = 4, .tex_coord = 9, .normal = 2 }, .{ .vertex = 5, .tex_coord = 10, .normal = 2 }, .{ .vertex = 5, .tex_coord = 11, .normal = 3 }, .{ .vertex = 1, .tex_coord = 12, .normal = 3 }, .{ .vertex = 3, .tex_coord = 4, .normal = 3 }, .{ .vertex = 7, .tex_coord = 13, .normal = 3 }, .{ .vertex = 1, .tex_coord = 12, .normal = 4 }, .{ .vertex = 0, .tex_coord = 0, .normal = 4 }, .{ .vertex = 2, .tex_coord = 3, .normal = 4 }, .{ .vertex = 3, .tex_coord = 4, .normal = 4 }, .{ .vertex = 5, .tex_coord = 10, .normal = 5 }, .{ .vertex = 4, .tex_coord = 9, .normal = 5 }, .{ .vertex = 0, .tex_coord = 0, .normal = 5 }, .{ .vertex = 1, .tex_coord = 12, .normal = 5 }, }, }, }, }; try expect(result.material_libs.len == 1); try expectEqualStrings(result.material_libs[0], expected.material_libs[0]); try expectEqualSlices(f32, result.vertices, expected.vertices); try expectEqualSlices(f32, result.tex_coords, expected.tex_coords); try expectEqualSlices(f32, result.normals, expected.normals); try expect(result.meshes.len == 1); try expect(result.meshes[0].eq(expected.meshes[0])); } // TODO add test for negative indices
src/obj.zig